Struct binance::config::Config

source ·
pub struct Config {
    pub rest_api_endpoint: String,
    pub ws_endpoint: String,
    pub futures_rest_api_endpoint: String,
    pub futures_ws_endpoint: String,
    pub recv_window: u64,
    pub binance_us_api: bool,
    pub timeout: Option<u64>,
}

Fields§

§rest_api_endpoint: String§ws_endpoint: String§futures_rest_api_endpoint: String§futures_ws_endpoint: String§recv_window: u64§binance_us_api: bool§timeout: Option<u64>

Implementations§

Configure binance with all testnet endpoints

Examples
use binance::config::Config;
let config = Config::testnet();

Sets the rest api endpoint. Defaults to https://api.binance.com.

Arguments
  • rest_api_endpoint:

returns: Config

Examples
use binance::config::Config;
let config = Config::default();
config.set_rest_api_endpoint("http://myendpoint:8080");

Sets the websocket endpoint. Defaults to “wss://stream.binance.com:9443”.

Arguments
  • ws_endpoint:

returns: Config

Examples
use binance::config::Config;
let config = Config::default();
config.set_ws_endpoint("ws://myendpoint:8080");

Sets the futures rest api endpoint. Defaults to https://fapi.binance.com.

Arguments
  • futures_rest_api_endpoint:

returns: Config

Examples
use binance::config::Config;
let config = Config::default();
config.set_futures_rest_api_endpoint("http://myendpoint:8080");

Sets the futures websocket endpoint. Defaults to “wss://fstream.binance.com”.

Arguments
  • futures_ws_endpoint:

returns: Config

Examples
use binance::config::Config;
let config = Config::default();
config.set_futures_ws_endpoint("ws://myendpoint:8080");

Sets the ‘receive window’. The receive window is the number of milliseconds after timestamp the request is valid for.

Arguments
  • recv_window: The receive window, in milliseconds. Defaults to 5000.

returns: Config

Examples
use binance::config::Config;
let config = Config::default();
config.set_recv_window(300);

Sets the client timeout

Arguments
  • timeout: The timeout, in seconds

returns: Config

Examples
use binance::config::Config;
let config = Config::default();
config.set_timeout(3);

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Configure binance with default production endpoints

Examples
use binance::config::Config;
let config = Config::default();
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more