#![allow(unused_imports, unused_variables, clippy::all)]
use crate::Value;
use crate::Params;
use crate::types::*;
#[async_trait::async_trait]
pub trait TypedExchange: Send {
async fn call_raw(&mut self, method: &str, args: Vec<Value>) -> crate::Result<Value>;
fn market(&self, symbol: &str) -> crate::Result<Market>;
fn markets(&self) -> Vec<Market>;
async fn load_markets(&mut self, reload: bool) -> Value {
self.call_raw("load_markets", vec![Value::Bool(reload)]).await.unwrap_or(Value::Null)
}
}
pub trait TypedExchangeExt: TypedExchange {
fn fetch_currencies<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Currencies>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_currencies", __args).await?;
Ok(dict_from_value(&v, Currency::from_value))
}
}
fn fetch_markets<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Market>>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_markets", __args).await?;
Ok(vec_from_value(&v, Market::from_value))
}
}
fn fetch_accounts<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Account>>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_accounts", __args).await?;
Ok(vec_from_value(&v, Account::from_value))
}
}
fn watch_liquidations<'a>(&'a mut self, symbol: &str, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Liquidation>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_liquidations", __args).await?;
Ok(vec_from_value(&v, Liquidation::from_value))
}
}
fn watch_liquidations_for_symbols<'a>(&'a mut self, symbols: Vec<String>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Liquidation>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(symbols.into_iter().map(Value::Str).collect())), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_liquidations_for_symbols", __args).await?;
Ok(vec_from_value(&v, Liquidation::from_value))
}
}
fn watch_my_liquidations<'a>(&'a mut self, symbol: &str, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Liquidation>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_my_liquidations", __args).await?;
Ok(vec_from_value(&v, Liquidation::from_value))
}
}
fn watch_my_liquidations_for_symbols<'a>(&'a mut self, symbols: Vec<String>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Liquidation>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(symbols.into_iter().map(Value::Str).collect())), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_my_liquidations_for_symbols", __args).await?;
Ok(vec_from_value(&v, Liquidation::from_value))
}
}
fn fetch_deposit_addresses<'a>(&'a mut self, codes: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<DepositAddress>>> + Send + 'a {
let __args: Vec<Value> = vec![match codes { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_deposit_addresses", __args).await?;
Ok(vec_from_value(&v, DepositAddress::from_value))
}
}
fn fetch_margin_mode<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginMode>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_margin_mode", __args).await?;
Ok(MarginMode::from_value(v))
}
}
fn fetch_margin_modes<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginModes>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_margin_modes", __args).await?;
Ok(dict_from_value(&v, MarginMode::from_value))
}
}
fn fetch_time<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Option<i64>>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_time", __args).await?;
Ok(match v { Value::Int(n) => Some(n), _ => None })
}
}
fn fetch_cross_borrow_rates<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<CrossBorrowRates>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_cross_borrow_rates", __args).await?;
Ok(dict_from_value(&v, BorrowRate::from_value))
}
}
fn fetch_isolated_borrow_rates<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<IsolatedBorrowRates>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_isolated_borrow_rates", __args).await?;
Ok(dict_from_value(&v, IsolatedBorrowRate::from_value))
}
}
fn fetch_leverage_tiers<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<LeverageTiers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_leverage_tiers", __args).await?;
Ok(dict_from_value(&v, |row| vec_from_value(&row, LeverageTier::from_value)))
}
}
fn fetch_funding_rates<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<FundingRates>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_funding_rates", __args).await?;
Ok(dict_from_value(&v, FundingRate::from_value))
}
}
fn fetch_funding_intervals<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<FundingRates>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_funding_intervals", __args).await?;
Ok(dict_from_value(&v, FundingRate::from_value))
}
}
fn watch_funding_rate<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<FundingRate>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("watch_funding_rate", __args).await?;
Ok(FundingRate::from_value(v))
}
}
fn watch_funding_rates<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<FundingRates>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("watch_funding_rates", __args).await?;
Ok(dict_from_value(&v, FundingRate::from_value))
}
}
fn watch_funding_rates_for_symbols<'a>(&'a mut self, symbols: Vec<String>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<FundingRates>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(symbols.into_iter().map(Value::Str).collect())), params.into().into_value()];
async move {
let v = self.call_raw("watch_funding_rates_for_symbols", __args).await?;
Ok(dict_from_value(&v, FundingRate::from_value))
}
}
fn transfer<'a>(&'a mut self, code: &str, amount: f64, from_account: &str, to_account: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Transfer>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), Value::Float(amount), Value::Str(from_account.to_string()), Value::Str(to_account.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("transfer", __args).await?;
Ok(Transfer::from_value(v))
}
}
fn withdraw<'a>(&'a mut self, code: &str, amount: f64, address: &str, tag: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Transaction>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), Value::Float(amount), Value::Str(address.to_string()), tag.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("withdraw", __args).await?;
Ok(Transaction::from_value(v))
}
}
fn create_deposit_address<'a>(&'a mut self, code: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<DepositAddress>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("create_deposit_address", __args).await?;
Ok(DepositAddress::from_value(v))
}
}
fn fetch_leverage<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Leverage>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_leverage", __args).await?;
Ok(Leverage::from_value(v))
}
}
fn fetch_leverages<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Leverages>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_leverages", __args).await?;
Ok(dict_from_value(&v, Leverage::from_value))
}
}
fn add_margin<'a>(&'a mut self, symbol: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginModification>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("add_margin", __args).await?;
Ok(MarginModification::from_value(v))
}
}
fn reduce_margin<'a>(&'a mut self, symbol: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginModification>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("reduce_margin", __args).await?;
Ok(MarginModification::from_value(v))
}
}
fn set_margin<'a>(&'a mut self, symbol: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginModification>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("set_margin", __args).await?;
Ok(MarginModification::from_value(v))
}
}
fn fetch_long_short_ratio<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<LongShortRatio>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_long_short_ratio", __args).await?;
Ok(LongShortRatio::from_value(v))
}
}
fn fetch_long_short_ratio_history<'a>(&'a mut self, symbol: Option<&str>, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<LongShortRatio>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_long_short_ratio_history", __args).await?;
Ok(vec_from_value(&v, LongShortRatio::from_value))
}
}
fn fetch_margin_adjustment_history<'a>(&'a mut self, symbol: Option<&str>, type_: Option<&str>, since: Option<f64>, limit: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<MarginModification>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), type_.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Float).unwrap_or(Value::Null), limit.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_margin_adjustment_history", __args).await?;
Ok(vec_from_value(&v, MarginModification::from_value))
}
}
fn fetch_deposit_addresses_by_network<'a>(&'a mut self, code: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<DepositAddresses>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_deposit_addresses_by_network", __args).await?;
Ok(dict_from_value(&v, DepositAddress::from_value))
}
}
fn fetch_open_interest_history<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OpenInterest>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_open_interest_history", __args).await?;
Ok(vec_from_value(&v, OpenInterest::from_value))
}
}
fn fetch_open_interests<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OpenInterests>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_open_interests", __args).await?;
Ok(dict_from_value(&v, OpenInterest::from_value))
}
}
fn repay_cross_margin<'a>(&'a mut self, code: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginLoan>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("repay_cross_margin", __args).await?;
Ok(MarginLoan::from_value(v))
}
}
fn repay_isolated_margin<'a>(&'a mut self, symbol: &str, code: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginLoan>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(code.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("repay_isolated_margin", __args).await?;
Ok(MarginLoan::from_value(v))
}
}
fn borrow_cross_margin<'a>(&'a mut self, code: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginLoan>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("borrow_cross_margin", __args).await?;
Ok(MarginLoan::from_value(v))
}
}
fn borrow_isolated_margin<'a>(&'a mut self, symbol: &str, code: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginLoan>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(code.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("borrow_isolated_margin", __args).await?;
Ok(MarginLoan::from_value(v))
}
}
fn borrow_margin<'a>(&'a mut self, code: &str, amount: f64, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginLoan>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), Value::Float(amount), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("borrow_margin", __args).await?;
Ok(MarginLoan::from_value(v))
}
}
fn repay_margin<'a>(&'a mut self, code: &str, amount: f64, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<MarginLoan>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), Value::Float(amount), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("repay_margin", __args).await?;
Ok(MarginLoan::from_value(v))
}
}
fn fetch_ohlcv<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OHLCV>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_ohlcv", __args).await?;
Ok(match v { Value::Arr(arr) => arr.iter().map(|c| { let mut out = [0.0f64; 6]; if let Value::Arr(fields) = c { for (i, slot) in out.iter_mut().enumerate() { if let Some(f) = fields.get(i).and_then(|x| x.as_f64()) { *slot = f; } } } out }).collect(), _ => Vec::new() })
}
}
fn fetch_spot_ohlcv<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OHLCV>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_spot_ohlcv", __args).await?;
Ok(match v { Value::Arr(arr) => arr.iter().map(|c| { let mut out = [0.0f64; 6]; if let Value::Arr(fields) = c { for (i, slot) in out.iter_mut().enumerate() { if let Some(f) = fields.get(i).and_then(|x| x.as_f64()) { *slot = f; } } } out }).collect(), _ => Vec::new() })
}
}
fn fetch_contract_ohlcv<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OHLCV>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_contract_ohlcv", __args).await?;
Ok(match v { Value::Arr(arr) => arr.iter().map(|c| { let mut out = [0.0f64; 6]; if let Value::Arr(fields) = c { for (i, slot) in out.iter_mut().enumerate() { if let Some(f) = fields.get(i).and_then(|x| x.as_f64()) { *slot = f; } } } out }).collect(), _ => Vec::new() })
}
}
fn watch_ohlcv<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OHLCV>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_ohlcv", __args).await?;
Ok(match v { Value::Arr(arr) => arr.iter().map(|c| { let mut out = [0.0f64; 6]; if let Value::Arr(fields) = c { for (i, slot) in out.iter_mut().enumerate() { if let Some(f) = fields.get(i).and_then(|x| x.as_f64()) { *slot = f; } } } out }).collect(), _ => Vec::new() })
}
}
fn fetch_borrow_interest<'a>(&'a mut self, code: Option<&str>, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<BorrowInterest>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_borrow_interest", __args).await?;
Ok(vec_from_value(&v, BorrowInterest::from_value))
}
}
fn fetch_ledger<'a>(&'a mut self, code: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<LedgerEntry>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_ledger", __args).await?;
Ok(vec_from_value(&v, LedgerEntry::from_value))
}
}
fn fetch_ledger_entry<'a>(&'a mut self, id: &str, code: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<LedgerEntry>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_ledger_entry", __args).await?;
Ok(LedgerEntry::from_value(v))
}
}
fn fetch_balance<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Balances>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_balance", __args).await?;
Ok(Balances::from_value(v))
}
}
fn watch_balance<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Balances>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("watch_balance", __args).await?;
Ok(Balances::from_value(v))
}
}
fn fetch_partial_balance<'a>(&'a mut self, part: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Balances>> + Send + 'a {
let __args: Vec<Value> = vec![part, params.into().into_value()];
async move {
let v = self.call_raw("fetch_partial_balance", __args).await?;
Ok(Balances::from_value(v))
}
}
fn fetch_free_balance<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Balances>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_free_balance", __args).await?;
Ok(Balances::from_value(v))
}
}
fn fetch_used_balance<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Balances>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_used_balance", __args).await?;
Ok(Balances::from_value(v))
}
}
fn fetch_total_balance<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Balances>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_total_balance", __args).await?;
Ok(Balances::from_value(v))
}
}
fn fetch_status<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Status>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_status", __args).await?;
Ok(Status::from_value(v))
}
}
fn fetch_deposit_withdraw_fees<'a>(&'a mut self, codes: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<DepositWithdrawFees>> + Send + 'a {
let __args: Vec<Value> = vec![match codes { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_deposit_withdraw_fees", __args).await?;
Ok(dict_from_value(&v, DepositWithdrawFee::from_value))
}
}
fn fetch_deposit_withdraw_fee<'a>(&'a mut self, code: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<DepositWithdrawFee>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_deposit_withdraw_fee", __args).await?;
Ok(DepositWithdrawFee::from_value(v))
}
}
fn fetch_cross_borrow_rate<'a>(&'a mut self, code: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<BorrowRate>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_cross_borrow_rate", __args).await?;
Ok(BorrowRate::from_value(v))
}
}
fn fetch_isolated_borrow_rate<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<IsolatedBorrowRate>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_isolated_borrow_rate", __args).await?;
Ok(IsolatedBorrowRate::from_value(v))
}
}
fn fetch_spot_tickers<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_spot_tickers", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn fetch_contract_tickers<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_contract_tickers", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn fetch_order_books<'a>(&'a mut self, symbols: Option<Vec<String>>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OrderBooks>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_order_books", __args).await?;
Ok(dict_from_value(&v, OrderBook::from_value))
}
}
fn create_twap_order<'a>(&'a mut self, symbol: &str, side: &str, amount: f64, duration: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(side.to_string()), Value::Float(amount), Value::Float(duration), params.into().into_value()];
async move {
let v = self.call_raw("create_twap_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_convert_trade<'a>(&'a mut self, id: &str, from_code: &str, to_code: &str, amount: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Conversion>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), Value::Str(from_code.to_string()), Value::Str(to_code.to_string()), amount.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_convert_trade", __args).await?;
Ok(Conversion::from_value(v))
}
}
fn fetch_convert_trade<'a>(&'a mut self, id: &str, code: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Conversion>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_convert_trade", __args).await?;
Ok(Conversion::from_value(v))
}
}
fn fetch_convert_trade_history<'a>(&'a mut self, code: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Conversion>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_convert_trade_history", __args).await?;
Ok(vec_from_value(&v, Conversion::from_value))
}
}
fn fetch_position_mode<'a>(&'a mut self, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<PositionModeInfo>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_position_mode", __args).await?;
Ok(PositionModeInfo::from_value(v))
}
}
fn fetch_adl_rank<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<ADL>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_adl_rank", __args).await?;
Ok(ADL::from_value(v))
}
}
fn fetch_positions_adl_rank<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<ADL>>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_positions_adl_rank", __args).await?;
Ok(vec_from_value(&v, ADL::from_value))
}
}
fn fetch_position_adl_rank<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<ADL>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_position_adl_rank", __args).await?;
Ok(ADL::from_value(v))
}
}
fn create_spot_orders<'a>(&'a mut self, orders: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![orders, params.into().into_value()];
async move {
let v = self.call_raw("create_spot_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn create_contract_orders<'a>(&'a mut self, orders: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![orders, params.into().into_value()];
async move {
let v = self.call_raw("create_contract_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn cancel_spot_order<'a>(&'a mut self, id: &str, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_spot_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn cancel_contract_order<'a>(&'a mut self, id: &str, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_contract_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn cancel_all_spot_orders<'a>(&'a mut self, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_all_spot_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn cancel_all_contract_orders<'a>(&'a mut self, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_all_contract_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn cancel_orders_for_symbols<'a>(&'a mut self, orders: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![orders, params.into().into_value()];
async move {
let v = self.call_raw("cancel_orders_for_symbols", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_my_liquidations<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Liquidation>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_my_liquidations", __args).await?;
Ok(vec_from_value(&v, Liquidation::from_value))
}
}
fn fetch_liquidations<'a>(&'a mut self, symbol: &str, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Liquidation>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_liquidations", __args).await?;
Ok(vec_from_value(&v, Liquidation::from_value))
}
}
fn fetch_greeks<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Greeks>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_greeks", __args).await?;
Ok(Greeks::from_value(v))
}
}
fn fetch_all_greeks<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<AllGreeks>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_all_greeks", __args).await?;
Ok(dict_from_value(&v, Greeks::from_value))
}
}
fn fetch_option_chain<'a>(&'a mut self, code: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OptionChain>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_option_chain", __args).await?;
Ok(dict_from_value(&v, OptionContract::from_value))
}
}
fn fetch_option<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OptionContract>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_option", __args).await?;
Ok(OptionContract::from_value(v))
}
}
fn fetch_convert_quote<'a>(&'a mut self, from_code: &str, to_code: &str, amount: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Conversion>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(from_code.to_string()), Value::Str(to_code.to_string()), amount.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_convert_quote", __args).await?;
Ok(Conversion::from_value(v))
}
}
fn fetch_deposits_withdrawals<'a>(&'a mut self, code: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Transaction>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_deposits_withdrawals", __args).await?;
Ok(vec_from_value(&v, Transaction::from_value))
}
}
fn fetch_deposits<'a>(&'a mut self, code: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Transaction>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_deposits", __args).await?;
Ok(vec_from_value(&v, Transaction::from_value))
}
}
fn fetch_withdrawals<'a>(&'a mut self, code: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Transaction>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_withdrawals", __args).await?;
Ok(vec_from_value(&v, Transaction::from_value))
}
}
fn fetch_funding_rate_history<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<FundingRateHistory>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_funding_rate_history", __args).await?;
Ok(vec_from_value(&v, FundingRateHistory::from_value))
}
}
fn fetch_funding_history<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<FundingHistory>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_funding_history", __args).await?;
Ok(vec_from_value(&v, FundingHistory::from_value))
}
}
fn fetch_deposit_address<'a>(&'a mut self, code: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<DepositAddress>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_deposit_address", __args).await?;
Ok(DepositAddress::from_value(v))
}
}
fn fetch_contract_deposit_address<'a>(&'a mut self, code: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<DepositAddress>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(code.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_contract_deposit_address", __args).await?;
Ok(DepositAddress::from_value(v))
}
}
fn fetch_market_leverage_tiers<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<LeverageTier>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_market_leverage_tiers", __args).await?;
Ok(vec_from_value(&v, LeverageTier::from_value))
}
}
fn fetch_last_prices<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<LastPrices>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_last_prices", __args).await?;
Ok(dict_from_value(&v, LastPrice::from_value))
}
}
fn fetch_trading_fees<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<TradingFees>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_trading_fees", __args).await?;
Ok(dict_from_value(&v, TradingFee::from_value))
}
}
fn fetch_convert_currencies<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Currencies>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("fetch_convert_currencies", __args).await?;
Ok(dict_from_value(&v, Currency::from_value))
}
}
fn fetch_funding_rate<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<FundingRate>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_funding_rate", __args).await?;
Ok(FundingRate::from_value(v))
}
}
fn fetch_funding_interval<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<FundingRate>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_funding_interval", __args).await?;
Ok(FundingRate::from_value(v))
}
}
fn fetch_mark_ohlcv<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OHLCV>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_mark_ohlcv", __args).await?;
Ok(match v { Value::Arr(arr) => arr.iter().map(|c| { let mut out = [0.0f64; 6]; if let Value::Arr(fields) = c { for (i, slot) in out.iter_mut().enumerate() { if let Some(f) = fields.get(i).and_then(|x| x.as_f64()) { *slot = f; } } } out }).collect(), _ => Vec::new() })
}
}
fn fetch_index_ohlcv<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OHLCV>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_index_ohlcv", __args).await?;
Ok(match v { Value::Arr(arr) => arr.iter().map(|c| { let mut out = [0.0f64; 6]; if let Value::Arr(fields) = c { for (i, slot) in out.iter_mut().enumerate() { if let Some(f) = fields.get(i).and_then(|x| x.as_f64()) { *slot = f; } } } out }).collect(), _ => Vec::new() })
}
}
fn fetch_premium_index_ohlcv<'a>(&'a mut self, symbol: &str, timeframe: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<OHLCV>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), timeframe.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_premium_index_ohlcv", __args).await?;
Ok(match v { Value::Arr(arr) => arr.iter().map(|c| { let mut out = [0.0f64; 6]; if let Value::Arr(fields) = c { for (i, slot) in out.iter_mut().enumerate() { if let Some(f) = fields.get(i).and_then(|x| x.as_f64()) { *slot = f; } } } out }).collect(), _ => Vec::new() })
}
}
fn fetch_transactions<'a>(&'a mut self, code: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Transaction>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_transactions", __args).await?;
Ok(vec_from_value(&v, Transaction::from_value))
}
}
fn fetch_transfer<'a>(&'a mut self, id: &str, code: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Transfer>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_transfer", __args).await?;
Ok(Transfer::from_value(v))
}
}
fn fetch_transfers<'a>(&'a mut self, code: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Transfer>>> + Send + 'a {
let __args: Vec<Value> = vec![code.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_transfers", __args).await?;
Ok(vec_from_value(&v, Transfer::from_value))
}
}
fn close_position<'a>(&'a mut self, symbol: &str, side: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), side.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("close_position", __args).await?;
Ok(Order::from_value(v))
}
}
fn close_all_positions<'a>(&'a mut self, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![params.into().into_value()];
async move {
let v = self.call_raw("close_all_positions", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn edit_orders<'a>(&'a mut self, orders: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![orders, params.into().into_value()];
async move {
let v = self.call_raw("edit_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_canceled_and_closed_orders<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_canceled_and_closed_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_position_history<'a>(&'a mut self, symbol: &str, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_position_history", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn fetch_positions_history<'a>(&'a mut self, symbols: Option<Vec<String>>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_positions_history", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn fetch_positions_risk<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_positions_risk", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn fetch_positions_for_symbol<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_positions_for_symbol", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn watch_position<'a>(&'a mut self, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Position>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_position", __args).await?;
Ok(Position::from_value(v))
}
}
fn watch_my_trades_for_symbols<'a>(&'a mut self, symbols: Vec<String>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Trade>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(symbols.into_iter().map(Value::Str).collect())), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_my_trades_for_symbols", __args).await?;
Ok(vec_from_value(&v, Trade::from_value))
}
}
fn watch_trades_for_symbols<'a>(&'a mut self, symbols: Vec<String>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Trade>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(symbols.into_iter().map(Value::Str).collect())), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_trades_for_symbols", __args).await?;
Ok(vec_from_value(&v, Trade::from_value))
}
}
fn fetch_bids_asks<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_bids_asks", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn fetch_mark_price<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Ticker>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_mark_price", __args).await?;
Ok(Ticker::from_value(v))
}
}
fn fetch_mark_prices<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_mark_prices", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn watch_bids_asks<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("watch_bids_asks", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn watch_mark_price<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Ticker>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("watch_mark_price", __args).await?;
Ok(Ticker::from_value(v))
}
}
fn watch_mark_prices<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("watch_mark_prices", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn fetch_l3_order_book<'a>(&'a mut self, symbol: &str, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OrderBook>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_l3_order_book", __args).await?;
Ok(OrderBook::from_value(v))
}
}
fn watch_order_book_for_symbols<'a>(&'a mut self, symbols: Vec<String>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OrderBook>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(symbols.into_iter().map(Value::Str).collect())), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_order_book_for_symbols", __args).await?;
Ok(OrderBook::from_value(v))
}
}
fn watch_orders_for_symbols<'a>(&'a mut self, symbols: Vec<String>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(symbols.into_iter().map(Value::Str).collect())), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_orders_for_symbols", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_trades<'a>(&'a mut self, symbol: &str, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Trade>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_trades", __args).await?;
Ok(vec_from_value(&v, Trade::from_value))
}
}
fn watch_trades<'a>(&'a mut self, symbol: &str, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Trade>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_trades", __args).await?;
Ok(vec_from_value(&v, Trade::from_value))
}
}
fn fetch_order_book<'a>(&'a mut self, symbol: &str, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OrderBook>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_order_book", __args).await?;
Ok(OrderBook::from_value(v))
}
}
fn watch_order_book<'a>(&'a mut self, symbol: &str, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OrderBook>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_order_book", __args).await?;
Ok(OrderBook::from_value(v))
}
}
fn fetch_open_interest<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<OpenInterest>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_open_interest", __args).await?;
Ok(OpenInterest::from_value(v))
}
}
fn edit_limit_buy_order<'a>(&'a mut self, id: &str, symbol: &str, amount: f64, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), Value::Str(symbol.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("edit_limit_buy_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn edit_limit_sell_order<'a>(&'a mut self, id: &str, symbol: &str, amount: f64, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), Value::Str(symbol.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("edit_limit_sell_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn edit_limit_order<'a>(&'a mut self, id: &str, symbol: &str, side: &str, amount: f64, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), Value::Str(symbol.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("edit_limit_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn edit_order<'a>(&'a mut self, id: &str, symbol: &str, type_: &str, side: &str, amount: Option<f64>, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), amount.map(Value::Float).unwrap_or(Value::Null), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("edit_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn edit_order_with_client_order_id<'a>(&'a mut self, client_order_id: &str, symbol: &str, type_: &str, side: &str, amount: Option<f64>, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(client_order_id.to_string()), Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), amount.map(Value::Float).unwrap_or(Value::Null), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("edit_order_with_client_order_id", __args).await?;
Ok(Order::from_value(v))
}
}
fn fetch_position<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Position>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_position", __args).await?;
Ok(Position::from_value(v))
}
}
fn watch_positions<'a>(&'a mut self, symbols: Option<Vec<String>>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_positions", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn watch_position_for_symbols<'a>(&'a mut self, symbols: Option<Vec<String>>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_position_for_symbols", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn fetch_positions<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Position>>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_positions", __args).await?;
Ok(vec_from_value(&v, Position::from_value))
}
}
fn fetch_ticker<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Ticker>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_ticker", __args).await?;
Ok(Ticker::from_value(v))
}
}
fn watch_ticker<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Ticker>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("watch_ticker", __args).await?;
Ok(Ticker::from_value(v))
}
}
fn fetch_tickers<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("fetch_tickers", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn watch_tickers<'a>(&'a mut self, symbols: Option<Vec<String>>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Tickers>> + Send + 'a {
let __args: Vec<Value> = vec![match symbols { Some(list) => Value::Arr(std::sync::Arc::new(list.into_iter().map(Value::Str).collect())), None => Value::Null }, params.into().into_value()];
async move {
let v = self.call_raw("watch_tickers", __args).await?;
Ok(dict_from_value(&v, Ticker::from_value))
}
}
fn fetch_order<'a>(&'a mut self, id: &str, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn fetch_order_with_client_order_id<'a>(&'a mut self, client_order_id: &str, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(client_order_id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_order_with_client_order_id", __args).await?;
Ok(Order::from_value(v))
}
}
fn fetch_order_status<'a>(&'a mut self, id: &str, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Option<String>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_order_status", __args).await?;
Ok(match v { Value::Str(s) => Some(s), _ => None })
}
}
fn fetch_unified_order<'a>(&'a mut self, order: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![order, params.into().into_value()];
async move {
let v = self.call_raw("fetch_unified_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_trailing_amount_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, trailing_amount: Option<f64>, trailing_trigger_price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), trailing_amount.map(Value::Float).unwrap_or(Value::Null), trailing_trigger_price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_trailing_amount_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_trailing_percent_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, trailing_percent: Option<f64>, trailing_trigger_price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), trailing_percent.map(Value::Float).unwrap_or(Value::Null), trailing_trigger_price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_trailing_percent_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_market_order_with_cost<'a>(&'a mut self, symbol: &str, side: &str, cost: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(side.to_string()), Value::Float(cost), params.into().into_value()];
async move {
let v = self.call_raw("create_market_order_with_cost", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_market_buy_order_with_cost<'a>(&'a mut self, symbol: &str, cost: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(cost), params.into().into_value()];
async move {
let v = self.call_raw("create_market_buy_order_with_cost", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_market_sell_order_with_cost<'a>(&'a mut self, symbol: &str, cost: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(cost), params.into().into_value()];
async move {
let v = self.call_raw("create_market_sell_order_with_cost", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_trigger_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, trigger_price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), trigger_price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_trigger_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_stop_loss_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, stop_loss_price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), stop_loss_price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_stop_loss_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_take_profit_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, take_profit_price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), take_profit_price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_take_profit_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_order_with_take_profit_and_stop_loss<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, take_profit: Option<f64>, stop_loss: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), take_profit.map(Value::Float).unwrap_or(Value::Null), stop_loss.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_order_with_take_profit_and_stop_loss", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_orders<'a>(&'a mut self, orders: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![orders, params.into().into_value()];
async move {
let v = self.call_raw("create_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn cancel_order<'a>(&'a mut self, id: &str, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn cancel_order_with_client_order_id<'a>(&'a mut self, client_order_id: &str, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(client_order_id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_order_with_client_order_id", __args).await?;
Ok(Order::from_value(v))
}
}
fn cancel_orders<'a>(&'a mut self, ids: Vec<String>, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(ids.into_iter().map(Value::Str).collect())), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn cancel_orders_with_client_order_ids<'a>(&'a mut self, client_order_ids: Vec<String>, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Arr(std::sync::Arc::new(client_order_ids.into_iter().map(Value::Str).collect())), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_orders_with_client_order_ids", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn cancel_all_orders<'a>(&'a mut self, symbol: Option<&str>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("cancel_all_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn cancel_unified_order<'a>(&'a mut self, order: Value, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![order, params.into().into_value()];
async move {
let v = self.call_raw("cancel_unified_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn fetch_orders<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_order_trades<'a>(&'a mut self, id: &str, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Trade>>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(id.to_string()), symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_order_trades", __args).await?;
Ok(vec_from_value(&v, Trade::from_value))
}
}
fn watch_orders<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_open_orders<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_open_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_closed_orders<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_closed_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_canceled_orders<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Order>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_canceled_orders", __args).await?;
Ok(vec_from_value(&v, Order::from_value))
}
}
fn fetch_my_trades<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Trade>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("fetch_my_trades", __args).await?;
Ok(vec_from_value(&v, Trade::from_value))
}
}
fn watch_my_trades<'a>(&'a mut self, symbol: Option<&str>, since: Option<i64>, limit: Option<i64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Vec<Trade>>> + Send + 'a {
let __args: Vec<Value> = vec![symbol.map(|s| Value::Str(s.to_string())).unwrap_or(Value::Null), since.map(Value::Int).unwrap_or(Value::Null), limit.map(Value::Int).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("watch_my_trades", __args).await?;
Ok(vec_from_value(&v, Trade::from_value))
}
}
fn create_limit_order<'a>(&'a mut self, symbol: &str, side: &str, amount: f64, price: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(side.to_string()), Value::Float(amount), Value::Float(price), params.into().into_value()];
async move {
let v = self.call_raw("create_limit_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_market_order<'a>(&'a mut self, symbol: &str, side: &str, amount: f64, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_market_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_limit_buy_order<'a>(&'a mut self, symbol: &str, amount: f64, price: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(amount), Value::Float(price), params.into().into_value()];
async move {
let v = self.call_raw("create_limit_buy_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_limit_sell_order<'a>(&'a mut self, symbol: &str, amount: f64, price: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(amount), Value::Float(price), params.into().into_value()];
async move {
let v = self.call_raw("create_limit_sell_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_market_buy_order<'a>(&'a mut self, symbol: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("create_market_buy_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_market_sell_order<'a>(&'a mut self, symbol: &str, amount: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Float(amount), params.into().into_value()];
async move {
let v = self.call_raw("create_market_sell_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_post_only_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_post_only_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_reduce_only_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_reduce_only_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_stop_order<'a>(&'a mut self, symbol: &str, type_: &str, side: &str, amount: f64, price: Option<f64>, trigger_price: Option<f64>, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(type_.to_string()), Value::Str(side.to_string()), Value::Float(amount), price.map(Value::Float).unwrap_or(Value::Null), trigger_price.map(Value::Float).unwrap_or(Value::Null), params.into().into_value()];
async move {
let v = self.call_raw("create_stop_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_stop_limit_order<'a>(&'a mut self, symbol: &str, side: &str, amount: f64, price: f64, trigger_price: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(side.to_string()), Value::Float(amount), Value::Float(price), Value::Float(trigger_price), params.into().into_value()];
async move {
let v = self.call_raw("create_stop_limit_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn create_stop_market_order<'a>(&'a mut self, symbol: &str, side: &str, amount: f64, trigger_price: f64, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<Order>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), Value::Str(side.to_string()), Value::Float(amount), Value::Float(trigger_price), params.into().into_value()];
async move {
let v = self.call_raw("create_stop_market_order", __args).await?;
Ok(Order::from_value(v))
}
}
fn fetch_trading_fee<'a>(&'a mut self, symbol: &str, params: impl Into<Params>) -> impl ::std::future::Future<Output = crate::Result<TradingFee>> + Send + 'a {
let __args: Vec<Value> = vec![Value::Str(symbol.to_string()), params.into().into_value()];
async move {
let v = self.call_raw("fetch_trading_fee", __args).await?;
Ok(TradingFee::from_value(v))
}
}
}
impl<T: TypedExchange + ?Sized> TypedExchangeExt for T {}
pub use crate::pro_typed::alpaca_typed::Alpaca;
pub use crate::pro_typed::apex_typed::Apex;
pub use crate::pro_typed::aster_typed::Aster;
pub use crate::pro_typed::backpack_typed::Backpack;
pub use crate::pro_typed::bequant_typed::Bequant;
pub use crate::pro_typed::binance_typed::Binance;
pub use crate::pro_typed::binancecoinm_typed::Binancecoinm;
pub use crate::pro_typed::binanceus_typed::Binanceus;
pub use crate::pro_typed::binanceusdm_typed::Binanceusdm;
pub use crate::pro_typed::bingx_typed::Bingx;
pub use crate::pro_typed::bitfinex_typed::Bitfinex;
pub use crate::pro_typed::bitget_typed::Bitget;
pub use crate::pro_typed::bithumb_typed::Bithumb;
pub use crate::pro_typed::bitmex_typed::Bitmex;
pub use crate::pro_typed::bitopro_typed::Bitopro;
pub use crate::pro_typed::bitrue_typed::Bitrue;
pub use crate::pro_typed::bitstamp_typed::Bitstamp;
pub use crate::pro_typed::bittrade_typed::Bittrade;
pub use crate::pro_typed::bitvavo_typed::Bitvavo;
pub use crate::pro_typed::blockchaincom_typed::Blockchaincom;
pub use crate::pro_typed::blofin_typed::Blofin;
pub use crate::pro_typed::bullish_typed::Bullish;
pub use crate::pro_typed::bybit_typed::Bybit;
pub use crate::pro_typed::bybiteu_typed::Bybiteu;
pub use crate::pro_typed::bydfi_typed::Bydfi;
pub use crate::pro_typed::cex_typed::Cex;
pub use crate::pro_typed::coinbase_typed::Coinbase;
pub use crate::pro_typed::coinbaseexchange_typed::Coinbaseexchange;
pub use crate::pro_typed::coinbaseinternational_typed::Coinbaseinternational;
pub use crate::pro_typed::coincheck_typed::Coincheck;
pub use crate::pro_typed::coinex_typed::Coinex;
pub use crate::pro_typed::coinone_typed::Coinone;
pub use crate::pro_typed::cryptocom_typed::Cryptocom;
pub use crate::pro_typed::deepcoin_typed::Deepcoin;
pub use crate::pro_typed::deribit_typed::Deribit;
pub use crate::pro_typed::derive_typed::Derive;
pub use crate::pro_typed::dydx_typed::Dydx;
pub use crate::pro_typed::extended_typed::Extended;
pub use crate::pro_typed::gate_typed::Gate;
pub use crate::pro_typed::gateeu_typed::Gateeu;
pub use crate::pro_typed::gemini_typed::Gemini;
pub use crate::pro_typed::grvt_typed::Grvt;
pub use crate::pro_typed::hashkey_typed::Hashkey;
pub use crate::pro_typed::hitbtc_typed::Hitbtc;
pub use crate::pro_typed::hollaex_typed::Hollaex;
pub use crate::pro_typed::htx_typed::Htx;
pub use crate::pro_typed::hyperliquid_typed::Hyperliquid;
pub use crate::pro_typed::independentreserve_typed::Independentreserve;
pub use crate::pro_typed::kraken_typed::Kraken;
pub use crate::pro_typed::krakenfutures_typed::Krakenfutures;
pub use crate::pro_typed::kucoin_typed::Kucoin;
pub use crate::pro_typed::kucoinfutures_typed::Kucoinfutures;
pub use crate::pro_typed::lbank_typed::Lbank;
pub use crate::pro_typed::lighter_typed::Lighter;
pub use crate::pro_typed::luno_typed::Luno;
pub use crate::pro_typed::mexc_typed::Mexc;
pub use crate::pro_typed::modetrade_typed::Modetrade;
pub use crate::pro_typed::mudrex_typed::Mudrex;
pub use crate::pro_typed::myokx_typed::Myokx;
pub use crate::pro_typed::nado_typed::Nado;
pub use crate::pro_typed::ndax_typed::Ndax;
pub use crate::pro_typed::okx_typed::Okx;
pub use crate::pro_typed::okxus_typed::Okxus;
pub use crate::pro_typed::onetrading_typed::Onetrading;
pub use crate::pro_typed::p2b_typed::P2b;
pub use crate::pro_typed::pacifica_typed::Pacifica;
pub use crate::pro_typed::paradex_typed::Paradex;
pub use crate::pro_typed::phemex_typed::Phemex;
pub use crate::pro_typed::poloniex_typed::Poloniex;
pub use crate::pro_typed::toobit_typed::Toobit;
pub use crate::pro_typed::upbit_typed::Upbit;
pub use crate::pro_typed::weex_typed::Weex;
pub use crate::pro_typed::whitebit_typed::Whitebit;
pub use crate::pro_typed::woo_typed::Woo;
pub use crate::pro_typed::woofipro_typed::Woofipro;
pub use crate::pro_typed::xt_typed::Xt;
pub fn from_id(id: &str, config: Option<crate::Value>) -> Option<Box<dyn TypedExchange>> {
match id {
"alpaca" => Some(Box::new(Alpaca::new(config))),
"apex" => Some(Box::new(Apex::new(config))),
"aster" => Some(Box::new(Aster::new(config))),
"backpack" => Some(Box::new(Backpack::new(config))),
"bequant" => Some(Box::new(Bequant::new(config))),
"binance" => Some(Box::new(Binance::new(config))),
"binancecoinm" => Some(Box::new(Binancecoinm::new(config))),
"binanceus" => Some(Box::new(Binanceus::new(config))),
"binanceusdm" => Some(Box::new(Binanceusdm::new(config))),
"bingx" => Some(Box::new(Bingx::new(config))),
"bitfinex" => Some(Box::new(Bitfinex::new(config))),
"bitget" => Some(Box::new(Bitget::new(config))),
"bithumb" => Some(Box::new(Bithumb::new(config))),
"bitmex" => Some(Box::new(Bitmex::new(config))),
"bitopro" => Some(Box::new(Bitopro::new(config))),
"bitrue" => Some(Box::new(Bitrue::new(config))),
"bitstamp" => Some(Box::new(Bitstamp::new(config))),
"bittrade" => Some(Box::new(Bittrade::new(config))),
"bitvavo" => Some(Box::new(Bitvavo::new(config))),
"blockchaincom" => Some(Box::new(Blockchaincom::new(config))),
"blofin" => Some(Box::new(Blofin::new(config))),
"bullish" => Some(Box::new(Bullish::new(config))),
"bybit" => Some(Box::new(Bybit::new(config))),
"bybiteu" => Some(Box::new(Bybiteu::new(config))),
"bydfi" => Some(Box::new(Bydfi::new(config))),
"cex" => Some(Box::new(Cex::new(config))),
"coinbase" => Some(Box::new(Coinbase::new(config))),
"coinbaseexchange" => Some(Box::new(Coinbaseexchange::new(config))),
"coinbaseinternational" => Some(Box::new(Coinbaseinternational::new(config))),
"coincheck" => Some(Box::new(Coincheck::new(config))),
"coinex" => Some(Box::new(Coinex::new(config))),
"coinone" => Some(Box::new(Coinone::new(config))),
"cryptocom" => Some(Box::new(Cryptocom::new(config))),
"deepcoin" => Some(Box::new(Deepcoin::new(config))),
"deribit" => Some(Box::new(Deribit::new(config))),
"derive" => Some(Box::new(Derive::new(config))),
"dydx" => Some(Box::new(Dydx::new(config))),
"extended" => Some(Box::new(Extended::new(config))),
"gate" => Some(Box::new(Gate::new(config))),
"gateeu" => Some(Box::new(Gateeu::new(config))),
"gemini" => Some(Box::new(Gemini::new(config))),
"grvt" => Some(Box::new(Grvt::new(config))),
"hashkey" => Some(Box::new(Hashkey::new(config))),
"hitbtc" => Some(Box::new(Hitbtc::new(config))),
"hollaex" => Some(Box::new(Hollaex::new(config))),
"htx" => Some(Box::new(Htx::new(config))),
"hyperliquid" => Some(Box::new(Hyperliquid::new(config))),
"independentreserve" => Some(Box::new(Independentreserve::new(config))),
"kraken" => Some(Box::new(Kraken::new(config))),
"krakenfutures" => Some(Box::new(Krakenfutures::new(config))),
"kucoin" => Some(Box::new(Kucoin::new(config))),
"kucoinfutures" => Some(Box::new(Kucoinfutures::new(config))),
"lbank" => Some(Box::new(Lbank::new(config))),
"lighter" => Some(Box::new(Lighter::new(config))),
"luno" => Some(Box::new(Luno::new(config))),
"mexc" => Some(Box::new(Mexc::new(config))),
"modetrade" => Some(Box::new(Modetrade::new(config))),
"mudrex" => Some(Box::new(Mudrex::new(config))),
"myokx" => Some(Box::new(Myokx::new(config))),
"nado" => Some(Box::new(Nado::new(config))),
"ndax" => Some(Box::new(Ndax::new(config))),
"okx" => Some(Box::new(Okx::new(config))),
"okxus" => Some(Box::new(Okxus::new(config))),
"onetrading" => Some(Box::new(Onetrading::new(config))),
"p2b" => Some(Box::new(P2b::new(config))),
"pacifica" => Some(Box::new(Pacifica::new(config))),
"paradex" => Some(Box::new(Paradex::new(config))),
"phemex" => Some(Box::new(Phemex::new(config))),
"poloniex" => Some(Box::new(Poloniex::new(config))),
"toobit" => Some(Box::new(Toobit::new(config))),
"upbit" => Some(Box::new(Upbit::new(config))),
"weex" => Some(Box::new(Weex::new(config))),
"whitebit" => Some(Box::new(Whitebit::new(config))),
"woo" => Some(Box::new(Woo::new(config))),
"woofipro" => Some(Box::new(Woofipro::new(config))),
"xt" => Some(Box::new(Xt::new(config))),
_ => None,
}
}
pub fn from_id_with_config(id: &str, config: crate::Config) -> Option<Box<dyn TypedExchange>> {
from_id(id, config.into_option())
}