// 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 BigoneCore {
pub exchange: crate::exchange::Exchange,
}
impl BigoneCore {
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 = BigoneCore::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 BigoneCore {
fn nonce(&self, ) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::nonce(self, )
}
fn parse_ticker(&self, ticker: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::parse_ticker(self, ticker, &[market.clone()])
}
fn parse_trade(&self, trade: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::parse_trade(self, trade, &[market.clone()])
}
fn parse_order(&self, order: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::parse_order(self, order, &[market.clone()])
}
fn parse_ohlcv(&self, ohlcv: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::parse_ohlcv(self, ohlcv, &[market.clone()])
}
fn parse_balance(&self, response: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::parse_balance(self, response)
}
fn parse_transfer(&self, transfer: crate::Value, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::parse_transfer(self, transfer, &[currency.clone()])
}
fn parse_currency(&self, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::parse_currency(self, currency)
}
fn parse_transaction(&self, transaction: crate::Value, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on BigoneCore.
BigoneCore::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 BigoneCore.
BigoneCore::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 BigoneCore.
BigoneCore::handle_errors(self, code, reason, url, method, headers, body, response, request_headers, request_body)
}
}
impl crate::exchange_generated::ExchangeBase for BigoneCore {
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_market_buy_order_with_cost" => self.create_market_buy_order_with_cost(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).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_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_deposit_address" => self.fetch_deposit_address(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_deposits" => self.fetch_deposits(&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_time" => self.fetch_time(&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,
"fetch_withdrawals" => self.fetch_withdrawals(&args.get(0..).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)),
"nonce" => self.nonce(),
"parse_balance" => self.parse_balance(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_contract_bids_asks" => self.parse_contract_bids_asks(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_contract_order_book" => self.parse_contract_order_book(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
"parse_currency" => self.parse_currency(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_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_transfer" => self.parse_transfer(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"parse_transfer_status" => self.parse_transfer_status(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_type" => self.parse_type(args.get(0).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()[..]),
"transfer" => self.transfer(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,
"withdraw" => self.withdraw(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..).unwrap_or(&[]).to_vec()[..]).await,
// Fall through to the base-only methods (cancelOrderWithClientOrderId, …).
_ => self.call_dynamic_base(method, args).await,
}
})
}
}
impl std::ops::Deref for BigoneCore {
type Target = crate::exchange::Exchange;
fn deref(&self) -> &crate::exchange::Exchange { &self.exchange }
}
impl std::ops::DerefMut for BigoneCore {
fn deref_mut(&mut self) -> &mut crate::exchange::Exchange { &mut self.exchange }
}
impl BigoneCore {
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("bigone".to_string()));
m.insert("name".to_string(), Value::Str("BigONE".to_string()));
m.insert("countries".to_string(), Value::List(vec![Value::Str("CN".to_string())]));
m.insert("version".to_string(), Value::Str("v3".to_string()));
m.insert("rateLimit".to_string(), Value::Int(20));
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(true));
m.insert("future".to_string(), Value::Null);
m.insert("option".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("createMarketBuyOrderWithCost".to_string(), Value::Bool(true));
m.insert("createMarketOrderWithCost".to_string(), Value::Bool(false));
m.insert("createMarketSellOrderWithCost".to_string(), Value::Bool(false));
m.insert("createOrder".to_string(), Value::Bool(true));
m.insert("createPostOnlyOrder".to_string(), Value::Bool(true));
m.insert("createStopLimitOrder".to_string(), Value::Bool(true));
m.insert("createStopMarketOrder".to_string(), Value::Bool(true));
m.insert("createStopOrder".to_string(), Value::Bool(true));
m.insert("fetchAllGreeks".to_string(), Value::Bool(false));
m.insert("fetchBalance".to_string(), Value::Bool(true));
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("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("fetchDepositAddress".to_string(), Value::Bool(true));
m.insert("fetchDepositAddresses".to_string(), Value::Bool(false));
m.insert("fetchDepositAddressesByNetwork".to_string(), Value::Bool(false));
m.insert("fetchDeposits".to_string(), Value::Bool(true));
m.insert("fetchFundingHistory".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("fetchIsolatedBorrowRate".to_string(), Value::Bool(false));
m.insert("fetchIsolatedBorrowRates".to_string(), Value::Bool(false));
m.insert("fetchMarkets".to_string(), Value::Bool(true));
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("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("fetchOrders".to_string(), Value::Bool(true));
m.insert("fetchTicker".to_string(), Value::Bool(true));
m.insert("fetchTickers".to_string(), Value::Bool(true));
m.insert("fetchTime".to_string(), Value::Bool(true));
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("fetchTransactionFees".to_string(), Value::Bool(false));
m.insert("fetchVolatilityHistory".to_string(), Value::Bool(false));
m.insert("fetchWithdrawals".to_string(), Value::Bool(true));
m.insert("repayCrossMargin".to_string(), Value::Bool(false));
m.insert("repayIsolatedMargin".to_string(), Value::Bool(false));
m.insert("transfer".to_string(), Value::Bool(true));
m.insert("withdraw".to_string(), Value::Bool(true));
m
}));
m.insert("timeframes".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("1m".to_string(), Value::Str("min1".to_string()));
m.insert("5m".to_string(), Value::Str("min5".to_string()));
m.insert("15m".to_string(), Value::Str("min15".to_string()));
m.insert("30m".to_string(), Value::Str("min30".to_string()));
m.insert("1h".to_string(), Value::Str("hour1".to_string()));
m.insert("3h".to_string(), Value::Str("hour3".to_string()));
m.insert("4h".to_string(), Value::Str("hour4".to_string()));
m.insert("6h".to_string(), Value::Str("hour6".to_string()));
m.insert("12h".to_string(), Value::Str("hour12".to_string()));
m.insert("1d".to_string(), Value::Str("day1".to_string()));
m.insert("1w".to_string(), Value::Str("week1".to_string()));
m.insert("1M".to_string(), Value::Str("month1".to_string()));
m
}));
m.insert("hostname".to_string(), Value::Str("big.one".to_string()));
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/4e5cfd53-98cc-4b90-92cd-0d7b512653d1".to_string()));
m.insert("api".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("public".to_string(), Value::Str("https://{hostname}/api/v3".to_string()));
m.insert("private".to_string(), Value::Str("https://{hostname}/api/v3/viewer".to_string()));
m.insert("contractPublic".to_string(), Value::Str("https://{hostname}/api/contract/v2".to_string()));
m.insert("contractPrivate".to_string(), Value::Str("https://{hostname}/api/contract/v2".to_string()));
m.insert("webExchange".to_string(), Value::Str("https://{hostname}/api/".to_string()));
m
}));
m.insert("www".to_string(), Value::Str("https://big.one".to_string()));
m.insert("doc".to_string(), Value::Str("https://open.big.one/docs/api.html".to_string()));
m.insert("fees".to_string(), Value::Str("https://bigone.zendesk.com/hc/en-us/articles/115001933374-BigONE-Fee-Policy".to_string()));
m.insert("referral".to_string(), Value::Str("https://b1.run/users/new?code=D3LLBVFT".to_string()));
m
}));
m.insert("api".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
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("ping".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("asset_pairs".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("asset_pairs/{asset_pair_name}/depth".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("asset_pairs/{asset_pair_name}/trades".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("asset_pairs/{asset_pair_name}/ticker".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("asset_pairs/{asset_pair_name}/candles".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("asset_pairs/tickers".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("accounts".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("fund/accounts".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("assets/{asset_symbol}/address".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/{id}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/multi".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trades".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("withdrawals".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("deposits".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("orders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/{id}/cancel".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/cancel".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("withdrawals".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("transfer".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m
}));
m.insert("contractPublic".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("symbols".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("instruments".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("depth@{symbol}/snapshot".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("instruments/difference".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("instruments/prices".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m
}));
m.insert("contractPrivate".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("accounts".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/{id}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/opening".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/count".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/opening/count".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trades".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("trades/count".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("orders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/batch".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m.insert("put".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("positions/{symbol}/margin".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("positions/{symbol}/risk-limit".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m.insert("delete".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("orders/{id}".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orders/batch".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m
}));
m.insert("webExchange".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("v3/assets".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("maker".to_string(), self.parse_number(Value::Str("0.001".to_string()), &[]));
m.insert("taker".to_string(), self.parse_number(Value::Str("0.001".to_string()), &[]));
m
}));
m.insert("funding".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("withdraw".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
m
}));
m
}));
m.insert("options".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("createOrder".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("createMarketBuyOrderRequiresPrice".to_string(), Value::Bool(true));
m
}));
m.insert("accountsByType".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("spot".to_string(), Value::Str("SPOT".to_string()));
m.insert("fund".to_string(), Value::Str("FUND".to_string()));
m.insert("funding".to_string(), Value::Str("FUND".to_string()));
m.insert("future".to_string(), Value::Str("CONTRACT".to_string()));
m.insert("swap".to_string(), Value::Str("CONTRACT".to_string()));
m
}));
m.insert("transfer".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("fillResponseFromRequest".to_string(), Value::Bool(true));
m
}));
m.insert("exchangeMillisecondsCorrection".to_string(), negate(&Value::Int(100)));
m.insert("fetchCurrencies".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("webApiEnable".to_string(), Value::Bool(true));
m.insert("webApiRetries".to_string(), Value::Int(5));
m.insert("webApiMuteFailure".to_string(), Value::Bool(true));
m
}));
m.insert("defaultNetwork".to_string(), Value::Str("ERC20".to_string()));
m.insert("defaultNetworks".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("USDT".to_string(), Value::Str("TRC20".to_string()));
m
}));
m.insert("networks".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("ABBC".to_string(), Value::Str("ABBC".to_string()));
m.insert("ACA".to_string(), Value::Str("Acala".to_string()));
m.insert("AE".to_string(), Value::Str("Aeternity".to_string()));
m.insert("ALGO".to_string(), Value::Str("Algorand".to_string()));
m.insert("APT".to_string(), Value::Str("Aptos".to_string()));
m.insert("AR".to_string(), Value::Str("Arweave".to_string()));
m.insert("ASTR".to_string(), Value::Str("Astar".to_string()));
m.insert("AVAXC".to_string(), Value::Str("Avax".to_string()));
m.insert("AVAXX".to_string(), Value::Str("AvaxChain".to_string()));
m.insert("BEAM".to_string(), Value::Str("Beam".to_string()));
m.insert("BEP20".to_string(), Value::Str("BinanceSmartChain".to_string()));
m.insert("BITCI".to_string(), Value::Str("BitciChain".to_string()));
m.insert("BTC".to_string(), Value::Str("Bitcoin".to_string()));
m.insert("BCH".to_string(), Value::Str("BitcoinCash".to_string()));
m.insert("BSV".to_string(), Value::Str("BitcoinSV".to_string()));
m.insert("CELO".to_string(), Value::Str("Celo".to_string()));
m.insert("CKKB".to_string(), Value::Str("CKB".to_string()));
m.insert("ATOM".to_string(), Value::Str("Cosmos".to_string()));
m.insert("CRC20".to_string(), Value::Str("CRO".to_string()));
m.insert("DASH".to_string(), Value::Str("Dash".to_string()));
m.insert("DOGE".to_string(), Value::Str("Dogecoin".to_string()));
m.insert("XEC".to_string(), Value::Str("ECash".to_string()));
m.insert("EOS".to_string(), Value::Str("EOS".to_string()));
m.insert("ETH".to_string(), Value::Str("Ethereum".to_string()));
m.insert("ETC".to_string(), Value::Str("EthereumClassic".to_string()));
m.insert("ETHW".to_string(), Value::Str("EthereumPow".to_string()));
m.insert("FTM".to_string(), Value::Str("Fantom".to_string()));
m.insert("FIL".to_string(), Value::Str("Filecoin".to_string()));
m.insert("FSN".to_string(), Value::Str("Fusion".to_string()));
m.insert("GRIN".to_string(), Value::Str("Grin".to_string()));
m.insert("ONE".to_string(), Value::Str("Harmony".to_string()));
m.insert("HRC20".to_string(), Value::Str("Hecochain".to_string()));
m.insert("HBAR".to_string(), Value::Str("Hedera".to_string()));
m.insert("HNT".to_string(), Value::Str("Helium".to_string()));
m.insert("ZEN".to_string(), Value::Str("Horizen".to_string()));
m.insert("IOST".to_string(), Value::Str("IOST".to_string()));
m.insert("IRIS".to_string(), Value::Str("IRIS".to_string()));
m.insert("KLAY".to_string(), Value::Str("Klaytn".to_string()));
m.insert("KSM".to_string(), Value::Str("Kusama".to_string()));
m.insert("LTC".to_string(), Value::Str("Litecoin".to_string()));
m.insert("XMR".to_string(), Value::Str("Monero".to_string()));
m.insert("GLMR".to_string(), Value::Str("Moonbeam".to_string()));
m.insert("NEAR".to_string(), Value::Str("Near".to_string()));
m.insert("NEO".to_string(), Value::Str("Neo".to_string()));
m.insert("NEON3".to_string(), Value::Str("NeoN3".to_string()));
m.insert("OASIS".to_string(), Value::Str("Oasis".to_string()));
m.insert("OKC".to_string(), Value::Str("Okexchain".to_string()));
m.insert("ONT".to_string(), Value::Str("Ontology".to_string()));
m.insert("OPTIMISM".to_string(), Value::Str("Optimism".to_string()));
m.insert("DOT".to_string(), Value::Str("Polkadot".to_string()));
m.insert("MATIC".to_string(), Value::Str("Polygon".to_string()));
m.insert("QTUM".to_string(), Value::Str("Qtum".to_string()));
m.insert("REI".to_string(), Value::Str("REI".to_string()));
m.insert("XRP".to_string(), Value::Str("Ripple".to_string()));
m.insert("SGB".to_string(), Value::Str("SGB".to_string()));
m.insert("SDN".to_string(), Value::Str("Shiden".to_string()));
m.insert("SOL".to_string(), Value::Str("Solana".to_string()));
m.insert("XLM".to_string(), Value::Str("Stellar".to_string()));
m.insert("TERA".to_string(), Value::Str("Tera".to_string()));
m.insert("XTZ".to_string(), Value::Str("Tezos".to_string()));
m.insert("TRC20".to_string(), Value::Str("Tron".to_string()));
m.insert("VET".to_string(), Value::Str("Vechain".to_string()));
m.insert("VSYS".to_string(), Value::Str("VSystems".to_string()));
m.insert("WAX".to_string(), Value::Str("WAX".to_string()));
m.insert("ZEC".to_string(), Value::Str("Zcash".to_string()));
m
}));
m
}));
m.insert("features".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("default".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(true));
m.insert("triggerPriceType".to_string(), Value::Null);
m.insert("triggerDirection".to_string(), Value::Bool(true));
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(true));
m.insert("FOK".to_string(), Value::Bool(false));
m.insert("PO".to_string(), Value::Bool(true));
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(true));
m.insert("marketBuyByCost".to_string(), Value::Bool(true));
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(200));
m.insert("daysBack".to_string(), Value::Null);
m.insert("untilDays".to_string(), Value::Null);
m.insert("symbolRequired".to_string(), Value::Bool(true));
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(200));
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(true));
m
}));
m.insert("fetchOrders".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(200));
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(true));
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(200));
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(true));
m
}));
m.insert("fetchOHLCV".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("limit".to_string(), Value::Int(500));
m
}));
m
}));
m.insert("spot".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("extends".to_string(), Value::Str("default".to_string()));
m
}));
m.insert("forDerivatives".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("extends".to_string(), Value::Str("default".to_string()));
m.insert("createOrder".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("triggerPriceType".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("mark".to_string(), Value::Bool(true));
m.insert("index".to_string(), Value::Bool(true));
m.insert("last".to_string(), Value::Bool(true));
m
}));
m
}));
m.insert("fetchOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("daysBack".to_string(), Value::Int(100000));
m.insert("untilDays".to_string(), Value::Int(100000));
m
}));
m.insert("fetchClosedOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("daysBack".to_string(), Value::Int(100000));
m.insert("untilDays".to_string(), Value::Int(100000));
m
}));
m
}));
m.insert("swap".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("linear".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("extends".to_string(), Value::Str("forDerivatives".to_string()));
m
}));
m.insert("inverse".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("extends".to_string(), Value::Str("forDerivatives".to_string()));
m
}));
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("precisionMode".to_string(), Value::Int(crate::runtime::TICK_SIZE));
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("10001".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("10005".to_string(), Value::Str("ExchangeError".to_string()).clone());
m.insert("Amount's scale must greater than AssetPair's base scale".to_string(), Value::Str("InvalidOrder".to_string()).clone());
m.insert("Price mulit with amount should larger than AssetPair's min_quote_value".to_string(), Value::Str("InvalidOrder".to_string()).clone());
m.insert("10007".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("10011".to_string(), Value::Str("ExchangeError".to_string()).clone());
m.insert("10013".to_string(), Value::Str("BadSymbol".to_string()).clone());
m.insert("10014".to_string(), Value::Str("InsufficientFunds".to_string()).clone());
m.insert("10403".to_string(), Value::Str("PermissionDenied".to_string()).clone());
m.insert("10429".to_string(), Value::Str("RateLimitExceeded".to_string()).clone());
m.insert("40004".to_string(), Value::Str("AuthenticationError".to_string()).clone());
m.insert("40103".to_string(), Value::Str("AuthenticationError".to_string()).clone());
m.insert("40104".to_string(), Value::Str("AuthenticationError".to_string()).clone());
m.insert("40301".to_string(), Value::Str("PermissionDenied".to_string()).clone());
m.insert("40302".to_string(), Value::Str("ExchangeError".to_string()).clone());
m.insert("40601".to_string(), Value::Str("ExchangeError".to_string()).clone());
m.insert("40602".to_string(), Value::Str("ExchangeError".to_string()).clone());
m.insert("40603".to_string(), Value::Str("InsufficientFunds".to_string()).clone());
m.insert("40604".to_string(), Value::Str("InvalidOrder".to_string()).clone());
m.insert("40605".to_string(), Value::Str("InvalidOrder".to_string()).clone());
m.insert("40120".to_string(), Value::Str("InvalidOrder".to_string()).clone());
m.insert("40121".to_string(), Value::Str("InvalidOrder".to_string()).clone());
m.insert("60100".to_string(), Value::Str("BadSymbol".to_string()).clone());
m
}));
m.insert("broad".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
m
}));
m.insert("commonCurrencies".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("CRE".to_string(), Value::Str("Cybereits".to_string()));
m.insert("FXT".to_string(), Value::Str("FXTTOKEN".to_string()));
m.insert("FREE".to_string(), Value::Str("FreeRossDAO".to_string()));
m.insert("MBN".to_string(), Value::Str("Mobilian Coin".to_string()));
m.insert("ONE".to_string(), Value::Str("BigONE Token".to_string()));
m
}));
m
})]);
Value::Null
}
/*
* @method
* @name bigone#fetchCurrencies
* @description fetches all available currencies on an exchange
* @param {dict} [params] extra parameters specific to the exchange API endpoint
* @returns {dict} 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
}));
// we use undocumented link (possible, less informative alternative is : https://big.one/api/uc/v3/assets/accounts)
let mut data: Value = self.fetch_web_endpoint(Value::Str("fetchCurrencies".to_string()), Value::Str("webExchangeGetV3Assets".to_string()), Value::Bool(true), &[]).await;
if is_equal(&data, &Value::Null) {
return Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
}
//
// {
// "code": "0",
// "message": "",
// "data": [
// {
// "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
// "symbol": "USDT",
// "name": "TetherUS",
// "scale": 12,
// "is_fiat": false,
// "is_transfer_enabled": true,
// "transfer_scale": 12,
// "binding_gateways": [
// {
// "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
// "is_deposit_enabled": true,
// "gateway_name": "Ethereum",
// "min_withdrawal_amount": "0.000001",
// "withdrawal_fee": "5.71",
// "is_withdrawal_enabled": true,
// "min_deposit_amount": "0.000001",
// "is_memo_required": false,
// "withdrawal_scale": 6,
// "scale": 12
// },
// {
// "guid": "4e387a9a-a480-40a3-b4ae-ed1773c2db5a",
// "is_deposit_enabled": true,
// "gateway_name": "BinanceSmartChain",
// "min_withdrawal_amount": "10",
// "withdrawal_fee": "5",
// "is_withdrawal_enabled": false,
// "min_deposit_amount": "1",
// "is_memo_required": false,
// "withdrawal_scale": 8,
// "scale": 12
// }
// ]
// },
// ...
// ],
// }
//
let mut currenciesData: Value = self.safe_list_k(data.clone(), "data", &[Value::List(vec![])]);
return self.parse_currencies(currenciesData.clone());
Value::Null
}
pub fn parse_currency(&self, mut rawCurrency: Value) -> Value {
let mut id: Value = self.safe_string_k(rawCurrency.clone(), "symbol", &[]);
let mut code: Value = self.safe_currency_code(id.clone(), &[]);
let mut name: Value = self.safe_string_k(rawCurrency.clone(), "name", &[]);
let mut networks: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut chains: Value = self.safe_list_k(rawCurrency.clone(), "binding_gateways", &[Value::List(vec![])]);
let mut currencyMaxPrecision: Value = self.parse_precision(&[self.safe_string2(rawCurrency.clone(), Value::Str("withdrawal_scale".to_string()), Value::Str("scale".to_string()), &[])]);
{
let mut j: Value = Value::Int(0);
let mut __for_first_239: bool = true;
while { if !__for_first_239 { j = add(&j, &Value::Int(1)); } __for_first_239 = false; is_less_than(&j, &get_array_length(&chains)) } {
let mut chain: Value = get_value(&chains, &j);
let mut chain: Value = get_value(&chains, &j);
let mut networkId: Value = self.safe_string_k(chain.clone(), "gateway_name", &[]);
let mut networkCode: Value = self.network_id_to_code(&[networkId.clone(), code.clone()]);
let mut deposit: Value = self.safe_bool_k(chain.clone(), "is_deposit_enabled", &[]);
let mut withdraw: Value = self.safe_bool_k(chain.clone(), "is_withdrawal_enabled", &[]);
let mut minDepositAmount: Value = self.safe_string_k(chain.clone(), "min_deposit_amount", &[]);
let mut minWithdrawalAmount: Value = self.safe_string_k(chain.clone(), "min_withdrawal_amount", &[]);
let mut withdrawalFee: Value = self.safe_string_k(chain.clone(), "withdrawal_fee", &[]);
let mut precision: Value = self.parse_precision(&[self.safe_string2(chain.clone(), Value::Str("withdrawal_scale".to_string()), Value::Str("scale".to_string()), &[])]);
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("margin".to_string(), Value::Null);
m.insert("deposit".to_string(), deposit.clone());
m.insert("withdraw".to_string(), withdraw.clone());
m.insert("active".to_string(), Value::Null);
m.insert("fee".to_string(), self.parse_number(withdrawalFee.clone(), &[]));
m.insert("precision".to_string(), self.parse_number(precision.clone(), &[]));
m.insert("limits".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("deposit".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), minDepositAmount.clone());
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(), minWithdrawalAmount.clone());
m.insert("max".to_string(), Value::Null);
m
}));
m
}));
m.insert("info".to_string(), chain.clone());
m
}));
}
}
}
let mut chainLength: Value = get_array_length(&chains);
let mut type_var: Value = Value::Null;
if is_equal(&self.safe_bool_k(rawCurrency.clone(), "is_fiat", &[]), &Value::Bool(true)) {
type_var = Value::Str("fiat".to_string());
} else if is_equal(&chainLength, &Value::Int(0)) {
if is_true(&self.is_leveraged_currency(id.clone(), &[])) {
type_var = Value::Str("leveraged".to_string());
} else {
type_var = Value::Str("other".to_string());
}
} else {
type_var = Value::Str("crypto".to_string());
}
return self.safe_currency_structure(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("code".to_string(), code.clone());
m.insert("info".to_string(), rawCurrency.clone());
m.insert("name".to_string(), name.clone());
m.insert("type".to_string(), type_var.clone());
m.insert("active".to_string(), Value::Null);
m.insert("deposit".to_string(), Value::Null);
m.insert("withdraw".to_string(), Value::Null);
m.insert("fee".to_string(), Value::Null);
m.insert("precision".to_string(), self.parse_number(currencyMaxPrecision.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(), Value::Null);
m.insert("max".to_string(), Value::Null);
m
}));
m
}));
m.insert("networks".to_string(), networks.clone());
m
}));
Value::Null
}
/*
* @method
* @name bigone#fetchMarkets
* @description retrieves data on all markets for bigone
* @see https://open.big.one/docs/spot_asset_pair.html
* @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 promises: Value = Value::List(vec![self.public_get_asset_pairs(&[params.clone()]).await, self.contract_public_get_symbols(&[params.clone()]).await]);
let mut promisesResult: Value = promise_all(&promises).await;
let mut response: Value = get_value(&promisesResult, &Value::Int(0));
let mut contractResponse: Value = get_value(&promisesResult, &Value::Int(1));
//
// {
// "code":0,
// "data":[
// {
// "id":"01e48809-b42f-4a38-96b1-c4c547365db1",
// "name":"PCX-BTC",
// "quote_scale":7,
// "quote_asset":{
// "id":"0df9c3c3-255a-46d7-ab82-dedae169fba9",
// "symbol":"BTC",
// "name":"Bitcoin",
// },
// "base_asset":{
// "id":"405484f7-4b03-4378-a9c1-2bd718ecab51",
// "symbol":"PCX",
// "name":"ChainX",
// },
// "base_scale":3,
// "min_quote_value":"0.0001",
// "max_quote_value":"35"
// },
// ]
// }
//
//
// [
// {
// "baseCurrency": "BTC",
// "multiplier": 1,
// "enable": true,
// "priceStep": 0.5,
// "maxRiskLimit": 1000,
// "pricePrecision": 1,
// "maintenanceMargin": 0.00500,
// "symbol": "BTCUSD",
// "valuePrecision": 4,
// "minRiskLimit": 100,
// "riskLimit": 100,
// "isInverse": true,
// "riskStep": 1,
// "settleCurrency": "BTC",
// "baseName": "Bitcoin",
// "feePrecision": 8,
// "priceMin": 0.5,
// "priceMax": 1E+6,
// "initialMargin": 0.01000,
// "quoteCurrency": "USD"
// },
// ...
// ]
//
let mut markets: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
let mut result: Value = Value::List(vec![]);
{
let mut i: Value = Value::Int(0);
let mut __for_first_240: bool = true;
while { if !__for_first_240 { i = add(&i, &Value::Int(1)); } __for_first_240 = false; is_less_than(&i, &get_array_length(&markets)) } {
let mut market: Value = get_value(&markets, &i);
let mut market: Value = get_value(&markets, &i);
let mut baseAsset: Value = self.safe_dict_k(market.clone(), "base_asset", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut quoteAsset: Value = self.safe_dict_k(market.clone(), "quote_asset", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut baseId: Value = self.safe_string_k(baseAsset.clone(), "symbol", &[]);
let mut quoteId: Value = self.safe_string_k(quoteAsset.clone(), "symbol", &[]);
let mut base: Value = self.safe_currency_code(baseId.clone(), &[]);
let mut quote: Value = self.safe_currency_code(quoteId.clone(), &[]);
append_to_array(&mut result, self.safe_market_structure(&[Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), self.safe_string_k(market.clone(), "name", &[]));
m.insert("uuid".to_string(), self.safe_string_k(market.clone(), "id", &[]));
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(), Value::Bool(true));
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(), "base_scale", &[])]), &[]));
m.insert("price".to_string(), self.parse_number(self.parse_precision(&[self.safe_string_k(market.clone(), "quote_scale", &[])]), &[]));
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(), self.safe_number_k(market.clone(), "min_quote_value", &[]));
m.insert("max".to_string(), self.safe_number_k(market.clone(), "max_quote_value", &[]));
m
}));
m
}));
m.insert("created".to_string(), Value::Null);
m.insert("info".to_string(), market.clone());
m
})]));
}
}
let mut contractMarkets: Value = self.to_array(contractResponse.clone());
{
let mut i: Value = Value::Int(0);
let mut __for_first_241: bool = true;
while { if !__for_first_241 { i = add(&i, &Value::Int(1)); } __for_first_241 = false; is_less_than(&i, &get_array_length(&contractMarkets)) } {
let mut market: Value = get_value(&contractMarkets, &i);
let mut market: Value = get_value(&contractMarkets, &i);
let mut baseId: Value = self.safe_string_k(market.clone(), "baseCurrency", &[]);
let mut quoteId: Value = self.safe_string_k(market.clone(), "quoteCurrency", &[]);
let mut settleId: Value = self.safe_string_k(market.clone(), "settleCurrency", &[]);
let mut marketId: Value = self.safe_string_k(market.clone(), "symbol", &[]);
let mut base: Value = self.safe_currency_code(baseId.clone(), &[]);
let mut quote: Value = self.safe_currency_code(quoteId.clone(), &[]);
let mut settle: Value = self.safe_currency_code(settleId.clone(), &[]);
let mut inverse: Value = self.safe_bool_k(market.clone(), "isInverse", &[]);
append_to_array(&mut result, self.safe_market_structure(&[Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), marketId.clone());
m.insert("symbol".to_string(), add(&add(&add(&add(&base, &Value::Str("/".to_string())), "e), &Value::Str(":".to_string())), &settle));
m.insert("base".to_string(), base.clone());
m.insert("quote".to_string(), quote.clone());
m.insert("settle".to_string(), settle.clone());
m.insert("baseId".to_string(), baseId.clone());
m.insert("quoteId".to_string(), quoteId.clone());
m.insert("settleId".to_string(), settleId.clone());
m.insert("type".to_string(), Value::Str("swap".to_string()));
m.insert("spot".to_string(), Value::Bool(false));
m.insert("margin".to_string(), Value::Bool(false));
m.insert("swap".to_string(), Value::Bool(true));
m.insert("future".to_string(), Value::Bool(false));
m.insert("option".to_string(), Value::Bool(false));
m.insert("active".to_string(), self.safe_bool_k(market.clone(), "enable", &[]));
m.insert("contract".to_string(), Value::Bool(true));
m.insert("linear".to_string(), Value::Bool((!is_equal(&inverse, &Value::Bool(true)))));
m.insert("inverse".to_string(), inverse.clone());
m.insert("contractSize".to_string(), self.safe_number_k(market.clone(), "multiplier", &[]));
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(), "valuePrecision", &[])]), &[]));
m.insert("price".to_string(), self.parse_number(self.parse_precision(&[self.safe_string_k(market.clone(), "pricePrecision", &[])]), &[]));
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(), self.safe_number_k(market.clone(), "priceMin", &[]));
m.insert("max".to_string(), self.safe_number_k(market.clone(), "priceMax", &[]));
m
}));
m.insert("cost".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("min".to_string(), self.safe_number_k(market.clone(), "initialMargin", &[]));
m.insert("max".to_string(), Value::Null);
m
}));
m
}));
m.insert("info".to_string(), market.clone());
m
})]));
}
}
return result;
Value::Null
}
pub fn parse_ticker(&self, mut ticker: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
//
// spot
//
// {
// "asset_pair_name": "ETH-BTC",
// "bid": {
// "price": "0.021593",
// "order_count": 1,
// "quantity": "0.20936"
// },
// "ask": {
// "price": "0.021613",
// "order_count": 1,
// "quantity": "2.87064"
// },
// "open": "0.021795",
// "high": "0.021795",
// "low": "0.021471",
// "close": "0.021613",
// "volume": "117078.90431",
// "daily_change": "-0.000182"
// }
//
// contract
//
// {
// "usdtPrice": 1.00031998,
// "symbol": "BTCUSD",
// "btcPrice": 34700.4,
// "ethPrice": 1787.83,
// "nextFundingRate": 0.00010,
// "fundingRate": 0.00010,
// "latestPrice": 34708.5,
// "last24hPriceChange": 0.0321,
// "indexPrice": 34700.4,
// "volume24h": 261319063,
// "turnover24h": 8204.129380685496,
// "nextFundingTime": 1698285600000,
// "markPrice": 34702.4646738,
// "last24hMaxPrice": 35127.5,
// "volume24hInUsd": 0.0,
// "openValue": 32.88054722085945,
// "last24hMinPrice": 33552.0,
// "openInterest": 1141372.0
// }
//
let mut marketType: Value = ternary(is_true(&(Value::Bool(in_op(&ticker, &Value::Str("asset_pair_name".to_string()))))), Value::Str("spot".to_string()), Value::Str("swap".to_string()));
let mut marketId: Value = self.safe_string2(ticker.clone(), Value::Str("asset_pair_name".to_string()), Value::Str("symbol".to_string()), &[]);
let mut symbol: Value = self.safe_symbol(marketId.clone(), &[market.clone(), Value::Str("-".to_string()), marketType.clone()]);
let mut close: Value = self.safe_string2(ticker.clone(), Value::Str("close".to_string()), Value::Str("latestPrice".to_string()), &[]);
let mut bid: Value = self.safe_dict_k(ticker.clone(), "bid", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut ask: Value = self.safe_dict_k(ticker.clone(), "ask", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.safe_ticker(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), symbol.clone());
m.insert("timestamp".to_string(), Value::Null);
m.insert("datetime".to_string(), Value::Null);
m.insert("high".to_string(), self.safe_string2(ticker.clone(), Value::Str("high".to_string()), Value::Str("last24hMaxPrice".to_string()), &[]));
m.insert("low".to_string(), self.safe_string2(ticker.clone(), Value::Str("low".to_string()), Value::Str("last24hMinPrice".to_string()), &[]));
m.insert("bid".to_string(), self.safe_string_k(bid.clone(), "price", &[]));
m.insert("bidVolume".to_string(), self.safe_string_k(bid.clone(), "quantity", &[]));
m.insert("ask".to_string(), self.safe_string_k(ask.clone(), "price", &[]));
m.insert("askVolume".to_string(), self.safe_string_k(ask.clone(), "quantity", &[]));
m.insert("vwap".to_string(), Value::Null);
m.insert("open".to_string(), self.safe_string_k(ticker.clone(), "open", &[]));
m.insert("close".to_string(), close.clone());
m.insert("last".to_string(), close.clone());
m.insert("previousClose".to_string(), Value::Null);
m.insert("change".to_string(), self.safe_string_k(ticker.clone(), "daily_change", &[]));
m.insert("percentage".to_string(), Value::Null);
m.insert("average".to_string(), Value::Null);
m.insert("baseVolume".to_string(), self.safe_string2(ticker.clone(), Value::Str("volume".to_string()), Value::Str("volume24h".to_string()), &[]));
m.insert("quoteVolume".to_string(), self.safe_string_k(ticker.clone(), "volume24hInUsd", &[]));
m.insert("markPrice".to_string(), self.safe_string_k(ticker.clone(), "markPrice", &[]));
m.insert("indexPrice".to_string(), self.safe_string_k(ticker.clone(), "indexPrice", &[]));
m.insert("info".to_string(), ticker.clone());
m
}), &[market.clone()]);
Value::Null
}
/*
* @method
* @name bigone#fetchTicker
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
* @see https://open.big.one/docs/spot_tickers.html
* @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://docs.ccxt.com/?id=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 type_var: Value = Value::Null;
{ let __destr_tmp = self.handle_market_type_and_params(Value::Str("fetchTicker".to_string()), &[market.clone(), params.clone()]); type_var = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
if is_equal(&type_var, &Value::Str("spot".to_string())) {
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
let __ws_arg_0 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_asset_pairs_asset_pair_name_ticker(&[__ws_arg_0]).await;
//
// {
// "code":0,
// "data":{
// "asset_pair_name":"ETH-BTC",
// "bid":{"price":"0.021593","order_count":1,"quantity":"0.20936"},
// "ask":{"price":"0.021613","order_count":1,"quantity":"2.87064"},
// "open":"0.021795",
// "high":"0.021795",
// "low":"0.021471",
// "close":"0.021613",
// "volume":"117078.90431",
// "daily_change":"-0.000182"
// }
// }
//
let mut ticker: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_ticker(ticker.clone(), &[market.clone()]);
} else {
let mut tickers: Value = self.fetch_tickers(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
return self.safe_value(tickers.clone(), symbol.clone(), &[]);
}
Value::Null
}
/*
* @method
* @name bigone#fetchTickers
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
* @see https://open.big.one/docs/spot_tickers.html
* @param {string[]} [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://docs.ccxt.com/?id=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 market: Value = Value::Null;
let mut symbol: Value = self.safe_string(symbols.clone(), Value::Int(0), &[]);
if !is_equal(&symbol, &Value::Null) {
market = self.market(symbol.clone());
}
let mut type_var: Value = Value::Null;
{ let __destr_tmp = self.handle_market_type_and_params(Value::Str("fetchTickers".to_string()), &[market.clone(), params.clone()]); type_var = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
let mut isSpot: bool = is_equal(&type_var, &Value::Str("spot".to_string()));
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
symbols = self.market_symbols(&[symbols.clone()]);
let mut data: Value = Value::Null;
if is_true(&isSpot) {
if !is_equal(&symbols, &Value::Null) {
let mut ids: Value = self.market_ids(&[symbols.clone()]);
add_element_to_object(&mut request, &Value::Str("pair_names".to_string()), join(&ids, &Value::Str(",".to_string())));
}
let __ws_arg_1 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_asset_pairs_tickers(&[__ws_arg_1]).await;
//
// {
// "code": 0,
// "data": [
// {
// "asset_pair_name": "PCX-BTC",
// "bid": {
// "price": "0.000234",
// "order_count": 1,
// "quantity": "0.518"
// },
// "ask": {
// "price": "0.0002348",
// "order_count": 1,
// "quantity": "2.348"
// },
// "open": "0.0002343",
// "high": "0.0002348",
// "low": "0.0002162",
// "close": "0.0002348",
// "volume": "12887.016",
// "daily_change": "0.0000005"
// },
// ...
// ]
// }
//
data = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
} else {
let mut instruments: Value = self.contract_public_get_instruments(&[params.clone()]).await;
data = self.to_array(instruments.clone());
}
let mut tickers: Value = self.parse_tickers(data.clone(), &[symbols.clone()]);
return self.filter_by_array_tickers(tickers.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
Value::Null
}
/*
* @method
* @name bigone#fetchTime
* @description fetches the current integer timestamp in milliseconds from the exchange server
* @see https://open.big.one/docs/spot_ping.html
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {int} the current integer timestamp in milliseconds from the exchange server
*/
pub async fn fetch_time(&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_ping(&[params.clone()]).await;
//
// {
// "data": {
// "timestamp": 1527665262168391000
// }
// }
//
let mut data: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut timestamp: Value = self.safe_integer_k(data.clone(), "Timestamp", &[]);
if is_equal(×tamp, &Value::Null) {
panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" fetchTime() missing timestamp".to_string()))));
}
return self.parse_to_int(divide(×tamp, &Value::Int(1000000)));
Value::Null
}
/*
* @method
* @name bigone#fetchOrderBook
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
* @see https://open.big.one/docs/contract_misc.html#get-orderbook-snapshot
* @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
* @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 response: Value = Value::Null;
if is_equal(&get_value(&market, &Value::Str("contract".to_string())), &Value::Bool(true)) {
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
let __ws_arg_2 = self.extend(request.clone(), &[params.clone()]);
response = self.contract_public_get_depth_symbol_snapshot(&[__ws_arg_2]).await;
return self.parse_contract_order_book(response.clone(), get_value(&market, &Value::Str("symbol".to_string())), &[limit.clone()]);
} else {
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone()); // default 50, max 200
}
let __ws_arg_3 = self.extend(request.clone(), &[params.clone()]);
response = self.public_get_asset_pairs_asset_pair_name_depth(&[__ws_arg_3]).await;
//
// {
// "code":0,
// "data": {
// "asset_pair_name": "EOS-BTC",
// "bids": [
// { "price": "42", "order_count": 4, "quantity": "23.33363711" }
// ],
// "asks": [
// { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
// ]
// }
// }
//
let mut orderbook: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_order_book(orderbook.clone(), get_value(&market, &Value::Str("symbol".to_string())), &[Value::Null, Value::Str("bids".to_string()), Value::Str("asks".to_string()), Value::Str("price".to_string()), Value::Str("quantity".to_string())]);
}
Value::Null
}
pub fn parse_contract_bids_asks(&self, mut bidsAsks: Value) -> Value {
let mut bidsAsksKeys: Value = object_keys(&bidsAsks);
let mut result: Value = Value::List(vec![]);
{
let mut i: Value = Value::Int(0);
let mut __for_first_242: bool = true;
while { if !__for_first_242 { i = add(&i, &Value::Int(1)); } __for_first_242 = false; is_less_than(&i, &get_array_length(&bidsAsksKeys)) } {
let mut price: Value = get_value(&bidsAsksKeys, &i);
let mut price: Value = get_value(&bidsAsksKeys, &i);
let mut amount: Value = get_value(&bidsAsks, &price);
let mut amount: Value = get_value(&bidsAsks, &price);
append_to_array(&mut result, Value::List(vec![self.parse_number(price.clone(), &[]), self.parse_number(amount.clone(), &[])]));
}
}
return result;
Value::Null
}
pub fn parse_contract_order_book(&self, mut orderbook: Value, mut symbol: Value, optional_args: &[Value]) -> Value {
let mut limit = get_arg(optional_args, 0, Value::Null);
let mut responseBids: Value = self.safe_value_k(orderbook.clone(), "bids", &[]);
let mut responseAsks: Value = self.safe_value_k(orderbook.clone(), "asks", &[]);
let mut bids: Value = self.parse_contract_bids_asks(responseBids.clone());
let mut asks: Value = self.parse_contract_bids_asks(responseAsks.clone());
return Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), symbol.clone());
m.insert("bids".to_string(), self.filter_by_limit(self.sort_by(bids.clone(), Value::Int(0), &[Value::Bool(true)]), &[limit.clone()]));
m.insert("asks".to_string(), self.filter_by_limit(self.sort_by(asks.clone(), Value::Int(0), &[]), &[limit.clone()]));
m.insert("timestamp".to_string(), Value::Null);
m.insert("datetime".to_string(), Value::Null);
m.insert("nonce".to_string(), Value::Null);
m
});
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 (public)
//
// {
// "id": 38199941,
// "price": "3378.67",
// "amount": "0.019812",
// "taker_side": "ASK",
// "created_at": "2019-01-29T06:05:56Z"
// }
//
// fetchMyTrades (private)
//
// {
// "id": 10854280,
// "asset_pair_name": "XIN-USDT",
// "price": "70",
// "amount": "1",
// "taker_side": "ASK",
// "maker_order_id": 58284908,
// "taker_order_id": 58284909,
// "maker_fee": "0.0008",
// "taker_fee": "0.07",
// "side": "SELF_TRADING",
// "inserted_at": "2019-04-16T12:00:01Z"
// },
//
// {
// "id": 10854263,
// "asset_pair_name": "XIN-USDT",
// "price": "75.7",
// "amount": "12.743149",
// "taker_side": "BID",
// "maker_order_id": null,
// "taker_order_id": 58284888,
// "maker_fee": null,
// "taker_fee": "0.0025486298",
// "side": "BID",
// "inserted_at": "2019-04-15T06:20:57Z"
// }
//
let mut timestamp: Value = self.parse8601(self.safe_string2(trade.clone(), Value::Str("created_at".to_string()), Value::Str("inserted_at".to_string()), &[]));
let mut priceString: Value = self.safe_string_k(trade.clone(), "price", &[]);
let mut amountString: Value = self.safe_string_k(trade.clone(), "amount", &[]);
let mut marketId: Value = self.safe_string_k(trade.clone(), "asset_pair_name", &[]);
market = self.safe_market(&[marketId.clone(), market.clone(), Value::Str("-".to_string())]);
let mut side: Value = self.safe_string_k(trade.clone(), "side", &[]);
let mut takerSide: Value = self.safe_string_k(trade.clone(), "taker_side", &[]);
let mut takerOrMaker: Value = Value::Null;
if is_true(&(!is_equal(&takerSide, &Value::Null))) && is_true(&(!is_equal(&side, &Value::Null))) && is_true(&(!is_equal(&side, &Value::Str("SELF_TRADING".to_string())))) {
takerOrMaker = ternary(is_true(&(is_equal(&takerSide, &side))), Value::Str("taker".to_string()), Value::Str("maker".to_string()));
}
if is_equal(&side, &Value::Null) {
// taker side is not related to buy/sell side
// the following code is probably a mistake
side = ternary(is_true(&(is_equal(&takerSide, &Value::Str("ASK".to_string())))), Value::Str("sell".to_string()), Value::Str("buy".to_string()));
} else {
if is_equal(&side, &Value::Str("BID".to_string())) {
side = Value::Str("buy".to_string());
} else if is_equal(&side, &Value::Str("ASK".to_string())) {
side = Value::Str("sell".to_string());
}
}
let mut makerOrderId: Value = self.safe_string_k(trade.clone(), "maker_order_id", &[]);
let mut takerOrderId: Value = self.safe_string_k(trade.clone(), "taker_order_id", &[]);
let mut orderId: Value = Value::Null;
if !is_equal(&makerOrderId, &Value::Null) {
orderId = makerOrderId.clone();
} else if !is_equal(&takerOrderId, &Value::Null) {
orderId = takerOrderId.clone();
}
let mut id: Value = self.safe_string_k(trade.clone(), "id", &[]);
let mut result: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m.insert("symbol".to_string(), get_value(&market, &Value::Str("symbol".to_string())));
m.insert("order".to_string(), orderId.clone());
m.insert("type".to_string(), Value::Str("limit".to_string()));
m.insert("side".to_string(), side.clone());
m.insert("takerOrMaker".to_string(), takerOrMaker.clone());
m.insert("price".to_string(), priceString.clone());
m.insert("amount".to_string(), amountString.clone());
m.insert("cost".to_string(), Value::Null);
m.insert("info".to_string(), trade.clone());
m
});
let mut makerCurrencyCode: Value = Value::Null;
let mut takerCurrencyCode: Value = Value::Null;
if !is_equal(&takerOrMaker, &Value::Null) {
if is_equal(&side, &Value::Str("buy".to_string())) {
if is_equal(&takerOrMaker, &Value::Str("maker".to_string())) {
makerCurrencyCode = get_value(&market, &Value::Str("base".to_string()));
takerCurrencyCode = get_value(&market, &Value::Str("quote".to_string()));
} else {
makerCurrencyCode = get_value(&market, &Value::Str("quote".to_string()));
takerCurrencyCode = get_value(&market, &Value::Str("base".to_string()));
}
} else {
if is_equal(&takerOrMaker, &Value::Str("maker".to_string())) {
makerCurrencyCode = get_value(&market, &Value::Str("quote".to_string()));
takerCurrencyCode = get_value(&market, &Value::Str("base".to_string()));
} else {
makerCurrencyCode = get_value(&market, &Value::Str("base".to_string()));
takerCurrencyCode = get_value(&market, &Value::Str("quote".to_string()));
}
}
} else if is_equal(&side, &Value::Str("SELF_TRADING".to_string())) {
if is_equal(&takerSide, &Value::Str("BID".to_string())) {
makerCurrencyCode = get_value(&market, &Value::Str("quote".to_string()));
takerCurrencyCode = get_value(&market, &Value::Str("base".to_string()));
} else if is_equal(&takerSide, &Value::Str("ASK".to_string())) {
makerCurrencyCode = get_value(&market, &Value::Str("base".to_string()));
takerCurrencyCode = get_value(&market, &Value::Str("quote".to_string()));
}
}
let mut makerFeeCost: Value = self.safe_string_k(trade.clone(), "maker_fee", &[]);
let mut takerFeeCost: Value = self.safe_string_k(trade.clone(), "taker_fee", &[]);
if !is_equal(&makerFeeCost, &Value::Null) {
let mut makerCode: Value = makerCurrencyCode.clone();
if !is_equal(&takerFeeCost, &Value::Null) {
let mut takerCode: Value = takerCurrencyCode.clone();
add_element_to_object(&mut result, &Value::Str("fees".to_string()), Value::List(vec![Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), makerFeeCost.clone());
m.insert("currency".to_string(), makerCode.clone());
m
}), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), takerFeeCost.clone());
m.insert("currency".to_string(), takerCode.clone());
m
})]));
} else {
add_element_to_object(&mut result, &Value::Str("fee".to_string()), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), makerFeeCost.clone());
m.insert("currency".to_string(), makerCode.clone());
m
}));
}
} else if !is_equal(&takerFeeCost, &Value::Null) {
let mut takerCode2: Value = takerCurrencyCode.clone();
add_element_to_object(&mut result, &Value::Str("fee".to_string()), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), takerFeeCost.clone());
m.insert("currency".to_string(), takerCode2.clone());
m
}));
} else {
add_element_to_object(&mut result, &Value::Str("fee".to_string()), Value::Null);
}
return self.safe_trade(result.clone(), &[market.clone()]);
Value::Null
}
/*
* @method
* @name bigone#fetchTrades
* @description get the list of most recent trades for a particular symbol
* @see https://open.big.one/docs/spot_asset_pair_trade.html
* @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://docs.ccxt.com/?id=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());
if is_equal(&get_value(&market, &Value::Str("contract".to_string())), &Value::Bool(true)) {
panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTrades () can only fetch trades for spot markets".to_string()))));
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
let __ws_arg_4 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_asset_pairs_asset_pair_name_trades(&[__ws_arg_4]).await;
//
// {
// "code": 0,
// "data": [
// {
// "id": 38199941,
// "price": "3378.67",
// "amount": "0.019812",
// "taker_side": "ASK",
// "created_at": "2019-01-29T06:05:56Z"
// },
// {
// "id": 38199934,
// "price": "3376.14",
// "amount": "0.019384",
// "taker_side": "ASK",
// "created_at": "2019-01-29T06:05:40Z"
// }
// ]
// }
//
let mut trades: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_trades(trades.clone(), &[market.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.parse8601(self.safe_string_k(ohlcv.clone(), "time", &[])), self.safe_number_k(ohlcv.clone(), "open", &[]), self.safe_number_k(ohlcv.clone(), "high", &[]), self.safe_number_k(ohlcv.clone(), "low", &[]), self.safe_number_k(ohlcv.clone(), "close", &[]), self.safe_number_k(ohlcv.clone(), "volume", &[])]);
Value::Null
}
/*
* @method
* @name bigone#fetchOHLCV
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
* @see https://open.big.one/docs/spot_asset_pair_candle.html
* @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
* @param {int} [params.until] timestamp in ms of the earliest candle to fetch
* @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());
if is_equal(&get_value(&market, &Value::Str("contract".to_string())), &Value::Bool(true)) {
panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOHLCV () can only fetch ohlcvs for spot markets".to_string()))));
}
let mut until: Value = self.safe_integer_k(params.clone(), "until", &[]);
let mut untilIsDefined: bool = !is_equal(&until, &Value::Null);
let mut sinceIsDefined: bool = !is_equal(&since, &Value::Null);
if is_equal(&limit, &Value::Null) {
limit = ternary(is_true(&(is_true(&sinceIsDefined) && is_true(&untilIsDefined))), Value::Int(500), Value::Int(100)); // default 100, max 500, if since and limit defined then fetch all the candles between them unless it exceeds the max of 500
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m.insert("period".to_string(), self.safe_string(self.timeframes.clone(), timeframe.clone(), &[timeframe.clone()]));
m.insert("limit".to_string(), limit.clone());
m
});
if is_true(&sinceIsDefined) {
// const start = this.parseToInt (since / 1000);
let mut duration: Value = self.parse_timeframe(timeframe.clone());
let mut endByLimit: Value = self.sum(&[since.clone(), multiply(&multiply(&limit, &duration), &Value::Int(1000))]);
if is_true(&untilIsDefined) {
add_element_to_object(&mut request, &Value::Str("time".to_string()), self.iso8601(crate::runtime::Math::min(&endByLimit, &add(&until, &Value::Int(1)))));
} else {
add_element_to_object(&mut request, &Value::Str("time".to_string()), self.iso8601(endByLimit.clone()));
}
} else if is_true(&untilIsDefined) {
add_element_to_object(&mut request, &Value::Str("time".to_string()), self.iso8601(add(&until, &Value::Int(1))));
}
params = self.omit(params.clone(), Value::Str("until".to_string()), &[]);
let __ws_arg_5 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_asset_pairs_asset_pair_name_candles(&[__ws_arg_5]).await;
//
// {
// "code": 0,
// "data": [
// {
// "close": "0.021656",
// "high": "0.021658",
// "low": "0.021652",
// "open": "0.021652",
// "time": "2019-11-21T09:30:00Z",
// "volume": "53.08664"
// },
// {
// "close": "0.021652",
// "high": "0.021656",
// "low": "0.021652",
// "open": "0.021656",
// "time": "2019-11-21T09:29:00Z",
// "volume": "88.39861"
// },
// ]
// }
//
let mut data: Value = self.safe_list_k(response.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_balance(&self, mut response: Value) -> Value {
let mut result: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), response.clone());
m.insert("timestamp".to_string(), Value::Null);
m.insert("datetime".to_string(), Value::Null);
m
});
let mut balances: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
{
let mut i: Value = Value::Int(0);
let mut __for_first_243: bool = true;
while { if !__for_first_243 { i = add(&i, &Value::Int(1)); } __for_first_243 = false; is_less_than(&i, &get_array_length(&balances)) } {
let mut balance: Value = get_value(&balances, &i);
let mut balance: Value = get_value(&balances, &i);
let mut symbol: Value = self.safe_string_k(balance.clone(), "asset_symbol", &[]);
let mut code: Value = self.safe_currency_code(symbol.clone(), &[]);
let mut account: Value = self.account();
add_element_to_object(&mut account, &Value::Str("total".to_string()), self.safe_string_k(balance.clone(), "balance", &[]));
add_element_to_object(&mut account, &Value::Str("used".to_string()), self.safe_string_k(balance.clone(), "locked_balance", &[]));
if !is_equal(&code, &Value::Null) {
add_element_to_object(&mut result, &code, account.clone());
}
}
}
return self.safe_balance(result.clone());
Value::Null
}
/*
* @method
* @name bigone#fetchBalance
* @description query for balance and get the amount of funds available for trading or funds locked in orders
* @see https://open.big.one/docs/fund_accounts.html
* @see https://open.big.one/docs/spot_accounts.html
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=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 type_var: Value = self.safe_string_k(params.clone(), "type", &[Value::Str("".to_string())]);
params = self.omit(params.clone(), Value::Str("type".to_string()), &[]);
let mut response: Value = Value::Null;
if is_equal(&type_var, &Value::Str("funding".to_string())) || is_equal(&type_var, &Value::Str("fund".to_string())) {
response = self.private_get_fund_accounts(&[params.clone()]).await;
} else {
response = self.private_get_accounts(&[params.clone()]).await;
}
return self.parse_balance(response.clone());
Value::Null
}
pub fn parse_type(&self, mut type_var: Value) -> Value {
let mut types: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("STOP_LIMIT".to_string(), Value::Str("limit".to_string()));
m.insert("STOP_MARKET".to_string(), Value::Str("market".to_string()));
m.insert("LIMIT".to_string(), Value::Str("limit".to_string()));
m.insert("MARKET".to_string(), Value::Str("market".to_string()));
m
});
return self.safe_string(types.clone(), type_var.clone(), &[type_var.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);
//
// {
// "id": "42154072252",
// "asset_pair_name": "SOL-USDT",
// "price": "20",
// "amount": "0.5",
// "filled_amount": "0",
// "avg_deal_price": "0",
// "side": "ASK",
// "state": "PENDING",
// "created_at": "2023-09-13T03:42:00Z",
// "updated_at": "2023-09-13T03:42:00Z",
// "type": "LIMIT",
// "stop_price": "0",
// "immediate_or_cancel": false,
// "post_only": false,
// "client_order_id": ''
// }
//
let mut id: Value = self.safe_string_k(order.clone(), "id", &[]);
let mut marketId: Value = self.safe_string_k(order.clone(), "asset_pair_name", &[]);
let mut symbol: Value = self.safe_symbol(marketId.clone(), &[market.clone(), Value::Str("-".to_string())]);
let mut timestamp: Value = self.parse8601(self.safe_string_k(order.clone(), "created_at", &[]));
let mut side: Value = self.safe_string_k(order.clone(), "side", &[]);
if is_equal(&side, &Value::Str("BID".to_string())) {
side = Value::Str("buy".to_string());
} else {
side = Value::Str("sell".to_string());
}
let mut triggerPrice: Value = self.safe_string_k(order.clone(), "stop_price", &[]);
if is_true(&crate::precise::Precise::stringEq(&triggerPrice, &Value::Str("0".to_string()))) {
triggerPrice = Value::Null;
}
let mut immediateOrCancel: Value = self.safe_bool_k(order.clone(), "immediate_or_cancel", &[]);
let mut timeInForce: Value = Value::Null;
if is_equal(&immediateOrCancel, &Value::Bool(true)) {
timeInForce = Value::Str("IOC".to_string());
}
let mut type_var: Value = self.parse_type(self.safe_string_k(order.clone(), "type", &[]));
let mut price: Value = self.safe_string_k(order.clone(), "price", &[]);
let mut amount: Value = Value::Null;
let mut filled: Value = Value::Null;
let mut cost: Value = Value::Null;
if is_equal(&type_var, &Value::Str("market".to_string())) && is_equal(&side, &Value::Str("buy".to_string())) {
cost = self.safe_string_k(order.clone(), "filled_amount", &[]);
} else {
amount = self.safe_string_k(order.clone(), "amount", &[]);
filled = self.safe_string_k(order.clone(), "filled_amount", &[]);
}
return self.safe_order(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), order.clone());
m.insert("id".to_string(), id.clone());
m.insert("clientOrderId".to_string(), self.safe_string_k(order.clone(), "client_order_id", &[]));
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m.insert("lastTradeTimestamp".to_string(), self.parse8601(self.safe_string_k(order.clone(), "updated_at", &[])));
m.insert("symbol".to_string(), symbol.clone());
m.insert("type".to_string(), type_var.clone());
m.insert("timeInForce".to_string(), timeInForce.clone());
m.insert("postOnly".to_string(), self.safe_bool_k(order.clone(), "post_only", &[]));
m.insert("side".to_string(), side.clone());
m.insert("price".to_string(), price.clone());
m.insert("triggerPrice".to_string(), triggerPrice.clone());
m.insert("amount".to_string(), amount.clone());
m.insert("cost".to_string(), cost.clone());
m.insert("average".to_string(), self.safe_string_k(order.clone(), "avg_deal_price", &[]));
m.insert("filled".to_string(), filled.clone());
m.insert("remaining".to_string(), Value::Null);
m.insert("status".to_string(), self.parse_order_status(self.safe_string_k(order.clone(), "state", &[])));
m.insert("fee".to_string(), Value::Null);
m.insert("trades".to_string(), Value::Null);
m
}), &[market.clone()]);
Value::Null
}
/*
* @method
* @name bigone#createMarketBuyOrderWithCost
* @description create a market buy order by providing the symbol and cost
* @see https://open.big.one/docs/spot_orders.html#create-order
* @param {string} symbol unified symbol of the market to create an order in
* @param {float} cost how much you want to trade in units of the quote currency
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
*/
pub async fn create_market_buy_order_with_cost(&mut self, mut symbol: Value, mut cost: 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());
if !is_equal(&get_value(&market, &Value::Str("spot".to_string())), &Value::Bool(true)) {
panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createMarketBuyOrderWithCost() supports spot orders only".to_string()))));
}
add_element_to_object(&mut params, &Value::Str("createMarketBuyOrderRequiresPrice".to_string()), Value::Bool(false));
return self.create_order(symbol.clone(), Value::Str("market".to_string()), Value::Str("buy".to_string()), cost.clone(), &[Value::Null, params.clone()]).await;
Value::Null
}
/*
* @method
* @name bigone#createOrder
* @description create a trade order
* @see https://open.big.one/docs/spot_orders.html#create-order
* @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
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
*
* EXCHANGE SPECIFIC PARAMETERS
* @param {string} [params.operator] *stop order only* GTE or LTE (default)
* @param {string} [params.client_order_id] must match ^[a-zA-Z0-9-_]{1,36}$ this regex. client_order_id is unique in 24 hours, If created 24 hours later and the order closed, it will be released and can be reused
* @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=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 isBuy: bool = is_equal(&side, &Value::Str("buy".to_string()));
let mut requestSide: Value = ternary(is_true(&isBuy), Value::Str("BID".to_string()), Value::Str("ASK".to_string()));
let mut uppercaseType: Value = to_upper(&type_var);
let mut isLimit: bool = is_equal(&uppercaseType, &Value::Str("LIMIT".to_string()));
let mut exchangeSpecificParam: Value = self.safe_bool_k(params.clone(), "post_only", &[Value::Bool(false)]);
let mut postOnly: Value = Value::Null;
{ let __destr_tmp = self.handle_post_only(Value::Bool(is_equal(&uppercaseType, &Value::Str("MARKET".to_string()))), Value::Bool(is_equal(&exchangeSpecificParam, &Value::Bool(true))), &[params.clone()]); postOnly = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
let mut triggerPrice: Value = self.safe_string_n(params.clone(), Value::List(vec![Value::Str("triggerPrice".to_string()), Value::Str("stopPrice".to_string()), Value::Str("stop_price".to_string())]), &[]);
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m.insert("side".to_string(), requestSide.clone());
m.insert("amount".to_string(), self.amount_to_precision(symbol.clone(), amount.clone()));
m
});
if is_true(&isLimit) || is_true(&(is_equal(&uppercaseType, &Value::Str("STOP_LIMIT".to_string())))) {
add_element_to_object(&mut request, &Value::Str("price".to_string()), self.price_to_precision(symbol.clone(), price.clone()));
if is_true(&isLimit) {
let mut timeInForce: Value = self.safe_string_k(params.clone(), "timeInForce", &[]);
if is_equal(&timeInForce, &Value::Str("IOC".to_string())) {
add_element_to_object(&mut request, &Value::Str("immediate_or_cancel".to_string()), Value::Bool(true));
}
if is_equal(&postOnly, &Value::Bool(true)) {
add_element_to_object(&mut request, &Value::Str("post_only".to_string()), Value::Bool(true));
}
}
add_element_to_object(&mut request, &Value::Str("amount".to_string()), self.amount_to_precision(symbol.clone(), amount.clone()));
} else {
if is_true(&isBuy) {
let mut createMarketBuyOrderRequiresPrice: Value = Value::Null;
{ let __destr_tmp = self.handle_option_and_params(params.clone(), Value::Str("createOrder".to_string()), Value::Str("createMarketBuyOrderRequiresPrice".to_string()), &[Value::Bool(true)]); createMarketBuyOrderRequiresPrice = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
let mut cost: Value = self.safe_number_k(params.clone(), "cost", &[]);
params = self.omit(params.clone(), Value::Str("cost".to_string()), &[]);
if is_true(&createMarketBuyOrderRequiresPrice) {
if is_true(&(is_equal(&price, &Value::Null))) && is_true(&(is_equal(&cost, &Value::Null))) {
panic!("{}", crate::exchange_errors::invalid_order(add(&self.id, &Value::Str(" createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument".to_string()))));
} else {
let mut amountString: Value = self.number_to_string(amount.clone());
let mut priceString: Value = self.number_to_string(price.clone());
let mut quoteAmount: Value = self.parse_to_numeric(crate::precise::Precise::stringMul(&amountString, &priceString));
let mut costRequest: Value = ternary(is_true(&(!is_equal(&cost, &Value::Null))), cost.clone(), quoteAmount.clone());
add_element_to_object(&mut request, &Value::Str("amount".to_string()), self.cost_to_precision(symbol.clone(), costRequest.clone()));
}
} else {
add_element_to_object(&mut request, &Value::Str("amount".to_string()), self.cost_to_precision(symbol.clone(), amount.clone()));
}
} else {
add_element_to_object(&mut request, &Value::Str("amount".to_string()), self.amount_to_precision(symbol.clone(), amount.clone()));
}
}
if !is_equal(&triggerPrice, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("stop_price".to_string()), self.price_to_precision(symbol.clone(), triggerPrice.clone()));
add_element_to_object(&mut request, &Value::Str("operator".to_string()), ternary(is_true(&isBuy), Value::Str("GTE".to_string()), Value::Str("LTE".to_string())));
if is_true(&isLimit) {
uppercaseType = Value::Str("STOP_LIMIT".to_string());
} else if is_equal(&uppercaseType, &Value::Str("MARKET".to_string())) {
uppercaseType = Value::Str("STOP_MARKET".to_string());
}
}
add_element_to_object(&mut request, &Value::Str("type".to_string()), uppercaseType.clone());
let mut clientOrderId: Value = self.safe_string_k(params.clone(), "clientOrderId", &[]);
if !is_equal(&clientOrderId, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("client_order_id".to_string()), clientOrderId.clone());
}
params = self.omit(params.clone(), Value::List(vec![Value::Str("stop_price".to_string()), Value::Str("stopPrice".to_string()), Value::Str("triggerPrice".to_string()), Value::Str("timeInForce".to_string()), Value::Str("clientOrderId".to_string())]), &[]);
let __ws_arg_6 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_orders(&[__ws_arg_6]).await;
//
// {
// "id": 10,
// "asset_pair_name": "EOS-BTC",
// "price": "10.00",
// "amount": "10.00",
// "filled_amount": "9.0",
// "avg_deal_price": "12.0",
// "side": "ASK",
// "state": "FILLED",
// "created_at":"2019-01-29T06:05:56Z",
// "updated_at":"2019-01-29T06:05:56Z"
// }
//
let mut order: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_order(order.clone(), &[market.clone()]);
Value::Null
}
/*
* @method
* @name bigone#cancelOrder
* @description cancels an open order
* @see https://open.big.one/docs/spot_orders.html#cancel-order
* @param {string} id order id
* @param {string} symbol Not used by bigone cancelOrder ()
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=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_7 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_orders_id_cancel(&[__ws_arg_7]).await;
// {
// "id": 10,
// "asset_pair_name": "EOS-BTC",
// "price": "10.00",
// "amount": "10.00",
// "filled_amount": "9.0",
// "avg_deal_price": "12.0",
// "side": "ASK",
// "state": "CANCELLED",
// "created_at":"2019-01-29T06:05:56Z",
// "updated_at":"2019-01-29T06:05:56Z"
// }
let mut order: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_order(order.clone(), &[]);
Value::Null
}
/*
* @method
* @name bigone#cancelAllOrders
* @description cancel all open orders
* @see https://open.big.one/docs/spot_orders.html#cancel-all-orders
* @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=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 = self.market(symbol.clone());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
let __ws_arg_8 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_orders_cancel(&[__ws_arg_8]).await;
//
// {
// "code":0,
// "data": {
// "cancelled":[
// 58272370,
// 58272377
// ],
// "failed": []
// }
// }
//
let mut data: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut cancelled: Value = self.safe_list_k(data.clone(), "cancelled", &[Value::List(vec![])]);
let mut failed: Value = self.safe_list_k(data.clone(), "failed", &[Value::List(vec![])]);
let mut result: Value = Value::List(vec![]);
{
let mut i: Value = Value::Int(0);
let mut __for_first_244: bool = true;
while { if !__for_first_244 { i = add(&i, &Value::Int(1)); } __for_first_244 = false; is_less_than(&i, &get_array_length(&cancelled)) } {
let mut orderId: Value = get_value(&cancelled, &i);
let mut orderId: Value = get_value(&cancelled, &i);
append_to_array(&mut result, self.safe_order(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), orderId.clone());
m.insert("id".to_string(), orderId.clone());
m.insert("status".to_string(), Value::Str("canceled".to_string()));
m
}), &[]));
}
}
{
let mut i: Value = Value::Int(0);
let mut __for_first_245: bool = true;
while { if !__for_first_245 { i = add(&i, &Value::Int(1)); } __for_first_245 = false; is_less_than(&i, &get_array_length(&failed)) } {
let mut orderId: Value = get_value(&failed, &i);
let mut orderId: Value = get_value(&failed, &i);
append_to_array(&mut result, self.safe_order(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), orderId.clone());
m.insert("id".to_string(), orderId.clone());
m.insert("status".to_string(), Value::Str("failed".to_string()));
m
}), &[]));
}
}
return result;
Value::Null
}
/*
* @method
* @name bigone#fetchOrder
* @description fetches information on an order made by the user
* @see https://open.big.one/docs/spot_orders.html#get-one-order
* @param {string} id the order id
* @param {string} symbol not used by bigone fetchOrder
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=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 __ws_arg_9 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_orders_id(&[__ws_arg_9]).await;
let mut order: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_order(order.clone(), &[]);
Value::Null
}
/*
* @method
* @name bigone#fetchOrders
* @description fetches information on multiple orders made by the user
* @see https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
* @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 order structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=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(&symbol, &Value::Null) {
panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" fetchOrders() requires a symbol argument".to_string()))));
}
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("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone()); // default 20, max 200
}
let __ws_arg_10 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_orders(&[__ws_arg_10]).await;
//
// {
// "code":0,
// "data": [
// {
// "id": 10,
// "asset_pair_name": "ETH-BTC",
// "price": "10.00",
// "amount": "10.00",
// "filled_amount": "9.0",
// "avg_deal_price": "12.0",
// "side": "ASK",
// "state": "FILLED",
// "created_at":"2019-01-29T06:05:56Z",
// "updated_at":"2019-01-29T06:05:56Z",
// },
// ],
// "page_token":"dxzef",
// }
//
let mut orders: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_orders(orders.clone(), &[market.clone(), since.clone(), limit.clone()]);
Value::Null
}
/*
* @method
* @name bigone#fetchMyTrades
* @description fetch all trades made by the user
* @see https://open.big.one/docs/spot_trade.html#trades-of-user
* @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
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=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(&symbol, &Value::Null) {
panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" fetchMyTrades() requires a symbol argument".to_string()))));
}
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("asset_pair_name".to_string(), get_value(&market, &Value::Str("id".to_string())));
m
});
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone()); // default 20, max 200
}
let __ws_arg_11 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_trades(&[__ws_arg_11]).await;
//
// {
// "code": 0,
// "data": [
// {
// "id": 10854280,
// "asset_pair_name": "XIN-USDT",
// "price": "70",
// "amount": "1",
// "taker_side": "ASK",
// "maker_order_id": 58284908,
// "taker_order_id": 58284909,
// "maker_fee": "0.0008",
// "taker_fee": "0.07",
// "side": "SELF_TRADING",
// "inserted_at": "2019-04-16T12:00:01Z"
// },
// {
// "id": 10854263,
// "asset_pair_name": "XIN-USDT",
// "price": "75.7",
// "amount": "12.743149",
// "taker_side": "BID",
// "maker_order_id": null,
// "taker_order_id": 58284888,
// "maker_fee": null,
// "taker_fee": "0.0025486298",
// "side": "BID",
// "inserted_at": "2019-04-15T06:20:57Z"
// }
// ],
// "page_token":"dxfv"
// }
//
let mut trades: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_trades(trades.clone(), &[market.clone(), since.clone(), limit.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("PENDING".to_string(), Value::Str("open".to_string()));
m.insert("FILLED".to_string(), Value::Str("closed".to_string()));
m.insert("CANCELLED".to_string(), Value::Str("canceled".to_string()));
m
});
return self.safe_string(statuses.clone(), status.clone(), &[]);
Value::Null
}
/*
* @method
* @name bigone#fetchOpenOrders
* @description fetch all unfilled currently open orders
* @see https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
* @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 orders structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=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
}));
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("state".to_string(), Value::Str("PENDING".to_string()));
m
});
let __ws_arg_12 = self.extend(request.clone(), &[params.clone()]);
return self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), __ws_arg_12]).await;
Value::Null
}
/*
* @method
* @name bigone#fetchClosedOrders
* @description fetches information on multiple closed orders made by the user
* @see https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
* @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 order structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=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
}));
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("state".to_string(), Value::Str("FILLED".to_string()));
m
});
let __ws_arg_13 = self.extend(request.clone(), &[params.clone()]);
return self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), __ws_arg_13]).await;
Value::Null
}
pub fn nonce(&self) -> Value {
let mut exchangeTimeCorrection: Value = multiply(&self.safe_integer_k(self.options.clone(), "exchangeMillisecondsCorrection", &[Value::Int(0)]), &Value::Int(1000000));
return self.sum(&[multiply(&self.microseconds(), &Value::Int(1000)), exchangeTimeCorrection.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 query: Value = self.omit(params.clone(), self.extract_params(path.clone()), &[]);
let mut baseUrl: Value = self.implode_hostname(get_value(&get_value(&self.urls, &Value::Str("api".to_string())), &api));
let mut url: Value = add(&add(&baseUrl, &Value::Str("/".to_string())), &self.implode_params(path.clone(), params.clone()));
headers = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
if is_equal(&api, &Value::Str("public".to_string())) || is_equal(&api, &Value::Str("webExchange".to_string())) || is_equal(&api, &Value::Str("contractPublic".to_string())) {
if is_greater_than(&get_array_length(&object_keys(&query)), &Value::Int(0)) {
url = add(&url, &add(&Value::Str("?".to_string()), &self.urlencode(query.clone(), &[])));
}
} else {
self.check_required_credentials(&[]);
let mut nonce: Value = to_string_val(&self.nonce());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("type".to_string(), Value::Str("OpenAPIV2".to_string()));
m.insert("sub".to_string(), self.apiKey.clone());
m.insert("nonce".to_string(), nonce.clone());
m
});
let mut token: Value = jwt(request.clone(), self.encode(self.secret.clone()), Value::Str("sha256".to_string()), Value::Bool(false), Value::Null);
add_element_to_object(&mut headers, &Value::Str("Authorization".to_string()), add(&Value::Str("Bearer ".to_string()), &token));
if is_equal(&method, &Value::Str("GET".to_string())) {
if is_greater_than(&get_array_length(&object_keys(&query)), &Value::Int(0)) {
url = add(&url, &add(&Value::Str("?".to_string()), &self.urlencode(query.clone(), &[])));
}
} else if is_equal(&method, &Value::Str("POST".to_string())) {
add_element_to_object(&mut headers, &Value::Str("Content-Type".to_string()), Value::Str("application/json".to_string()));
body = self.json(query.clone());
}
}
add_element_to_object(&mut headers, &Value::Str("User-Agent".to_string()), add(&add(&add(&Value::Str("ccxt/".to_string()), &self.id), &Value::Str("-".to_string())), &self.version));
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
}
/*
* @method
* @name bigone#fetchDepositAddress
* @description fetch the deposit address for a currency associated with this account
* @see https://open.big.one/docs/spot_deposit.html#get-deposite-address-of-one-asset-of-user
* @param {string} code unified currency code
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an [address structure]{@link https://docs.ccxt.com/?id=address-structure}
*/
pub async fn fetch_deposit_address(&mut self, mut code: 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 currency: Value = self.currency(code.clone());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("asset_symbol".to_string(), get_value(¤cy, &Value::Str("id".to_string())));
m
});
let mut networkCodeparamsOmittedVariable = self.handle_network_code_and_params(params.clone());
let mut networkCode: Value = get_value(&networkCodeparamsOmittedVariable, &Value::Int(0));
let mut paramsOmitted: Value = get_value(&networkCodeparamsOmittedVariable, &Value::Int(1));
let __ws_arg_14 = self.extend(request.clone(), &[paramsOmitted.clone()]);
let mut response: Value = self.private_get_assets_asset_symbol_address(&[__ws_arg_14]).await;
//
// the actual response format is not the same as the documented one
// the data key contains an array in the actual response
//
// {
// "code":0,
// "message":"",
// "data":[
// {
// "id":5521878,
// "chain":"Bitcoin",
// "value":"1GbmyKoikhpiQVZ1C9sbF17mTyvBjeobVe",
// "memo":""
// }
// ]
// }
//
let mut data: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
let mut dataLength: Value = get_array_length(&data);
if is_less_than(&dataLength, &Value::Int(1)) {
panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" fetchDepositAddress() returned empty address response".to_string()))));
}
let mut chainsIndexedById: Value = self.index_by(data.clone(), Value::Str("chain".to_string()));
let mut selectedNetworkId: Value = self.select_network_id_from_raw_networks(code.clone(), networkCode.clone(), chainsIndexedById.clone());
let mut addressObject: Value = self.safe_dict(chainsIndexedById.clone(), selectedNetworkId.clone(), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut address: Value = self.safe_string_k(addressObject.clone(), "value", &[]);
let mut tag: Value = self.safe_string_k(addressObject.clone(), "memo", &[]);
self.check_address(&[address.clone()]);
return Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), response.clone());
m.insert("currency".to_string(), code.clone());
m.insert("network".to_string(), self.network_id_to_code(&[selectedNetworkId.clone(), code.clone()]));
m.insert("address".to_string(), address.clone());
m.insert("tag".to_string(), tag.clone());
m
});
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("WITHHOLD".to_string(), Value::Str("ok".to_string()));
m.insert("UNCONFIRMED".to_string(), Value::Str("pending".to_string()));
m.insert("CONFIRMED".to_string(), Value::Str("ok".to_string()));
m.insert("COMPLETED".to_string(), Value::Str("ok".to_string()));
m.insert("PENDING".to_string(), Value::Str("pending".to_string()));
m
});
return self.safe_string(statuses.clone(), status.clone(), &[status.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);
//
// fetchDeposits
//
// {
// "amount": "25.0",
// "asset_symbol": "BTS"
// "confirms": 100,
// "id": 5,
// "inserted_at": "2018-02-16T11:39:58.000Z",
// "is_internal": false,
// "kind": "default",
// "memo": "",
// "state": "WITHHOLD",
// "txid": "72e03037d144dae3d32b68b5045462b1049a0755",
// "updated_at": "2018-11-09T10:20:09.000Z",
// }
//
// fetchWithdrawals
//
// {
// "amount": "5",
// "asset_symbol": "ETH",
// "completed_at": "2018-03-15T16:13:45.610463Z",
// "customer_id": "10",
// "id": 10,
// "inserted_at": "2018-03-15T16:13:45.610463Z",
// "is_internal": true,
// "note": "2018-03-15T16:13:45.610463Z",
// "state": "CONFIRMED",
// "target_address": "0x4643bb6b393ac20a6175c713175734a72517c63d6f7"
// "txid": "0x4643bb6b393ac20a6175c713175734a72517c63d6f73a3ca90a15356f2e967da0",
// }
//
// withdraw
//
// {
// "id":1077391,
// "customer_id":1082679,
// "amount":"21.9000000000000000",
// "txid":"",
// "is_internal":false,
// "kind":"on_chain",
// "state":"PENDING",
// "inserted_at":"2020-06-03T00:50:57+00:00",
// "updated_at":"2020-06-03T00:50:57+00:00",
// "memo":"",
// "target_address":"rDYtYT3dBeuw376rvHqoZBKW3UmvguoBAf",
// "fee":"0.1000000000000000",
// "asset_symbol":"XRP"
// }
//
let mut currencyId: Value = self.safe_string_k(transaction.clone(), "asset_symbol", &[]);
let mut code: Value = self.safe_currency_code(currencyId.clone(), &[]);
let mut id: Value = self.safe_string_k(transaction.clone(), "id", &[]);
let mut amount: Value = self.safe_number_k(transaction.clone(), "amount", &[]);
let mut status: Value = self.parse_transaction_status(self.safe_string_k(transaction.clone(), "state", &[]));
let mut timestamp: Value = self.parse8601(self.safe_string_k(transaction.clone(), "inserted_at", &[]));
let mut updated: Value = self.parse8601(self.safe_string2(transaction.clone(), Value::Str("updated_at".to_string()), Value::Str("completed_at".to_string()), &[]));
let mut txid: Value = self.safe_string_k(transaction.clone(), "txid", &[]);
let mut address: Value = self.safe_string_k(transaction.clone(), "target_address", &[]);
let mut tag: Value = self.safe_string_k(transaction.clone(), "memo", &[]);
let mut type_var: Value = ternary(is_true(&(Value::Bool(in_op(&transaction, &Value::Str("customer_id".to_string()))))), Value::Str("withdrawal".to_string()), Value::Str("deposit".to_string()));
let mut internal: Value = self.safe_bool_k(transaction.clone(), "is_internal", &[]);
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(), Value::Null);
m.insert("addressFrom".to_string(), Value::Null);
m.insert("address".to_string(), Value::Null);
m.insert("addressTo".to_string(), address.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(), amount.clone());
m.insert("currency".to_string(), code.clone());
m.insert("status".to_string(), status.clone());
m.insert("updated".to_string(), updated.clone());
m.insert("fee".to_string(), Value::Null);
m.insert("comment".to_string(), Value::Null);
m.insert("internal".to_string(), internal.clone());
m
});
Value::Null
}
/*
* @method
* @name bigone#fetchDeposits
* @description fetch all deposits made to an account
* @see https://open.big.one/docs/spot_deposit.html#deposit-of-user
* @param {string} code unified currency code
* @param {int} [since] the earliest time in ms to fetch deposits for
* @param {int} [limit] the maximum number of deposits structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/?id=transaction-structure}
*/
pub async fn fetch_deposits(&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 request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut currency: Value = Value::Null;
if !is_equal(&code, &Value::Null) {
currency = self.currency(code.clone());
add_element_to_object(&mut request, &Value::Str("asset_symbol".to_string()), get_value(¤cy, &Value::Str("id".to_string())));
}
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone()); // default 50
}
let __ws_arg_15 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_deposits(&[__ws_arg_15]).await;
//
// {
// "code": 0,
// "page_token": "NQ==",
// "data": [
// {
// "id": 5,
// "amount": "25.0",
// "confirms": 100,
// "txid": "72e03037d144dae3d32b68b5045462b1049a0755",
// "is_internal": false,
// "inserted_at": "2018-02-16T11:39:58.000Z",
// "updated_at": "2018-11-09T10:20:09.000Z",
// "kind": "default",
// "memo": "",
// "state": "WITHHOLD",
// "asset_symbol": "BTS"
// }
// ]
// }
//
let mut deposits: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_transactions(deposits.clone(), &[currency.clone(), since.clone(), limit.clone()]);
Value::Null
}
/*
* @method
* @name bigone#fetchWithdrawals
* @description fetch all withdrawals made from an account
* @see https://open.big.one/docs/spot_withdrawal.html#get-withdrawals-of-user
* @param {string} code unified currency code
* @param {int} [since] the earliest time in ms to fetch withdrawals for
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/?id=transaction-structure}
*/
pub async fn fetch_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 request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut currency: Value = Value::Null;
if !is_equal(&code, &Value::Null) {
currency = self.currency(code.clone());
add_element_to_object(&mut request, &Value::Str("asset_symbol".to_string()), get_value(¤cy, &Value::Str("id".to_string())));
}
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone()); // default 50
}
let __ws_arg_16 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_withdrawals(&[__ws_arg_16]).await;
//
// {
// "code": 0,
// "data": [
// {
// "id": 10,
// "customer_id": "10",
// "asset_symbol": "ETH",
// "amount": "5",
// "state": "CONFIRMED",
// "note": "2018-03-15T16:13:45.610463Z",
// "txid": "0x4643bb6b393ac20a6175c713175734a72517c63d6f73a3ca90a15356f2e967da0",
// "completed_at": "2018-03-15T16:13:45.610463Z",
// "inserted_at": "2018-03-15T16:13:45.610463Z",
// "is_internal": true,
// "target_address": "0x4643bb6b393ac20a6175c713175734a72517c63d6f7"
// }
// ],
// "page_token":"dxvf"
// }
//
let mut withdrawals: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_transactions(withdrawals.clone(), &[currency.clone(), since.clone(), limit.clone()]);
Value::Null
}
/*
* @method
* @name bigone#transfer
* @description transfer currency internally between wallets on the same account
* @see https://open.big.one/docs/spot_transfer.html#transfer-of-user
* @param {string} code unified currency code
* @param {float} amount amount to transfer
* @param {string} fromAccount 'SPOT', 'FUND', or 'CONTRACT'
* @param {string} toAccount 'SPOT', 'FUND', or 'CONTRACT'
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure}
*/
pub async fn transfer(&mut self, mut code: Value, mut amount: Value, mut fromAccount: Value, mut toAccount: 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 currency: Value = self.currency(code.clone());
let mut accountsByType: Value = self.safe_dict_k(self.options.clone(), "accountsByType", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut fromId: Value = self.safe_string(accountsByType.clone(), fromAccount.clone(), &[fromAccount.clone()]);
let mut toId: Value = self.safe_string(accountsByType.clone(), toAccount.clone(), &[toAccount.clone()]);
let mut guid: Value = self.safe_string_k(params.clone(), "guid", &[self.uuid(&[])]);
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), get_value(¤cy, &Value::Str("id".to_string())));
m.insert("amount".to_string(), self.currency_to_precision(code.clone(), amount.clone(), &[]));
m.insert("from".to_string(), fromId.clone());
m.insert("to".to_string(), toId.clone());
m.insert("guid".to_string(), guid.clone());
m
});
let __ws_arg_17 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_transfer(&[__ws_arg_17]).await;
//
// {
// "code": 0,
// "data": null
// }
//
let mut transfer: Value = self.parse_transfer(response.clone(), &[currency.clone()]);
let mut transferOptions: Value = self.safe_dict_k(self.options.clone(), "transfer", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut fillResponseFromRequest: Value = self.safe_bool_k(transferOptions.clone(), "fillResponseFromRequest", &[Value::Bool(true)]);
if is_equal(&fillResponseFromRequest, &Value::Bool(true)) {
add_element_to_object(&mut transfer, &Value::Str("fromAccount".to_string()), fromAccount.clone());
add_element_to_object(&mut transfer, &Value::Str("toAccount".to_string()), toAccount.clone());
add_element_to_object(&mut transfer, &Value::Str("amount".to_string()), amount.clone());
add_element_to_object(&mut transfer, &Value::Str("id".to_string()), guid.clone());
}
return transfer;
Value::Null
}
pub fn parse_transfer(&self, mut transfer: Value, optional_args: &[Value]) -> Value {
let mut currency = get_arg(optional_args, 0, Value::Null);
//
// {
// "code": 0,
// "data": null
// }
//
let mut code: Value = self.safe_string_k(transfer.clone(), "code", &[]);
return Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), transfer.clone());
m.insert("id".to_string(), Value::Null);
m.insert("timestamp".to_string(), Value::Null);
m.insert("datetime".to_string(), Value::Null);
m.insert("currency".to_string(), Value::Null);
m.insert("amount".to_string(), Value::Null);
m.insert("fromAccount".to_string(), Value::Null);
m.insert("toAccount".to_string(), Value::Null);
m.insert("status".to_string(), self.parse_transfer_status(code.clone()));
m
});
Value::Null
}
pub fn parse_transfer_status(&self, mut status: Value) -> Value {
let mut statuses: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("0".to_string(), Value::Str("ok".to_string()));
m
});
return self.safe_string(statuses.clone(), status.clone(), &[Value::Str("failed".to_string())]);
Value::Null
}
/*
* @method
* @name bigone#withdraw
* @description make a withdrawal
* @see https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user
* @param {string} code unified currency code
* @param {float} amount the amount to withdraw
* @param {string} address the address to withdraw to
* @param {string} tag
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/?id=transaction-structure}
*/
pub async fn withdraw(&mut self, mut code: Value, mut amount: Value, mut address: Value, optional_args: &[Value]) -> Value {
let mut tag = get_arg(optional_args, 0, Value::Null);
let mut params = get_arg(optional_args, 1, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
{ let __destr_tmp = self.handle_withdraw_tag_and_params(tag.clone(), params.clone()); tag = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut currency: Value = self.currency(code.clone());
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), get_value(¤cy, &Value::Str("id".to_string())));
m.insert("target_address".to_string(), address.clone());
m.insert("amount".to_string(), self.currency_to_precision(code.clone(), amount.clone(), &[]));
m
});
if !is_equal(&tag, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("memo".to_string()), tag.clone());
}
let mut networkCode: Value = Value::Null;
{ let __destr_tmp = self.handle_network_code_and_params(params.clone()); networkCode = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
if !is_equal(&networkCode, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("gateway_name".to_string()), self.network_code_to_id(networkCode.clone(), &[get_value(¤cy, &Value::Str("code".to_string()))]));
}
// requires write permission on the wallet
let __ws_arg_18 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_withdrawals(&[__ws_arg_18]).await;
//
// {
// "code":0,
// "message":"",
// "data":{
// "id":1077391,
// "customer_id":1082679,
// "amount":"21.9000000000000000",
// "txid":"",
// "is_internal":false,
// "kind":"on_chain",
// "state":"PENDING",
// "inserted_at":"2020-06-03T00:50:57+00:00",
// "updated_at":"2020-06-03T00:50:57+00:00",
// "memo":"",
// "target_address":"rDYtYT3dBeuw376rvHqoZBKW3UmvguoBAf",
// "fee":"0.1000000000000000",
// "asset_symbol":"XRP"
// }
// }
//
let mut data: Value = self.safe_dict_k(response.clone(), "data", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_transaction(data.clone(), &[currency.clone()]);
Value::Null
}
pub fn handle_errors(&self, mut httpCode: 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;
}
//
// {"code":10013,"message":"Resource not found"}
// {"code":40004,"message":"invalid jwt"}
//
let mut code: Value = self.safe_string_k(response.clone(), "code", &[]);
let mut message: Value = self.safe_string_k(response.clone(), "message", &[]);
if is_true(&(!is_equal(&code, &Value::Str("0".to_string())))) && is_true(&(!is_equal(&code, &Value::Null))) {
let mut feedback: Value = add(&add(&self.id, &Value::Str(" ".to_string())), &body);
self.throw_exactly_matched_exception(get_value(&self.exceptions, &Value::Str("exact".to_string())), message.clone(), feedback.clone());
self.throw_exactly_matched_exception(get_value(&self.exceptions, &Value::Str("exact".to_string())), code.clone(), feedback.clone());
self.throw_broadly_matched_exception(get_value(&self.exceptions, &Value::Str("broad".to_string())), message.clone(), feedback.clone());
panic!("{}", crate::exchange_errors::exchange_error(feedback));
}
return Value::Null;
Value::Null
}
}