rusftx 0.4.0

Rust bindings for the FTX REST and Websocket API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::endpoint::EndpointCom;
use crate::rest::{RestApiWithAuthentication, RestApiWithAuthenticationBuilder};

pub fn get_rest_api_with_authentication_from_env() -> RestApiWithAuthentication<EndpointCom> {
    dotenv::dotenv().ok();

    let api_key = std::env::var("FTX_API_KEY").expect("FTX_API_KEY is not set");
    let secret = std::env::var("FTX_SECRET").expect("FTX_SECRET is not set");
    let subaccount = std::env::var("FTX_SUBACCOUNT").ok();
    RestApiWithAuthenticationBuilder::new()
        .endpoint(EndpointCom::default())
        .authentication(api_key, secret)
        .subaccount(subaccount)
        .build()
}