// 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 HollaexCore {
pub exchange: crate::exchange::Exchange,
}
impl HollaexCore {
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 = HollaexCore::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 HollaexCore {
fn parse_ticker(&self, ticker: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_ticker(self, ticker, &[market.clone()])
}
fn parse_trade(&self, trade: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_trade(self, trade, &[market.clone()])
}
fn parse_order(&self, order: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_order(self, order, &[market.clone()])
}
fn parse_ohlcv(&self, ohlcv: crate::Value, market: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_ohlcv(self, ohlcv, &[market.clone()])
}
fn parse_balance(&self, response: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_balance(self, response)
}
fn parse_deposit_address(&self, depositAddress: crate::Value, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_deposit_address(self, depositAddress, &[currency.clone()])
}
fn parse_currency(&self, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_currency(self, currency)
}
fn parse_transaction(&self, transaction: crate::Value, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_transaction(self, transaction, &[currency.clone()])
}
fn parse_deposit_withdraw_fee(&self, fee: crate::Value, currency: crate::Value) -> crate::Value {
// Forward to the inherent method on HollaexCore.
HollaexCore::parse_deposit_withdraw_fee(self, fee, &[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 HollaexCore.
HollaexCore::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 HollaexCore.
HollaexCore::handle_errors(self, code, reason, url, method, headers, body, response, request_headers, request_body)
}
}
impl crate::exchange_generated::ExchangeBase for HollaexCore {
fn call_dynamic<'a>(&'a mut self, method: &'a str, args: Vec<crate::Value>)
-> std::pin::Pin<Box<dyn std::future::Future<Output = crate::Value> + Send + 'a>>
{
Box::pin(async move {
match method {
"cancel_all_orders" => self.cancel_all_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"cancel_order" => self.cancel_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"create_order" => self.create_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_balance" => self.fetch_balance(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_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_addresses" => self.fetch_deposit_addresses(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_deposit_withdraw_fees" => self.fetch_deposit_withdraw_fees(&args.get(0..).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_order" => self.fetch_open_order(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_order_books" => self.fetch_order_books(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_orders" => self.fetch_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_ticker" => self.fetch_ticker(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_tickers" => self.fetch_tickers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_trades" => self.fetch_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_trading_fees" => self.fetch_trading_fees(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
"fetch_withdrawal" => self.fetch_withdrawal(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)),
"parse_balance" => self.parse_balance(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_currency" => self.parse_currency(args.get(0).cloned().unwrap_or(crate::Value::Null)),
"parse_deposit_address" => self.parse_deposit_address(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"parse_deposit_withdraw_fee" => self.parse_deposit_withdraw_fee(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"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_tickers" => self.parse_tickers(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()[..]),
"sign" => self.sign(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
"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 HollaexCore {
type Target = crate::exchange::Exchange;
fn deref(&self) -> &crate::exchange::Exchange { &self.exchange }
}
impl std::ops::DerefMut for HollaexCore {
fn deref_mut(&mut self) -> &mut crate::exchange::Exchange { &mut self.exchange }
}
impl HollaexCore {
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("hollaex".to_string()));
m.insert("name".to_string(), Value::Str("HollaEx".to_string()));
m.insert("countries".to_string(), Value::List(vec![Value::Str("KR".to_string())]));
m.insert("rateLimit".to_string(), Value::Int(250));
m.insert("version".to_string(), Value::Str("v2".to_string()));
m.insert("pro".to_string(), Value::Bool(true));
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::Null);
m.insert("swap".to_string(), Value::Bool(false));
m.insert("future".to_string(), Value::Bool(false));
m.insert("option".to_string(), Value::Bool(false));
m.insert("addMargin".to_string(), Value::Bool(false));
m.insert("cancelAllOrders".to_string(), Value::Bool(true));
m.insert("cancelOrder".to_string(), Value::Bool(true));
m.insert("createLimitBuyOrder".to_string(), Value::Bool(true));
m.insert("createLimitSellOrder".to_string(), Value::Bool(true));
m.insert("createMarketBuyOrder".to_string(), Value::Bool(true));
m.insert("createMarketSellOrder".to_string(), Value::Bool(true));
m.insert("createOrder".to_string(), Value::Bool(true));
m.insert("createPostOnlyOrder".to_string(), Value::Bool(true));
m.insert("createReduceOnlyOrder".to_string(), Value::Bool(false));
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("fetchBalance".to_string(), Value::Bool(true));
m.insert("fetchBorrowRateHistories".to_string(), Value::Bool(false));
m.insert("fetchBorrowRateHistory".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::Str("emulated".to_string()));
m.insert("fetchDepositAddresses".to_string(), Value::Bool(true));
m.insert("fetchDepositAddressesByNetwork".to_string(), Value::Bool(false));
m.insert("fetchDeposits".to_string(), Value::Bool(true));
m.insert("fetchDepositWithdrawFees".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("fetchIndexOHLCV".to_string(), Value::Bool(false));
m.insert("fetchIsolatedBorrowRate".to_string(), Value::Bool(false));
m.insert("fetchIsolatedBorrowRates".to_string(), Value::Bool(false));
m.insert("fetchLeverage".to_string(), Value::Bool(false));
m.insert("fetchMarginMode".to_string(), Value::Bool(false));
m.insert("fetchMarkets".to_string(), Value::Bool(true));
m.insert("fetchMarkOHLCV".to_string(), Value::Bool(false));
m.insert("fetchMyTrades".to_string(), Value::Bool(true));
m.insert("fetchOHLCV".to_string(), Value::Bool(true));
m.insert("fetchOpenInterestHistory".to_string(), Value::Bool(false));
m.insert("fetchOpenOrder".to_string(), Value::Bool(true));
m.insert("fetchOpenOrders".to_string(), Value::Bool(true));
m.insert("fetchOrder".to_string(), Value::Bool(true));
m.insert("fetchOrderBook".to_string(), Value::Bool(true));
m.insert("fetchOrderBooks".to_string(), Value::Bool(true));
m.insert("fetchOrders".to_string(), Value::Bool(true));
m.insert("fetchPosition".to_string(), Value::Bool(false));
m.insert("fetchPositionMode".to_string(), Value::Bool(false));
m.insert("fetchPositions".to_string(), Value::Bool(false));
m.insert("fetchPositionsRisk".to_string(), Value::Bool(false));
m.insert("fetchPremiumIndexOHLCV".to_string(), Value::Bool(false));
m.insert("fetchTicker".to_string(), Value::Bool(true));
m.insert("fetchTickers".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(true));
m.insert("fetchTransactions".to_string(), Value::Bool(false));
m.insert("fetchTransfer".to_string(), Value::Bool(false));
m.insert("fetchTransfers".to_string(), Value::Bool(false));
m.insert("fetchWithdrawal".to_string(), Value::Bool(true));
m.insert("fetchWithdrawals".to_string(), Value::Bool(true));
m.insert("reduceMargin".to_string(), Value::Bool(false));
m.insert("sandbox".to_string(), Value::Bool(true));
m.insert("setLeverage".to_string(), Value::Bool(false));
m.insert("setMarginMode".to_string(), Value::Bool(false));
m.insert("setPositionMode".to_string(), Value::Bool(false));
m.insert("transfer".to_string(), Value::Bool(false));
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("1m".to_string()));
m.insert("5m".to_string(), Value::Str("5m".to_string()));
m.insert("15m".to_string(), Value::Str("15m".to_string()));
m.insert("1h".to_string(), Value::Str("1h".to_string()));
m.insert("4h".to_string(), Value::Str("4h".to_string()));
m.insert("1d".to_string(), Value::Str("1d".to_string()));
m.insert("1w".to_string(), Value::Str("1w".to_string()));
m
}));
m.insert("urls".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("logo".to_string(), Value::Str("https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg".to_string()));
m.insert("test".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("rest".to_string(), Value::Str("https://api.sandbox.hollaex.com".to_string()));
m
}));
m.insert("api".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("rest".to_string(), Value::Str("https://api.hollaex.com".to_string()));
m
}));
m.insert("www".to_string(), Value::Str("https://hollaex.com".to_string()));
m.insert("doc".to_string(), Value::Str("https://apidocs.hollaex.com".to_string()));
m.insert("referral".to_string(), Value::Str("https://pro.hollaex.com/signup?affiliation_code=QSWA6G".to_string()));
m
}));
m.insert("precisionMode".to_string(), Value::Int(crate::runtime::TICK_SIZE));
m.insert("requiredCredentials".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("apiKey".to_string(), Value::Bool(true));
m.insert("secret".to_string(), Value::Bool(true));
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("health".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("constants".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("kit".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("tiers".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("ticker".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("tickers".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orderbook".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("orderbooks".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("chart".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("charts".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("minicharts".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("oracle/prices".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("quick-trade".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("udf/config".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("udf/history".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("udf/symbols".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("user".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("user/balance".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("user/deposits".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("user/withdrawals".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("user/withdrawal/fee".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("user/trades".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("order".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("user/withdrawal".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("order".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("order/all".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m.insert("order".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), Value::Int(1));
m
}));
m
}));
m
}));
m
}));
m.insert("features".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("spot".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("sandbox".to_string(), Value::Bool(true));
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(false));
m.insert("stopLossPrice".to_string(), Value::Bool(false));
m.insert("takeProfitPrice".to_string(), Value::Bool(false));
m.insert("attachedStopLossTakeProfit".to_string(), Value::Null);
m.insert("timeInForce".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("IOC".to_string(), Value::Bool(false));
m.insert("FOK".to_string(), Value::Bool(false));
m.insert("PO".to_string(), Value::Bool(true));
m.insert("GTD".to_string(), Value::Bool(false));
m
}));
m.insert("hedged".to_string(), Value::Bool(false));
m.insert("selfTradePrevention".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("leverage".to_string(), Value::Bool(false));
m.insert("marketBuyByCost".to_string(), Value::Bool(false));
m.insert("marketBuyRequiresPrice".to_string(), Value::Bool(false));
m.insert("iceberg".to_string(), Value::Bool(false));
m
}));
m.insert("createOrders".to_string(), Value::Null);
m.insert("fetchMyTrades".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("limit".to_string(), Value::Int(100));
m.insert("daysBack".to_string(), Value::Int(100000));
m.insert("untilDays".to_string(), Value::Int(100000));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOrder".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOpenOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("limit".to_string(), Value::Int(100));
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("limit".to_string(), Value::Int(100));
m.insert("daysBack".to_string(), Value::Int(100000));
m.insert("untilDays".to_string(), Value::Int(100000));
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchClosedOrders".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("marginMode".to_string(), Value::Bool(false));
m.insert("limit".to_string(), Value::Int(100));
m.insert("daysBack".to_string(), Value::Int(100000));
m.insert("daysBackCanceled".to_string(), Value::Int(1));
m.insert("untilDays".to_string(), Value::Int(100000));
m.insert("trigger".to_string(), Value::Bool(false));
m.insert("trailing".to_string(), Value::Bool(false));
m.insert("symbolRequired".to_string(), Value::Bool(false));
m
}));
m.insert("fetchOHLCV".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("limit".to_string(), Value::Int(1000));
m
}));
m
}));
m.insert("swap".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("linear".to_string(), Value::Null);
m.insert("inverse".to_string(), Value::Null);
m
}));
m.insert("future".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("linear".to_string(), Value::Null);
m.insert("inverse".to_string(), Value::Null);
m
}));
m
}));
m.insert("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("tierBased".to_string(), Value::Bool(true));
m.insert("percentage".to_string(), Value::Bool(true));
m.insert("taker".to_string(), Value::Float(0.001));
m.insert("maker".to_string(), Value::Float(0.001));
m
}));
m
}));
m.insert("exceptions".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("broad".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("API request is expired".to_string(), Value::Str("InvalidNonce".to_string()).clone());
m.insert("Invalid token".to_string(), Value::Str("AuthenticationError".to_string()).clone());
m.insert("Order not found".to_string(), Value::Str("OrderNotFound".to_string()).clone());
m.insert("Insufficient balance".to_string(), Value::Str("InsufficientFunds".to_string()).clone());
m.insert("Error 1001 - Order rejected. Order could not be submitted as this order was set to a post only order.".to_string(), Value::Str("OrderImmediatelyFillable".to_string()).clone());
m
}));
m.insert("exact".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("400".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("403".to_string(), Value::Str("AuthenticationError".to_string()).clone());
m.insert("404".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("405".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("410".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("429".to_string(), Value::Str("BadRequest".to_string()).clone());
m.insert("500".to_string(), Value::Str("NetworkError".to_string()).clone());
m.insert("503".to_string(), Value::Str("NetworkError".to_string()).clone());
m
}));
m
}));
m.insert("options".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("api-expires".to_string(), self.parse_to_int(divide(&self.timeout, &Value::Int(1000))));
m.insert("networks".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("BTC".to_string(), Value::Str("btc".to_string()));
m.insert("ETH".to_string(), Value::Str("eth".to_string()));
m.insert("ERC20".to_string(), Value::Str("eth".to_string()));
m.insert("TRX".to_string(), Value::Str("trx".to_string()));
m.insert("TRC20".to_string(), Value::Str("trx".to_string()));
m.insert("XRP".to_string(), Value::Str("xrp".to_string()));
m.insert("XLM".to_string(), Value::Str("xlm".to_string()));
m.insert("BNB".to_string(), Value::Str("bnb".to_string()));
m.insert("MATIC".to_string(), Value::Str("matic".to_string()));
m
}));
m.insert("networksById".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("eth".to_string(), Value::Str("ERC20".to_string()));
m.insert("ETH".to_string(), Value::Str("ERC20".to_string()));
m.insert("ERC20".to_string(), Value::Str("ERC20".to_string()));
m.insert("trx".to_string(), Value::Str("TRC20".to_string()));
m.insert("TRX".to_string(), Value::Str("TRC20".to_string()));
m.insert("TRC20".to_string(), Value::Str("TRC20".to_string()));
m
}));
m
}));
m
})]);
Value::Null
}
/*
* @method
* @name hollaex#fetchMarkets
* @description retrieves data on all markets for hollaex
* @see https://apidocs.hollaex.com/#constants
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} an array of objects representing market data
*/
pub async fn fetch_markets(&mut self, optional_args: &[Value]) -> Value {
let mut params = get_arg(optional_args, 0, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
let mut response: Value = self.public_get_constants(&[params.clone()]).await;
//
// {
// "coins": {
// "xmr": {
// "id": 7,
// "fullname": "Monero",
// "symbol": "xmr",
// "active": true,
// "allow_deposit": true,
// "allow_withdrawal": true,
// "withdrawal_fee": 0.02,
// "min": 0.001,
// "max": 100000,
// "increment_unit": 0.001,
// "deposit_limits": { '1': 0, '2': 0, '3': 0, '4': 0, "5": 0, "6": 0 },
// "withdrawal_limits": { '1': 10, '2': 15, '3': 100, '4': 100, '5': 200, '6': 300, '7': 350, '8': 400, "9": 500, "10": -1 },
// "created_at": "2019-12-09T07:14:02.720Z",
// "updated_at": "2020-01-16T12:12:53.162Z"
// },
// // ...
// },
// "pairs": {
// "btc-usdt": {
// "id": 2,
// "name": "btc-usdt",
// "pair_base": "btc",
// "pair_2": "usdt",
// "taker_fees": { '1': 0.3, '2': 0.25, '3': 0.2, '4': 0.18, '5': 0.1, '6': 0.09, '7': 0.08, '8': 0.06, "9": 0.04, "10": 0 },
// "maker_fees": { '1': 0.1, '2': 0.08, '3': 0.05, '4': 0.03, '5': 0, '6': 0, '7': 0, '8': 0, "9": 0, "10": 0 },
// "min_size": 0.0001,
// "max_size": 1000,
// "min_price": 100,
// "max_price": 100000,
// "increment_size": 0.0001,
// "increment_price": 0.05,
// "active": true,
// "created_at": "2019-12-09T07:15:54.537Z",
// "updated_at": "2019-12-09T07:15:54.537Z"
// },
// },
// "config": { tiers: 10 },
// "status": true
// }
//
let mut pairs: Value = self.safe_value_k(response.clone(), "pairs", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut keys: Value = object_keys(&pairs);
let mut result: Value = Value::List(vec![]);
{
let mut i: Value = Value::Int(0);
let mut __for_first_752: bool = true;
while { if !__for_first_752 { i = add(&i, &Value::Int(1)); } __for_first_752 = false; is_less_than(&i, &get_array_length(&keys)) } {
let mut key: Value = get_value(&keys, &i);
let mut key: Value = get_value(&keys, &i);
let mut market: Value = get_value(&pairs, &key);
let mut market: Value = get_value(&pairs, &key);
let mut baseId: Value = self.safe_string_k(market.clone(), "pair_base", &[]);
let mut quoteId: Value = self.safe_string_k(market.clone(), "pair_2", &[]);
let mut base: Value = self.common_currency_code(to_upper(&baseId));
let mut quote: Value = self.common_currency_code(to_upper("eId));
append_to_array(&mut result, Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), self.safe_string_k(market.clone(), "name", &[]));
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(), self.safe_value_k(market.clone(), "active", &[]));
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.safe_number_k(market.clone(), "increment_size", &[]));
m.insert("price".to_string(), self.safe_number_k(market.clone(), "increment_price", &[]));
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(), self.safe_number_k(market.clone(), "min_size", &[]));
m.insert("max".to_string(), self.safe_number_k(market.clone(), "max_size", &[]));
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(), "min_price", &[]));
m.insert("max".to_string(), self.safe_number_k(market.clone(), "max_price", &[]));
m
}));
m.insert("cost".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("created".to_string(), self.parse8601(self.safe_string_k(market.clone(), "created_at", &[])));
m.insert("info".to_string(), market.clone());
m
}));
}
}
return result;
Value::Null
}
/*
* @method
* @name hollaex#fetchCurrencies
* @description fetches all available currencies on an exchange
* @see https://apidocs.hollaex.com/#constants
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an associative dictionary of currencies
*/
pub async fn fetch_currencies(&mut self, optional_args: &[Value]) -> Value {
let mut params = get_arg(optional_args, 0, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
let mut response: Value = self.public_get_constants(&[params.clone()]).await;
//
// {
// "coins": {
// "usdt": {
// "id": "6",
// "fullname": "USD Tether",
// "symbol": "usdt",
// "active": true,
// "verified": true,
// "allow_deposit": true,
// "allow_withdrawal": true,
// "withdrawal_fee": "20",
// "min": "1",
// "max": "10000000",
// "increment_unit": "0.0001",
// "logo": "https://hollaex-resources.s3.ap-southeast-1.amazonaws.com/icons/usdt.svg",
// "code": "usdt",
// "is_public": true,
// "meta": {
// "color": "#27a17a",
// "website": "https://tether.to",
// "explorer": "https://blockchair.com/tether",
// "decimal_points": "6"
// },
// "estimated_price": "1",
// "description": "<p>Tether (USDT) is a stablecoin pegged 1:1 to the US dollar. It is a digital currency that aims to maintain its value while allowing for fast and secure transfer of funds. It was the first stablecoin, and is the most widely used due stablecoin due to its stability and low volatility compared to other cryptocurrencies. It was launched in 2014 by Tether Limited.</p>",
// "type": "blockchain",
// "network": "eth,trx,bnb,matic",
// "standard": "",
// "issuer": "HollaEx",
// "withdrawal_fees": {
// "bnb": {
// "value": "0.8",
// "active": true,
// "symbol": "usdt"
// },
// "eth": {
// "value": "1.5",
// "active": true,
// "symbol": "usdt"
// },
// "trx": {
// "value": "4",
// "active": true,
// "symbol": "usdt"
// },
// "matic": {
// "value": "0.3",
// "active": true,
// "symbol": "usdt"
// }
// },
// "display_name": null,
// "deposit_fees": null,
// "is_risky": false,
// "market_cap": "144568098696.29",
// "category": "stable",
// "created_at": "2019-08-09T10:45:43.367Z",
// "updated_at": "2025-03-25T17:12:37.970Z",
// "created_by": "168",
// "owner_id": "1"
// },
// },
// "network":"https://api.hollaex.network"
// }
//
let mut coins: Value = self.safe_dict_k(response.clone(), "coins", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut values: Value = object_values(&coins);
return self.parse_currencies(values.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 withdrawalLimits: Value = self.safe_list_k(rawCurrency.clone(), "withdrawal_limits", &[Value::List(vec![])]);
let mut rawType: Value = self.safe_string_k(rawCurrency.clone(), "type", &[]);
let mut type_var: Value = ternary(is_true(&(is_equal(&rawType, &Value::Str("blockchain".to_string())))), Value::Str("crypto".to_string()), Value::Str("other".to_string()));
let mut rawNetworks: Value = self.safe_dict_k(rawCurrency.clone(), "withdrawal_fees", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut networks: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut networkIds: Value = object_keys(&rawNetworks);
{
let mut j: Value = Value::Int(0);
let mut __for_first_753: bool = true;
while { if !__for_first_753 { j = add(&j, &Value::Int(1)); } __for_first_753 = false; is_less_than(&j, &get_array_length(&networkIds)) } {
let mut networkId: Value = get_value(&networkIds, &j);
let mut networkId: Value = get_value(&networkIds, &j);
let mut networkEntry: Value = self.safe_dict(rawNetworks.clone(), networkId.clone(), &[]);
let mut networkCode: Value = self.network_id_to_code(&[networkId.clone(), code.clone()]);
if !is_equal(&networkCode, &Value::Null) {
add_element_to_object(&mut networks, &networkCode, Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), networkId.clone());
m.insert("network".to_string(), networkCode.clone());
m.insert("active".to_string(), self.safe_bool_k(networkEntry.clone(), "active", &[]));
m.insert("deposit".to_string(), Value::Null);
m.insert("withdraw".to_string(), Value::Null);
m.insert("fee".to_string(), self.safe_number_k(networkEntry.clone(), "value", &[]));
m.insert("precision".to_string(), Value::Null);
m.insert("limits".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
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("info".to_string(), networkEntry.clone());
m
}));
}
}
}
return self.safe_currency_structure(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("numericId".to_string(), self.safe_integer_k(rawCurrency.clone(), "id", &[]));
m.insert("code".to_string(), code.clone());
m.insert("info".to_string(), rawCurrency.clone());
m.insert("name".to_string(), self.safe_string_k(rawCurrency.clone(), "fullname", &[]));
m.insert("active".to_string(), self.safe_bool_k(rawCurrency.clone(), "active", &[]));
m.insert("deposit".to_string(), self.safe_bool_k(rawCurrency.clone(), "allow_deposit", &[]));
m.insert("withdraw".to_string(), self.safe_bool_k(rawCurrency.clone(), "allow_withdrawal", &[]));
m.insert("fee".to_string(), self.safe_number_k(rawCurrency.clone(), "withdrawal_fee", &[]));
m.insert("precision".to_string(), self.safe_number_k(rawCurrency.clone(), "increment_unit", &[]));
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(), self.safe_number_k(rawCurrency.clone(), "min", &[]));
m.insert("max".to_string(), self.safe_number_k(rawCurrency.clone(), "max", &[]));
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(), self.safe_value(withdrawalLimits.clone(), Value::Int(0), &[]));
m
}));
m
}));
m.insert("networks".to_string(), networks.clone());
m.insert("type".to_string(), type_var.clone());
m
}));
Value::Null
}
/*
* @method
* @name hollaex#fetchOrderBooks
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
* @see https://apidocs.hollaex.com/#orderbooks
* @param {string[]|undefined} symbols not used by fetchOrderBooks ()
* @param {int} [limit] not used by fetchOrderBooks ()
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbol
*/
pub async fn fetch_order_books(&mut self, optional_args: &[Value]) -> Value {
let mut symbols = 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 response: Value = self.public_get_orderbooks(&[params.clone()]).await;
let mut result: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut marketIds: Value = object_keys(&response);
{
let mut i: Value = Value::Int(0);
let mut __for_first_754: bool = true;
while { if !__for_first_754 { i = add(&i, &Value::Int(1)); } __for_first_754 = false; is_less_than(&i, &get_array_length(&marketIds)) } {
let mut marketId: Value = get_value(&marketIds, &i);
let mut marketId: Value = get_value(&marketIds, &i);
let mut orderbook: Value = self.safe_dict(response.clone(), marketId.clone(), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut symbol: Value = self.safe_symbol(marketId.clone(), &[Value::Null, Value::Str("-".to_string())]);
let mut timestamp: Value = self.parse8601(self.safe_string_k(orderbook.clone(), "timestamp", &[]));
add_element_to_object(&mut result, &symbol, self.parse_order_book(orderbook.clone(), symbol.clone(), &[timestamp.clone()]));
}
}
return result;
Value::Null
}
/*
* @method
* @name hollaex#fetchOrderBook
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
* @see https://apidocs.hollaex.com/#orderbook
* @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 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_0 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_orderbook(&[__ws_arg_0]).await;
//
// {
// "btc-usdt": {
// "bids": [
// [ 8836.4, 1.022 ],
// [ 8800, 0.0668 ],
// [ 8797.75, 0.2398 ],
// ],
// "asks": [
// [ 8839.35, 1.5334 ],
// [ 8852.6, 0.0579 ],
// [ 8860.45, 0.1815 ],
// ],
// "timestamp": "2020-03-03T02:27:25.147Z"
// },
// "eth-usdt": {},
// // ...
// }
//
let mut orderbook: Value = self.safe_value(response.clone(), get_value(&market, &Value::Str("id".to_string())), &[]);
let mut timestamp: Value = self.parse8601(self.safe_string_k(orderbook.clone(), "timestamp", &[]));
return self.parse_order_book(orderbook.clone(), get_value(&market, &Value::Str("symbol".to_string())), &[timestamp.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#fetchTicker
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
* @see https://apidocs.hollaex.com/#ticker
* @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 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_1 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_ticker(&[__ws_arg_1]).await;
return self.parse_ticker(response.clone(), &[market.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#fetchTickers
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
* @see https://apidocs.hollaex.com/#tickers
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a dictionary of [ticker structures]{@link https://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;
}
symbols = self.market_symbols(&[symbols.clone()]);
let mut response: Value = self.public_get_tickers(&[params.clone()]).await;
return self.parse_tickers(response.clone(), &[symbols.clone()]);
Value::Null
}
pub fn parse_tickers(&self, mut tickers: Value, 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
}));
let mut result: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut keys: Value = object_keys(&tickers);
{
let mut i: Value = Value::Int(0);
let mut __for_first_755: bool = true;
while { if !__for_first_755 { i = add(&i, &Value::Int(1)); } __for_first_755 = false; is_less_than(&i, &get_array_length(&keys)) } {
let mut key: Value = get_value(&keys, &i);
let mut key: Value = get_value(&keys, &i);
let mut ticker: Value = get_value(&tickers, &key);
let mut ticker: Value = get_value(&tickers, &key);
let mut marketId: Value = self.safe_string_k(ticker.clone(), "symbol", &[key.clone()]);
let mut market: Value = self.safe_market(&[marketId.clone(), Value::Null, Value::Str("-".to_string())]);
let mut symbol: Value = get_value(&market, &Value::Str("symbol".to_string()));
let __ws_arg_2 = self.parse_ticker(ticker.clone(), &[market.clone()]);
add_element_to_object(&mut result, &symbol, self.extend(__ws_arg_2, &[params.clone()]));
}
}
return self.filter_by_array_tickers(result.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
Value::Null
}
pub fn parse_ticker(&self, mut ticker: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
//
// fetchTicker
//
// {
// "open": 8615.55,
// "close": 8841.05,
// "high": 8921.1,
// "low": 8607,
// "last": 8841.05,
// "volume": 20.2802,
// "timestamp": "2020-03-03T03:11:18.964Z",
// }
//
// fetchTickers
//
// {
// "time": "2020-03-02T04:29:45.011Z",
// "open": 341.65,
// "close": 337.9,
// "high": 341.65,
// "low": 337.3,
// "last": 337.9,
// "volume": 0.054,
// "symbol": "bch-usdt"
// }
//
let mut marketId: Value = self.safe_string_k(ticker.clone(), "symbol", &[]);
market = self.safe_market(&[marketId.clone(), market.clone(), Value::Str("-".to_string())]);
let mut symbol: Value = get_value(&market, &Value::Str("symbol".to_string()));
let mut timestamp: Value = self.parse8601(self.safe_string2(ticker.clone(), Value::Str("time".to_string()), Value::Str("timestamp".to_string()), &[]));
let mut close: Value = self.safe_string_k(ticker.clone(), "close", &[]);
return self.safe_ticker(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), symbol.clone());
m.insert("info".to_string(), ticker.clone());
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m.insert("high".to_string(), self.safe_string_k(ticker.clone(), "high", &[]));
m.insert("low".to_string(), self.safe_string_k(ticker.clone(), "low", &[]));
m.insert("bid".to_string(), Value::Null);
m.insert("bidVolume".to_string(), Value::Null);
m.insert("ask".to_string(), Value::Null);
m.insert("askVolume".to_string(), Value::Null);
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(), self.safe_string_k(ticker.clone(), "last", &[close.clone()]));
m.insert("previousClose".to_string(), Value::Null);
m.insert("change".to_string(), Value::Null);
m.insert("percentage".to_string(), Value::Null);
m.insert("average".to_string(), Value::Null);
m.insert("baseVolume".to_string(), self.safe_string_k(ticker.clone(), "volume", &[]));
m.insert("quoteVolume".to_string(), Value::Null);
m
}), &[market.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#fetchTrades
* @description get the list of most recent trades for a particular symbol
* @see https://apidocs.hollaex.com/#trades
* @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());
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_3 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_trades(&[__ws_arg_3]).await;
//
// {
// "btc-usdt": [
// {
// "size": 0.5,
// "price": 8830,
// "side": "buy",
// "timestamp": "2020-03-03T04:44:33.034Z"
// },
// // ...
// ]
// }
//
let mut trades: Value = self.safe_list(response.clone(), get_value(&market, &Value::Str("id".to_string())), &[Value::List(vec![])]);
return self.parse_trades(trades.clone(), &[market.clone(), since.clone(), limit.clone()]);
Value::Null
}
pub fn parse_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
//
// fetchTrades (public)
//
// {
// "size": 0.5,
// "price": 8830,
// "side": "buy",
// "timestamp": "2020-03-03T04:44:33.034Z"
// }
//
// fetchMyTrades (private)
// {
// "side":"sell",
// "symbol":"doge-usdt",
// "size":70,
// "price":0.147411,
// "timestamp":"2022-01-26T17:53:34.650Z",
// "order_id":"cba78ecb-4187-4da2-9d2f-c259aa693b5a",
// "fee":0.01031877,
// "fee_coin":"usdt"
// }
//
let mut marketId: Value = self.safe_string_k(trade.clone(), "symbol", &[]);
market = self.safe_market(&[marketId.clone(), market.clone(), Value::Str("-".to_string())]);
let mut symbol: Value = get_value(&market, &Value::Str("symbol".to_string()));
let mut datetime: Value = self.safe_string_k(trade.clone(), "timestamp", &[]);
let mut timestamp: Value = self.parse8601(datetime.clone());
let mut side: Value = self.safe_string_k(trade.clone(), "side", &[]);
let mut orderId: Value = self.safe_string_k(trade.clone(), "order_id", &[]);
let mut priceString: Value = self.safe_string_k(trade.clone(), "price", &[]);
let mut amountString: Value = self.safe_string_k(trade.clone(), "size", &[]);
let mut feeCostString: Value = self.safe_string_k(trade.clone(), "fee", &[]);
let mut feeCoin: Value = self.safe_string_k(trade.clone(), "fee_coin", &[]);
let mut fee: Value = Value::Null;
if !is_equal(&feeCostString, &Value::Null) {
fee = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("cost".to_string(), feeCostString.clone());
m.insert("currency".to_string(), self.safe_currency_code(feeCoin.clone(), &[]));
m
});
}
return self.safe_trade(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), trade.clone());
m.insert("id".to_string(), Value::Null);
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), datetime.clone());
m.insert("symbol".to_string(), symbol.clone());
m.insert("order".to_string(), orderId.clone());
m.insert("type".to_string(), Value::Null);
m.insert("side".to_string(), side.clone());
m.insert("takerOrMaker".to_string(), Value::Null);
m.insert("price".to_string(), priceString.clone());
m.insert("amount".to_string(), amountString.clone());
m.insert("cost".to_string(), Value::Null);
m.insert("fee".to_string(), fee.clone());
m
}), &[market.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#fetchTradingFees
* @description fetch the trading fees for multiple markets
* @see https://apidocs.hollaex.com/#tiers
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure} indexed by market symbols
*/
pub async fn fetch_trading_fees(&mut self, optional_args: &[Value]) -> Value {
let mut params = get_arg(optional_args, 0, Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut response: Value = self.public_get_tiers(&[params.clone()]).await;
//
// {
// "1": {
// "id": "1",
// "name": "Silver",
// "icon": '',
// "description": "Your crypto journey starts here! Make your first deposit to start trading, and verify your account to level up!",
// "deposit_limit": "0",
// "withdrawal_limit": "1000",
// "fees": {
// "maker": {
// 'eth-btc': "0.1",
// 'ada-usdt': "0.1",
// ...
// },
// "taker": {
// 'eth-btc': "0.1",
// 'ada-usdt': "0.1",
// ...
// }
// },
// "note": "<ul>\n<li>Login and verify email</li>\n</ul>\n",
// "created_at": "2021-03-22T03:51:39.129Z",
// "updated_at": "2021-11-01T02:51:56.214Z"
// },
// ...
// }
//
let mut firstTier: Value = self.safe_value_k(response.clone(), "1", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut fees: Value = self.safe_value_k(firstTier.clone(), "fees", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut makerFees: Value = self.safe_value_k(fees.clone(), "maker", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut takerFees: Value = self.safe_value_k(fees.clone(), "taker", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut result: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
{
let mut i: Value = Value::Int(0);
let mut __for_first_756: bool = true;
while { if !__for_first_756 { i = add(&i, &Value::Int(1)); } __for_first_756 = false; is_less_than(&i, &get_array_length(&self.symbols)) } {
let mut symbol: Value = get_value(&self.symbols, &i);
let mut market: Value = self.market(symbol.clone());
let mut makerString: Value = self.safe_string(makerFees.clone(), get_value(&market, &Value::Str("id".to_string())), &[]);
let mut takerString: Value = self.safe_string(takerFees.clone(), get_value(&market, &Value::Str("id".to_string())), &[]);
add_element_to_object(&mut result, &symbol, Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), fees.clone());
m.insert("symbol".to_string(), symbol.clone());
m.insert("maker".to_string(), self.parse_number(crate::precise::Precise::stringDiv(&makerString, &Value::Str("100".to_string())), &[]));
m.insert("taker".to_string(), self.parse_number(crate::precise::Precise::stringDiv(&takerString, &Value::Str("100".to_string())), &[]));
m.insert("percentage".to_string(), Value::Bool(true));
m.insert("tierBased".to_string(), Value::Bool(true));
m
}));
}
}
return result;
Value::Null
}
/*
* @method
* @name hollaex#fetchOHLCV
* @description hollaex has large gaps between candles, so it's recommended to specify since
* @see https://apidocs.hollaex.com/#chart
* @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 (max 500)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {int} [params.until] timestamp in ms of the latest 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());
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.insert("resolution".to_string(), self.safe_string(self.timeframes.clone(), timeframe.clone(), &[timeframe.clone()]));
m
});
let mut paginate: Value = Value::Bool(false);
let mut maxLimit: Value = Value::Int(500);
{ let __destr_tmp = self.handle_option_and_params(params.clone(), Value::Str("fetchOHLCV".to_string()), Value::Str("paginate".to_string()), &[paginate.clone()]); paginate = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
if is_true(&paginate) {
return self.fetch_paginated_call_deterministic(Value::Str("fetchOHLCV".to_string()), &[symbol.clone(), since.clone(), limit.clone(), timeframe.clone(), params.clone(), maxLimit.clone()]).await;
}
let mut until: Value = self.safe_integer_k(params.clone(), "until", &[]);
let mut timeDelta: Value = multiply(&multiply(&self.parse_timeframe(timeframe.clone()), &maxLimit), &Value::Int(1000));
let mut start: Value = since.clone();
let mut now: Value = self.milliseconds();
if is_equal(&until, &Value::Null) {
until = now.clone(); // the exchange has not a lot of trades, so if we count until by limit and limit is small, it may return empty result
}
if is_equal(&start, &Value::Null) {
start = subtract(&until, &timeDelta);
}
add_element_to_object(&mut request, &Value::Str("from".to_string()), self.parse_to_int(divide(&start, &Value::Int(1000)))); // convert to seconds
add_element_to_object(&mut request, &Value::Str("to".to_string()), self.parse_to_int(divide(&until, &Value::Int(1000)))); // convert to seconds
params = self.omit(params.clone(), Value::Str("until".to_string()), &[]);
let __ws_arg_4 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.public_get_chart(&[__ws_arg_4]).await;
return self.parse_ohlc_vs(self.to_array(response.clone()), &[market.clone(), timeframe.clone(), since.clone(), limit.clone()]);
Value::Null
}
pub fn parse_ohlcv(&self, mut ohlcv: Value, optional_args: &[Value]) -> Value {
let mut market = get_arg(optional_args, 0, Value::Null);
return Value::List(vec![self.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
}
pub fn parse_balance(&self, mut response: Value) -> Value {
let mut timestamp: Value = self.parse8601(self.safe_string_k(response.clone(), "updated_at", &[]));
let mut result: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), response.clone());
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m
});
let mut currenciesById: Value = self.currencies_by_id.clone();
if is_equal(¤ciesById, &Value::Null) {
panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" currencies not loaded".to_string()))));
}
let mut currencyIds: Value = object_keys(¤ciesById);
{
let mut i: Value = Value::Int(0);
let mut __for_first_757: bool = true;
while { if !__for_first_757 { i = add(&i, &Value::Int(1)); } __for_first_757 = false; is_less_than(&i, &get_array_length(¤cyIds)) } {
let mut currencyId: Value = get_value(¤cyIds, &i);
let mut currencyId: Value = get_value(¤cyIds, &i);
let mut code: Value = self.safe_currency_code(currencyId.clone(), &[]);
let mut account: Value = self.account();
add_element_to_object(&mut account, &Value::Str("free".to_string()), self.safe_string(response.clone(), add(¤cyId, &Value::Str("_available".to_string())), &[]));
add_element_to_object(&mut account, &Value::Str("total".to_string()), self.safe_string(response.clone(), add(¤cyId, &Value::Str("_balance".to_string())), &[]));
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 hollaex#fetchBalance
* @description query for balance and get the amount of funds available for trading or funds locked in orders
* @see https://apidocs.hollaex.com/#get-balance
* @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 response: Value = self.private_get_user_balance(&[params.clone()]).await;
return self.parse_balance(response.clone());
Value::Null
}
/*
* @method
* @name hollaex#fetchOpenOrder
* @description fetch an open order by it's id
* @see https://apidocs.hollaex.com/#get-order
* @param {string} id order id
* @param {string} symbol not used by fetchOpenOrder ()
* @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_open_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("order_id".to_string(), id.clone());
m
});
let __ws_arg_5 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_order(&[__ws_arg_5]).await;
return self.parse_order(response.clone(), &[]);
Value::Null
}
/*
* @method
* @name hollaex#fetchOpenOrders
* @description fetch all unfilled currently open orders
* @see https://apidocs.hollaex.com/#get-all-orders
* @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("open".to_string(), Value::Bool(true));
m
});
let __ws_arg_6 = self.extend(request.clone(), &[params.clone()]);
return self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), __ws_arg_6]).await;
Value::Null
}
/*
* @method
* @name hollaex#fetchClosedOrders
* @description fetches information on multiple closed orders made by the user
* @see https://apidocs.hollaex.com/#get-all-orders
* @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("open".to_string(), Value::Bool(false));
m
});
let __ws_arg_7 = self.extend(request.clone(), &[params.clone()]);
return self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), __ws_arg_7]).await;
Value::Null
}
/*
* @method
* @name hollaex#fetchOrder
* @description fetches information on an order made by the user
* @see https://apidocs.hollaex.com/#get-order
* @param {string} id
* @param {string} symbol unified symbol of the market the order was made in
* @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("order_id".to_string(), id.clone());
m
});
let __ws_arg_8 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_order(&[__ws_arg_8]).await;
// {
// "id": "string",
// "side": "sell",
// "symbol": "xht-usdt",
// "size": 0.1,
// "filled": 0,
// "stop": null,
// "fee": 0,
// "fee_coin": "usdt",
// "type": "limit",
// "price": 1.09,
// "status": "new",
// "created_by": 116,
// "created_at": "2021-02-17T02:32:38.910Z",
// "updated_at": "2021-02-17T02:32:38.910Z",
// "User": {
// "id": 116,
// "email": "fight@club.com",
// "username": "narrator",
// "exchange_id": 176
// }
// }
let mut order: Value = response.clone();
if is_equal(&order, &Value::Null) {
panic!("{}", crate::exchange_errors::order_not_found(add(&add(&self.id, &Value::Str(" fetchOrder() could not find order id ".to_string())), &id)));
}
return self.parse_order(order.clone(), &[]);
Value::Null
}
/*
* @method
* @name hollaex#fetchOrders
* @description fetches information on multiple orders made by the user
* @see https://apidocs.hollaex.com/#get-all-orders
* @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(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut market: Value = Value::Null;
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
if !is_equal(&symbol, &Value::Null) {
market = self.market(symbol.clone());
add_element_to_object(&mut request, &Value::Str("symbol".to_string()), get_value(&market, &Value::Str("id".to_string())));
}
if !is_equal(&since, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("start_date".to_string()), self.iso8601(since.clone()));
}
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone()); // default 50, max 100
}
let __ws_arg_9 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_orders(&[__ws_arg_9]).await;
//
// {
// "count": 1,
// "data": [
// {
// "id": "string",
// "side": "sell",
// "symbol": "xht-usdt",
// "size": 0.1,
// "filled": 0,
// "stop": null,
// "fee": 0,
// "fee_coin": "usdt",
// "type": "limit",
// "price": 1.09,
// "status": "new",
// "created_by": 116,
// "created_at": "2021-02-17T02:32:38.910Z",
// "updated_at": "2021-02-17T02:32:38.910Z",
// "User": {
// "id": 116,
// "email": "fight@club.com",
// "username": "narrator",
// "exchange_id": 176
// }
// }
// ]
// }
//
let mut data: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_orders(data.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("new".to_string(), Value::Str("open".to_string()));
m.insert("pfilled".to_string(), Value::Str("open".to_string()));
m.insert("filled".to_string(), Value::Str("closed".to_string()));
m.insert("canceled".to_string(), Value::Str("canceled".to_string()));
m
});
return self.safe_string(statuses.clone(), status.clone(), &[status.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);
//
// createOrder, fetchOpenOrder, fetchOpenOrders
//
// {
// "id":"10644b7e-3c90-4ba9-bc3b-188f3a4e9cfd",
// "created_by":140093,
// "exchange_id":22,
// "side":"buy",
// "symbol":"doge-usdt",
// "type":"limit",
// "price":0.05,
// "size":10,
// "stop":null,
// "filled":0,
// "status":"canceled",
// "fee":0,
// "fee_coin":"doge",
// "meta": { // optional field only returned for postOnly orders
// "post_only":true
// },
// "fee_structure": {
// "maker":0.1,
// "taker":0.1
// },
// "created_at":"2022-05-31T08:14:14.747Z",
// "updated_at":"2022-05-31T08:14:23.727Z"
// }
//
let mut marketId: Value = self.safe_string_k(order.clone(), "symbol", &[]);
let mut symbol: Value = self.safe_symbol(marketId.clone(), &[market.clone(), Value::Str("-".to_string())]);
let mut id: Value = self.safe_string_k(order.clone(), "id", &[]);
let mut timestamp: Value = self.parse8601(self.safe_string_k(order.clone(), "created_at", &[]));
let mut type_var: Value = self.safe_string_k(order.clone(), "type", &[]);
let mut side: Value = self.safe_string_k(order.clone(), "side", &[]);
let mut price: Value = self.safe_string_k(order.clone(), "price", &[]);
let mut amount: Value = self.safe_string_k(order.clone(), "size", &[]);
let mut filled: Value = self.safe_string_k(order.clone(), "filled", &[]);
let mut status: Value = self.parse_order_status(self.safe_string_k(order.clone(), "status", &[]));
let mut meta: Value = self.safe_value_k(order.clone(), "meta", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut postOnly: Value = self.safe_bool_k(meta.clone(), "post_only", &[Value::Bool(false)]);
return self.safe_order(Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("id".to_string(), id.clone());
m.insert("clientOrderId".to_string(), Value::Null);
m.insert("timestamp".to_string(), timestamp.clone());
m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
m.insert("lastTradeTimestamp".to_string(), Value::Null);
m.insert("status".to_string(), status.clone());
m.insert("symbol".to_string(), symbol.clone());
m.insert("type".to_string(), type_var.clone());
m.insert("timeInForce".to_string(), Value::Null);
m.insert("postOnly".to_string(), postOnly.clone());
m.insert("side".to_string(), side.clone());
m.insert("price".to_string(), price.clone());
m.insert("triggerPrice".to_string(), self.safe_string_k(order.clone(), "stop", &[]));
m.insert("amount".to_string(), amount.clone());
m.insert("filled".to_string(), filled.clone());
m.insert("remaining".to_string(), Value::Null);
m.insert("cost".to_string(), Value::Null);
m.insert("trades".to_string(), Value::Null);
m.insert("fee".to_string(), Value::Null);
m.insert("info".to_string(), order.clone());
m.insert("average".to_string(), Value::Null);
m
}), &[market.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#createOrder
* @description create a trade order
* @see https://apidocs.hollaex.com/#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
* @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 request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("symbol".to_string(), get_value(&market, &Value::Str("id".to_string())));
m.insert("side".to_string(), side.clone());
m.insert("size".to_string(), self.amount_to_precision(symbol.clone(), amount.clone()));
m.insert("type".to_string(), type_var.clone());
m
});
let mut triggerPrice: Value = self.safe_number_n(params.clone(), Value::List(vec![Value::Str("triggerPrice".to_string()), Value::Str("stopPrice".to_string()), Value::Str("stop".to_string())]), &[]);
let mut meta: Value = self.safe_value_k(params.clone(), "meta", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
let mut exchangeSpecificParam: Value = self.safe_bool_k(meta.clone(), "post_only", &[Value::Bool(false)]);
let mut isMarketOrder: Value = Value::Bool(is_equal(&type_var, &Value::Str("market".to_string())));
let mut postOnly: Value = self.is_post_only(isMarketOrder.clone(), exchangeSpecificParam.clone(), &[params.clone()]);
if !is_true(&isMarketOrder) {
add_element_to_object(&mut request, &Value::Str("price".to_string()), self.price_to_precision(symbol.clone(), price.clone()));
}
if !is_equal(&triggerPrice, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("stop".to_string()), self.price_to_precision(symbol.clone(), triggerPrice.clone()));
}
if is_true(&postOnly) {
add_element_to_object(&mut request, &Value::Str("meta".to_string()), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("post_only".to_string(), Value::Bool(true));
m
}));
}
params = self.omit(params.clone(), Value::List(vec![Value::Str("postOnly".to_string()), Value::Str("timeInForce".to_string()), Value::Str("stopPrice".to_string()), Value::Str("triggerPrice".to_string()), Value::Str("stop".to_string())]), &[]);
let __ws_arg_10 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_order(&[__ws_arg_10]).await;
return self.parse_order(response.clone(), &[market.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#cancelOrder
* @description cancels an open order
* @see https://apidocs.hollaex.com/#cancel-order
* @param {string} id order id
* @param {string} symbol unified symbol of the market the order was made in
* @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("order_id".to_string(), id.clone());
m
});
let __ws_arg_11 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_delete_order(&[__ws_arg_11]).await;
return self.parse_order(response.clone(), &[]);
Value::Null
}
/*
* @method
* @name hollaex#cancelAllOrders
* @description cancel all open orders in a market
* @see https://apidocs.hollaex.com/#cancel-all-orders
* @param {string} symbol unified market symbol of the market to cancel orders in
* @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(&symbol, &Value::Null) {
panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" cancelAllOrders() requires a symbol argument".to_string()))));
}
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut market: Value = Value::Null;
market = self.market(symbol.clone());
add_element_to_object(&mut request, &Value::Str("symbol".to_string()), get_value(&market, &Value::Str("id".to_string())));
let __ws_arg_12 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_delete_order_all(&[__ws_arg_12]).await;
return self.parse_orders(response.clone(), &[market.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#fetchMyTrades
* @description fetch all trades made by the user
* @see https://apidocs.hollaex.com/#get-trades
* @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(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m
});
let mut market: Value = Value::Null;
if !is_equal(&symbol, &Value::Null) {
market = self.market(symbol.clone());
add_element_to_object(&mut request, &Value::Str("symbol".to_string()), get_value(&market, &Value::Str("id".to_string())));
}
if !is_equal(&limit, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("limit".to_string()), limit.clone()); // default 50, max 100
}
if !is_equal(&since, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("start_date".to_string()), self.iso8601(since.clone()));
}
let __ws_arg_13 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_user_trades(&[__ws_arg_13]).await;
//
// {
// "count": 1,
// "data": [
// {
// "side": "buy",
// "symbol": "eth-usdt",
// "size": 0.086,
// "price": 226.19,
// "timestamp": "2020-03-03T08:03:55.459Z",
// "fee": 0.1
// }
// ]
// }
//
let mut data: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_trades(data.clone(), &[market.clone(), since.clone(), limit.clone()]);
Value::Null
}
pub fn parse_deposit_address(&self, mut depositAddress: Value, optional_args: &[Value]) -> Value {
let mut currency = get_arg(optional_args, 0, Value::Null);
//
// {
// "currency":"usdt",
// "address":"TECLD9XBH31XpyykdHU3uEAeUK7E6Lrmik",
// "network":"trx",
// "standard":null,
// "is_valid":true,
// "created_at":"2021-05-12T02:43:05.446Z"
// }
//
let mut address: Value = self.safe_string_k(depositAddress.clone(), "address", &[]);
let mut tag: Value = Value::Null;
if !is_equal(&address, &Value::Null) {
let mut parts: Value = split(&address, &Value::Str(":".to_string()));
address = self.safe_string(parts.clone(), Value::Int(0), &[]);
tag = self.safe_string(parts.clone(), Value::Int(1), &[]);
}
self.check_address(&[address.clone()]);
let mut currencyId: Value = self.safe_string_k(depositAddress.clone(), "currency", &[]);
currency = self.safe_currency(currencyId.clone(), &[currency.clone()]);
let mut network: Value = self.safe_string_k(depositAddress.clone(), "network", &[]);
return Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), depositAddress.clone());
m.insert("currency".to_string(), get_value(¤cy, &Value::Str("code".to_string())));
m.insert("network".to_string(), network.clone());
m.insert("address".to_string(), address.clone());
m.insert("tag".to_string(), tag.clone());
m
});
Value::Null
}
/*
* @method
* @name hollaex#fetchDepositAddresses
* @description fetch deposit addresses for multiple currencies and chain types
* @see https://apidocs.hollaex.com/#get-user
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a list of [address structures]{@link https://docs.ccxt.com/?id=address-structure}
*/
pub async fn fetch_deposit_addresses(&mut self, optional_args: &[Value]) -> Value {
let mut codes = 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 network: Value = self.safe_string_k(params.clone(), "network", &[]);
params = self.omit(params.clone(), Value::Str("network".to_string()), &[]);
let mut response: Value = self.private_get_user(&[params.clone()]).await;
//
// {
// "id":620,
// "email":"igor.kroitor@gmail.com",
// "full_name":"",
// "gender":false,
// "nationality":"",
// "dob":null,
// "phone_number":"",
// "address":{"city":"","address":"","country":"","postal_code":""},
// "id_data":{"note":"","type":"","number":"","status":0,"issued_date":"","expiration_date":""},
// "bank_account":[],
// "crypto_wallet":{},
// "verification_level":1,
// "email_verified":true,
// "otp_enabled":true,
// "activated":true,
// "username":"igor.kroitor",
// "affiliation_code":"QSWA6G",
// "settings":{
// "chat":{"set_username":false},
// "risk":{"popup_warning":false,"order_portfolio_percentage":20},
// "audio":{"public_trade":false,"order_completed":true,"order_partially_completed":true},
// "language":"en",
// "interface":{"theme":"white","order_book_levels":10},
// "notification":{"popup_order_completed":true,"popup_order_confirmation":true,"popup_order_partially_filled":true}
// },
// "affiliation_rate":0,
// "network_id":10620,
// "discount":0,
// "created_at":"2021-03-24T02:37:57.379Z",
// "updated_at":"2021-03-24T02:37:57.379Z",
// "balance":{
// "btc_balance":0,
// "btc_available":0,
// "eth_balance":0.000914,
// "eth_available":0.000914,
// "updated_at":"2020-03-04T04:03:27.174Z
// "},
// "wallet":[
// {"currency":"usdt","address":"TECLD9XBH31XpyykdHU3uEAeUK7E6Lrmik","network":"trx","standard":null,"is_valid":true,"created_at":"2021-05-12T02:43:05.446Z"},
// {"currency":"xrp","address":"rGcSzmuRx8qngPRnrvpCKkP9V4njeCPGCv:286741597","network":"xrp","standard":null,"is_valid":true,"created_at":"2021-05-12T02:49:01.273Z"}
// ]
// }
//
let mut wallet: Value = self.safe_value_k(response.clone(), "wallet", &[Value::List(vec![])]);
let mut addresses: Value = ternary(is_true(&(is_equal(&network, &Value::Null))), wallet.clone(), self.filter_by(wallet.clone(), Value::Str("network".to_string()), network.clone(), &[]));
return self.parse_deposit_addresses(addresses.clone(), &[codes.clone(), Value::Bool(false)]);
Value::Null
}
/*
* @method
* @name hollaex#fetchDeposits
* @description fetch all deposits made to an account
* @see https://apidocs.hollaex.com/#get-deposits
* @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("currency".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, max 100
}
if !is_equal(&since, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("start_date".to_string()), self.iso8601(since.clone()));
}
let __ws_arg_14 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_user_deposits(&[__ws_arg_14]).await;
//
// {
// "count": 1,
// "data": [
// {
// "id": 539,
// "amount": 20,
// "fee": 0,
// "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
// "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
// "status": true,
// "dismissed": false,
// "rejected": false,
// "description": "",
// "type": "deposit",
// "currency": "usdt",
// "created_at": "2020-03-03T07:56:36.198Z",
// "updated_at": "2020-03-03T08:00:05.674Z",
// "user_id": 620
// }
// ]
// }
//
let mut data: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_transactions(data.clone(), &[currency.clone(), since.clone(), limit.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#fetchWithdrawal
* @description fetch data on a currency withdrawal via the withdrawal id
* @see https://apidocs.hollaex.com/#get-withdrawals
* @param {string} id withdrawal id
* @param {string} code unified currency code of the currency withdrawn, default is undefined
* @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 fetch_withdrawal(&mut self, mut id: Value, optional_args: &[Value]) -> Value {
let mut code = 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("transaction_id".to_string(), id.clone());
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("currency".to_string()), get_value(¤cy, &Value::Str("id".to_string())));
}
let __ws_arg_15 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_user_withdrawals(&[__ws_arg_15]).await;
//
// {
// "count": 1,
// "data": [
// {
// "id": 539,
// "amount": 20,
// "fee": 0,
// "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
// "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
// "status": true,
// "dismissed": false,
// "rejected": false,
// "description": "",
// "type": "withdrawal",
// "currency": "usdt",
// "created_at": "2020-03-03T07:56:36.198Z",
// "updated_at": "2020-03-03T08:00:05.674Z",
// "user_id": 620
// }
// ]
// }
//
let mut data: Value = self.safe_value_k(response.clone(), "data", &[Value::List(vec![])]);
let mut transaction: Value = self.safe_dict(data.clone(), Value::Int(0), &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_transaction(transaction.clone(), &[currency.clone()]);
Value::Null
}
/*
* @method
* @name hollaex#fetchWithdrawals
* @description fetch all withdrawals made from an account
* @see https://apidocs.hollaex.com/#get-withdrawals
* @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("currency".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, max 100
}
if !is_equal(&since, &Value::Null) {
add_element_to_object(&mut request, &Value::Str("start_date".to_string()), self.iso8601(since.clone()));
}
let __ws_arg_16 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_get_user_withdrawals(&[__ws_arg_16]).await;
//
// {
// "count": 1,
// "data": [
// {
// "id": 539,
// "amount": 20,
// "fee": 0,
// "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
// "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
// "status": true,
// "dismissed": false,
// "rejected": false,
// "description": "",
// "type": "withdrawal",
// "currency": "usdt",
// "created_at": "2020-03-03T07:56:36.198Z",
// "updated_at": "2020-03-03T08:00:05.674Z",
// "user_id": 620
// }
// ]
// }
//
let mut data: Value = self.safe_list_k(response.clone(), "data", &[Value::List(vec![])]);
return self.parse_transactions(data.clone(), &[currency.clone(), since.clone(), limit.clone()]);
Value::Null
}
pub fn parse_transaction(&self, mut transaction: Value, optional_args: &[Value]) -> Value {
let mut currency = get_arg(optional_args, 0, Value::Null);
//
// fetchWithdrawals, fetchDeposits
//
// {
// "id": 539,
// "amount": 20,
// "fee": 0,
// "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
// "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
// "status": true,
// "dismissed": false,
// "rejected": false,
// "description": "",
// "type": "withdrawal",
// "currency": "usdt",
// "created_at": "2020-03-03T07:56:36.198Z",
// "updated_at": "2020-03-03T08:00:05.674Z",
// "user_id": 620
// }
//
// withdraw
//
// {
// "message": "Withdrawal request is in the queue and will be processed.",
// "transaction_id": "1d1683c3-576a-4d53-8ff5-27c93fd9758a",
// "amount": 1,
// "currency": "xht",
// "fee": 0,
// "fee_coin": "xht"
// }
//
let mut id: Value = self.safe_string_k(transaction.clone(), "id", &[]);
let mut txid: Value = self.safe_string_k(transaction.clone(), "transaction_id", &[]);
let mut timestamp: Value = self.parse8601(self.safe_string_k(transaction.clone(), "created_at", &[]));
let mut updated: Value = self.parse8601(self.safe_string_k(transaction.clone(), "updated_at", &[]));
let mut type_var: Value = self.safe_string_k(transaction.clone(), "type", &[]);
let mut amount: Value = self.safe_number_k(transaction.clone(), "amount", &[]);
let mut address: Value = self.safe_string_k(transaction.clone(), "address", &[]);
let mut addressTo: Value = Value::Null;
let mut addressFrom: Value = Value::Null;
let mut tag: Value = Value::Null;
let mut tagTo: Value = Value::Null;
let mut tagFrom: Value = Value::Null;
if !is_equal(&address, &Value::Null) {
let mut parts: Value = split(&address, &Value::Str(":".to_string()));
address = self.safe_string(parts.clone(), Value::Int(0), &[]);
tag = self.safe_string(parts.clone(), Value::Int(1), &[]);
addressTo = address.clone();
tagTo = tag.clone();
}
let mut currencyId: Value = self.safe_string_k(transaction.clone(), "currency", &[]);
currency = self.safe_currency(currencyId.clone(), &[currency.clone()]);
let mut status: Value = self.safe_value_k(transaction.clone(), "status", &[]);
let mut dismissed: Value = self.safe_value_k(transaction.clone(), "dismissed", &[]);
let mut rejected: Value = self.safe_value_k(transaction.clone(), "rejected", &[]);
if is_equal(&status, &Value::Bool(true)) {
status = Value::Str("ok".to_string());
} else if is_equal(&dismissed, &Value::Bool(true)) {
status = Value::Str("canceled".to_string());
} else if is_equal(&rejected, &Value::Bool(true)) {
status = Value::Str("failed".to_string());
} else {
status = Value::Str("pending".to_string());
}
let mut feeCurrencyId: Value = self.safe_string_k(transaction.clone(), "fee_coin", &[]);
let mut feeCurrencyCode: Value = self.safe_currency_code(feeCurrencyId.clone(), &[currency.clone()]);
let mut feeCost: Value = self.safe_number_k(transaction.clone(), "fee", &[]);
let mut fee: Value = Value::Null;
if !is_equal(&feeCost, &Value::Null) {
fee = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("currency".to_string(), feeCurrencyCode.clone());
m.insert("cost".to_string(), feeCost.clone());
m
});
}
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(), addressFrom.clone());
m.insert("address".to_string(), address.clone());
m.insert("addressTo".to_string(), addressTo.clone());
m.insert("tagFrom".to_string(), tagFrom.clone());
m.insert("tag".to_string(), tag.clone());
m.insert("tagTo".to_string(), tagTo.clone());
m.insert("type".to_string(), type_var.clone());
m.insert("amount".to_string(), amount.clone());
m.insert("currency".to_string(), get_value(¤cy, &Value::Str("code".to_string())));
m.insert("status".to_string(), status.clone());
m.insert("updated".to_string(), updated.clone());
m.insert("comment".to_string(), self.safe_string_k(transaction.clone(), "message", &[]));
m.insert("internal".to_string(), Value::Null);
m.insert("fee".to_string(), fee.clone());
m
});
Value::Null
}
/*
* @method
* @name hollaex#withdraw
* @description make a withdrawal
* @see https://apidocs.hollaex.com/#withdrawal
* @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)); }
self.check_address(&[address.clone()]);
if is_equal(&self.markets, &Value::Null) {
self.load_markets(&[]).await;
}
let mut currency: Value = self.currency(code.clone());
if !is_equal(&tag, &Value::Null) {
address = add(&address, &add(&Value::Str(":".to_string()), &tag));
}
let mut network: Value = self.safe_string_k(params.clone(), "network", &[]);
if is_equal(&network, &Value::Null) {
panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" withdraw() requires a network parameter".to_string()))));
}
params = self.omit(params.clone(), Value::Str("network".to_string()), &[]);
let mut request: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("currency".to_string(), get_value(¤cy, &Value::Str("id".to_string())));
m.insert("amount".to_string(), amount.clone());
m.insert("address".to_string(), address.clone());
m.insert("network".to_string(), self.network_code_to_id(network.clone(), &[code.clone()]));
m
});
let __ws_arg_17 = self.extend(request.clone(), &[params.clone()]);
let mut response: Value = self.private_post_user_withdrawal(&[__ws_arg_17]).await;
return self.parse_transaction(response.clone(), &[currency.clone()]);
Value::Null
}
pub fn parse_deposit_withdraw_fee(&self, mut fee: Value, optional_args: &[Value]) -> Value {
let mut currency = get_arg(optional_args, 0, Value::Null);
//
// "bch":{
// "id":4,
// "fullname":"Bitcoin Cash",
// "symbol":"bch",
// "active":true,
// "verified":true,
// "allow_deposit":true,
// "allow_withdrawal":true,
// "withdrawal_fee":0.0001,
// "min":0.001,
// "max":100000,
// "increment_unit":0.001,
// "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
// "code":"bch",
// "is_public":true,
// "meta":{},
// "estimated_price":null,
// "description":null,
// "type":"blockchain",
// "network":null,
// "standard":null,
// "issuer":"HollaEx",
// "withdrawal_fees":null,
// "created_at":"2019-08-09T10:45:43.367Z",
// "updated_at":"2021-12-13T03:08:32.372Z",
// "created_by":1,
// "owner_id":1
// }
//
let mut result: Value = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("info".to_string(), fee.clone());
m.insert("withdraw".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("fee".to_string(), Value::Null);
m.insert("percentage".to_string(), Value::Null);
m
}));
m.insert("deposit".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("fee".to_string(), Value::Null);
m.insert("percentage".to_string(), Value::Null);
m
}));
m.insert("networks".to_string(), Value::Map({
let mut m = indexmap::IndexMap::new();
m
}));
m
});
let mut allowWithdrawal: Value = self.safe_value_k(fee.clone(), "allow_withdrawal", &[]);
if is_equal(&allowWithdrawal, &Value::Bool(true)) {
add_element_to_object(&mut result, &Value::Str("withdraw".to_string()), Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("fee".to_string(), self.safe_number_k(fee.clone(), "withdrawal_fee", &[]));
m.insert("percentage".to_string(), Value::Bool(false));
m
}));
}
let mut withdrawalFees: Value = self.safe_value_k(fee.clone(), "withdrawal_fees", &[]);
if !is_equal(&withdrawalFees, &Value::Null) {
let mut keys: Value = object_keys(&withdrawalFees);
let mut keysLength: Value = get_array_length(&keys);
{
let mut i: Value = Value::Int(0);
let mut __for_first_758: bool = true;
while { if !__for_first_758 { i = add(&i, &Value::Int(1)); } __for_first_758 = false; is_less_than(&i, &keysLength) } {
let mut key: Value = get_value(&keys, &i);
let mut key: Value = get_value(&keys, &i);
let mut value: Value = get_value(&withdrawalFees, &key);
let mut value: Value = get_value(&withdrawalFees, &key);
let mut currencyId: Value = self.safe_string_k(value.clone(), "symbol", &[]);
let mut currencyCode: Value = self.safe_currency_code(currencyId.clone(), &[]);
let mut networkCode: Value = self.network_id_to_code(&[key.clone(), currencyCode.clone()]);
if is_equal(&networkCode, &Value::Null) {
panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" requires a networkCode argument".to_string()))));
}
let mut networkCodeUpper: Value = to_upper(&networkCode); // default to the upper case network code
let mut withdrawalFee: Value = self.safe_number_k(value.clone(), "value", &[]);
add_element_to_object(get_value_mut(&mut result, &Value::Str("networks".to_string())), &networkCodeUpper, Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("deposit".to_string(), Value::Null);
m.insert("withdraw".to_string(), withdrawalFee.clone());
m
}));
}
}
}
return result;
Value::Null
}
/*
* @method
* @name hollaex#fetchDepositWithdrawFees
* @description fetch deposit and withdraw fees
* @see https://apidocs.hollaex.com/#constants
* @param {string[]|undefined} codes list of unified currency codes
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure}
*/
pub async fn fetch_deposit_withdraw_fees(&mut self, optional_args: &[Value]) -> Value {
let mut codes = 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 mut response: Value = self.public_get_constants(&[params.clone()]).await;
//
// {
// "coins":{
// "bch":{
// "id":4,
// "fullname":"Bitcoin Cash",
// "symbol":"bch",
// "active":true,
// "verified":true,
// "allow_deposit":true,
// "allow_withdrawal":true,
// "withdrawal_fee":0.0001,
// "min":0.001,
// "max":100000,
// "increment_unit":0.001,
// "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
// "code":"bch",
// "is_public":true,
// "meta":{},
// "estimated_price":null,
// "description":null,
// "type":"blockchain",
// "network":null,
// "standard":null,
// "issuer":"HollaEx",
// "withdrawal_fees":null,
// "created_at":"2019-08-09T10:45:43.367Z",
// "updated_at":"2021-12-13T03:08:32.372Z",
// "created_by":1,
// "owner_id":1
// },
// },
// "network":"https://api.hollaex.network"
// }
//
let mut coins: Value = self.safe_dict_k(response.clone(), "coins", &[Value::Map({
let mut m = indexmap::IndexMap::new();
m
})]);
return self.parse_deposit_withdraw_fees(coins.clone(), &[codes.clone(), Value::Str("symbol".to_string())]);
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()), &[]);
path = add(&add(&add(&Value::Str("/".to_string()), &self.version), &Value::Str("/".to_string())), &self.implode_params(path.clone(), params.clone()));
if is_true(&(is_equal(&method, &Value::Str("GET".to_string())))) || is_true(&(is_equal(&method, &Value::Str("DELETE".to_string())))) {
if is_greater_than(&get_array_length(&object_keys(&query)), &Value::Int(0)) {
path = add(&path, &add(&Value::Str("?".to_string()), &self.urlencode(query.clone(), &[])));
}
}
let mut url: Value = add(&get_value(&get_value(&self.urls, &Value::Str("api".to_string())), &Value::Str("rest".to_string())), &path);
if is_equal(&api, &Value::Str("private".to_string())) {
self.check_required_credentials(&[]);
let mut defaultExpires: Value = self.safe_integer2(self.options.clone(), Value::Str("api-expires".to_string()), Value::Str("expires".to_string()), &[self.parse_to_int(divide(&self.timeout, &Value::Int(1000)))]);
let mut expires: Value = self.sum(&[self.seconds(), defaultExpires.clone()]);
let mut expiresString: Value = to_string_val(&expires);
let mut auth: Value = add(&add(&method, &path), &expiresString);
headers = Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("api-key".to_string(), self.apiKey.clone());
m.insert("api-expires".to_string(), expiresString.clone());
m
});
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()));
if is_greater_than(&get_array_length(&object_keys(&query)), &Value::Int(0)) {
body = self.json(query.clone());
auth = add(&auth, &body);
}
}
let mut signature: Value = self.hmac(self.encode(auth.clone()), self.encode(self.secret.clone()), Value::Str("sha256".to_string()), &[]);
add_element_to_object(&mut headers, &Value::Str("api-signature".to_string()), signature.clone());
}
return Value::Map({
let mut m = indexmap::IndexMap::new();
m.insert("url".to_string(), url.clone());
m.insert("method".to_string(), method.clone());
m.insert("body".to_string(), body.clone());
m.insert("headers".to_string(), headers.clone());
m
});
Value::Null
}
pub fn handle_errors(&self, mut code: Value, mut reason: Value, mut url: Value, mut method: Value, mut headers: Value, mut body: Value, mut response: Value, mut requestHeaders: Value, mut requestBody: Value) -> Value {
// { "message": "Invalid token" }
if is_equal(&response, &Value::Null) {
return Value::Null;
}
if is_true(&(is_greater_than_or_equal(&code, &Value::Int(400)))) && is_true(&(is_less_than_or_equal(&code, &Value::Int(503)))) {
//
// { "message": "Invalid token" }
//
// different errors return the same code eg
//
// { "message":"Error 1001 - Order rejected. Order could not be submitted as this order was set to a post only order." }
//
// { "message":"Error 1001 - POST ONLY order can not be of type market" }
//
let mut feedback: Value = add(&add(&self.id, &Value::Str(" ".to_string())), &body);
let mut message: Value = self.safe_string_k(response.clone(), "message", &[]);
self.throw_broadly_matched_exception(get_value(&self.exceptions, &Value::Str("broad".to_string())), message.clone(), feedback.clone());
let mut status: Value = to_string_val(&code);
self.throw_exactly_matched_exception(get_value(&self.exceptions, &Value::Str("exact".to_string())), status.clone(), feedback.clone());
}
return Value::Null;
Value::Null
}
}