pub struct General {
pub client: Client,
}Fields§
§client: ClientImplementations§
source§impl General
impl General
sourcepub async fn ping(&self) -> Result<&'static str>
pub async fn ping(&self) -> Result<&'static str>
Test connectivity
Examples
use binance::{api::*, general::*, config::*};
let conf = Config::default().set_rest_api_endpoint(DATA_REST_ENDPOINT);
let general: General = Binance::new_with_env(&conf);
let pong = tokio_test::block_on(general.ping());
assert!(pong.is_ok(), "{:?}", pong);
assert_eq!(pong.unwrap(), "pong");sourcepub async fn get_server_time(&self) -> Result<ServerTime>
pub async fn get_server_time(&self) -> Result<ServerTime>
Check server time
Examples
use binance::{api::*, general::*, config::*};
let conf = Config::default().set_rest_api_endpoint(DATA_REST_ENDPOINT);
let general: General = Binance::new_with_env(&conf);
let server_time = tokio_test::block_on(general.get_server_time());
assert!(server_time.is_ok(), "{:?}", server_time);sourcepub async fn exchange_info(&self) -> Result<ExchangeInformation>
pub async fn exchange_info(&self) -> Result<ExchangeInformation>
Obtain exchange information (rate limits, symbol metadata etc)
Examples
use binance::{api::*, general::*, config::*};
let conf = Config::default().set_rest_api_endpoint(DATA_REST_ENDPOINT);
let general: General = Binance::new_with_env(&conf);
let exchange_info = tokio_test::block_on(general.exchange_info());
assert!(exchange_info.is_ok(), "{:?}", exchange_info);Trait Implementations§
source§impl Binance for General
impl Binance for General
fn new_with_config(
api_key: Option<String>,
secret_key: Option<String>,
config: &Config
) -> General
fn new(api_key: Option<String>, secret_key: Option<String>) -> Self
source§fn new_with_env(config: &Config) -> Self
fn new_with_env(config: &Config) -> Self
Create a binance API using environment variables for credentials
BINANCE_API_KEY=$YOUR_API_KEY
BINANCE_API_SECRET_KEY=$YOUR_SECRET_KEY