pub struct Config { /* private fields */ }Expand description
Constructor configuration for an exchange, without exposing Value.
let ex = Binance::with_config(
Config::new()
.api_key(&key)
.secret(&secret)
.sandbox(true)
.option_strs("fetchMarkets.types", &["spot"]),
);options nests exactly the way it does in every other ccxt binding. What
the manual writes as
{ "options": { "fetchMarkets": { "types": ["spot"] } } }is built with Config::option and a nested Params:
Config::new().option("fetchMarkets", Params::new().with_strs("types", &["spot"]))Use Config::option_str and friends for a flat key
(options: { defaultType: "swap" }), or Config::options to hand over
the whole block at once.
Implementations§
Source§impl Config
impl Config
pub fn new() -> Config
pub fn api_key(self, v: &str) -> Config
pub fn secret(self, v: &str) -> Config
pub fn password(self, v: &str) -> Config
pub fn uid(self, v: &str) -> Config
pub fn wallet_address(self, v: &str) -> Config
pub fn private_key(self, v: &str) -> Config
pub fn token(self, v: &str) -> Config
Sourcepub fn enable_rate_limit(self, on: bool) -> Config
pub fn enable_rate_limit(self, on: bool) -> Config
Client-side rate limiting (on by default in ccxt).
Sourcepub fn rate_limit_ms(self, ms: i64) -> Config
pub fn rate_limit_ms(self, ms: i64) -> Config
Milliseconds per rate-limit token.
Sourcepub fn timeout_ms(self, ms: i64) -> Config
pub fn timeout_ms(self, ms: i64) -> Config
Request timeout in milliseconds.
pub fn set_int(self, key: &str, v: i64) -> Config
pub fn set_float(self, key: &str, v: f64) -> Config
pub fn set_bool(self, key: &str, v: bool) -> Config
Sourcepub fn options(self, options: Params) -> Config
pub fn options(self, options: Params) -> Config
Merge a whole options block in — the closest match to passing an
options dict wholesale in the other language bindings. Deep-merges, so
it composes with anything already set (sandbox, earlier option
calls) instead of discarding it.
Sourcepub fn option(self, key: &str, value: Params) -> Config
pub fn option(self, key: &str, value: Params) -> Config
Set one nested object under options, e.g.
option("fetchMarkets", Params::new().with_strs("types", &["spot"]))
for options: { fetchMarkets: { types: ["spot"] } }.
Calling it twice with the same key MERGES the two objects, so nested options can be built up across several calls.
Sourcepub fn option_str(self, key: &str, v: &str) -> Config
pub fn option_str(self, key: &str, v: &str) -> Config
Set a flat entry under options. The key is taken literally.
pub fn option_int(self, key: &str, v: i64) -> Config
pub fn option_float(self, key: &str, v: f64) -> Config
pub fn option_bool(self, key: &str, v: bool) -> Config
pub fn option_strs(self, key: &str, values: &[&str]) -> Config
Sourcepub fn into_value(self) -> Value
pub fn into_value(self) -> Value
Lower to the dynamic representation the transpiled core consumes.
Sourcepub fn into_option(self) -> Option<Value>
pub fn into_option(self) -> Option<Value>
Some(value) for the generated new(Option<Value>) constructors.