rusftx/rest/requests/
test_utils.rs

1use crate::endpoint::EndpointCom;
2use crate::rest::{RestApiWithAuthentication, RestApiWithAuthenticationBuilder};
3
4pub fn get_rest_api_with_authentication_from_env() -> RestApiWithAuthentication<EndpointCom> {
5    dotenv::dotenv().ok();
6
7    let api_key = std::env::var("FTX_API_KEY").expect("FTX_API_KEY is not set");
8    let secret = std::env::var("FTX_SECRET").expect("FTX_SECRET is not set");
9    let subaccount = std::env::var("FTX_SUBACCOUNT").ok();
10    RestApiWithAuthenticationBuilder::new()
11        .endpoint(EndpointCom::default())
12        .authentication(api_key, secret)
13        .subaccount(subaccount)
14        .build()
15}