// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
#![allow(unused, non_snake_case, clippy::all)]
use crate::Value;
use crate::get_value;
use crate::runtime::*;
// Base methods are now trait methods (review #1: static dispatch). Bring the
// traits into scope so `self.market(...)`, `self.safe_market(...)`,
// `self.load_markets(...)`, … on this Core resolve to the base defaults.
use crate::exchange_generated::ExchangeBase;
use crate::exchange::ExchangeRuntime;
pub struct BitteamCore {
pub exchange: crate::exchange::Exchange,
}
impl BitteamCore {
pub fn new(config: Option<crate::Value>) -> Self {
let mut s = Self { exchange: crate::exchange::Exchange::new(config) };
s.init();
s
}
pub fn init(&mut self) {
let described = BitteamCore::describe(self);
self.initialize_properties(described);
<Self as crate::exchange_generated::ExchangeBase>::after_construct(self);
}
/// Compatibility no-op. The old pointer-based dispatch needed a post-move
/// `bind()`; static trait dispatch (review #1) needs no binding, so this
/// just exists so callers that still call it keep compiling.
#[inline]
pub fn bind(&mut self) {}
}
impl crate::exchange::DerivedExchange for BitteamCore {
fn parse_ticker(&self, ticker: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_ticker(self, ticker, &[market.clone()])
}
fn parse_trade(&self, trade: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_trade(self, trade, &[market.clone()])
}
fn parse_order(&self, order: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_order(self, order, &[market.clone()])
}
fn parse_market(&self, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_market(self, market)
}
fn parse_ohlcv(&self, ohlcv: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_ohlcv(self, ohlcv, &[market.clone()])
}
fn parse_balance(&self, response: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_balance(self, response)
}
fn parse_currency(&self, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_currency(self, currency)
}
fn parse_transaction(&self, transaction: crate::Value, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::parse_transaction(self, transaction, &[currency.clone()])
}
fn sign(&self, path: crate::Value, api: crate::Value, method: crate::Value, params: crate::Value, headers: crate::Value, body: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::sign(self, path, &[api.clone(), method.clone(), params.clone(), headers.clone(), body.clone()])
}
fn handle_errors(&self, code: crate::Value, reason: crate::Value, url: crate::Value, method: crate::Value, headers: crate::Value, body: crate::Value, response: crate::Value, request_headers: crate::Value, request_body: crate::Value) -> crate::Value {
// Forward to the inherent method on BitteamCore.
BitteamCore::handle_errors(self, code, reason, url, method, headers, body, response, request_headers, request_body)
}
}
impl crate::exchange_generated::ExchangeBase for BitteamCore {
fn call_dynamic<'a>(&'a mut self, method: &'a str, args: Vec<crate::Value>)
-> std::pin::Pin<Box<dyn std::future::Future<Output = crate::Value> + Send + 'a>>
{
Box::pin(async move {
match method {
"cancel_all_orders" => self.cancel_all_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"cancel_order" => self.cancel_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"create_order" => self.create_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_balance" => self.fetch_balance(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_canceled_orders" => self.fetch_canceled_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_closed_orders" => self.fetch_closed_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_currencies" => self.fetch_currencies(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_deposits_withdrawals" => self.fetch_deposits_withdrawals(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_markets" => self.fetch_markets(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_my_trades" => self.fetch_my_trades(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_ohlcv" => self.fetch_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_open_orders" => self.fetch_open_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_order" => self.fetch_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_order_book" => self.fetch_order_book(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_orders" => self.fetch_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_ticker" => self.fetch_ticker(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_tickers" => self.fetch_tickers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_trades" => self.fetch_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"handle_errors" => self.handle_errors(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), args.get(4).cloned().unwrap_or(crate::Value::Null), args.get(5).cloned().unwrap_or(crate::Value::Null), args.get(6).cloned().unwrap_or(crate::Value::Null), args.get(7).cloned().unwrap_or(crate::Value::Null), args.get(8).cloned().unwrap_or(crate::Value::Null)),
"parse_balance" => self.parse_balance(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_currency" => self.parse_currency(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_market" => self.parse_market(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_ohlcv" => self.parse_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"parse_order" => self.parse_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"parse_order_status" => self.parse_order_status(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_order_type" => self.parse_order_type(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_ticker" => self.parse_ticker(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"parse_trade" => self.parse_trade(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"parse_transaction" => self.parse_transaction(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"parse_transaction_status" => self.parse_transaction_status(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_transaction_type" => self.parse_transaction_type(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_value_to_pricision" => self.parse_value_to_pricision(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null)),
"sign" => self.sign(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
// Fall through to the base-only methods (cancelOrderWithClientOrderId, …).
_ => self.call_dynamic_base(method, args).await,
}
})
}
}
impl std::ops::Deref for BitteamCore {
type Target = crate::exchange::Exchange;
fn deref(&self) -> &crate::exchange::Exchange { &self.exchange }
}
impl std::ops::DerefMut for BitteamCore {
fn deref_mut(&mut self) -> &mut crate::exchange::Exchange { &mut self.exchange }
}
impl BitteamCore {
pub fn describe(&self) -> Value {
return self.deep_extend(self.super_describe(), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), Value::Str("bitteam".to_string()));
m.insert("name".to_string(), Value::Str("BIT.TEAM".to_string()));
m.insert("countries".to_string(), Value::List(vec![Value::Str("UK".to_string())]));
m.insert("version".to_string(), Value::Str("v2.0.6".to_string()));
m.insert("rateLimit".to_string(), Value::Int(1));
m.insert("certified".to_string(), Value::Bool(false));
m.insert("pro".to_string(), Value::Bool(false));
m.insert("has".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("CORS".to_string(), Value::Null);
m.insert("spot".to_string(), Value::Bool(true));
m.insert("margin".to_string(), Value::Bool(false));
m.insert("swap".to_string(), Value::Bool(false));
m.insert("future".to_string(), Value::Bool(false));
m.insert("option".to_string(), Value::Bool(false));
m.insert("addMargin".to_string(), Value::Bool(false));
m.insert("borrowCrossMargin".to_string(), Value::Bool(false));
m.insert("borrowIsolatedMargin".to_string(), Value::Bool(false));
m.insert("borrowMargin".to_string(), Value::Bool(false));
m.insert("cancelAllOrders".to_string(), Value::Bool(true));
m.insert("cancelOrder".to_string(), Value::Bool(true));
m.insert("cancelOrders".to_string(), Value::Bool(false));
m.insert("closeAllPositions".to_string(), Value::Bool(false));
m.insert("closePosition".to_string(), Value::Bool(false));
m.insert("createDepositAddress".to_string(), Value::Bool(false));
m.insert("createOrder".to_string(), Value::Bool(true));
m.insert("createOrderWithTakeProfitAndStopLoss".to_string(), Value::Bool(false));
m.insert("createOrderWithTakeProfitAndStopLossWs".to_string(), Value::Bool(false));
m.insert("createPostOnlyOrder".to_string(), Value::Bool(false));
m.insert("createReduceOnlyOrder".to_string(), Value::Bool(false));
m.insert("createStopLimitOrder".to_string(), Value::Bool(false));
m.insert("createStopMarketOrder".to_string(), Value::Bool(false));
m.insert("createStopOrder".to_string(), Value::Bool(false));
m.insert("deposit".to_string(), Value::Bool(false));
m.insert("editOrder".to_string(), Value::Bool(false));
m.insert("fetchAccounts".to_string(), Value::Bool(false));
m.insert("fetchBalance".to_string(), Value::Bool(true));
m.insert("fetchBidsAsks".to_string(), Value::Bool(false));
m.insert("fetchBorrowInterest".to_string(), Value::Bool(false));
m.insert("fetchBorrowRate".to_string(), Value::Bool(false));
m.insert("fetchBorrowRateHistories".to_string(), Value::Bool(false));
m.insert("fetchBorrowRateHistory".to_string(), Value::Bool(false));
m.insert("fetchBorrowRates".to_string(), Value::Bool(false));
m.insert("fetchBorrowRatesPerSymbol".to_string(), Value::Bool(false));
m.insert("fetchCanceledOrders".to_string(), Value::Bool(true));
m.insert("fetchClosedOrder".to_string(), Value::Bool(false));
m.insert("fetchClosedOrders".to_string(), Value::Bool(true));
m.insert("fetchCrossBorrowRate".to_string(), Value::Bool(false));
m.insert("fetchCrossBorrowRates".to_string(), Value::Bool(false));
m.insert("fetchCurrencies".to_string(), Value::Bool(true));
m.insert("fetchDeposit".to_string(), Value::Bool(false));
m.insert("fetchDepositAddress".to_string(), Value::Bool(false));
m.insert("fetchDepositAddresses".to_string(), Value::Bool(false));
m.insert("fetchDepositAddressesByNetwork".to_string(), Value::Bool(false));
m.insert("fetchDeposits".to_string(), Value::Bool(false));
m.insert("fetchDepositsWithdrawals".to_string(), Value::Bool(true));
m.insert("fetchDepositWithdrawFee".to_string(), Value::Bool(false));
m.insert("fetchDepositWithdrawFees".to_string(), Value::Bool(false));
m.insert("fetchFundingHistory".to_string(), Value::Bool(false));
m.insert("fetchFundingInterval".to_string(), Value::Bool(false));
m.insert("fetchFundingIntervals".to_string(), Value::Bool(false));
m.insert("fetchFundingRate".to_string(), Value::Bool(false));
m.insert("fetchFundingRateHistory".to_string(), Value::Bool(false));
m.insert("fetchFundingRates".to_string(), Value::Bool(false));
m.insert("fetchGreeks".to_string(), Value::Bool(false));
m.insert("fetchIndexOHLCV".to_string(), Value::Bool(false));
m.insert("fetchIsolatedBorrowRate".to_string(), Value::Bool(false));
m.insert("fetchIsolatedBorrowRates".to_string(), Value::Bool(false));
m.insert("fetchIsolatedPositions".to_string(), Value::Bool(false));
m.insert("fetchL3OrderBook".to_string(), Value::Bool(false));
m.insert("fetchLedger".to_string(), Value::Bool(false));
m.insert("fetchLeverage".to_string(), Value::Bool(false));
m.insert("fetchLeverages".to_string(), Value::Bool(false));
m.insert("fetchLeverageTiers".to_string(), Value::Bool(false));
m.insert("fetchLiquidations".to_string(), Value::Bool(false));
m.insert("fetchLongShortRatio".to_string(), Value::Bool(false));
m.insert("fetchLongShortRatioHistory".to_string(), Value::Bool(false));
m.insert("fetchMarginAdjustmentHistory".to_string(), Value::Bool(false));
m.insert("fetchMarginMode".to_string(), Value::Bool(false));
m.insert("fetchMarginModes".to_string(), Value::Bool(false));
m.insert("fetchMarketLeverageTiers".to_string(), Value::Bool(false));
m.insert("fetchMarkets".to_string(), Value::Bool(true));
m.insert("fetchMarkOHLCV".to_string(), Value::Bool(false));
m.insert("fetchMarkPrices".to_string(), Value::Bool(false));
m.insert("fetchMyLiquidations".to_string(), Value::Bool(false));
m.insert("fetchMySettlementHistory".to_string(), Value::Bool(false));
m.insert("fetchMyTrades".to_string(), Value::Bool(true));
m.insert("fetchOHLCV".to_string(), Value::Bool(true));
m.insert("fetchOpenInterest".to_string(), Value::Bool(false));
m.insert("fetchOpenInterestHistory".to_string(), Value::Bool(false));
m.insert("fetchOpenInterests".to_string(), Value::Bool(false));
m.insert("fetchOpenOrder".to_string(), Value::Bool(false));
m.insert("fetchOpenOrders".to_string(), Value::Bool(true));
m.insert("fetchOption".to_string(), Value::Bool(false));
m.insert("fetchOptionChain".to_string(), Value::Bool(false));
m.insert("fetchOrder".to_string(), Value::Bool(true));
m.insert("fetchOrderBook".to_string(), Value::Bool(true));
m.insert("fetchOrderBooks".to_string(), Value::Bool(false));
m.insert("fetchOrders".to_string(), Value::Bool(true));
m.insert("fetchOrderTrades".to_string(), Value::Bool(false));
m.insert("fetchPosition".to_string(), Value::Bool(false));
m.insert("fetchPositionHistory".to_string(), Value::Bool(false));
m.insert("fetchPositionMode".to_string(), Value::Bool(false));
m.insert("fetchPositions".to_string(), Value::Bool(false));
m.insert("fetchPositionsForSymbol".to_string(), Value::Bool(false));
m.insert("fetchPositionsHistory".to_string(), Value::Bool(false));
m.insert("fetchPositionsRisk".to_string(), Value::Bool(false));
m.insert("fetchPremiumIndexOHLCV".to_string(), Value::Bool(false));
m.insert("fetchSettlementHistory".to_string(), Value::Bool(false));
m.insert("fetchStatus".to_string(), Value::Bool(false));
m.insert("fetchTicker".to_string(), Value::Bool(true));
m.insert("fetchTickers".to_string(), Value::Bool(true));
m.insert("fetchTime".to_string(), Value::Bool(false));
m.insert("fetchTrades".to_string(), Value::Bool(true));
m.insert("fetchTradingFee".to_string(), Value::Bool(false));
m.insert("fetchTradingFees".to_string(), Value::Bool(false));
m.insert("fetchTradingLimits".to_string(), Value::Bool(false));
m.insert("fetchTransactionFee".to_string(), Value::Bool(false));
m.insert("fetchTransactionFees".to_string(), Value::Bool(false));
m.insert("fetchTransactions".to_string(), Value::Bool(true));
m.insert("fetchTransfers".to_string(), Value::Bool(false));
m.insert("fetchVolatilityHistory".to_string(), Value::Bool(false));
m.insert("fetchWithdrawal".to_string(), Value::Bool(false));
m.insert("fetchWithdrawals".to_string(), Value::Bool(false));
m.insert("fetchWithdrawalWhitelist".to_string(), Value::Bool(false));
m.insert("reduceMargin".to_string(), Value::Bool(false));
m.insert("repayCrossMargin".to_string(), Value::Bool(false));
m.insert("repayIsolatedMargin".to_string(), Value::Bool(false));
m.insert("repayMargin".to_string(), Value::Bool(false));
m.insert("setLeverage".to_string(), Value::Bool(false));
m.insert("setMargin".to_string(), Value::Bool(false));
m.insert("setMarginMode".to_string(), Value::Bool(false));
m.insert("setPositionMode".to_string(), Value::Bool(false));
m.insert("signIn".to_string(), Value::Bool(false));
m.insert("transfer".to_string(), Value::Bool(false));
m.insert("withdraw".to_string(), Value::Bool(false));
m.insert("ws".to_string(), Value::Bool(false));
m
}));
m.insert("timeframes".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("1m".to_string(), Value::Str("1".to_string()));
m.insert("5m".to_string(), Value::Str("5".to_string()));
m.insert("15m".to_string(), Value::Str("15".to_string()));
m.insert("1h".to_string(), Value::Str("60".to_string()));
m.insert("1d".to_string(), Value::Str("1D".to_string()));
m
}));
m.insert("urls".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("logo".to_string(), Value::Str("https://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135".to_string()));
m.insert("api".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("history".to_string(), Value::Str("https://history.bit.team".to_string()));
m.insert("public".to_string(), Value::Str("https://bit.team".to_string()));
m.insert("private".to_string(), Value::Str("https://bit.team".to_string()));
m
}));
m.insert("www".to_string(), Value::Str("https://bit.team/".to_string()));
m.insert("referral".to_string(), Value::Str("https://bit.team/auth/sign-up?ref=bitboy2023".to_string()));
m.insert("doc".to_string(), Value::List(vec![Value::Str("https://bit.team/trade/api/documentation".to_string())]));
m
}));
m.insert("api".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("history".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("get".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("api/tw/history/{pairName}/{resolution}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m
}));
m.insert("public".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("get".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("trade/api/asset".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/currencies".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/orderbooks/{symbol}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/orders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/pair/{name}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/pairs".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/pairs/precisions".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/rates".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/trade/{id}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/trades".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/ccxt/pairs".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/cmc/assets".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/cmc/orderbook/{pair}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/cmc/summary".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/cmc/ticker".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/cmc/trades/{pair}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m
}));
m.insert("private".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("get".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("trade/api/ccxt/balance".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/ccxt/order/{id}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/ccxt/ordersOfUser".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/ccxt/tradesOfUser".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/transactionsOfUser".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m.insert("post".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("trade/api/ccxt/cancel-all-order".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/ccxt/cancelorder".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trade/api/ccxt/ordercreate".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m
}));
m
}));
m.insert("fees".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("trading".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("feeSide".to_string(), Value::Str("get".to_string()));
m.insert("tierBased".to_string(), Value::Bool(false));
m.insert("percentage".to_string(), Value::Bool(true));
m.insert("taker".to_string(), self.parse_number(Value::Str("0.002".to_string()), &[]));
m.insert("maker".to_string(), self.parse_number(Value::Str("0.002".to_string()), &[]));
m
}));
m
}));
m.insert("precisionMode".to_string(), Value::Int(crate::runtime::TICK_SIZE));
m.insert("options".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("networksById".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("Ethereum".to_string(), Value::Str("ERC20".to_string()));
m.insert("ethereum".to_string(), Value::Str("ERC20".to_string()));
m.insert("Tron".to_string(), Value::Str("TRC20".to_string()));
m.insert("tron".to_string(), Value::Str("TRC20".to_string()));
m.insert("Binance".to_string(), Value::Str("BSC".to_string()));
m.insert("binance".to_string(), Value::Str("BSC".to_string()));
m.insert("Binance Smart Chain".to_string(), Value::Str("BSC".to_string()));
m.insert("bscscan".to_string(), Value::Str("BSC".to_string()));
m.insert("Bitcoin".to_string(), Value::Str("BTC".to_string()));
m.insert("bitcoin".to_string(), Value::Str("BTC".to_string()));
m.insert("Litecoin".to_string(), Value::Str("LTC".to_string()));
m.insert("litecoin".to_string(), Value::Str("LTC".to_string()));
m.insert("Polygon".to_string(), Value::Str("POLYGON".to_string()));
m.insert("polygon".to_string(), Value::Str("POLYGON".to_string()));
m.insert("PRIZM".to_string(), Value::Str("PRIZM".to_string()));
m.insert("Decimal".to_string(), Value::Str("Decimal".to_string()));
m.insert("ufobject".to_string(), Value::Str("ufobject".to_string()));
m.insert("tonchain".to_string(), Value::Str("tonchain".to_string()));
m
}));
m.insert("fetchMarkets".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("currenciesValuedInUsd".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("USDT".to_string(), Value::Bool(true));
m.insert("BUSD".to_string(), Value::Bool(true));
m
}));
m
}));
m
}));
m.insert("features".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("spot".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("sandbox".to_string(), Value::Bool(false));
m.insert("createOrder".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("triggerPrice".to_string(), Value::Bool(false));
m.insert("triggerPriceType".to_string(), Value::Null);
m.insert("triggerDirection".to_string(), Value::Null);
m.insert("stopLossPrice".to_string(), Value::Bool(false));
m.insert("takeProfitPrice".to_string(), Value::Bool(false));
m.insert("attachedStopLossTakeProfit".to_string(), Value::Null);
m.insert("timeInForce".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("IOC".to_string(), Value::Bool(false));
m.insert("FOK".to_string(), Value::Bool(false));
m.insert("PO".to_string(), Value::Bool(false));
m.insert("GTD".to_string(), Value::Bool(false));
m
}));
m.insert("hedged".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("leverage".to_string(), Value::Bool(false));
m.insert("marketBuyRequiresPrice".to_string(), Value::Bool(false));
m.insert("marketBuyByCost".to_string(), Value::Bool(false));
m.insert("selfTradePrevention".to_string(), Value::Bool(false));
m.insert("iceberg".to_string(), Value::Bool(false));
m
}));
m.insert("createOrders".to_string(), Value::Null);
m.insert("fetchMyTrades".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("limit".to_string(), Value::Int(100));
m.insert("daysBack".to_string(), Value::Int(100000));
m.insert("untilDays".to_string(), Value::Int(100000));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOrder".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOpenOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("limit".to_string(), Value::Int(100));
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(true));
m.insert("limit".to_string(), Value::Int(100));
m.insert("daysBack".to_string(), Value::Null);
m.insert("untilDays".to_string(), Value::Null);
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchClosedOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("limit".to_string(), Value::Int(100));
m.insert("daysBack".to_string(), Value::Null);
m.insert("daysBackCanceled".to_string(), Value::Null);
m.insert("untilDays".to_string(), Value::Null);
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOHLCV".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("limit".to_string(), Value::Int(1000));
m
}));
m
}));
m.insert("swap".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("linear".to_string(), Value::Null);
m.insert("inverse".to_string(), Value::Null);
m
}));
m.insert("future".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("linear".to_string(), Value::Null);
m.insert("inverse".to_string(), Value::Null);
m
}));
m
}));
m.insert("exceptions".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("exact".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("400002".to_string(), Value::Str("BadSymbol".to_string()).clone());
m.insert("401000".to_string(), Value::Str("AuthenticationError".to_string()).clone());
m.insert("403002".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("404200".to_string(), Value::Str("BadSymbol".to_string()).clone());
m
}));
m.insert("broad".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("is not allowed".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("Insufficient funds".to_string(), Value::Str("InsufficientFunds".to_string()).clone());
m.insert("Invalid request params input".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("must be a number".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("must be a string".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("must be of type".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("must be one of".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("Order not found".to_string(), Value::Str("OrderNotFound".to_string()).clone());
m.insert("Pair with pair name".to_string(), Value::Str("BadSymbol".to_string()).clone());
m.insert("pairName".to_string(), Value::Str("BadSymbol".to_string()).clone());
m.insert("Service Unavailable".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
m.insert("Symbol ".to_string(), Value::Str("BadSymbol".to_string()).clone());
m
}));
m
}));
m
})]);
Value::Null
}
/*
* @method
* @name bitteam#fetchMarkets
* @description retrieves data on all markets for bitteam
* @see https://bit.team/trade/api/documentation#/CCXT/getTradeApiCcxtPairs
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} an array of objects representing market data
*/
pub async fn fetch_markets(&mut self, optional_args: &[Value]) -> Value {
let mut params = get_arg(optional_args, 0, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
let mut response: Value = self.public_get_trade_api_ccxt_pairs(&[params.clone()]).await;
//
// {
// "ok": true,
// "result": {
// "count": 28,
// "pairs": [
// {
// "id": 2,
// "name": "eth_usdt",
// "baseAssetId": 2,
// "quoteAssetId": 3,
// "fullName": "ETH USDT",
// "description": "ETH USDT",
// "lastBuy": 1964.665001,
// "lastSell": 1959.835005,
// "lastPrice": 1964.665001,
// "change24": 1.41,
// "volume24": 28.22627543,
// "volume24USD": 55662.35636401598,
// "active": true,
// "baseStep": 8,
// "quoteStep": 6,
// "status": 1,
// "settings": {
// "limit_usd": "0.1",
// "price_max": "10000000000000",
// "price_min": "1",
// "price_tick": "1",
// "pricescale": 10000,
// "lot_size_max": "1000000000000000",
// "lot_size_min": "1",
// "lot_size_tick": "1",
// "price_view_min": 6,
// "default_slippage": 10,
// "lot_size_view_min": 6
// },
// "updateId": "50620",
// "timeStart": "2021-01-28T09:19:30.706Z",
// "makerFee": 200,
// "takerFee": 200,
// "quoteVolume24": 54921.93404134529,
// "lowPrice24": 1919.355,
// "highPrice24": 1971.204995
// },
// {
// "id": 27,
// "name": "ltc_usdt",
// "baseAssetId": 13,
// "quoteAssetId": 3,
// "fullName": "LTC USDT",
// "description": "This is LTC USDT",
// "lastBuy": 53.14,
// "lastSell": 53.58,
// "lastPrice": 53.58,
// "change24": -6.72,
// "volume24": 0,
// "volume24USD": null,
// "active": true,
// "baseStep": 8,
// "quoteStep": 6,
// "status": 0,
// "settings": {
// "limit_usd": "0.1",
// "price_max": "1000000000000",
// "price_min": "1",
// "price_tick": "1",
// "pricescale": 10000,
// "lot_size_max": "1000000000000",
// "lot_size_min": "1",
// "lot_size_tick": "1",
// "price_view_min": 6,
// "default_slippage": 10,
// "lot_size_view_min": 6
// },
// "updateId": "30",
// "timeStart": "2021-10-13T12:11:05.359Z",
// "makerFee": 200,
// "takerFee": 200,
// "quoteVolume24": 0,
// "lowPrice24": null,
// "highPrice24": null
// }
// ]
// }
// }
//
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut markets: Value = self.safe_value_k(result.clone(), "pairs", &[Value::List(vec![])]);
return self.parse_markets(markets.clone());
Value::Null
}
pub fn parse_market(&self, mut market: Value) -> Value {
let mut id: Value = self.safe_string_k(market.clone(), "name", &[]);
let mut numericId: Value = self.safe_integer_k(market.clone(), "id", &[]);
let mut parts: Value = split(&id, &Value::Str("_".to_string()));
let mut baseId: Value = self.safe_string(parts.clone(), Value::Int(0), &[]);
let mut quoteId: Value = self.safe_string(parts.clone(), Value::Int(1), &[]);
let mut base: Value = self.safe_currency_code(baseId.clone(), &[]);
let mut quote: Value = self.safe_currency_code(quoteId.clone(), &[]);
let mut active: Value = self.safe_value_k(market.clone(), "active", &[]);
let mut timeStart: Value = self.safe_string_k(market.clone(), "timeStart", &[]);
let mut created: Value = self.parse8601(timeStart.clone());
let mut minCost: Value = Value::Null;
let mut currenciesValuedInUsd: Value = self.handle_option(Value::Str("fetchMarkets".to_string()), Value::Str("currenciesValuedInUsd".to_string()), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut quoteInUsd: Value = self.safe_bool(currenciesValuedInUsd.clone(), quote.clone(), &[Value::Bool(false)]);
if is_equal("eInUsd, &Value::Bool(true)) {
let mut settings: Value = self.safe_value_k(market.clone(), "settings", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
minCost = self.safe_number_k(settings.clone(), "limit_usd", &[]);
}
return self.safe_market_structure(&[Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("numericId".to_string(), numericId.clone());
m.insert("symbol".to_string(), add(&add(&base, &Value::Str("/".to_string())), "e));
m.insert("base".to_string(), base.clone());
m.insert("quote".to_string(), quote.clone());
m.insert("settle".to_string(), Value::Null);
m.insert("baseId".to_string(), baseId.clone());
m.insert("quoteId".to_string(), quoteId.clone());
m.insert("settleId".to_string(), Value::Null);
m.insert("type".to_string(), Value::Str("spot".to_string()));
m.insert("spot".to_string(), Value::Bool(true));
m.insert("margin".to_string(), Value::Bool(false));
m.insert("swap".to_string(), Value::Bool(false));
m.insert("future".to_string(), Value::Bool(false));
m.insert("option".to_string(), Value::Bool(false));
m.insert("active".to_string(), active.clone());
m.insert("contract".to_string(), Value::Bool(false));
m.insert("linear".to_string(), Value::Null);
m.insert("inverse".to_string(), Value::Null);
m.insert("contractSize".to_string(), Value::Null);
m.insert("expiry".to_string(), Value::Null);
m.insert("expiryDatetime".to_string(), Value::Null);
m.insert("strike".to_string(), Value::Null);
m.insert("optionType".to_string(), Value::Null);
m.insert("precision".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("amount".to_string(), self.parse_number(self.parse_precision(&[self.safe_string_k(market.clone(), "baseStep", &[])]), &[]));
m.insert("price".to_string(), self.parse_number(self.parse_precision(&[self.safe_string_k(market.clone(), "quoteStep", &[])]), &[]));
m
}));
m.insert("limits".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("leverage".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), Value::Null);
m.insert("max".to_string(), Value::Null);
m
}));
m.insert("amount".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), Value::Null);
m.insert("max".to_string(), Value::Null);
m
}));
m.insert("price".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), Value::Null);
m.insert("max".to_string(), Value::Null);
m
}));
m.insert("cost".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), minCost.clone());
m.insert("max".to_string(), Value::Null);
m
}));
m
}));
m.insert("created".to_string(), created.clone());
m.insert("info".to_string(), market.clone());
m
})]);
Value::Null
}
/*
* @method
* @name bitteam#fetchCurrencies
* @description fetches all available currencies on an exchange
* @see https://bit.team/trade/api/documentation#/PUBLIC/getTradeApiCurrencies
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an associative dictionary of currencies
*/
pub async fn fetch_currencies(&mut self, optional_args: &[Value]) -> Value {
let mut params = get_arg(optional_args, 0, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
let mut response: Value = self.public_get_trade_api_currencies(&[params.clone()]).await;
//
// {
// "ok": true,
// "result": {
// "count": 24,
// "currencies": [
// {
// "txLimits": {
// "minDeposit": "0.0001",
// "minWithdraw": "0.02",
// "maxWithdraw": "10000",
// "withdrawCommissionPercentage": "NaN",
// "withdrawCommissionFixed": "0.005"
// },
// "id": 2,
// "status": 1,
// "symbol": "eth",
// "title": "Ethereum",
// "logoURL": "https://ethereum.org/static/6b935ac0e6194247347855dc3d328e83/34ca5/eth-diamond-black.png",
// "isDiscount": false,
// "address": "https://ethereum.org/",
// "description": "Ethereum ETH",
// "decimals": 18,
// "blockChain": "Ethereum",
// "precision": 8,
// "currentRate": null,
// "active": true,
// "timeStart": "2021-01-28T08:57:41.719Z",
// "type": "crypto",
// "typeNetwork": "internalGW",
// "idSorting": 2,
// "links": [
// {
// "tx": "https://etherscan.io/tx/",
// "address": "https://etherscan.io/address/",
// "blockChain": "Ethereum"
// }
// ]
// },
// {
// "txLimits": {
// "minDeposit": "0.001",
// "minWithdraw": "1",
// "maxWithdraw": "100000",
// "withdrawCommissionPercentage": "NaN",
// "withdrawCommissionFixed": {
// "Tron": "2",
// "Binance": "2",
// "Ethereum": "20"
// }
// },
// "id": 3,
// "status": 1,
// "symbol": "usdt",
// "title": "Tether USD",
// "logoURL": "https://cryptologos.cc/logos/tether-usdt-logo.png?v=010",
// "isDiscount": false,
// "address": "https://tether.to/",
// "description": "Tether USD",
// "decimals": 6,
// "blockChain": "",
// "precision": 6,
// "currentRate": null,
// "active": true,
// "timeStart": "2021-01-28T09:04:17.170Z",
// "type": "crypto",
// "typeNetwork": "internalGW",
// "idSorting": 0,
// "links": [
// {
// "tx": "https://etherscan.io/tx/",
// "address": "https://etherscan.io/address/",
// "blockChain": "Ethereum"
// },
// {
// "tx": "https://tronscan.org/#/transaction/",
// "address": "https://tronscan.org/#/address/",
// "blockChain": "Tron"
// },
// {
// "tx": "https://bscscan.com/tx/",
// "address": "https://bscscan.com/address/",
// "blockChain": "Binance"
// }
// ]
// }
// ]
// }
// }
//
let mut responseResult: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut currencies: Value = self.safe_value_k(responseResult.clone(), "currencies", &[Value::List(vec![])]);
// using another endpoint to fetch statuses of deposits and withdrawals
let mut statusesResponse: Value = self.public_get_trade_api_cmc_assets(&[]).await;
//
// {
// "ZNX": {
// "name": "ZeNeX Coin",
// "unified_cryptoasset_id": 30,
// "withdrawStatus": true,
// "depositStatus": true,
// "min_withdraw": 0.00001,
// "max_withdraw": 10000
// },
// "USDT": {
// "name": "Tether USD",
// "unified_cryptoasset_id": 3,
// "withdrawStatus": true,
// "depositStatus": true,
// "min_withdraw": 1,
// "max_withdraw": 100000
// },
// }
//
statusesResponse = self.index_by(statusesResponse.clone(), Value::Str("unified_cryptoasset_id".to_string()));
add_element_to_object(&mut self.options, &Value::Str("_temp_currencies_statuses".to_string()), statusesResponse.clone());
let mut result: Value = self.parse_currencies(currencies.clone());
remove(&mut self.options, &Value::Str("_temp_currencies_statuses".to_string()));
return result;
Value::Null
}
pub fn parse_currency(&self, mut currency: Value) -> Value {
let mut statusesResponse: Value = self.safe_value_k(self.options.clone(), "_temp_currencies_statuses", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut id: Value = self.safe_string_k(currency.clone(), "symbol", &[]);
let mut numericId: Value = self.safe_integer_k(currency.clone(), "id", &[]);
let mut code: Value = self.safe_currency_code(id.clone(), &[]);
let mut active: Value = self.safe_bool_k(currency.clone(), "active", &[Value::Bool(false)]);
let mut precision: Value = self.parse_number(self.parse_precision(&[self.safe_string_k(currency.clone(), "precision", &[])]), &[]);
let mut txLimits: Value = self.safe_value_k(currency.clone(), "txLimits", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut minWithdraw: Value = self.safe_string_k(txLimits.clone(), "minWithdraw", &[]);
let mut maxWithdraw: Value = self.safe_string_k(txLimits.clone(), "maxWithdraw", &[]);
let mut minDeposit: Value = self.safe_string_k(txLimits.clone(), "minDeposit", &[]);
let mut fee: Value = Value::Null;
let mut withdrawCommissionFixed: Value = self.safe_value_k(txLimits.clone(), "withdrawCommissionFixed", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut feesByNetworkId: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut blockChain: Value = self.safe_string_k(currency.clone(), "blockChain", &[]);
// if only one blockChain
if is_true(&(!is_equal(&blockChain, &Value::Null))) && is_true(&(!is_equal(&blockChain, &Value::Str("".to_string())))) {
fee = self.parse_number(withdrawCommissionFixed.clone(), &[]);
add_element_to_object(&mut feesByNetworkId, &blockChain, fee.clone());
} else {
feesByNetworkId = withdrawCommissionFixed.clone();
}
let mut statuses: Value = self.safe_value(statusesResponse.clone(), numericId.clone(), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut deposit: Value = self.safe_value_k(statuses.clone(), "depositStatus", &[]);
let mut withdraw: Value = self.safe_value_k(statuses.clone(), "withdrawStatus", &[]);
let mut networkIds: Value = object_keys(&feesByNetworkId);
let mut networks: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut networkPrecision: Value = self.parse_number(self.parse_precision(&[self.safe_string_k(currency.clone(), "decimals", &[])]), &[]);
let mut typeRaw: Value = self.safe_string_k(currency.clone(), "type", &[]);
{
let mut j: Value = Value::Int(0);
let mut __for_first_420: bool = true;
while { if !__for_first_420 { j = add(&j, &Value::Int(1)); } __for_first_420 = false; is_less_than(&j, &get_array_length(&networkIds)) } {
let mut networkId: Value = get_value(&networkIds, &j);
let mut networkId: Value = get_value(&networkIds, &j);
let mut networkCode: Value = self.network_id_to_code(&[networkId.clone(), code.clone()]);
let mut networkFee: Value = self.safe_number(feesByNetworkId.clone(), networkId.clone(), &[]);
if !is_equal(&networkCode, &Value::Null) {
add_element_to_object(&mut networks, &networkCode, Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), networkId.clone());
m.insert("network".to_string(), networkCode.clone());
m.insert("deposit".to_string(), deposit.clone());
m.insert("withdraw".to_string(), withdraw.clone());
m.insert("active".to_string(), active.clone());
m.insert("fee".to_string(), networkFee.clone());
m.insert("precision".to_string(), networkPrecision.clone());
m.insert("limits".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("amount".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), Value::Null);
m.insert("max".to_string(), Value::Null);
m
}));
m.insert("withdraw".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), self.parse_number(minWithdraw.clone(), &[]));
m.insert("max".to_string(), self.parse_number(maxWithdraw.clone(), &[]));
m
}));
m.insert("deposit".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), self.parse_number(minDeposit.clone(), &[]));
m.insert("max".to_string(), Value::Null);
m
}));
m
}));
m.insert("info".to_string(), currency.clone());
m
}));
}
}
}
return self.safe_currency_structure(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("numericId".to_string(), numericId.clone());
m.insert("code".to_string(), code.clone());
m.insert("name".to_string(), code.clone());
m.insert("info".to_string(), currency.clone());
m.insert("active".to_string(), active.clone());
m.insert("deposit".to_string(), deposit.clone());
m.insert("withdraw".to_string(), withdraw.clone());
m.insert("fee".to_string(), fee.clone());
m.insert("precision".to_string(), precision.clone());
m.insert("limits".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("amount".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), Value::Null);
m.insert("max".to_string(), Value::Null);
m
}));
m.insert("withdraw".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), self.parse_number(minWithdraw.clone(), &[]));
m.insert("max".to_string(), self.parse_number(maxWithdraw.clone(), &[]));
m
}));
m.insert("deposit".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), self.parse_number(minDeposit.clone(), &[]));
m.insert("max".to_string(), Value::Null);
m
}));
m
}));
m.insert("type".to_string(), typeRaw.clone());
m.insert("networks".to_string(), networks.clone());
m
}));
Value::Null
}
/*
* @method
* @name bitteam#fetchOHLCV
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
* @param {string} timeframe the length of time each candle represents
* @param {int} [since] timestamp in ms of the earliest candle to fetch
* @param {int} [limit] the maximum amount of candles to fetch
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
*/
pub async fn fetch_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> Value {
let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
let mut since = get_arg(optional_args, 1, Value::Null);
let mut limit = get_arg(optional_args, 2, Value::Null);
let mut params = get_arg(optional_args, 3, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut market: Value = self.market(symbol.clone());
let mut resolution: Value = self.safe_string(self.timeframes.clone(), timeframe.clone(), &[timeframe.clone()]);
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("pairName".to_string(), get_value(&market, &Value::Str("id".to_string())));
m.insert("resolution".to_string(), resolution.clone());
m
});
let __ws_arg_0 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.history_get_api_tw_history_pair_name_resolution(&[__ws_arg_0]).await;
//
// {
// "ok": true,
// "result": {
// "count": 364,
// "data": [
// {
// "t": 1669593600,
// "o": 16211.259266,
// "h": 16476.985001,
// "l": 16023.714999,
// "c": 16430.636894,
// "v": 2.60150368999999
// },
// {
// "t": 1669680000,
// "o": 16430.636894,
// "h": 17065.229582,
// "l": 16346.114155,
// "c": 16882.297736,
// "v": 3.0872548400000115
// },
// ...
// ]
// }
// }
//
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut data: Value = self.safe_list_k(result.clone(), "data", &[Value::List(vec![])]);
return self.parse_ohlc_vs(data.clone(), &[market.clone(), timeframe.clone(), since.clone(), limit.clone()]);
Value::Null
}
pub fn parse_ohlcv(&self, mut ohlcv: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
return Value::List(vec![self.safe_timestamp(ohlcv.clone(), Value::Str("t".to_string()), &[]), self.safe_number_k(ohlcv.clone(), "o", &[]), self.safe_number_k(ohlcv.clone(), "h", &[]), self.safe_number_k(ohlcv.clone(), "l", &[]), self.safe_number_k(ohlcv.clone(), "c", &[]), self.safe_number_k(ohlcv.clone(), "v", &[])]);
Value::Null
}
/*
* @method
* @name bitteam#fetchOrderBook
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
* @see https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcOrderbookPair
* @param {string} symbol unified symbol of the market to fetch the order book for
* @param {int} [limit] the maximum amount of order book entries to return (default 100, max 200)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an [order book structure]{@link https://docs.ccxt.com/?id=order-book-structure}
*/
pub async fn fetch_order_book(&mut self, mut symbol: Value, optional_args: &[Value]) -> Value {
let mut limit = get_arg(optional_args, 0, Value::Null);
let mut params = get_arg(optional_args, 1, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut market: Value = self.market(symbol.clone());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("pair".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
let __ws_arg_1 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_trade_api_cmc_orderbook_pair(&[__ws_arg_1]).await;
//
// {
// "timestamp": 1701166703284,
// "bids": [
// [
// 2019.334988,
// 0.09048525
// ],
// [
// 1999.860002,
// 0.0225
// ],
// ...
// ],
// "asks": [
// [
// 2019.334995,
// 0.00899078
// ],
// [
// 2019.335013,
// 0.09833052
// ],
// ...
// ]
// }
//
let mut timestamp: Value = self.safe_integer_k(response.clone(), "timestamp", &[]);
let mut orderbook: Value = self.parse_order_book(response.clone(), symbol.clone(), &[timestamp.clone()]);
return orderbook;
Value::Null
}
/*
* @method
* @name bitteam#fetchOrders
* @description fetches information on multiple orders made by the user
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser
* @param {string} symbol unified market symbol of the market orders were made in
* @param {int} [since] the earliest time in ms to fetch orders for
* @param {int} [limit] the maximum number of orde structures to retrieve (default 10)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {string} [params.type] the status of the order - 'active', 'closed', 'cancelled', 'all', 'history' (default 'all')
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn fetch_orders(&mut self, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut since = get_arg(optional_args, 1, Value::Null);
let mut limit = get_arg(optional_args, 2, Value::Null);
let mut params = get_arg(optional_args, 3, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut type_var: Value = self.safe_string_k(params.clone(), "type", &[Value::Str("all".to_string())]);
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("type".to_string(), type_var.clone());
m
});
let mut market: Value = Value::Null;
if !is_equal(&symbol, &Value::Null) {
market = self.market(symbol.clone());
add_element_to_object(&mut request, &Value::Str("pair".to_string()), get_value(&market, &Value::Str("id".to_string())));
}
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone());
}
let __ws_arg_2 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_trade_api_ccxt_orders_of_user(&[__ws_arg_2]).await;
//
// {
// "ok": true,
// "result": {
// "count": 3,
// "orders": [
// {
// "id": 106733026,
// "orderId": null,
// "userId": 21639,
// "pair": "btc_usdt",
// "pairId": 22,
// "quantity": "0.00001",
// "price": "40",
// "executedPrice": "0",
// "fee": null,
// "orderCid": null,
// "executed": "0",
// "expires": null,
// "baseDecimals": 8,
// "quoteDecimals": 6,
// "timestamp": 1700594804,
// "status": "inactive",
// "side": "buy",
// "type": "limit",
// "createdAt": "2023-11-21T19:26:43.868Z",
// "updatedAt": "2023-11-21T19:26:43.868Z"
// },
// {
// "id": 106733308,
// "orderId": "13074362",
// "userId": 21639,
// "pair": "btc_usdt",
// "pairId": 22,
// "quantity": "0.00001",
// "price": "50000",
// "executedPrice": "37017.495008",
// "fee": {
// "amount": "0.00000002",
// "symbol": "btc",
// "userId": 21639,
// "decimals": 8,
// "symbolId": 11
// },
// "orderCid": null,
// "executed": "0.00001",
// "expires": null,
// "baseDecimals": 8,
// "quoteDecimals": 6,
// "timestamp": 1700594959,
// "status": "executed",
// "side": "buy",
// "type": "limit",
// "createdAt": "2023-11-21T19:29:19.946Z",
// "updatedAt": "2023-11-21T19:29:19.946Z"
// },
// {
// "id": 106734455,
// "orderId": "13248984",
// "userId": 21639,
// "pair": "eth_usdt",
// "pairId": 2,
// "quantity": "0.001",
// "price": "1750",
// "executedPrice": "0",
// "fee": null,
// "orderCid": null,
// "executed": "0",
// "expires": null,
// "baseDecimals": 18,
// "quoteDecimals": 6,
// "timestamp": 1700595523,
// "status": "accepted",
// "side": "buy",
// "type": "limit",
// "createdAt": "2023-11-21T19:38:43.530Z",
// "updatedAt": "2023-11-21T19:38:43.530Z"
// }
// ]
// }
// }
//
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut orders: Value = self.safe_list_k(result.clone(), "orders", &[Value::List(vec![])]);
return self.parse_orders(orders.clone(), &[market.clone(), since.clone(), limit.clone()]);
Value::Null
}
/*
* @method
* @name bitteam#fetchOrder
* @description fetches information on an order
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrderId
* @param {int|string} id order id
* @param {string} symbol not used by fetchOrder ()
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn fetch_order(&mut self, mut id: Value, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut params = get_arg(optional_args, 1, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m
});
let mut market: Value = Value::Null;
if !is_equal(&symbol, &Value::Null) {
market = self.market(symbol.clone());
}
let __ws_arg_3 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_trade_api_ccxt_order_id(&[__ws_arg_3]).await;
//
// {
// "ok": true,
// "result": {
// "id": 106494347,
// "orderId": "13214332",
// "userId": 15912,
// "pair": "eth_usdt",
// "pairId": 2,
// "quantity": "0.00448598",
// "price": "2015.644995",
// "executedPrice": "2015.644995",
// "fee": {
// "amount": "0",
// "symbol": "eth",
// "userId": 15912,
// "decimals": 18,
// "symbolId": 2,
// "discountAmount": "0",
// "discountSymbol": "btt",
// "discountDecimals": 18,
// "discountSymbolId": 5
// },
// "orderCid": null,
// "executed": "0.00448598",
// "expires": null,
// "baseDecimals": 18,
// "quoteDecimals": 6,
// "timestamp": 1700470476,
// "status": "executed",
// "side": "buy",
// "type": "limit",
// "stopPrice": null,
// "slippage": null
// }
// }
//
let mut result: Value = self.safe_dict_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_order(result.clone(), &[market.clone()]);
Value::Null
}
/*
* @method
* @name bitteam#fetchOpenOrders
* @description fetch all unfilled currently open orders
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser
* @param {string} symbol unified market symbol
* @param {int} [since] the earliest time in ms to fetch open orders for
* @param {int} [limit] the maximum number of open order structures to retrieve (default 10)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn fetch_open_orders(&mut self, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut since = get_arg(optional_args, 1, Value::Null);
let mut limit = get_arg(optional_args, 2, Value::Null);
let mut params = get_arg(optional_args, 3, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("type".to_string(), Value::Str("active".to_string()));
m
});
let __ws_arg_4 = self.extend(request.clone(), &[params.clone()]);
return self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), __ws_arg_4]).await;
Value::Null
}
/*
* @method
* @name bitteam#fetchClosedOrders
* @description fetches information on multiple closed orders made by the user
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser
* @param {string} symbol unified market symbol of the market orders were made in
* @param {int} [since] the earliest time in ms to fetch orders for
* @param {int} [limit] the maximum number of closed order structures to retrieve (default 10)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn fetch_closed_orders(&mut self, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut since = get_arg(optional_args, 1, Value::Null);
let mut limit = get_arg(optional_args, 2, Value::Null);
let mut params = get_arg(optional_args, 3, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("type".to_string(), Value::Str("closed".to_string()));
m
});
let __ws_arg_5 = self.extend(request.clone(), &[params.clone()]);
return self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), __ws_arg_5]).await;
Value::Null
}
/*
* @method
* @name bitteam#fetchCanceledOrders
* @description fetches information on multiple canceled orders made by the user
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser
* @param {string} symbol unified market symbol of the market orders were made in
* @param {int} [since] the earliest time in ms to fetch orders for
* @param {int} [limit] the maximum number of canceled order structures to retrieve (default 10)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn fetch_canceled_orders(&mut self, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut since = get_arg(optional_args, 1, Value::Null);
let mut limit = get_arg(optional_args, 2, Value::Null);
let mut params = get_arg(optional_args, 3, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("type".to_string(), Value::Str("cancelled".to_string()));
m
});
let __ws_arg_6 = self.extend(request.clone(), &[params.clone()]);
return self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), __ws_arg_6]).await;
Value::Null
}
/*
* @method
* @name bitteam#createOrder
* @description create a trade order
* @see https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtOrdercreate
* @param {string} symbol unified symbol of the market to create an order in
* @param {string} type 'market' or 'limit'
* @param {string} side 'buy' or 'sell'
* @param {float} amount how much of currency you want to trade in units of base currency
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn create_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> Value {
let mut price = get_arg(optional_args, 0, Value::Null);
let mut params = get_arg(optional_args, 1, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut market: Value = self.market(symbol.clone());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("pairId".to_string(), self.safe_string_k(market.clone(), "numericId", &[]));
m.insert("type".to_string(), type_var.clone());
m.insert("side".to_string(), side.clone());
m.insert("amount".to_string(), self.amount_to_precision(symbol.clone(), amount.clone()));
m
});
if is_equal(&type_var, &Value::Str("limit".to_string())) {
if is_equal(&price, &Value::Null) {
panic!("{}", crate::exchange_errors::arguments_required(add(&add(&add(&self.id, &Value::Str(" createOrder() requires a price argument for a ".to_string())), &type_var), &Value::Str(" order".to_string()))));
} else {
add_element_to_object(&mut request, &Value::Str("price".to_string()), self.price_to_precision(symbol.clone(), price.clone()));
}
}
let __ws_arg_7 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_trade_api_ccxt_ordercreate(&[__ws_arg_7]).await;
//
// {
// "ok": true,
// "result": {
// "id": 106733308,
// "userId": 21639,
// "quantity": "0.00001",
// "pair": "btc_usdt",
// "side": "buy",
// "price": "50000",
// "executed": "0",
// "executedPrice": "0",
// "status": "created",
// "baseDecimals": 8,
// "quoteDecimals": 6,
// "pairId": 22,
// "type": "limit",
// "stopPrice": null,
// "slippage": null,
// "timestamp": "1700594959"
// }
// }
//
let mut order: Value = self.safe_dict_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_order(order.clone(), &[market.clone()]);
Value::Null
}
/*
* @method
* @name bitteam#cancelOrder
* @description cancels an open order
* @see https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtCancelorder
* @param {string} id order id
* @param {string} symbol not used by cancelOrder ()
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn cancel_order(&mut self, mut id: Value, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut params = get_arg(optional_args, 1, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m
});
let __ws_arg_8 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_trade_api_ccxt_cancelorder(&[__ws_arg_8]).await;
//
// {
// "ok": true,
// "result": {
// "message": "The request to cancel your order was received"
// }
// }
//
let mut result: Value = self.safe_dict_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_order(result.clone(), &[]);
Value::Null
}
/*
* @method
* @name bitteam#cancelAllOrders
* @description cancel open orders of market
* @see https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtCancelallorder
* @param {string} [symbol] unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
*/
pub async fn cancel_all_orders(&mut self, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut params = get_arg(optional_args, 1, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut market: Value = Value::Null;
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
if !is_equal(&symbol, &Value::Null) {
market = self.market(symbol.clone());
add_element_to_object(&mut request, &Value::Str("pairId".to_string()), self.safe_string_k(market.clone(), "numericId", &[]));
} else {
add_element_to_object(&mut request, &Value::Str("pairId".to_string()), Value::Str("0".to_string())); // '0' for all markets
}
let __ws_arg_9 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_trade_api_ccxt_cancel_all_order(&[__ws_arg_9]).await;
//
// {
// "ok": true,
// "result": {
// "message":"The request to cancel all your orders was received"
// }
// }
//
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut orders: Value = Value::List(vec![result.clone()]);
return self.parse_orders(orders.clone(), &[market.clone()]);
Value::Null
}
pub fn parse_order(&self, mut order: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
//
// fetchOrders
// {
// "id": 106733308,
// "orderId": "13074362",
// "userId": 21639,
// "pair": "btc_usdt",
// "pairId": 22,
// "quantity": "0.00001",
// "price": "50000",
// "executedPrice": "37017.495008",
// "fee": {
// "amount": "0.00000002",
// "symbol": "btc",
// "userId": 21639,
// "decimals": 8,
// "symbolId": 11
// },
// "orderCid": null,
// "executed": "0.00001",
// "expires": null,
// "baseDecimals": 8,
// "quoteDecimals": 6,
// "timestamp": 1700594959,
// "status": "executed",
// "side": "buy",
// "type": "limit",
// "createdAt": "2023-11-21T19:29:19.946Z",
// "updatedAt": "2023-11-21T19:29:19.946Z"
// },
//
// fetchOrder
// {
// "id": 106494347,
// "orderId": "13214332",
// "userId": 15912,
// "pair": "eth_usdt",
// "pairId": 2,
// "quantity": "0.00448598",
// "price": "2015.644995",
// "executedPrice": "2015.644995",
// "fee": {
// "amount": "0",
// "symbol": "eth",
// "userId": 15912,
// "decimals": 18,
// "symbolId": 2,
// "discountAmount": "0",
// "discountSymbol": "btt",
// "discountDecimals": 18,
// "discountSymbolId": 5
// },
// "orderCid": null,
// "executed": "0.00448598",
// "expires": null,
// "baseDecimals": 18,
// "quoteDecimals": 6,
// "timestamp": 1700470476,
// "status": "executed",
// "side": "buy",
// "type": "limit",
// "stopPrice": null,
// "slippage": null
// }
//
// createOrder
// {
// "id": 106733308,
// "userId": 21639,
// "quantity": "0.00001",
// "pair": "btc_usdt",
// "side": "buy",
// "price": "50000",
// "executed": "0",
// "executedPrice": "0",
// "status": "created",
// "baseDecimals": 8,
// "quoteDecimals": 6,
// "pairId": 22,
// "type": "limit",
// "stopPrice": null,
// "slippage": null,
// "timestamp": "1700594959"
// }
//
let mut id: Value = self.safe_string_k(order.clone(), "id", &[]);
let mut marketId: Value = self.safe_string_k(order.clone(), "pair", &[]);
market = self.safe_market(&[marketId.clone(), market.clone()]);
let mut clientOrderId: Value = self.safe_string_k(order.clone(), "orderCid", &[]);
let mut timestamp: Value = Value::Null;
let mut createdAt: Value = self.safe_string_k(order.clone(), "createdAt", &[]);
if !is_equal(&createdAt, &Value::Null) {
timestamp = self.parse8601(createdAt.clone());
} else {
timestamp = self.safe_timestamp(order.clone(), Value::Str("timestamp".to_string()), &[]);
}
let mut updatedAt: Value = self.safe_string_k(order.clone(), "updatedAt", &[]);
let mut lastUpdateTimestamp: Value = self.parse8601(updatedAt.clone());
let mut status: Value = self.parse_order_status(self.safe_string_k(order.clone(), "status", &[]));
let mut type_var: Value = self.parse_order_type(self.safe_string_k(order.clone(), "type", &[]));
let mut side: Value = self.safe_string_k(order.clone(), "side", &[]);
let mut feeRaw: Value = self.safe_value_k(order.clone(), "fee", &[]);
let mut price: Value = self.safe_string_k(order.clone(), "price", &[]);
let mut amount: Value = self.safe_string_k(order.clone(), "quantity", &[]);
let mut filled: Value = self.safe_string_k(order.clone(), "executed", &[]);
let mut fee: Value = Value::Null;
if !is_equal(&feeRaw, &Value::Null) {
let mut feeCost: Value = self.safe_string_k(feeRaw.clone(), "amount", &[]);
let mut feeCurrencyId: Value = self.safe_string_k(feeRaw.clone(), "symbol", &[]);
fee = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("currency".to_string(), self.safe_currency_code(feeCurrencyId.clone(), &[]));
m.insert("cost".to_string(), feeCost.clone());
m.insert("rate".to_string(), Value::Null);
m
});
}
return self.safe_order(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("clientOrderId".to_string(), clientOrderId.clone());
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m.insert("lastTradeTimestamp".to_string(), Value::Null);
m.insert("lastUpdateTimestamp".to_string(), lastUpdateTimestamp.clone());
m.insert("status".to_string(), status.clone());
m.insert("symbol".to_string(), get_value(&market, &Value::Str("symbol".to_string())));
m.insert("type".to_string(), type_var.clone());
m.insert("timeInForce".to_string(), Value::Str("GTC".to_string()));
m.insert("side".to_string(), side.clone());
m.insert("price".to_string(), price.clone());
m.insert("triggerPrice".to_string(), self.safe_string_k(order.clone(), "stopPrice", &[]));
m.insert("average".to_string(), Value::Null);
m.insert("amount".to_string(), amount.clone());
m.insert("cost".to_string(), Value::Null);
m.insert("filled".to_string(), filled.clone());
m.insert("remaining".to_string(), Value::Null);
m.insert("fee".to_string(), fee.clone());
m.insert("trades".to_string(), Value::Null);
m.insert("info".to_string(), order.clone());
m.insert("postOnly".to_string(), Value::Bool(false));
m
}), &[market.clone()]);
Value::Null
}
pub fn parse_order_status(&self, mut status: Value) -> Value {
let mut statuses: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("accepted".to_string(), Value::Str("open".to_string()));
m.insert("executed".to_string(), Value::Str("closed".to_string()));
m.insert("cancelled".to_string(), Value::Str("canceled".to_string()));
m.insert("partiallyCancelled".to_string(), Value::Str("canceled".to_string()));
m.insert("delete".to_string(), Value::Str("rejected".to_string()));
m.insert("inactive".to_string(), Value::Str("rejected".to_string()));
m.insert("executing".to_string(), Value::Str("open".to_string()));
m.insert("created".to_string(), Value::Str("open".to_string()));
m
});
return self.safe_string(statuses.clone(), status.clone(), &[status.clone()]);
Value::Null
}
pub fn parse_order_type(&self, mut status: Value) -> Value {
let mut statuses: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("market".to_string(), Value::Str("market".to_string()));
m.insert("limit".to_string(), Value::Str("limit".to_string()));
m
});
return self.safe_string(statuses.clone(), status.clone(), &[status.clone()]);
Value::Null
}
pub fn parse_value_to_pricision(&self, mut valueObject: Value, mut valueKey: Value, mut preciseObject: Value, mut precisionKey: Value) -> Value {
let mut valueRawString: Value = self.safe_string(valueObject.clone(), valueKey.clone(), &[]);
let mut precisionRawString: Value = self.safe_string(preciseObject.clone(), precisionKey.clone(), &[]);
if is_equal(&valueRawString, &Value::Null) || is_equal(&precisionRawString, &Value::Null) {
return Value::Null;
}
let mut precisionString: Value = self.parse_precision(&[precisionRawString.clone()]);
return crate::precise::Precise::stringMul(&valueRawString, &precisionString);
Value::Null
}
/*
* @method
* @name bitteam#fetchTickers
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
* @see https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcSummary
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
*/
pub async fn fetch_tickers(&mut self, optional_args: &[Value]) -> Value {
let mut symbols = get_arg(optional_args, 0, Value::Null);
let mut params = get_arg(optional_args, 1, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut response: Value = self.public_get_trade_api_cmc_summary(&[]).await;
//
// [
// {
// "trading_pairs": "BTC_USDT",
// "base_currency": "BTC",
// "quote_currency": "USDT",
// "last_price": 37669.955001,
// "lowest_ask": 37670.055,
// "highest_bid": 37669.955,
// "base_volume": 6.81156888,
// "quote_volume": 257400.516878529,
// "price_change_percent_24h": -0.29,
// "highest_price_24h": 38389.994463,
// "lowest_price_24h": 37574.894999
// },
// {
// "trading_pairs": "BNB_USDT",
// "base_currency": "BNB",
// "quote_currency": "USDT",
// "last_price": 233.525142,
// "lowest_ask": 233.675,
// "highest_bid": 233.425,
// "base_volume": 245.0199339,
// "quote_volume": 57356.91823827642,
// "price_change_percent_24h": -0.32,
// "highest_price_24h": 236.171123,
// "lowest_price_24h": 231.634637
// },
// ...
// ]
//
let mut tickers: Value = Value::List(vec![]);
let mut rawTickers: Value = Value::List(vec![]);
if is_true(&Value::Bool(is_array(&response))) {
rawTickers = response.clone();
}
{
let mut i: Value = Value::Int(0);
let mut __for_first_421: bool = true;
while { if !__for_first_421 { i = add(&i, &Value::Int(1)); } __for_first_421 = false; is_less_than(&i, &get_array_length(&rawTickers)) } {
let mut rawTicker: Value = get_value(&rawTickers, &i);
let mut rawTicker: Value = get_value(&rawTickers, &i);
let mut ticker: Value = self.parse_ticker(rawTicker.clone(), &[]);
append_to_array(&mut tickers, ticker.clone());
}
}
return self.filter_by_array_tickers(tickers.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
Value::Null
}
/*
* @method
* @name bitteam#fetchTicker
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
* @see https://bit.team/trade/api/documentation#/PUBLIC/getTradeApiPairName
* @param {string} symbol unified symbol of the market to fetch the ticker for
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
*/
pub async fn fetch_ticker(&mut self, mut symbol: Value, optional_args: &[Value]) -> Value {
let mut params = get_arg(optional_args, 0, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut market: Value = self.market(symbol.clone());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
let __ws_arg_10 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_trade_api_pair_name(&[__ws_arg_10]).await;
//
// {
// "ok": true,
// "result": {
// "pair": {
// "id": 2,
// "name": "eth_usdt",
// "baseAssetId": 2,
// "quoteAssetId": 3,
// "fullName": "ETH USDT",
// "description": "ETH USDT",
// "lastBuy": "1976.715012",
// "lastSell": "1971.995006",
// "lastPrice": "1976.715012",
// "change24": "1.02",
// "volume24": 24.0796457,
// "volume24USD": 44282.347995912205,
// "active": true,
// "baseStep": 8,
// "quoteStep": 6,
// "status": 1,
// "settings": {
// "limit_usd": "0.1",
// "price_max": "10000000000000",
// "price_min": "1",
// "price_tick": "1",
// "pricescale": 10000,
// "lot_size_max": "1000000000000000",
// "lot_size_min": "1",
// "lot_size_tick": "1",
// "price_view_min": 6,
// "default_slippage": 10,
// "lot_size_view_min": 6
// },
// "asks": [
// {
// "price": "1976.405003",
// "quantity": "0.0051171",
// "amount": "10.1134620408513"
// },
// {
// "price": "1976.405013",
// "quantity": "0.09001559",
// "amount": "177.90726332415267"
// },
// {
// "price": "2010.704988",
// "quantity": "0.00127892",
// "amount": "2.57153082325296"
// }
// ],
// "bids": [
// {
// "price": "1976.404988",
// "quantity": "0.09875861",
// "amount": "195.18700941194668"
// },
// {
// "price": "1905.472973",
// "quantity": "0.00263591",
// "amount": "5.02265526426043"
// },
// {
// "price": "1904.274973",
// "quantity": "0.09425304",
// "amount": "179.48370520116792"
// }
// ],
// "updateId": "78",
// "timeStart": "2021-01-28T09:19:30.706Z",
// "makerFee": 200,
// "takerFee": 200,
// "quoteVolume24": 49125.1374009045,
// "lowPrice24": 1966.704999,
// "highPrice24": 2080.354997,
// "baseCurrency": {
// "id": 2,
// "status": 1,
// "symbol": "eth",
// "title": "Ethereum",
// "logoURL": "https://ethereum.org/static/6b935ac0e6194247347855dc3d328e83/34ca5/eth-diamond-black.png",
// "isDiscount": false,
// "address": "https://ethereum.org/",
// "description": "Ethereum ETH",
// "decimals": 18,
// "blockChain": "Ethereum",
// "precision": 8,
// "currentRate": null,
// "active": true,
// "timeStart": "2021-01-28T08:57:41.719Z",
// "txLimits": {
// "minDeposit": "100000000000000",
// "maxWithdraw": "10000000000000000000000",
// "minWithdraw": "20000000000000000",
// "withdrawCommissionFixed": "5000000000000000",
// "withdrawCommissionPercentage": "NaN"
// },
// "type": "crypto",
// "typeNetwork": "internalGW",
// "icon": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAzMCAzMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMTVDMCA2LjcxNTczIDYuNzE1NzMgMCAxNSAwVjBDMjMuMjg0MyAwIDMwIDYuNzE1NzMgMzAgMTVWMTVDMzAgMjMuMjg0MyAyMy4yODQzIDMwIDE1IDMwVjMwQzYuNzE1NzMgMzAgMCAyMy4yODQzIDAgMTVWMTVaIiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNMTQuOTU1NyAxOS45NzM5TDkgMTYuMzUwOUwxNC45NTIxIDI1TDIwLjkxMDkgMTYuMzUwOUwxNC45NTIxIDE5Ljk3MzlIMTQuOTU1N1pNMTUuMDQ0MyA1TDkuMDkwOTUgMTUuMTg1M0wxNS4wNDQzIDE4LjgxNDZMMjEgMTUuMTg5MUwxNS4wNDQzIDVaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",
// "idSorting": 2,
// "links": [
// {
// "tx": "https://etherscan.io/tx/",
// "address": "https://etherscan.io/address/",
// "blockChain": "Ethereum"
// }
// ],
// "clientTxLimits": {
// "minDeposit": "0.0001",
// "minWithdraw": "0.02",
// "maxWithdraw": "10000",
// "withdrawCommissionPercentage": "NaN",
// "withdrawCommissionFixed": "0.005"
// }
// },
// "quoteCurrency": {
// "id": 3,
// "status": 1,
// "symbol": "usdt",
// "title": "Tether USD",
// "logoURL": "https://cryptologos.cc/logos/tether-usdt-logo.png?v=010",
// "isDiscount": false,
// "address": "https://tether.to/",
// "description": "Tether USD",
// "decimals": 6,
// "blockChain": "",
// "precision": 6,
// "currentRate": null,
// "active": true,
// "timeStart": "2021-01-28T09:04:17.170Z",
// "txLimits": {
// "minDeposit": "1000",
// "maxWithdraw": "100000000000",
// "minWithdraw": "1000000",
// "withdrawCommissionFixed": {
// "Tron": "2000000",
// "Binance": "2000000000000000000",
// "Ethereum": "20000000"
// },
// "withdrawCommissionPercentage": "NaN"
// },
// "type": "crypto",
// "typeNetwork": "internalGW",
// "icon": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAzMCAzMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMTVDMCA2LjcxNTczIDYuNzE1NzMgMCAxNSAwVjBDMjMuMjg0MyAwIDMwIDYuNzE1NzMgMzAgMTVWMTVDMzAgMjMuMjg0MyAyMy4yODQzIDMwIDE1IDMwVjMwQzYuNzE1NzMgMzAgMCAyMy4yODQzIDAgMTVWMTVaIiBmaWxsPSIjNkZBNjg4Ii8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMjMgN0g3VjExSDEzVjEyLjA2MkM4Ljk5MjAyIDEyLjMxNDYgNiAxMy4zMTAyIDYgMTQuNUM2IDE1LjY4OTggOC45OTIwMiAxNi42ODU0IDEzIDE2LjkzOFYyM0gxN1YxNi45MzhDMjEuMDA4IDE2LjY4NTQgMjQgMTUuNjg5OCAyNCAxNC41QzI0IDEzLjMxMDIgMjEuMDA4IDEyLjMxNDYgMTcgMTIuMDYyVjExSDIzVjdaTTcuNSAxNC41QzcuNSAxMy40NjA2IDkuMzMzMzMgMTIuMzY4IDEzIDEyLjA3NTZWMTUuNUgxN1YxMi4wNzU5QzIwLjkzODQgMTIuMzkyNyAyMi41IDEzLjYzMzkgMjIuNSAxNC41QzIyLjUgMTUuMzIyIDIwLjAwMDggMTUuODA2MSAxNyAxNS45NTI1QzE1LjcwODIgMTYuMDQ2MiAxMy43OTUxIDE1Ljk4MjYgMTMgMTUuOTM5MUM5Ljk5OTIxIDE1Ljc1NTkgNy41IDE1LjE4MDkgNy41IDE0LjVaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",
// "idSorting": 0,
// "links": [
// {
// "tx": "https://etherscan.io/tx/",
// "address": "https://etherscan.io/address/",
// "blockChain": "Ethereum"
// },
// {
// "tx": "https://tronscan.org/#/transaction/",
// "address": "https://tronscan.org/#/address/",
// "blockChain": "Tron"
// },
// {
// "tx": "https://bscscan.com/tx/",
// "address": "https://bscscan.com/address/",
// "blockChain": "Binance"
// }
// ],
// "clientTxLimits": {
// "minDeposit": "0.001",
// "minWithdraw": "1",
// "maxWithdraw": "100000",
// "withdrawCommissionPercentage": "NaN",
// "withdrawCommissionFixed": {
// "Tron": "2",
// "Binance": "2",
// "Ethereum": "20"
// }
// }
// },
// "quantities": {
// "asks": "5.58760757",
// "bids": "2226.98663823032198"
// }
// }
// }
// }
//
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut pair: Value = self.safe_dict_k(result.clone(), "pair", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_ticker(pair.clone(), &[market.clone()]);
Value::Null
}
pub fn parse_ticker(&self, mut ticker: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
//
// fetchTicker
// {
// "id": 2,
// "name": "eth_usdt",
// "baseAssetId": 2,
// "quoteAssetId": 3,
// "fullName": "ETH USDT",
// "description": "ETH USDT",
// "lastBuy": "1976.715012",
// "lastSell": "1971.995006",
// "lastPrice": "1976.715012",
// "change24": "1.02",
// "volume24": 24.0796457,
// "volume24USD": 44282.347995912205,
// "active": true,
// "baseStep": 8,
// "quoteStep": 6,
// "status": 1,
// "asks": [
// {
// "price": "1976.405003",
// "quantity": "0.0051171",
// "amount": "10.1134620408513"
// },
// {
// "price": "1976.405013",
// "quantity": "0.09001559",
// "amount": "177.90726332415267"
// },
// {
// "price": "2010.704988",
// "quantity": "0.00127892",
// "amount": "2.57153082325296"
// }
// ...
// ],
// "bids": [
// {
// "price": "1976.404988",
// "quantity": "0.09875861",
// "amount": "195.18700941194668"
// },
// {
// "price": "1905.472973",
// "quantity": "0.00263591",
// "amount": "5.02265526426043"
// },
// {
// "price": "1904.274973",
// "quantity": "0.09425304",
// "amount": "179.48370520116792"
// }
// ...
// ],
// "updateId": "78",
// "timeStart": "2021-01-28T09:19:30.706Z",
// "makerFee": 200,
// "takerFee": 200,
// "quoteVolume24": 49125.1374009045,
// "lowPrice24": 1966.704999,
// "highPrice24": 2080.354997,
// ...
// }
//
// fetchTickers
// {
// "trading_pairs": "BTC_USDT",
// "base_currency": "BTC",
// "quote_currency": "USDT",
// "last_price": 37669.955001,
// "lowest_ask": 37670.055,
// "highest_bid": 37669.955,
// "base_volume": 6.81156888,
// "quote_volume": 257400.516878529,
// "price_change_percent_24h": -0.29,
// "highest_price_24h": 38389.994463,
// "lowest_price_24h": 37574.894999
// }
let mut marketId: Value = self.safe_string_lower(ticker.clone(), Value::Str("trading_pairs".to_string()), &[]);
market = self.safe_market(&[marketId.clone(), market.clone()]);
let mut bestBidPrice: Value = Value::Null;
let mut bestAskPrice: Value = Value::Null;
let mut bestBidVolume: Value = Value::Null;
let mut bestAskVolume: Value = Value::Null;
let mut bids: Value = self.safe_value_k(ticker.clone(), "bids", &[]);
let mut asks: Value = self.safe_value_k(ticker.clone(), "asks", &[]);
if is_true(&(!is_equal(&bids, &Value::Null))) && is_true(&(Value::Bool(is_array(&bids)))) && is_true(&(!is_equal(&asks, &Value::Null))) && is_true(&(Value::Bool(is_array(&asks)))) {
let mut bestBid: Value = self.safe_value(bids.clone(), Value::Int(0), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
bestBidPrice = self.safe_string_k(bestBid.clone(), "price", &[]);
bestBidVolume = self.safe_string_k(bestBid.clone(), "quantity", &[]);
let mut bestAsk: Value = self.safe_value(asks.clone(), Value::Int(0), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
bestAskPrice = self.safe_string_k(bestAsk.clone(), "price", &[]);
bestAskVolume = self.safe_string_k(bestAsk.clone(), "quantity", &[]);
} else {
bestBidPrice = self.safe_string_k(ticker.clone(), "highest_bid", &[]);
bestAskPrice = self.safe_string_k(ticker.clone(), "lowest_ask", &[]);
}
let mut baseVolume: Value = self.safe_string2(ticker.clone(), Value::Str("volume24".to_string()), Value::Str("base_volume".to_string()), &[]);
let mut quoteVolume: Value = self.safe_string2(ticker.clone(), Value::Str("quoteVolume24".to_string()), Value::Str("quote_volume".to_string()), &[]);
let mut high: Value = self.safe_string2(ticker.clone(), Value::Str("highPrice24".to_string()), Value::Str("highest_price_24h".to_string()), &[]);
let mut low: Value = self.safe_string2(ticker.clone(), Value::Str("lowPrice24".to_string()), Value::Str("lowest_price_24h".to_string()), &[]);
let mut close: Value = self.safe_string2(ticker.clone(), Value::Str("lastPrice".to_string()), Value::Str("last_price".to_string()), &[]);
let mut changePcnt: Value = self.safe_string2(ticker.clone(), Value::Str("change24".to_string()), Value::Str("price_change_percent_24h".to_string()), &[]);
return self.safe_ticker(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), get_value(&market, &Value::Str("symbol".to_string())));
m.insert("timestamp".to_string(), Value::Null);
m.insert("datetime".to_string(), Value::Null);
m.insert("open".to_string(), Value::Null);
m.insert("high".to_string(), high.clone());
m.insert("low".to_string(), low.clone());
m.insert("close".to_string(), close.clone());
m.insert("bid".to_string(), bestBidPrice.clone());
m.insert("bidVolume".to_string(), bestBidVolume.clone());
m.insert("ask".to_string(), bestAskPrice.clone());
m.insert("askVolume".to_string(), bestAskVolume.clone());
m.insert("vwap".to_string(), Value::Null);
m.insert("previousClose".to_string(), Value::Null);
m.insert("change".to_string(), Value::Null);
m.insert("percentage".to_string(), changePcnt.clone());
m.insert("average".to_string(), Value::Null);
m.insert("baseVolume".to_string(), baseVolume.clone());
m.insert("quoteVolume".to_string(), quoteVolume.clone());
m.insert("info".to_string(), ticker.clone());
m
}), &[market.clone()]);
Value::Null
}
/*
* @method
* @name bitteam#fetchTrades
* @description get the list of most recent trades for a particular symbol
* @see https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcTradesPair
* @param {string} symbol unified symbol of the market to fetch trades for
* @param {int} [since] timestamp in ms of the earliest trade to fetch
* @param {int} [limit] the maximum amount of trades to fetch
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
*/
pub async fn fetch_trades(&mut self, mut symbol: Value, optional_args: &[Value]) -> Value {
let mut since = get_arg(optional_args, 0, Value::Null);
let mut limit = get_arg(optional_args, 1, Value::Null);
let mut params = get_arg(optional_args, 2, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut market: Value = self.market(symbol.clone());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("pair".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
let __ws_arg_11 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_trade_api_cmc_trades_pair(&[__ws_arg_11]).await;
return self.parse_trades(response.clone(), &[market.clone(), since.clone(), limit.clone()]);
Value::Null
}
/*
* @method
* @name bitteam#fetchMyTrades
* @description fetch all trades made by the user
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtTradesofuser
* @param {string} symbol unified market symbol
* @param {int} [since] the earliest time in ms to fetch trades for
* @param {int} [limit] the maximum number of trades structures to retrieve (default 10)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
*/
pub async fn fetch_my_trades(&mut self, optional_args: &[Value]) -> Value {
let mut symbol = get_arg(optional_args, 0, Value::Null);
let mut since = get_arg(optional_args, 1, Value::Null);
let mut limit = get_arg(optional_args, 2, Value::Null);
let mut params = get_arg(optional_args, 3, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut market: Value = Value::Null;
if !is_equal(&symbol, &Value::Null) {
market = self.market(symbol.clone());
add_element_to_object(&mut request, &Value::Str("pairId".to_string()), get_value(&market, &Value::Str("numericId".to_string())));
}
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone());
}
let __ws_arg_12 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_trade_api_ccxt_trades_of_user(&[__ws_arg_12]).await;
//
// {
// "ok": true,
// "result": {
// "count": 3,
// "trades": [
// {
// "id": 34880724,
// "tradeId": "4368041",
// "makerOrderId": 106742914,
// "takerOrderId": 106761614,
// "pairId": 2,
// "quantity": "0.00955449",
// "price": "1993.674994",
// "isBuyerMaker": true,
// "baseDecimals": 18,
// "quoteDecimals": 6,
// "side": "sell",
// "timestamp": 1700615250,
// "rewarded": true,
// "makerUserId": 21639,
// "takerUserId": 15913,
// "baseCurrencyId": 2,
// "quoteCurrencyId": 3,
// "feeMaker": {
// "amount": "0.0000191",
// "symbol": "eth",
// "userId": 21639,
// "decimals": 18,
// "symbolId": 2
// },
// "feeTaker": {
// "amount": "0",
// "symbol": "usdt",
// "userId": 15913,
// "decimals": 6,
// "symbolId": 3,
// "discountAmount": "0",
// "discountSymbol": "btt",
// "discountDecimals": 18,
// "discountSymbolId": 5
// },
// "pair": "eth_usdt",
// "createdAt": "2023-11-22T01:07:30.593Z",
// "updatedAt": "2023-11-22T01:10:00.117Z",
// "isCurrentSide": "maker"
// },
// {
// "id": 34875793,
// "tradeId": "4368010",
// "makerOrderId": 106742914,
// "takerOrderId": 106745926,
// "pairId": 2,
// "quantity": "0.0027193",
// "price": "1993.674994",
// "isBuyerMaker": true,
// "baseDecimals": 18,
// "quoteDecimals": 6,
// "side": "sell",
// "timestamp": 1700602983,
// "rewarded": true,
// "makerUserId": 21639,
// "takerUserId": 15912,
// "baseCurrencyId": 2,
// "quoteCurrencyId": 3,
// "feeMaker": {
// "amount": "0.00000543",
// "symbol": "eth",
// "userId": 21639,
// "decimals": 18,
// "symbolId": 2
// },
// "feeTaker": {
// "amount": "0",
// "symbol": "usdt",
// "userId": 15912,
// "decimals": 6,
// "symbolId": 3,
// "discountAmount": "0",
// "discountSymbol": "btt",
// "discountDecimals": 18,
// "discountSymbolId": 5
// },
// "pair": "eth_usdt",
// "createdAt": "2023-11-21T21:43:02.758Z",
// "updatedAt": "2023-11-21T21:45:00.147Z",
// "isCurrentSide": "maker"
// },
// {
// "id": 34871727,
// "tradeId": "3441840",
// "makerOrderId": 106733299,
// "takerOrderId": 106733308,
// "pairId": 22,
// "quantity": "0.00001",
// "price": "37017.495008",
// "isBuyerMaker": false,
// "baseDecimals": 8,
// "quoteDecimals": 6,
// "side": "buy",
// "timestamp": 1700594960,
// "rewarded": true,
// "makerUserId": 15909,
// "takerUserId": 21639,
// "baseCurrencyId": 11,
// "quoteCurrencyId": 3,
// "feeMaker": {
// "amount": "0",
// "symbol": "usdt",
// "userId": 15909,
// "decimals": 6,
// "symbolId": 3,
// "discountAmount": "0",
// "discountSymbol": "btt",
// "discountDecimals": 18,
// "discountSymbolId": 5
// },
// "feeTaker": {
// "amount": "0.00000002",
// "symbol": "btc",
// "userId": 21639,
// "decimals": 8,
// "symbolId": 11
// },
// "pair": "btc_usdt",
// "createdAt": "2023-11-21T19:29:20.092Z",
// "updatedAt": "2023-11-21T19:30:00.159Z"
// "isCurrentSide": "taker"
// }
// ]
// }
// }
//
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut trades: Value = self.safe_list_k(result.clone(), "trades", &[Value::List(vec![])]);
return self.parse_trades(trades.clone(), &[market.clone(), since.clone(), limit.clone()]);
Value::Null
}
pub fn parse_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
//
// fetchTrades
// {
// "trade_id": 34970337,
// "price": 37769.994793,
// "base_volume": 0.00119062,
// "quote_volume": 44.96971120044166,
// "timestamp": 1700827234000,
// "type": "buy"
// },
//
// fetchMyTrades
// {
// "id": 34875793,
// "tradeId": "4368010",
// "makerOrderId": 106742914,
// "takerOrderId": 106745926,
// "pairId": 2,
// "quantity": "0.0027193",
// "price": "1993.674994",
// "isBuyerMaker": true,
// "baseDecimals": 18,
// "quoteDecimals": 6,
// "side": "sell",
// "timestamp": 1700602983,
// "rewarded": true,
// "makerUserId": 21639,
// "takerUserId": 15912,
// "baseCurrencyId": 2,
// "quoteCurrencyId": 3,
// "feeMaker": {
// "amount": "0.00000543",
// "symbol": "eth",
// "userId": 21639,
// "decimals": 18,
// "symbolId": 2
// },
// "feeTaker": {
// "amount": "0",
// "symbol": "usdt",
// "userId": 15912,
// "decimals": 6,
// "symbolId": 3,
// "discountAmount": "0",
// "discountSymbol": "btt",
// "discountDecimals": 18,
// "discountSymbolId": 5
// },
// "pair": "eth_usdt",
// "createdAt": "2023-11-21T21:43:02.758Z",
// "updatedAt": "2023-11-21T21:45:00.147Z",
// "isCurrentSide": "maker"
// }
//
let mut marketId: Value = self.safe_string_k(trade.clone(), "pair", &[]);
market = self.safe_market(&[marketId.clone(), market.clone()]);
let mut symbol: Value = get_value(&market, &Value::Str("symbol".to_string()));
let mut id: Value = self.safe_string2(trade.clone(), Value::Str("id".to_string()), Value::Str("trade_id".to_string()), &[]);
let mut price: Value = self.safe_string_k(trade.clone(), "price", &[]);
let mut amount: Value = self.safe_string2(trade.clone(), Value::Str("quantity".to_string()), Value::Str("base_volume".to_string()), &[]);
let mut cost: Value = self.safe_string_k(trade.clone(), "quote_volume", &[]);
let mut takerOrMaker: Value = self.safe_string_k(trade.clone(), "isCurrentSide", &[]);
let mut timestamp: Value = self.safe_string_k(trade.clone(), "timestamp", &[]);
if !is_equal(&takerOrMaker, &Value::Null) {
timestamp = crate::precise::Precise::stringMul(×tamp, &Value::Str("1000".to_string()));
}
// the exchange returns the side of the taker
let mut side: Value = self.safe_string2(trade.clone(), Value::Str("side".to_string()), Value::Str("type".to_string()), &[]);
let mut feeInfo: Value = Value::Null;
let mut order: Value = Value::Null;
if is_equal(&takerOrMaker, &Value::Str("maker".to_string())) {
if is_equal(&side, &Value::Str("sell".to_string())) {
side = Value::Str("buy".to_string());
} else if is_equal(&side, &Value::Str("buy".to_string())) {
side = Value::Str("sell".to_string());
}
order = self.safe_string_k(trade.clone(), "makerOrderId", &[]);
feeInfo = self.safe_value_k(trade.clone(), "feeMaker", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
} else if is_equal(&takerOrMaker, &Value::Str("taker".to_string())) {
order = self.safe_string_k(trade.clone(), "takerOrderId", &[]);
feeInfo = self.safe_value_k(trade.clone(), "feeTaker", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
}
let mut feeCurrencyId: Value = self.safe_string_k(feeInfo.clone(), "symbol", &[]);
let mut feeCost: Value = self.safe_string_k(feeInfo.clone(), "amount", &[]);
let mut fee: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("currency".to_string(), self.safe_currency_code(feeCurrencyId.clone(), &[]));
m.insert("cost".to_string(), feeCost.clone());
m
});
let mut intTs: Value = self.parse_to_int(timestamp.clone());
return self.safe_trade(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("order".to_string(), order.clone());
m.insert("timestamp".to_string(), intTs.clone());
m.insert("datetime".to_string(), self.iso8601(intTs.clone()));
m.insert("symbol".to_string(), symbol.clone());
m.insert("type".to_string(), Value::Null);
m.insert("side".to_string(), side.clone());
m.insert("takerOrMaker".to_string(), takerOrMaker.clone());
m.insert("price".to_string(), price.clone());
m.insert("amount".to_string(), amount.clone());
m.insert("cost".to_string(), cost.clone());
m.insert("fee".to_string(), fee.clone());
m.insert("info".to_string(), trade.clone());
m
}), &[market.clone()]);
Value::Null
}
/*
* @method
* @name betteam#fetchBalance
* @description query for balance and get the amount of funds available for trading or funds locked in orders
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtBalance
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
*/
pub async fn fetch_balance(&mut self, optional_args: &[Value]) -> Value {
let mut params = get_arg(optional_args, 0, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut response: Value = self.private_get_trade_api_ccxt_balance(&[params.clone()]).await;
return self.parse_balance(response.clone());
Value::Null
}
pub fn parse_balance(&self, mut response: Value) -> Value {
//
// {
// "ok": true,
// "result": {
// "free": {
// "USDT": "0",
// "DEL": "0",
// "BTC": "0",
// ...
// },
// "used": {
// "USDT": "0",
// "DEL": "0",
// "BTC": "0",
// ...
// },
// "total": {
// "USDT": "0",
// "DEL": "0",
// "BTC": "0",
// ...
// },
// "USDT": {
// "free": "0",
// "used": "0",
// "total": "0",
// },
// "DEL": {
// "free": "0",
// "used": "0",
// "total": "0",
// },
// "BTC": {
// "free": "0",
// "used": "0",
// "total": "0",
// }
// ...
// }
// }
//
let mut timestamp: Value = self.milliseconds();
let mut balance: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), response.clone());
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m
});
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut balanceByCurrencies: Value = self.omit(result.clone(), Value::List(vec![Value::Str("free".to_string()), Value::Str("used".to_string()), Value::Str("total".to_string())]), &[]);
let mut rawCurrencyIds: Value = object_keys(&balanceByCurrencies);
{
let mut i: Value = Value::Int(0);
let mut __for_first_422: bool = true;
while { if !__for_first_422 { i = add(&i, &Value::Int(1)); } __for_first_422 = false; is_less_than(&i, &get_array_length(&rawCurrencyIds)) } {
let mut rawCurrencyId: Value = get_value(&rawCurrencyIds, &i);
let mut rawCurrencyId: Value = get_value(&rawCurrencyIds, &i);
let mut currencyBalance: Value = self.safe_value(result.clone(), rawCurrencyId.clone(), &[]);
let mut free: Value = self.safe_string_k(currencyBalance.clone(), "free", &[]);
let mut used: Value = self.safe_string_k(currencyBalance.clone(), "used", &[]);
let mut total: Value = self.safe_string_k(currencyBalance.clone(), "total", &[]);
let mut currencyCode: Value = self.safe_currency_code(to_lower(&rawCurrencyId), &[]);
if !is_equal(¤cyCode, &Value::Null) {
add_element_to_object(&mut balance, ¤cyCode, Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("free".to_string(), free.clone());
m.insert("used".to_string(), used.clone());
m.insert("total".to_string(), total.clone());
m
}));
}
}
}
return self.safe_balance(balance.clone());
Value::Null
}
/*
* @method
* @name bitteam#fetchDepositsWithdrawals
* @description fetch history of deposits and withdrawals from external wallets and between CoinList Pro trading account and CoinList wallet
* @see https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiTransactionsofuser
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal
* @param {int} [limit] max number of deposit/withdrawals to return (default 10)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a list of [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
*/
pub async fn fetch_deposits_withdrawals(&mut self, optional_args: &[Value]) -> Value {
let mut code = get_arg(optional_args, 0, Value::Null);
let mut since = get_arg(optional_args, 1, Value::Null);
let mut limit = get_arg(optional_args, 2, Value::Null);
let mut params = get_arg(optional_args, 3, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut currency: Value = Value::Null;
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
if !is_equal(&code, &Value::Null) {
currency = self.currency(code.clone());
add_element_to_object(&mut request, &Value::Str("currency".to_string()), get_value(¤cy, &Value::Str("numericId".to_string())));
}
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone());
}
let __ws_arg_13 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_trade_api_transactions_of_user(&[__ws_arg_13]).await;
//
// {
// "ok": true,
// "result": {
// "count": 2,
// "transactions": [
// {
// "id": 1329686,
// "orderId": "2f060ad5-30f7-4f2b-ac5f-1bb8f5fd34dc",
// "transactionCoreId": "561863",
// "userId": 21639,
// "recipient": "0x9050dfA063D1bE7cA711c750b18D51fDD13e90Ee",
// "sender": "0x6894a93B6fea044584649278621723cac51443Cd",
// "symbolId": 2,
// "CommissionId": 17571,
// "amount": "44000000000000000",
// "params": {},
// "reason": null,
// "timestamp": 1700715341743,
// "status": "approving",
// "statusDescription": null,
// "type": "withdraw",
// "message": null,
// "blockChain": "",
// "before": null,
// "after": null,
// "currency": {
// "symbol": "eth",
// "decimals": 18,
// "blockChain": "Ethereum",
// "links": [
// {
// "tx": "https://etherscan.io/tx/",
// "address": "https://etherscan.io/address/",
// "blockChain": "Ethereum"
// }
// ]
// }
// },
// {
// "id": 1329229,
// "orderId": null,
// "transactionCoreId": "561418",
// "userId": 21639,
// "recipient": "0x7d6a797f2406e06b2f9b41d067df324affa315dd",
// "sender": null,
// "symbolId": 3,
// "CommissionId": null,
// "amount": "100000000",
// "params": {
// "tx_id": "0x2253823c828d838acd983fe6a348fb0e034efe3874b081871d8b80da76ec758b"
// },
// "reason": null,
// "timestamp": 1700594180417,
// "status": "success",
// "statusDescription": null,
// "type": "deposit",
// "message": null,
// "blockChain": "Ethereum",
// "before": 0,
// "after": 100000000,
// "currency": {
// "symbol": "usdt",
// "decimals": 6,
// "blockChain": "",
// "links": [
// {
// "tx": "https://etherscan.io/tx/",
// "address": "https://etherscan.io/address/",
// "blockChain": "Ethereum"
// },
// {
// "tx": "https://tronscan.org/#/transaction/",
// "address": "https://tronscan.org/#/address/",
// "blockChain": "Tron"
// },
// {
// "tx": "https://bscscan.com/tx/",
// "address": "https://bscscan.com/address/",
// "blockChain": "Binance"
// }
// ]
// }
// }
// ]
// }
// }
//
let mut result: Value = self.safe_value_k(response.clone(), "result", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut transactions: Value = self.safe_list_k(result.clone(), "transactions", &[Value::List(vec![])]);
return self.parse_transactions(transactions.clone(), &[currency.clone(), since.clone(), limit.clone()]);
Value::Null
}
pub fn parse_transaction(&self, mut transaction: Value, optional_args: &[Value]) -> Value {
let mut currency = get_arg(optional_args, 0, Value::Null);
//
// {
// "id": 1329229,
// "orderId": null,
// "transactionCoreId": "561418",
// "userId": 21639,
// "recipient": "0x7d6a797f2406e06b2f9b41d067df324affa315dd",
// "sender": null,
// "symbolId": 3,
// "CommissionId": null,
// "amount": "100000000",
// "params": {
// "tx_id": "0x2253823c828d838acd983fe6a348fb0e034efe3874b081871d8b80da76ec758b"
// },
// "reason": null,
// "timestamp": 1700594180417,
// "status": "success",
// "statusDescription": null,
// "type": "deposit",
// "message": null,
// "blockChain": "Ethereum",
// "before": 0,
// "after": 100000000,
// "currency": {
// "symbol": "usdt",
// "decimals": 6,
// "blockChain": "",
// "links": [
// {
// "tx": "https://etherscan.io/tx/",
// "address": "https://etherscan.io/address/",
// "blockChain": "Ethereum"
// },
// {
// "tx": "https://tronscan.org/#/transaction/",
// "address": "https://tronscan.org/#/address/",
// "blockChain": "Tron"
// },
// {
// "tx": "https://bscscan.com/tx/",
// "address": "https://bscscan.com/address/",
// "blockChain": "Binance"
// }
// ]
// }
// }
//
let mut currencyObject: Value = self.safe_value_k(transaction.clone(), "currency", &[]);
let mut currencyId: Value = self.safe_string_k(currencyObject.clone(), "symbol", &[]);
let mut code: Value = self.safe_currency_code(currencyId.clone(), &[currency.clone()]);
let mut id: Value = self.safe_string_k(transaction.clone(), "id", &[]);
let mut params: Value = self.safe_value_k(transaction.clone(), "params", &[]);
let mut txid: Value = self.safe_string_k(params.clone(), "tx_id", &[]);
let mut timestamp: Value = self.safe_integer_k(transaction.clone(), "timestamp", &[]);
let mut networkId: Value = self.safe_string_k(transaction.clone(), "blockChain", &[]);
if is_equal(&networkId, &Value::Null) {
let mut links: Value = self.safe_value_k(currencyObject.clone(), "links", &[Value::List(vec![])]);
let mut blockChain: Value = self.safe_value(links.clone(), Value::Int(0), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
networkId = self.safe_string_k(blockChain.clone(), "blockChain", &[]);
}
let mut addressFrom: Value = self.safe_string_k(transaction.clone(), "sender", &[]);
let mut addressTo: Value = self.safe_string_k(transaction.clone(), "recipient", &[]);
let mut tag: Value = self.safe_string_k(transaction.clone(), "message", &[]);
let mut type_var: Value = self.parse_transaction_type(self.safe_string_k(transaction.clone(), "type", &[]));
let mut amount: Value = self.parse_value_to_pricision(transaction.clone(), Value::Str("amount".to_string()), currencyObject.clone(), Value::Str("decimals".to_string()));
let mut status: Value = self.parse_transaction_status(self.safe_value_k(transaction.clone(), "status", &[]));
return Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), transaction.clone());
m.insert("id".to_string(), id.clone());
m.insert("txid".to_string(), txid.clone());
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m.insert("network".to_string(), self.network_id_to_code(&[networkId.clone(), code.clone()]));
m.insert("addressFrom".to_string(), addressFrom.clone());
m.insert("address".to_string(), Value::Null);
m.insert("addressTo".to_string(), addressTo.clone());
m.insert("tagFrom".to_string(), Value::Null);
m.insert("tag".to_string(), tag.clone());
m.insert("tagTo".to_string(), Value::Null);
m.insert("type".to_string(), type_var.clone());
m.insert("amount".to_string(), self.parse_number(amount.clone(), &[]));
m.insert("currency".to_string(), code.clone());
m.insert("status".to_string(), status.clone());
m.insert("updated".to_string(), Value::Null);
m.insert("fee".to_string(), Value::Null);
m.insert("comment".to_string(), self.safe_string_k(transaction.clone(), "description", &[]));
m.insert("internal".to_string(), Value::Bool(false));
m
});
Value::Null
}
pub fn parse_transaction_type(&self, mut type_var: Value) -> Value {
let mut types: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("deposit".to_string(), Value::Str("deposit".to_string()));
m.insert("withdraw".to_string(), Value::Str("withdrawal".to_string()));
m
});
return self.safe_string(types.clone(), type_var.clone(), &[type_var.clone()]);
Value::Null
}
pub fn parse_transaction_status(&self, mut status: Value) -> Value {
let mut statuses: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("approving".to_string(), Value::Str("pending".to_string()));
m.insert("success".to_string(), Value::Str("ok".to_string()));
m
});
return self.safe_string(statuses.clone(), status.clone(), &[status.clone()]);
Value::Null
}
pub fn sign(&self, mut path: Value, optional_args: &[Value]) -> Value {
let mut api = get_arg(optional_args, 0, Value::Str("public".to_string()));
let mut method = get_arg(optional_args, 1, Value::Str("GET".to_string()));
let mut params = get_arg(optional_args, 2, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
let mut headers = get_arg(optional_args, 3, Value::Null);
let mut body = get_arg(optional_args, 4, Value::Null);
let mut request: Value = self.omit(params.clone(), self.extract_params(path.clone()), &[]);
let mut endpoint: Value = add(&Value::Str("/".to_string()), &self.implode_params(path.clone(), params.clone()));
let mut url: Value = add(&get_value(&get_value(&self.urls, &Value::Str("api".to_string())), &api), &endpoint);
let mut query: Value = self.urlencode(request.clone(), &[]);
if is_equal(&api, &Value::Str("private".to_string())) {
self.check_required_credentials(&[]);
if is_equal(&method, &Value::Str("POST".to_string())) {
body = self.json(request.clone());
} else if !is_equal(&get_array_length(&query), &Value::Int(0)) {
url = add(&url, &add(&Value::Str("?".to_string()), &query));
}
let mut auth: Value = add(&add(&self.apiKey, &Value::Str(":".to_string())), &self.secret);
let mut auth64: Value = self.string_to_base64(auth.clone(), &[]);
let mut signature: Value = add(&Value::Str("Basic ".to_string()), &auth64);
headers = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("Authorization".to_string(), signature.clone());
m.insert("Content-Type".to_string(), Value::Str("application/json".to_string()));
m
});
} else if !is_equal(&get_array_length(&query), &Value::Int(0)) {
url = add(&url, &add(&Value::Str("?".to_string()), &query));
}
return Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("url".to_string(), url.clone());
m.insert("method".to_string(), method.clone());
m.insert("body".to_string(), body.clone());
m.insert("headers".to_string(), headers.clone());
m
});
Value::Null
}
pub fn handle_errors(&self, mut code: Value, mut reason: Value, mut url: Value, mut method: Value, mut headers: Value, mut body: Value, mut response: Value, mut requestHeaders: Value, mut requestBody: Value) -> Value {
if is_equal(&response, &Value::Null) {
return Value::Null;
}
if !is_equal(&code, &Value::Int(200)) {
if is_equal(&code, &Value::Int(404)) {
if is_true(&(is_greater_than_or_equal(&get_index_of(&url, &Value::Str("/ccxt/order/".to_string())), &Value::Int(0)))) && is_true(&(is_equal(&method, &Value::Str("GET".to_string())))) {
let mut parts: Value = split(&url, &Value::Str("/order/".to_string()));
let mut orderId: Value = self.safe_string(parts.clone(), Value::Int(1), &[]);
panic!("{}", crate::exchange_errors::order_not_found(add(&add(&add(&self.id, &Value::Str(" order ".to_string())), &orderId), &Value::Str(" not found".to_string()))));
}
if is_greater_than_or_equal(&get_index_of(&url, &Value::Str("/cmc/orderbook/".to_string())), &Value::Int(0)) {
let mut parts: Value = split(&url, &Value::Str("/cmc/orderbook/".to_string()));
let mut symbolId: Value = self.safe_string(parts.clone(), Value::Int(1), &[]);
panic!("{}", crate::exchange_errors::bad_symbol(add(&add(&add(&self.id, &Value::Str(" symbolId ".to_string())), &symbolId), &Value::Str(" not found".to_string()))));
}
}
let mut feedback: Value = add(&add(&self.id, &Value::Str(" ".to_string())), &body);
let mut message: Value = self.safe_string_k(response.clone(), "message", &[]);
let mut responseCode: Value = self.safe_string_k(response.clone(), "code", &[]);
self.throw_broadly_matched_exception(get_value(&self.exceptions, &Value::Str("broad".to_string())), message.clone(), feedback.clone());
self.throw_exactly_matched_exception(get_value(&self.exceptions, &Value::Str("exact".to_string())), responseCode.clone(), feedback.clone());
panic!("{}", crate::exchange_errors::exchange_error(feedback));
}
return Value::Null;
Value::Null
}
}