# HTX Exchange Specification # # Auto-generated by: mix ccxt.extract htx # CCXT version: 4.5.34 # Spec format version: 1 # # Review before use: # - signing: Detected from sign() method, verify with testnet # - endpoints: Raw paths extracted, map to unified API as needed # - exceptions: Extracted (exact, broad, HTTP status codes) # - features/options: Extracted from describe() # - classification: Set to :supported initially, promote after validation # %{ api_param_requirements: nil, certified: true, classification: :certified_pro, comment: nil, countries: [ "CN" ], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "BIFI" => "BITCOINFILE", "FUD" => "FTX Users Debt", "GET" => "THEMIS", "GTC" => "GAMECOM", "HIT" => "HITCHAIN", "NGL" => "GFNGL", "PNT" => "PENTA", "SBTC" => "SUPERBITCOIN", "SOUL" => "SOULSAVER", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 68, "coveragePercent" => 100, "enabledMethods" => 73, "excluded" => [ %{ "method" => "fetchIndexOHLCV", "reason" => "htx swap has no api endpoint for index kline data" }, %{ "method" => "editOrder", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchDepositWithdrawFee", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchMarketLeverageTiers", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchPositionHistory", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 5, "extractableMethods" => 68, "failures" => [] }, endpoints: [ %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :borrow_cross_margin, param_mappings: %{ "code" => "currency" }, params: [ :code, :amount ], path: "/cross-margin/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, market_type: :spot, method: :post, name: :borrow_isolated_margin, param_mappings: %{ "code" => "currency" }, params: [ :symbol, :code, :amount ], path: "/margin/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.4, market_type: :spot, method: :post, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/v1/order/orders/batchCancelOpenOrders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v2Private", auth: true, cost: 1, default_params: %{ "timeout" => 1 }, market_type: :spot, method: :post, name: :cancel_all_orders_after, param_mappings: %{}, params: [ :timeout ], path: "/algo-orders/cancel-all-after", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :post, name: :cancel_order, param_mappings: %{ "id" => "order-id" }, params: [ :id, :symbol ], path: "/v1/order/orders/{order-id}/submitcancel", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "contract_code" => "BTCUSDT", "order_id" => "test-order-id" }, market_type: :spot, method: :post, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/linear-swap-api/v1/swap_cross_cancel", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :create_limit_order, param_mappings: %{}, params: [ :symbol, :side, :amount, :price ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :create_market_buy_order_with_cost, param_mappings: %{}, params: [ :symbol, :cost ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :create_market_order, param_mappings: %{}, params: [ :symbol, :side, :amount, :price ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :create_order, param_mappings: %{}, params: [ :symbol, :type, :side, :amount, :price ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "orders_data" => [ %{ "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "direction" => "buy", "lever_rate" => 1, "order_price_type" => "limit", "price" => "50000", "volume" => "0.001" } ] }, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/linear-swap-api/v1/swap_cross_batchorder", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "lever_rate" => 1, "order_price_type" => "limit", "triggerDirection" => "below", "trigger_type" => "le" }, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "volume", "price" => "order_price", "side" => "direction", "triggerPrice" => "trigger_price" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/linear-swap-api/v1/swap_cross_trigger_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "triggerDirection" => "below" }, market_type: :swap, method: :post, name: :create_stop_loss_order, param_mappings: %{ "amount" => "volume", "price" => "sl_order_price", "side" => "direction", "stopLossPrice" => "sl_trigger_price", "type" => "sl_order_price_type" }, params: [ :symbol, :type, :side, :amount, :price, :stopLossPrice ], path: "/linear-swap-api/v1/swap_cross_tpsl_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "lever_rate" => 1, "order_price_type" => "market", "triggerDirection" => "below", "trigger_type" => "le" }, market_type: :swap, method: :post, name: :create_stop_market_order, param_mappings: %{ "amount" => "volume", "side" => "direction", "triggerPrice" => "trigger_price" }, params: [ :symbol, :side, :amount, :triggerPrice ], path: "/linear-swap-api/v1/swap_cross_trigger_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "lever_rate" => 1, "triggerDirection" => "below", "trigger_type" => "le" }, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "volume", "price" => "order_price", "side" => "direction", "triggerPrice" => "trigger_price", "type" => "order_price_type" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/linear-swap-api/v1/swap_cross_trigger_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "triggerDirection" => "above" }, market_type: :swap, method: :post, name: :create_take_profit_order, param_mappings: %{ "amount" => "volume", "price" => "tp_order_price", "side" => "direction", "takeProfitPrice" => "tp_trigger_price", "type" => "tp_order_price_type" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfitPrice ], path: "/linear-swap-api/v1/swap_cross_tpsl_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "callback_rate" => 0.01, "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "order_price_type" => "formula_price" }, market_type: :swap, method: :post, name: :create_trailing_percent_order, param_mappings: %{ "amount" => "volume", "side" => "direction", "trailingPercent" => "lever_rate", "trailingTriggerPrice" => "active_price" }, params: [ :symbol, :type, :side, :amount, :price, :trailingPercent, :trailingTriggerPrice ], path: "/linear-swap-api/v1/swap_cross_track_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "channel_code" => "AA03022abc", "contract_code" => "BTCUSDT", "lever_rate" => 1, "triggerDirection" => "below", "trigger_type" => "le" }, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "volume", "price" => "order_price", "side" => "direction", "triggerPrice" => "trigger_price", "type" => "order_price_type" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/linear-swap-api/v1/swap_cross_trigger_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :fetch_accounts, param_mappings: %{}, params: [], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_borrow_interest, param_mappings: %{ "code" => "currency" }, params: [ :code, :symbol, :since, :limit ], path: "/cross-margin/loan-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.4, default_params: %{ "states" => "filled,partial-canceled,canceled" }, market_type: :spot, method: :get, name: :fetch_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v1/order/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/v2/reference/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "currency" }, params: [ :code ], path: "/v2/account/deposit/address", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_deposit_addresses_by_network, param_mappings: %{ "code" => "currency" }, params: [ :code ], path: "/v2/account/deposit/address", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fees, param_mappings: %{}, params: [ :codes ], path: "/v2/reference/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, default_params: %{ "direct" => "next", "size" => 100, "type" => "deposit" }, market_type: :spot, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "currency", "since" => "from" }, params: [ :code, :since, :limit ], path: "/v1/query/deposit-withdraw", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "contract" => "BTCUSDT", "mar_acct" => "USDT", "type" => "30,31" }, market_type: :swap, method: :post, name: :fetch_funding_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/linear-swap-api/v3/swap_financial_record_exact", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "category" => "linear", "contract_code" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/linear-swap-api/v1/swap_funding_rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "category" => "linear", "contract_code" => "BTCUSDT", "page_size" => 50 }, market_type: :swap, method: :get, name: :fetch_funding_rate_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/linear-swap-api/v1/swap_historical_funding_rate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "category" => "linear" }, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/linear-swap-api/v1/swap_batch_funding_rate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_isolated_borrow_rates, param_mappings: %{}, params: [], path: "/v1/margin/loan-info", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, default_params: %{ "type" => "step0" }, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/market/depth", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_last_prices, param_mappings: %{}, params: [ :symbols ], path: "/linear-swap-ex/market/trade", response_transformer: {:extract_path, ["tick", "data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :fetch_ledger, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_leverage_tiers, param_mappings: %{}, params: [ :symbols ], path: "/linear-swap-api/v1/swap_adjustfactor", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "contract" => "BTCUSDT", "trade_type" => 0 }, market_type: :swap, method: :get, name: :fetch_liquidations, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/linear-swap-api/v3/swap_liquidation_orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "contract_code" => "BTCUSDT", "period" => "1min" }, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, param_mappings: %{ "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/index/market/history/linear_swap_mark_price_kline", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/v1/common/symbols", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v1/order/matchresults", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, default_params: %{ "period" => "60min" }, market_type: :spot, method: :get, name: :fetch_ohlcv, param_mappings: %{ "limit" => "size", "since" => "from", "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/market/history/candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "category" => "linear", "contract_code" => "BTCUSDT", "contract_type" => "swap" }, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{}, params: [ :symbol ], path: "/linear-swap-api/v1/swap_open_interest", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "amount_type" => 2, "category" => "linear", "contract_code" => "BTCUSDT", "contract_type" => "swap", "period" => "60min" }, market_type: :swap, method: :get, name: :fetch_open_interest_history, param_mappings: %{ "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/linear-swap-api/v1/swap_his_open_interest", response_transformer: {:extract_path, ["data", "tick"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "contract_type" => "swap" }, market_type: :spot, method: :get, name: :fetch_open_interests, param_mappings: %{}, params: [ :symbols ], path: "/linear-swap-api/v1/swap_open_interest", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.4, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "order-id" }, params: [ :id, :symbol ], path: "/v1/order/orders/{order-id}", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, default_params: %{ "type" => "step0" }, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{ "limit" => "depth" }, params: [ :symbol, :limit ], path: "/market/depth", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.4, market_type: :spot, method: :get, name: :fetch_order_trades, param_mappings: %{ "id" => "order-id" }, params: [ :id, :symbol, :since, :limit ], path: "/v1/order/orders/{order-id}/matchresults", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.4, default_params: %{ "states" => "pre-submitted,submitted,partial-filled,filled,partial-canceled,canceled" }, market_type: :spot, method: :get, name: :fetch_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v1/order/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "category" => "linear", "contract_code" => "BTCUSDT", "margin_account" => "USDT" }, market_type: :swap, method: :post, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/linear-swap-api/v1/swap_cross_account_position_info", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "category" => "linear" }, market_type: :swap, method: :post, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/linear-swap-api/v1/swap_cross_position_info", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "contract_code" => "BTCUSDT", "period" => "1min" }, market_type: :swap, method: :get, name: :fetch_premium_index_ohlcv, param_mappings: %{ "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/index/market/history/linear_swap_premium_index_kline", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/public", auth: false, cost: 1, default_params: %{ "contract_code" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_settlement_history, param_mappings: %{}, params: [], path: "/linear-swap-api/v1/swap_settlement_records", response_transformer: {:extract_path, ["data", "settlement_record"]}, source: :intercepted }, %{ api_section: "status/public/spot", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_status, param_mappings: %{}, params: [], path: "/api/v2/summary.json", response_transformer: {:extract_path, ["status", "indicator"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/market/detail/merged", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/market/tickers", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/v1/common/timestamp", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{ "limit" => "size" }, params: [ :symbol, :since, :limit ], path: "/market/history/trade", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{ "symbol" => "symbols" }, params: [ :symbol ], path: "/v2/reference/transact-fee-rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "spot/public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :spot, method: :get, name: :fetch_trading_limits, param_mappings: %{}, params: [ :symbols ], path: "/v1/common/exchange", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_withdraw_addresses, param_mappings: %{ "arg0" => "currency" }, params: [], path: "/v2/account/withdraw/address", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, default_params: %{ "direct" => "next", "size" => 100, "type" => "withdraw" }, market_type: :spot, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "currency", "since" => "from" }, params: [ :code, :since, :limit ], path: "/v1/query/deposit-withdraw", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :repay_cross_margin, param_mappings: %{}, params: [ :code, :amount ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["Data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 0.2, market_type: :spot, method: :get, name: :repay_isolated_margin, param_mappings: %{}, params: [ :symbol, :code, :amount ], path: "/v1/account/accounts", response_transformer: {:extract_path, ["Data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 30, default_params: %{ "contract_code" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{ "leverage" => "lever_rate" }, params: [ :leverage, :symbol ], path: "/linear-swap-api/v1/swap_cross_switch_lever_rate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "contract/private", auth: true, cost: 1, default_params: %{ "margin_account" => "USDT", "position_mode" => "dual_side" }, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/linear-swap-api/v1/swap_cross_switch_position_mode", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v2Private", auth: true, cost: 1, default_params: %{ "margin-account" => "USDT", "to" => "" }, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "code" => "currency", "fromAccount" => "from" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/account/transfer", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/private", auth: true, cost: 1, market_type: :spot, method: :post, name: :withdraw, param_mappings: %{ "code" => "currency" }, params: [ :code, :amount, :address, :tag ], path: "/v1/dw/withdraw/api/create", response_transformer: {:extract_path, ["data"]}, source: :intercepted } ], error_code_details: %{ 1003 => %{ description: "{code: '1003', message: 'invalid signature'}", type: :invalid_credentials }, 1010 => %{ description: "{\"status\":\"error\",\"err_code\":1010,\"err_msg\":\"Account doesnt exist.\",\"ts\":1648137970490}", type: :access_restricted }, 1013 => %{ description: "{\"status\":\"error\",\"err_code\":1013,\"err_msg\":\"This contract symbol doesnt exist.\",\"ts\":1640550459583}", type: :invalid_order }, 1017 => %{ description: "{\"status\":\"error\",\"err_code\":1017,\"err_msg\":\"Order doesnt exist.\",\"ts\":1640550859242}", type: :order_not_found }, 1034 => %{ description: "{\"status\":\"error\",\"err_code\":1034,\"err_msg\":\"Incorrect field of order price type.\",\"ts\":1643802870182}", type: :invalid_order }, 1036 => %{ description: "{\"status\":\"error\",\"err_code\":1036,\"err_msg\":\"Incorrect field of open long form.\",\"ts\":1643802518986}", type: :invalid_order }, 1039 => %{ description: "{\"status\":\"error\",\"err_code\":1039,\"err_msg\":\"Buy price must be lower than 39270.9USDT. Sell price must exceed 37731USDT.\",\"ts\":1643802374403}", type: :invalid_order }, 1041 => %{ description: "{\"status\":\"error\",\"err_code\":1041,\"err_msg\":\"The order amount exceeds the limit (170000Cont), please modify and order again.\",\"ts\":1643802784940}", type: :invalid_order }, 1047 => %{ description: "{\"status\":\"error\",\"err_code\":1047,\"err_msg\":\"Insufficient margin available.\",\"ts\":1643802672652}", type: :insufficient_balance }, 1048 => %{ description: "{\"status\":\"error\",\"err_code\":1048,\"err_msg\":\"Insufficient close amount available.\",\"ts\":1652772408864}", type: :insufficient_balance }, 1051 => %{ description: "{\"status\":\"error\",\"err_code\":1051,\"err_msg\":\"No orders to cancel.\",\"ts\":1652552125876}", type: :invalid_order }, 1061 => %{ description: "{\"status\":\"ok\",\"data\":{\"errors\":[{\"order_id\":\"1349442392365359104\",\"err_code\":1061,\"err_msg\":\"The order does not exist.\"}],\"successes\":\"\"},\"ts\":1741773744526}", type: :order_not_found }, 1066 => %{ description: "{\"status\":\"error\",\"err_code\":1066,\"err_msg\":\"The symbol field cannot be empty. Please re-enter.\",\"ts\":1640550819147}", type: :invalid_order }, 1067 => %{ description: "{\"status\":\"error\",\"err_code\":1067,\"err_msg\":\"The client_order_id field is invalid. Please re-enter.\",\"ts\":1643802119413}", type: :invalid_order }, 1094 => %{ description: "{\"status\":\"error\",\"err_code\":1094,\"err_msg\":\"The leverage cannot be empty, please switch the leverage or contact customer service\",\"ts\":1640496946243}", type: :invalid_order }, 1220 => %{ description: "{\"status\":\"error\",\"err_code\":1220,\"err_msg\":\"You don’t have access permission as you have not opened contracts trading.\",\"ts\":1645096660718}", type: :access_restricted }, 1303 => %{ description: "Each transfer-out cannot be less than 5USDT.", type: :invalid_parameters }, 1461 => %{ description: "{\"status\":\"error\",\"err_code\":1461,\"err_msg\":\"Current positions have triggered position limits (5000USDT). Please modify.\",\"ts\":1652554651234}", type: :invalid_order }, 4007 => %{ description: "{\"code\":\"4007\",\"msg\":\"Unified account special interface, non - one account is not available\",\"data\":null,\"ts\":\"1698413427651\"}'", type: :invalid_parameters }, 403 => %{ description: "{\"status\":\"error\",\"err_code\":403,\"err_msg\":\"Incorrect Access key [Access key错误]\",\"ts\":1652774224344}", type: :invalid_credentials }, "API key has no permission" => %{ description: "{\"status\":\"error\",\"err-code\":\"api-signature-not-valid\",\"err-msg\":\"Signature not valid: API key has no permission [API Key没有权限]\",\"data\":null}", type: :access_restricted }, "account-frozen-balance-insufficient-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"account-frozen-balance-insufficient-error\",\"err-msg\":\"trade account balance is not enough, left: `0.0027`\",\"data\":null}", type: :insufficient_balance }, "api-not-support-temp-addr" => %{ description: "{\"status\":\"error\",\"err-code\":\"api-not-support-temp-addr\",\"err-msg\":\"API withdrawal does not support temporary addresses\",\"data\":null}", type: :access_restricted }, "api-signature-check-failed" => %{ description: nil, type: :invalid_credentials }, "api-signature-not-valid" => %{ description: "{\"status\":\"error\",\"err-code\":\"api-signature-not-valid\",\"err-msg\":\"Signature not valid: Incorrect Access key [Access key错误]\",\"data\":null}", type: :invalid_credentials }, "bad-request" => %{ description: nil, type: :invalid_parameters }, "base-currency-chain-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"base-currency-chain-error\",\"err-msg\":\"The current currency chain does not exist\",\"data\":null},", type: :invalid_parameters }, "base-date-limit-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"base-date-limit-error\",\"err-msg\":\"date less than system limit\",\"data\":null}", type: :invalid_parameters }, "base-record-invalid" => %{ description: "https://github.com/ccxt/ccxt/issues/5750", type: :order_not_found }, "base-request-exceed-frequency-limit" => %{ description: "{\"status\":\"error\",\"err-code\":\"base-request-exceed-frequency-limit\",\"err-msg\":\"Frequency of requests has exceeded the limit, please try again later\",\"data\":null}", type: :rate_limited }, "base-symbol-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"base-symbol-error\",\"err-msg\":\"The symbol is invalid\",\"data\":null}", type: :invalid_order }, "base-symbol-trade-disabled" => %{ description: "{\"status\":\"error\",\"err-code\":\"base-symbol-trade-disabled\",\"err-msg\":\"Trading is disabled for this symbol\",\"data\":null}", type: :invalid_order }, "base-withdraw-fee-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"base-withdraw-fee-error\",\"err-msg\":\"withdrawal fee is not within limits\",\"data\":null}", type: :invalid_parameters }, "contract is restricted of closing positions on API. Please contact customer service" => %{ description: nil, type: :network_error }, "dw-insufficient-balance" => %{ description: "{\"status\":\"error\",\"err-code\":\"dw-insufficient-balance\",\"err-msg\":\"Insufficient balance. You can only transfer `12.3456` at most.\",\"data\":null}", type: :insufficient_balance }, "dw-withdraw-min-limit" => %{ description: "{\"status\":\"error\",\"err-code\":\"dw-withdraw-min-limit\",\"err-msg\":\"The withdrawal amount is less than the minimum limit.\",\"data\":null}", type: :invalid_parameters }, "gateway-internal-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"gateway-internal-error\",\"err-msg\":\"Failed to load data. Try again later.\",\"data\":null}", type: :network_error }, "invalid symbol" => %{ description: "{\"ts\":1568813334794,\"status\":\"error\",\"err-code\":\"invalid-parameter\",\"err-msg\":\"invalid symbol\"}", type: :invalid_order }, "invalid-address" => %{ description: "{\"status\":\"error\",\"err-code\":\"invalid-address\",\"err-msg\":\"Invalid address.\",\"data\":null},", type: :invalid_parameters }, "invalid-amount" => %{ description: "eg \"Paramemter `amount` is invalid.\"", type: :invalid_order }, "maintain" => %{ description: nil, type: :network_error }, "order-etp-nav-price-max-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"order-etp-nav-price-max-error\",\"err-msg\":\"Order price cannot be higher than 5% of NAV\",\"data\":null}", type: :invalid_order }, "order-holding-limit-failed" => %{ description: "{\"status\":\"error\",\"err-code\":\"order-holding-limit-failed\",\"err-msg\":\"Order failed, exceeded the holding limit of this currency\",\"data\":null}", type: :invalid_order }, "order-invalid-price" => %{ description: "{\"status\":\"error\",\"err-code\":\"order-invalid-price\",\"err-msg\":\"invalid price\",\"data\":null}", type: :invalid_order }, "order-limitorder-amount-max-error" => %{ description: "market order amount error, max: `1000000`", type: :invalid_order }, "order-limitorder-amount-min-error" => %{ description: "limit order amount error, min: `0.001`", type: :invalid_order }, "order-limitorder-price-buy-max-error" => %{ description: "limit order price error", type: :invalid_order }, "order-limitorder-price-buy-min-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"order-limitorder-price-buy-min-error\",\"err-msg\":\"The price cannot be lower than 0.0006 USDT\",\"data\":null}", type: :invalid_order }, "order-limitorder-price-max-error" => %{ description: "limit order price error", type: :invalid_order }, "order-limitorder-price-min-error" => %{ description: "limit order price error", type: :invalid_order }, "order-limitorder-price-sell-max-error" => %{ description: "limit order price error", type: :invalid_order }, "order-limitorder-price-sell-min-error" => %{ description: "limit order price error", type: :invalid_order }, "order-marketorder-amount-min-error" => %{ description: "market order amount error, min: `0.01`", type: :invalid_order }, "order-orderprice-precision-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"order-orderprice-precision-error\",\"err-msg\":\"order price precision error, scale: `4`\",\"data\":null}", type: :invalid_order }, "order-orderstate-error" => %{ description: "canceling an already canceled order", type: :order_not_found }, "order-queryorder-invalid" => %{ description: "querying a non-existent order", type: :order_not_found }, "order-stop-order-hit-trigger" => %{ description: "{\"status\":\"error\",\"err-code\":\"order-stop-order-hit-trigger\",\"err-msg\":\"Orders that are triggered immediately are not supported.\",\"data\":null}", type: :invalid_order }, "order-update-error" => %{ description: "undocumented error", type: :network_error }, "order-value-min-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"order-value-min-error\",\"err-msg\":\"Order total cannot be lower than: 1 USDT\",\"data\":null}", type: :invalid_order }, "rate-too-many-requests" => %{ description: "{\"status\":\"error\",\"err-code\":\"rate-too-many-requests\",\"err-msg\":\"exceeded rate limit\",\"data\":null}", type: :rate_limited }, "request limit" => %{ description: "{\"ts\":1687004814731,\"status\":\"error\",\"err-code\":\"invalid-parameter\",\"err-msg\":\"request limit\"}", type: :rate_limited }, "require-symbol" => %{ description: "{\"status\":\"error\",\"err-code\":\"require-symbol\",\"err-msg\":\"Parameter `symbol` is required.\",\"data\":null},", type: :invalid_order }, "symbol trade not open now" => %{ description: "{\"ts\":1576210479343,\"status\":\"error\",\"err-code\":\"invalid-parameter\",\"err-msg\":\"symbol trade not open now\"}", type: :invalid_order }, "system-maintenance" => %{ description: "{\"status\": \"error\", \"err-code\": \"system-maintenance\", \"err-msg\": \"System is in maintenance!\", \"data\": null}", type: :network_error }, "timeout" => %{ description: "{\"ts\":1571653730865,\"status\":\"error\",\"err-code\":\"timeout\",\"err-msg\":\"Request Timeout\"}", type: :network_error }, "validation-constraints-required" => %{ description: "{\"status\":\"error\",\"err-code\":\"validation-constraints-required\",\"err-msg\":\"Field is missing: client-order-id.\",\"data\":null}", type: :invalid_parameters }, "validation-format-error" => %{ description: "{\"status\":\"error\",\"err-code\":\"validation-format-error\",\"err-msg\":\"Format Error: order-id.\",\"data\":null}", type: :invalid_parameters } }, error_codes: %{ 1003 => :invalid_credentials, 1010 => :access_restricted, 1013 => :invalid_order, 1017 => :order_not_found, 1034 => :invalid_order, 1036 => :invalid_order, 1039 => :invalid_order, 1041 => :invalid_order, 1047 => :insufficient_balance, 1048 => :insufficient_balance, 1051 => :invalid_order, 1061 => :order_not_found, 1066 => :invalid_order, 1067 => :invalid_order, 1094 => :invalid_order, 1220 => :access_restricted, 1303 => :invalid_parameters, 1461 => :invalid_order, 4007 => :invalid_parameters, 403 => :invalid_credentials, "API key has no permission" => :access_restricted, "account-frozen-balance-insufficient-error" => :insufficient_balance, "api-not-support-temp-addr" => :access_restricted, "api-signature-check-failed" => :invalid_credentials, "api-signature-not-valid" => :invalid_credentials, "bad-request" => :invalid_parameters, "base-currency-chain-error" => :invalid_parameters, "base-date-limit-error" => :invalid_parameters, "base-record-invalid" => :order_not_found, "base-request-exceed-frequency-limit" => :rate_limited, "base-symbol-error" => :invalid_order, "base-symbol-trade-disabled" => :invalid_order, "base-withdraw-fee-error" => :invalid_parameters, "contract is restricted of closing positions on API. Please contact customer service" => :network_error, "dw-insufficient-balance" => :insufficient_balance, "dw-withdraw-min-limit" => :invalid_parameters, "gateway-internal-error" => :network_error, "invalid symbol" => :invalid_order, "invalid-address" => :invalid_parameters, "invalid-amount" => :invalid_order, "maintain" => :network_error, "order-etp-nav-price-max-error" => :invalid_order, "order-holding-limit-failed" => :invalid_order, "order-invalid-price" => :invalid_order, "order-limitorder-amount-max-error" => :invalid_order, "order-limitorder-amount-min-error" => :invalid_order, "order-limitorder-price-buy-max-error" => :invalid_order, "order-limitorder-price-buy-min-error" => :invalid_order, "order-limitorder-price-max-error" => :invalid_order, "order-limitorder-price-min-error" => :invalid_order, "order-limitorder-price-sell-max-error" => :invalid_order, "order-limitorder-price-sell-min-error" => :invalid_order, "order-marketorder-amount-min-error" => :invalid_order, "order-orderprice-precision-error" => :invalid_order, "order-orderstate-error" => :order_not_found, "order-queryorder-invalid" => :order_not_found, "order-stop-order-hit-trigger" => :invalid_order, "order-update-error" => :network_error, "order-value-min-error" => :invalid_order, "rate-too-many-requests" => :rate_limited, "request limit" => :rate_limited, "require-symbol" => :invalid_order, "symbol trade not open now" => :invalid_order, "system-maintenance" => :network_error, "timeout" => :network_error, "validation-constraints-required" => :invalid_parameters, "validation-format-error" => :invalid_parameters }, exceptions: %{ broad: %{ "API key has no permission" => :permission_denied, "contract is restricted of closing positions on API. Please contact customer service" => :on_maintenance, "maintain" => :on_maintenance }, exact: %{ "1003" => :authentication_error, "1010" => :account_not_enabled, "1013" => :bad_symbol, "1017" => :order_not_found, "1034" => :invalid_order, "1036" => :invalid_order, "1039" => :invalid_order, "1041" => :invalid_order, "1047" => :insufficient_funds, "1048" => :insufficient_funds, "1051" => :invalid_order, "1061" => :order_not_found, "1066" => :bad_symbol, "1067" => :invalid_order, "1094" => :invalid_order, "1220" => :account_not_enabled, "1303" => :bad_request, "1461" => :invalid_order, "4007" => :bad_request, "403" => :authentication_error, "account-frozen-balance-insufficient-error" => :insufficient_funds, "api-not-support-temp-addr" => :permission_denied, "api-signature-check-failed" => :authentication_error, "api-signature-not-valid" => :authentication_error, "bad-request" => :bad_request, "base-currency-chain-error" => :bad_request, "base-date-limit-error" => :bad_request, "base-record-invalid" => :order_not_found, "base-request-exceed-frequency-limit" => :rate_limit_exceeded, "base-symbol-error" => :bad_symbol, "base-symbol-trade-disabled" => :bad_symbol, "base-withdraw-fee-error" => :bad_request, "dw-insufficient-balance" => :insufficient_funds, "dw-withdraw-min-limit" => :bad_request, "gateway-internal-error" => :exchange_not_available, "invalid symbol" => :bad_symbol, "invalid-address" => :bad_request, "invalid-amount" => :invalid_order, "order-etp-nav-price-max-error" => :invalid_order, "order-holding-limit-failed" => :invalid_order, "order-invalid-price" => :invalid_order, "order-limitorder-amount-max-error" => :invalid_order, "order-limitorder-amount-min-error" => :invalid_order, "order-limitorder-price-buy-max-error" => :invalid_order, "order-limitorder-price-buy-min-error" => :invalid_order, "order-limitorder-price-max-error" => :invalid_order, "order-limitorder-price-min-error" => :invalid_order, "order-limitorder-price-sell-max-error" => :invalid_order, "order-limitorder-price-sell-min-error" => :invalid_order, "order-marketorder-amount-min-error" => :invalid_order, "order-orderprice-precision-error" => :invalid_order, "order-orderstate-error" => :order_not_found, "order-queryorder-invalid" => :order_not_found, "order-stop-order-hit-trigger" => :invalid_order, "order-update-error" => :exchange_not_available, "order-value-min-error" => :invalid_order, "rate-too-many-requests" => :rate_limit_exceeded, "request limit" => :rate_limit_exceeded, "require-symbol" => :bad_symbol, "symbol trade not open now" => :bad_symbol, "system-maintenance" => :on_maintenance, "timeout" => :request_timeout, "validation-constraints-required" => :bad_request, "validation-format-error" => :bad_request } }, exchange_options: %{ "accountsById" => %{ "borrow" => "borrow", "deposit-earning" => "deposit-earning", "grid-trading" => "grid-trading", "investment" => "investment", "margin" => "margin", "otc" => "otc", "otc-options" => "otc-options", "point" => "point", "spot" => "spot", "super-margin" => "super-margin" }, "accountsByType" => %{ "funding" => "pro", "future" => "futures", "spot" => "pro" }, "adjustForTimeDifference" => false, "broker" => %{ "id" => "AA03022abc" }, "createMarketBuyOrderRequiresPrice" => true, "defaultNetwork" => "ERC20", "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "defaultNetworks" => %{ "BTC" => "BTC", "ETH" => "ERC20", "USDT" => "TRC20" }, "defaultSubType" => "linear", "defaultType" => "spot", "fetchMarkets" => %{ "types" => %{ "inverse" => true, "linear" => true, "spot" => true } }, "fetchOHLCV" => %{ "useHistoricalEndpointForSpot" => true }, "fetchOrdersByStatesMethod" => "spot_private_get_v1_order_orders", "include_OS_certificates" => false, "language" => "en-US", "networks" => %{ "AAC" => "AAC", "ACT" => "ACT", "ADA" => "ADA", "AE" => "AE", "AKT" => "AKT", "AOTI" => "COTI", "APT" => "APT", "AR" => "AR", "ARDR" => "ARDR", "ARS" => "ARS", "ASTR" => "ASTR", "AZERO" => "AZERO", "BAND" => "BAND", "BCD" => "BCD", "BCV" => "BCV", "BCX" => "BCX", "BEP20" => "BSC", "BHD" => "BHD", "BIFI" => "BIFI", "BITCI" => "BITCI", "BLD" => "BLD", "BRISE" => "BRISE", "BSV" => "BSV", "BTC" => "BTC", "BTG" => "BTG", "BTM" => "BTM", "BTS" => "BTS", "BTT" => "BTT", "CARDANO" => "ADA", "CCA" => "ACA", "CELO" => "CELO", "CKB" => "CKB", "CMT" => "CMT", "CORE" => "CORE", "CRO" => "CRO", "CRONOS" => "CRO", "CRUST" => "CRUST", "CSPR" => "CSPR", "CTXC" => "CTXC", "CUBE" => "CUBE", "CVNT1" => "CVNT1", "DASH" => "DASH", "DCR" => "DCR", "DESO" => "DESO", "DFI" => "DFI", "DGB" => "DGB", "DOCK" => "DOCK", "DOGE" => "DOGE", "DOGECHAIN" => "DOGECHAIN", "DOT" => "DOT", "EGLD" => "EGLD", "ELA" => "ELA", "ELF" => "ELF", "EM" => "EM", "ENJ" => "ENJ", "EOS" => "EOS", "EOSS" => "EOSS", "ERC20" => "ETH", "ERG" => "ERG", "ETC" => "ETC", "ETHF" => "ETHFAIR", "ETHW" => "ETHW", "ETN" => "ETN", "EVMOS" => "EVMOS", "FIL" => "FIL", "FINSCHIA" => "FINSCHIA", "FIO" => "FIO", "FIS" => "FIS", "FLOW" => "FLOW", "FLR" => "FLR", "FSN" => "FSN", "FTM" => "FTM", "GAS" => "GAS", "GLMR" => "GLMR", "GRS" => "GRS", "HBAR" => "HBAR", "HC" => "HC", "HIVE" => "HIVE", "HRC20" => "HECO", "ICP" => "ICP", "ICX" => "ICX", "IOST" => "IOST", "IOTA" => "IOTA", "IOTX" => "IOTX", "IRIS" => "IRIS", "KAVA" => "KAVA", "KLAY" => "KLAY", "KMA" => "KMA", "KMD" => "KMD", "KSM" => "KSM", "KYVE" => "KYVE", "LAMB" => "LAMB", "LAT" => "LAT", "LSK" => "LSK", "LTC" => "LTC", "LUK" => "LUK", "MASS" => "MASS", "MATIC" => "MATIC", "MEV" => "MEV", "MINA" => "MINA", "MINEPLEX" => "MINEPLEX", "MOVR" => "MOVR", "NANO" => "NANO", "NAS" => "NAS", "NBS" => "NBS", "NEAR" => "NEAR", "NEO" => "NEO", "NEON3" => "NEON3", "NEWTON" => "NEWTON", "NODL" => "NODL", "NULS" => "NULS", "OAS" => "OAS", "OEP4" => "OEP4", "ONE" => "ONE", "OSMO" => "OSMO", "PAI" => "PAI", "PAYCOIN" => "PAYCOIN", "POKT" => "POKT", "POLYGON" => "MATIC", "POLYX" => "POLYX", "PYG" => "PYG", "QTUM" => "QTUM", "RBTC" => "RBTC", "REI" => "REI", "RVN" => "RVN", "SBTC" => "SBTC", "SC" => "SC", "SCRT" => "SCRT", "SDN" => "SDN", "SEELE" => "SEELE", "SEI" => "SEI", "SGB" => "SGB", "SMT" => "SMT", "SOL" => "SOLANA", "STEEM" => "STEEM", "STEP" => "STEP", "SUI" => "SUI", "SXP" => "SOLAR", "SYS" => "SYS", "TENET" => "TENET", "THETA" => "THETA", "TON" => "TON", "TOP" => "TOP", "TRC20" => "TRX", "TT" => "TT", "UGAS" => "UGAS", "UNQ" => "UNQ", "UYU" => "UYU", "VET" => "VET", "VSYS" => "VSYS", "WAN" => "WAN", "WAVES" => "WAVES", "WAX" => "WAX1", "WEMIX" => "WEMIX", "WICC" => "WICC", "WTC" => "WTC", "XCH" => "XCH", "XDC" => "XDC", "XEC" => "ECASH", "XEM" => "XEM", "XLM" => "XLM", "XMR" => "XMR", "XPLA" => "XPLA", "XPRT" => "XPRT", "XRP" => "XRP", "XTZ" => "XTZ", "XVG" => "XVG", "XYM" => "XYM", "XZC" => "XZC", "ZEC" => "ZEC", "ZEN" => "ZEN", "ZIL" => "ZIL" }, "networksById" => %{ "AAC" => "AAC", "ACA" => "CCA", "ACT" => "ACT", "ADA" => "ADA", "AE" => "AE", "AKT" => "AKT", "APT" => "APT", "AR" => "AR", "ARDR" => "ARDR", "ARS" => "ARS", "ASTR" => "ASTR", "AZERO" => "AZERO", "BAND" => "BAND", "BCD" => "BCD", "BCV" => "BCV", "BCX" => "BCX", "BHD" => "BHD", "BIFI" => "BIFI", "BITCI" => "BITCI", "BLD" => "BLD", "BRISE" => "BRISE", "BSC" => "BEP20", "BSV" => "BSV", "BTC" => "BTC", "BTG" => "BTG", "BTM" => "BTM", "BTS" => "BTS", "BTT" => "BTT", "CELO" => "CELO", "CKB" => "CKB", "CMT" => "CMT", "CORE" => "CORE", "COTI" => "AOTI", "CRO" => "CRO", "CRUST" => "CRUST", "CSPR" => "CSPR", "CTXC" => "CTXC", "CUBE" => "CUBE", "CVNT1" => "CVNT1", "DASH" => "DASH", "DCR" => "DCR", "DESO" => "DESO", "DFI" => "DFI", "DGB" => "DGB", "DOCK" => "DOCK", "DOGE" => "DOGE", "DOGECHAIN" => "DOGECHAIN", "DOT" => "DOT", "ECASH" => "XEC", "EGLD" => "EGLD", "ELA" => "ELA", "ELF" => "ELF", "EM" => "EM", "ENJ" => "ENJ", "EOS" => "EOS", "EOSS" => "EOSS", "ERG" => "ERG", "ETC" => "ETC", "ETH" => "ERC20", "ETHFAIR" => "ETHF", "ETHW" => "ETHW", "ETN" => "ETN", "EVMOS" => "EVMOS", "FIL" => "FIL", "FINSCHIA" => "FINSCHIA", "FIO" => "FIO", "FIS" => "FIS", "FLOW" => "FLOW", "FLR" => "FLR", "FSN" => "FSN", "FTM" => "FTM", "GAS" => "GAS", "GLMR" => "GLMR", "GRS" => "GRS", "HBAR" => "HBAR", "HC" => "HC", "HECO" => "HRC20", "HIVE" => "HIVE", "ICP" => "ICP", "ICX" => "ICX", "IOST" => "IOST", "IOTA" => "IOTA", "IOTX" => "IOTX", "IRIS" => "IRIS", "KAVA" => "KAVA", "KLAY" => "KLAY", "KMA" => "KMA", "KMD" => "KMD", "KSM" => "KSM", "KYVE" => "KYVE", "LAMB" => "LAMB", "LAT" => "LAT", "LSK" => "LSK", "LTC" => "LTC", "LUK" => "LUK", "MASS" => "MASS", "MATIC" => "MATIC", "MEV" => "MEV", "MINA" => "MINA", "MINEPLEX" => "MINEPLEX", "MOVR" => "MOVR", "NANO" => "NANO", "NAS" => "NAS", "NBS" => "NBS", "NEAR" => "NEAR", "NEO" => "NEO", "NEON3" => "NEON3", "NEWTON" => "NEWTON", "NODL" => "NODL", "NULS" => "NULS", "OAS" => "OAS", "OEP4" => "OEP4", "ONE" => "ONE", "OSMO" => "OSMO", "PAI" => "PAI", "PAYCOIN" => "PAYCOIN", "POKT" => "POKT", "POLYX" => "POLYX", "PYG" => "PYG", "QTUM" => "QTUM", "RBTC" => "RBTC", "REI" => "REI", "RVN" => "RVN", "SBTC" => "SBTC", "SC" => "SC", "SCRT" => "SCRT", "SDN" => "SDN", "SEELE" => "SEELE", "SEI" => "SEI", "SGB" => "SGB", "SMT" => "SMT", "SOLANA" => "SOL", "SOLAR" => "SXP", "STEEM" => "STEEM", "STEP" => "STEP", "SUI" => "SUI", "SYS" => "SYS", "TENET" => "TENET", "THETA" => "THETA", "TON" => "TON", "TOP" => "TOP", "TRX" => "TRC20", "TT" => "TT", "UGAS" => "UGAS", "UNQ" => "UNQ", "UYU" => "UYU", "VET" => "VET", "VSYS" => "VSYS", "WAN" => "WAN", "WAVES" => "WAVES", "WAX1" => "WAX", "WEMIX" => "WEMIX", "WICC" => "WICC", "WTC" => "WTC", "XCH" => "XCH", "XDC" => "XDC", "XEM" => "XEM", "XLM" => "XLM", "XMR" => "XMR", "XPLA" => "XPLA", "XPRT" => "XPRT", "XRP" => "XRP", "XTZ" => "XTZ", "XVG" => "XVG", "XYM" => "XYM", "XZC" => "XZC", "ZEC" => "ZEC", "ZEN" => "ZEN", "ZIL" => "ZIL" }, "spot" => %{ "limitOrderTypes" => %{ "buy-ioc" => true, "buy-limit" => true, "buy-limit-fok" => true, "buy-limit-maker" => true, "buy-stop-limit" => true, "buy-stop-limit-fok" => true, "ioc" => true, "limit" => true, "limit-fok" => true, "limit-maker" => true, "sell-ioc" => true, "sell-limit" => true, "sell-limit-fok" => true, "sell-limit-maker" => true, "sell-stop-limit" => true, "sell-stop-limit-fok" => true, "stop-limit" => true, "stop-limit-fok" => true }, "stopOrderTypes" => %{ "buy-stop-limit" => true, "buy-stop-limit-fok" => true, "sell-stop-limit" => true, "sell-stop-limit-fok" => true, "stop-limit" => true, "stop-limit-fok" => true } }, "timeDifference" => 0, "typesByAccount" => %{ "futures" => "future", "pro" => "spot" }, "withdraw" => %{ "includeFee" => false } }, extended_metadata: %{ fees_url: "https://www.huobi.com/about/fee/", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg", referral_discount: 0.15, referral_url: "https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ for_derivatives: %{ create_order: %{ hedged: true, stop_loss_price: true, take_profit_price: true, trailing: true }, create_orders: %{ max: 25 }, extends: "spot", fetch_closed_orders: %{ days_back: 90, days_back_canceled: 0.08333333333333333, limit: 50, margin_mode: true, trailing: false, trigger: false, until_days: 2 }, fetch_ohlcv: %{ limit: 2000 }, fetch_open_orders: %{ limit: 50, margin_mode: true, trailing: false, trigger: false }, fetch_order: %{ margin_mode: true }, fetch_orders: %{ days_back: 90, limit: 50, margin_mode: true, trailing: false, trigger: false } }, future: %{ inverse: %{ extends: "forDerivatives" }, linear: %{ extends: "forDerivatives" } }, spot: %{ create_order: %{ hedged: false, iceberg: false, leverage: true, margin_mode: true, market_buy_by_cost: true, market_buy_requires_price: true, self_trade_prevention: true, stop_loss_price: false, take_profit_price: false, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: false, trigger_direction: true, trigger_price: true }, create_orders: %{ max: 10 }, fetch_closed_orders: %{ days_back: 180, days_back_canceled: 0.08333333333333333, limit: 500, margin_mode: false, symbol_required: false, trailing: false, trigger: true, until_days: 2 }, fetch_my_trades: %{ days_back: 120, limit: 500, margin_mode: false, symbol_required: false, until_days: 2 }, fetch_ohlcv: %{ limit: 1000 }, fetch_open_orders: %{ limit: 500, margin_mode: false, symbol_required: false, trailing: false, trigger: true }, fetch_order: %{ margin_mode: false, symbol_required: false, trailing: false, trigger: false }, fetch_orders: %{ days_back: 180, limit: 500, margin_mode: false, symbol_required: false, trailing: false, trigger: true, until_days: 2 }, sandbox: true }, swap: %{ inverse: %{ extends: "forDerivatives" }, linear: %{ extends: "forDerivatives" } } }, fees: %{ trading: %{ fee_side: "get", maker: 0.002, percentage: true, taker: 0.002, tier_based: false } }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (response === undefined) {\n return undefined; // fallback to default error handler\n }\n if ('status' in response) {\n //\n // {\"status\":\"error\",\"err-code\":\"o-amount-min-error\",\"err-msg\":\"limit order amount error, min: `0.001`\",\"data\":null}\n // {\"status\":\"ok\",\"data\":{\"errors\":[{\"order_id\":\"1349442392365359104\",\"err_code\":1061,\"err_msg\":\"The order does not exist.\"}],\"successes\":\"\"},\"ts\":1741773744526}\n //\n const status = this.safeString(response, 'status');\n if (status === 'error') {\n const code = this.safeString2(response, 'err-code', 'err_code');\n const feedback = this.id + ' ' + body;\n this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);\n const message = this.safeString2(response, 'err-msg', 'err_msg');\n this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);\n throw new errors.ExchangeError(feedback);\n }\n }\n if ('code' in response) {\n // {code: '1003', message: 'invalid signature'}\n const feedback = this.id + ' ' + body;\n const code = this.safeString(response, 'code');\n this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);\n }\n const data = this.safeDict(response, 'data');\n const errorsList = this.safeList(data, 'errors');\n if (errorsList !== undefined) {\n const first = this.safeDict(errorsList, 0);\n const errcode = this.safeString(first, 'err_code');\n const errmessage = this.safeString(first, 'err_msg');\n const feedBack = this.id + ' ' + body;\n this.throwExactlyMatchedException(this.exceptions['exact'], errcode, feedBack);\n this.throwExactlyMatchedException(this.exceptions['exact'], errmessage, feedBack);\n }\n return undefined;\n }", has: %{ add_margin: false, borrow_cross_margin: true, borrow_isolated_margin: true, borrow_margin: false, c_o_r_s: false, cancel_all_orders: true, cancel_all_orders_after: true, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: true, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, close_all_positions: false, close_position: true, create_deposit_address: false, create_limit_buy_order: false, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: false, create_limit_sell_order_ws: false, create_market_buy_order: false, create_market_buy_order_with_cost: true, create_market_buy_order_with_cost_ws: false, create_market_buy_order_ws: false, create_market_order: true, create_market_order_with_cost: false, create_market_order_with_cost_ws: false, create_market_order_ws: true, create_market_sell_order: false, create_market_sell_order_with_cost: false, create_market_sell_order_with_cost_ws: false, create_market_sell_order_ws: false, create_order: true, create_order_with_take_profit_and_stop_loss: false, create_order_with_take_profit_and_stop_loss_ws: false, create_order_ws: false, create_orders: true, create_post_only_order: false, create_post_only_order_ws: false, create_reduce_only_order: false, create_reduce_only_order_ws: false, create_stop_limit_order: true, create_stop_limit_order_ws: false, create_stop_loss_order: true, create_stop_loss_order_ws: false, create_stop_market_order: true, create_stop_market_order_ws: false, create_stop_order: true, create_stop_order_ws: false, create_take_profit_order: true, create_take_profit_order_ws: false, create_trailing_amount_order: false, create_trailing_amount_order_ws: false, create_trailing_percent_order: true, create_trailing_percent_order_ws: false, create_trigger_order: true, create_trigger_order_ws: false, deposit: false, edit_order: true, edit_order_with_client_order_id: false, edit_order_ws: false, edit_orders: false, fetch_accounts: true, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: false, fetch_borrow_interest: true, fetch_borrow_rate: false, fetch_borrow_rate_histories: false, fetch_borrow_rate_history: false, fetch_borrow_rates: false, fetch_borrow_rates_per_symbol: false, fetch_canceled_and_closed_orders: false, fetch_canceled_orders: false, fetch_closed_order: false, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: false, fetch_convert_quote: false, fetch_convert_trade: false, fetch_convert_trade_history: false, fetch_cross_borrow_rate: false, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: false, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: true, fetch_deposit_withdraw_fee: true, fetch_deposit_withdraw_fees: true, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: true, fetch_funding_interval: false, fetch_funding_intervals: false, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: true, fetch_greeks: false, fetch_index_ohlcv: true, fetch_isolated_borrow_rate: false, fetch_isolated_borrow_rates: true, fetch_isolated_positions: false, fetch_l2_order_book: true, fetch_l3_order_book: false, fetch_last_prices: true, fetch_ledger: true, fetch_ledger_entry: false, fetch_leverage: false, fetch_leverage_tiers: true, fetch_leverages: false, fetch_liquidations: true, fetch_long_short_ratio: false, fetch_long_short_ratio_history: false, fetch_margin_adjustment_history: false, fetch_margin_mode: false, fetch_margin_modes: false, fetch_mark_ohlcv: true, fetch_mark_prices: false, fetch_market_leverage_tiers: true, fetch_markets: true, fetch_markets_ws: false, fetch_my_liquidations: false, fetch_my_settlement_history: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: true, fetch_open_interest_history: true, fetch_open_interests: true, fetch_open_order: false, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: false, fetch_option_chain: false, fetch_order: true, fetch_order_book: true, fetch_order_book_ws: false, fetch_order_books: false, fetch_order_trades: true, fetch_order_with_client_order_id: false, fetch_order_ws: false, fetch_orders: true, fetch_orders_by_status: false, fetch_orders_ws: false, fetch_position: true, fetch_position_history: true, fetch_position_mode: false, fetch_position_ws: false, fetch_positions: true, fetch_positions_for_symbol: false, fetch_positions_for_symbol_ws: false, fetch_positions_history: false, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: true, fetch_settlement_history: true, fetch_status: true, fetch_ticker: true, fetch_ticker_ws: false, fetch_tickers: true, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: true, fetch_trading_fees: false, fetch_trading_fees_ws: false, fetch_trading_limits: true, fetch_transaction_fee: false, fetch_transaction_fees: false, fetch_transactions: false, fetch_transfer: false, fetch_transfers: false, fetch_underlying_assets: false, fetch_volatility_history: false, fetch_withdraw_addresses: true, fetch_withdrawal: false, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: true, margin: true, option: false, private_api: true, public_api: true, reduce_margin: false, repay_cross_margin: true, repay_isolated_margin: true, sandbox: false, set_leverage: true, set_margin: false, set_margin_mode: false, set_position_mode: true, sign_in: false, spot: true, swap: true, transfer: true, un_watch_my_trades: false, un_watch_ohlcv: false, un_watch_ohlcv_for_symbols: false, un_watch_order_book: false, un_watch_order_book_for_symbols: false, un_watch_orders: false, un_watch_positions: false, un_watch_ticker: false, un_watch_tickers: false, un_watch_trades: false, un_watch_trades_for_symbols: false, watch_balance: true, watch_bids_asks: false, watch_liquidations: false, watch_liquidations_for_symbols: false, watch_my_liquidations: false, watch_my_liquidations_for_symbols: false, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: false, watch_order_book: true, watch_order_book_for_symbols: false, watch_orders: true, watch_orders_for_symbols: false, watch_position: false, watch_positions: false, watch_status: false, watch_ticker: true, watch_tickers: false, watch_trades: true, watch_trades_for_symbols: false, withdraw: true, ws: false }, http_config: %{ user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36" }, id: "htx", markets: nil, name: "HTX", ohlcv_timestamp_resolution: :seconds, options: %{ accounts_by_id: %{ "borrow" => "borrow", "deposit-earning" => "deposit-earning", "grid-trading" => "grid-trading", "investment" => "investment", "margin" => "margin", "otc" => "otc", "otc-options" => "otc-options", "point" => "point", "spot" => "spot", "super-margin" => "super-margin" }, accounts_by_type: %{ "funding" => "pro", "future" => "futures", "spot" => "pro" }, adjust_for_time_difference: false, broker: %{ "id" => "AA03022abc" }, create_market_buy_order_requires_price: true, default_account_type: "spot", default_network: "ERC20", default_networks: %{ "BTC" => "BTC", "ETH" => "ERC20", "USDT" => "TRC20" }, default_sub_type: "linear", default_type: "spot", fetch_markets: %{ "types" => %{ "inverse" => true, "linear" => true, "spot" => true } }, fetch_o_h_l_c_v: %{ "useHistoricalEndpointForSpot" => true }, fetch_orders_by_states_method: "spot_private_get_v1_order_orders", include__o_s_certificates: false, language: "en-US", networks: %{ "AAC" => "AAC", "ACT" => "ACT", "ADA" => "ADA", "AE" => "AE", "AKT" => "AKT", "AOTI" => "COTI", "APT" => "APT", "AR" => "AR", "ARDR" => "ARDR", "ARS" => "ARS", "ASTR" => "ASTR", "AZERO" => "AZERO", "BAND" => "BAND", "BCD" => "BCD", "BCV" => "BCV", "BCX" => "BCX", "BEP20" => "BSC", "BHD" => "BHD", "BIFI" => "BIFI", "BITCI" => "BITCI", "BLD" => "BLD", "BRISE" => "BRISE", "BSV" => "BSV", "BTC" => "BTC", "BTG" => "BTG", "BTM" => "BTM", "BTS" => "BTS", "BTT" => "BTT", "CARDANO" => "ADA", "CCA" => "ACA", "CELO" => "CELO", "CKB" => "CKB", "CMT" => "CMT", "CORE" => "CORE", "CRO" => "CRO", "CRONOS" => "CRO", "CRUST" => "CRUST", "CSPR" => "CSPR", "CTXC" => "CTXC", "CUBE" => "CUBE", "CVNT1" => "CVNT1", "DASH" => "DASH", "DCR" => "DCR", "DESO" => "DESO", "DFI" => "DFI", "DGB" => "DGB", "DOCK" => "DOCK", "DOGE" => "DOGE", "DOGECHAIN" => "DOGECHAIN", "DOT" => "DOT", "EGLD" => "EGLD", "ELA" => "ELA", "ELF" => "ELF", "EM" => "EM", "ENJ" => "ENJ", "EOS" => "EOS", "EOSS" => "EOSS", "ERC20" => "ETH", "ERG" => "ERG", "ETC" => "ETC", "ETHF" => "ETHFAIR", "ETHW" => "ETHW", "ETN" => "ETN", "EVMOS" => "EVMOS", "FIL" => "FIL", "FINSCHIA" => "FINSCHIA", "FIO" => "FIO", "FIS" => "FIS", "FLOW" => "FLOW", "FLR" => "FLR", "FSN" => "FSN", "FTM" => "FTM", "GAS" => "GAS", "GLMR" => "GLMR", "GRS" => "GRS", "HBAR" => "HBAR", "HC" => "HC", "HIVE" => "HIVE", "HRC20" => "HECO", "ICP" => "ICP", "ICX" => "ICX", "IOST" => "IOST", "IOTA" => "IOTA", "IOTX" => "IOTX", "IRIS" => "IRIS", "KAVA" => "KAVA", "KLAY" => "KLAY", "KMA" => "KMA", "KMD" => "KMD", "KSM" => "KSM", "KYVE" => "KYVE", "LAMB" => "LAMB", "LAT" => "LAT", "LSK" => "LSK", "LTC" => "LTC", "LUK" => "LUK", "MASS" => "MASS", "MATIC" => "MATIC", "MEV" => "MEV", "MINA" => "MINA", "MINEPLEX" => "MINEPLEX", "MOVR" => "MOVR", "NANO" => "NANO", "NAS" => "NAS", "NBS" => "NBS", "NEAR" => "NEAR", "NEO" => "NEO", "NEON3" => "NEON3", "NEWTON" => "NEWTON", "NODL" => "NODL", "NULS" => "NULS", "OAS" => "OAS", "OEP4" => "OEP4", "ONE" => "ONE", "OSMO" => "OSMO", "PAI" => "PAI", "PAYCOIN" => "PAYCOIN", "POKT" => "POKT", "POLYGON" => "MATIC", "POLYX" => "POLYX", "PYG" => "PYG", "QTUM" => "QTUM", "RBTC" => "RBTC", "REI" => "REI", "RVN" => "RVN", "SBTC" => "SBTC", "SC" => "SC", "SCRT" => "SCRT", "SDN" => "SDN", "SEELE" => "SEELE", "SEI" => "SEI", "SGB" => "SGB", "SMT" => "SMT", "SOL" => "SOLANA", "STEEM" => "STEEM", "STEP" => "STEP", "SUI" => "SUI", "SXP" => "SOLAR", "SYS" => "SYS", "TENET" => "TENET", "THETA" => "THETA", "TON" => "TON", "TOP" => "TOP", "TRC20" => "TRX", "TT" => "TT", "UGAS" => "UGAS", "UNQ" => "UNQ", "UYU" => "UYU", "VET" => "VET", "VSYS" => "VSYS", "WAN" => "WAN", "WAVES" => "WAVES", "WAX" => "WAX1", "WEMIX" => "WEMIX", "WICC" => "WICC", "WTC" => "WTC", "XCH" => "XCH", "XDC" => "XDC", "XEC" => "ECASH", "XEM" => "XEM", "XLM" => "XLM", "XMR" => "XMR", "XPLA" => "XPLA", "XPRT" => "XPRT", "XRP" => "XRP", "XTZ" => "XTZ", "XVG" => "XVG", "XYM" => "XYM", "XZC" => "XZC", "ZEC" => "ZEC", "ZEN" => "ZEN", "ZIL" => "ZIL" }, spot: %{ "limitOrderTypes" => %{ "buy-ioc" => true, "buy-limit" => true, "buy-limit-fok" => true, "buy-limit-maker" => true, "buy-stop-limit" => true, "buy-stop-limit-fok" => true, "ioc" => true, "limit" => true, "limit-fok" => true, "limit-maker" => true, "sell-ioc" => true, "sell-limit" => true, "sell-limit-fok" => true, "sell-limit-maker" => true, "sell-stop-limit" => true, "sell-stop-limit-fok" => true, "stop-limit" => true, "stop-limit-fok" => true }, "stopOrderTypes" => %{ "buy-stop-limit" => true, "buy-stop-limit-fok" => true, "sell-stop-limit" => true, "sell-stop-limit-fok" => true, "stop-limit" => true, "stop-limit-fok" => true } }, time_difference: 0, types_by_account: %{ "futures" => "future", "pro" => "spot" }, withdraw: %{ "includeFee" => false } }, order_mappings: nil, param_mappings: %{ "amount" => "volume", "arg0" => "currency", "code" => "currency", "fromAccount" => "from", "id" => "order-id", "leverage" => "lever_rate", "limit" => "size", "price" => "order_price", "side" => "direction", "since" => "from", "stopLossPrice" => "sl_trigger_price", "symbol" => "symbols", "takeProfitPrice" => "tp_trigger_price", "timeframe" => "period", "trailingPercent" => "lever_rate", "trailingTriggerPrice" => "active_price", "triggerPrice" => "trigger_price", "type" => "order_price_type" }, parse_methods: [ %{ "comment" => nil, "examples" => [ "{\n \"id\": 5202591,\n \"type\": \"point\", // spot, margin, otc, point, super-margin, investment, borrow, grid-trading, deposit-earning, otc-options\n \"subtype\": \"\", // The corresponding trading symbol (currency pair) the isolated margin is based on, e.g. btcusdt\n \"state\": \"working\" // working, lock\n }" ], "line_end" => 3346, "line_start" => 3328, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "account" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (account, 'id')" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "code", "value" => "undefined" } ], "name" => "parseAccount", "signature" => "parseAccount (account)", "source" => "parseAccount (account) {\n //\n // {\n // \"id\": 5202591,\n // \"type\": \"point\", // spot, margin, otc, point, super-margin, investment, borrow, grid-trading, deposit-earning, otc-options\n // \"subtype\": \"\", // The corresponding trading symbol (currency pair) the isolated margin is based on, e.g. btcusdt\n // \"state\": \"working\" // working, lock\n // }\n //\n const typeId = this.safeString (account, 'type');\n const accountsById = this.safeValue (this.options, 'accountsById', {});\n const type = this.safeValue (accountsById, typeId, typeId);\n return {\n 'info': account,\n 'id': this.safeString (account, 'id'),\n 'type': type,\n 'code': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"interest-rate\":\"0.000040830000000000\",\n \"user-id\":35930539,\n \"account-id\":48916071,\n \"updated-at\":1649320794195,\n \"deduct-rate\":\"1\",\n \"day-interest-rate\":\"0.000980000000000000\",\n \"hour-interest-rate\":\"0.000040830000000000\",\n \"loan-balance\":\"100.790000000000000000\",\n \"interest-balance\":\"0.004115260000000000\",\n \"loan-amount\":\"100.790000000000000000\",\n \"paid-coin\":\"0.000000000000000000\",\n \"accrued-at\":1649320794148,\n \"created-at\":1649320794148,\n \"interest-amount\":\"0.004115260000000000\",\n \"deduct-amount\":\"0\",\n \"deduct-currency\":\"\",\n \"paid-point\":\"0.000000000000000000\",\n \"currency\":\"usdt\",\n \"symbol\":\"ltcusdt\",\n \"id\":20242721,\n }", "{\n \"id\":3416576,\n \"user-id\":35930539,\n \"account-id\":48956839,\n \"currency\":\"usdt\",\n \"loan-amount\":\"102\",\n \"loan-balance\":\"102\",\n \"interest-amount\":\"0.00416466\",\n \"interest-balance\":\"0.00416466\",\n \"created-at\":1649322735333,\n \"accrued-at\":1649322735382,\n \"state\":\"accrual\",\n \"filled-points\":\"0\",\n \"filled-ht\":\"0\"\n }" ], "line_end" => 7387, "line_start" => 7329, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (this.safeString (info, 'currency'))" }, %{ "comment" => nil, "key" => "interest", "value" => "this.safeNumber (info, 'interest-amount')" }, %{ "comment" => nil, "key" => "interestRate", "value" => "this.safeNumber (info, 'interest-rate')" }, %{ "comment" => nil, "key" => "amountBorrowed", "value" => "this.safeNumber (info, 'loan-amount')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" } ], "name" => "parseBorrowInterest", "signature" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest", "source" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest {\n // isolated\n // {\n // \"interest-rate\":\"0.000040830000000000\",\n // \"user-id\":35930539,\n // \"account-id\":48916071,\n // \"updated-at\":1649320794195,\n // \"deduct-rate\":\"1\",\n // \"day-interest-rate\":\"0.000980000000000000\",\n // \"hour-interest-rate\":\"0.000040830000000000\",\n // \"loan-balance\":\"100.790000000000000000\",\n // \"interest-balance\":\"0.004115260000000000\",\n // \"loan-amount\":\"100.790000000000000000\",\n // \"paid-coin\":\"0.000000000000000000\",\n // \"accrued-at\":1649320794148,\n // \"created-at\":1649320794148,\n // \"interest-amount\":\"0.004115260000000000\",\n // \"deduct-amount\":\"0\",\n // \"deduct-currency\":\"\",\n // \"paid-point\":\"0.000000000000000000\",\n // \"currency\":\"usdt\",\n // \"symbol\":\"ltcusdt\",\n // \"id\":20242721,\n // }\n //\n // cross\n // {\n // \"id\":3416576,\n // \"user-id\":35930539,\n // \"account-id\":48956839,\n // \"currency\":\"usdt\",\n // \"loan-amount\":\"102\",\n // \"loan-balance\":\"102\",\n // \"interest-amount\":\"0.00416466\",\n // \"interest-balance\":\"0.00416466\",\n // \"created-at\":1649322735333,\n // \"accrued-at\":1649322735382,\n // \"state\":\"accrual\",\n // \"filled-points\":\"0\",\n // \"filled-ht\":\"0\"\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n const marginMode = (marketId === undefined) ? 'cross' : 'isolated';\n market = this.safeMarket (marketId);\n const symbol = this.safeString (market, 'symbol');\n const timestamp = this.safeInteger (info, 'accrued-at');\n return {\n 'info': info,\n 'symbol': symbol,\n 'currency': this.safeCurrencyCode (this.safeString (info, 'currency')),\n 'interest': this.safeNumber (info, 'interest-amount'),\n 'interestRate': this.safeNumber (info, 'interest-rate'),\n 'amountBorrowed': this.safeNumber (info, 'loan-amount'),\n 'marginMode': marginMode,\n 'timestamp': timestamp, // Interest accrued time\n 'datetime': this.iso8601 (timestamp),\n } as BorrowInterest;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"success\": [\n \"5983466\"\n ],\n \"failed\": [\n {\n \"err-msg\": \"Incorrect order state\",\n \"order-state\": 7,\n \"order-id\": \"\",\n \"err-code\": \"order-orderstate-error\",\n \"client-order-id\": \"first\"\n },\n ...\n ]\n }", "{\n \"errors\": [\n {\n \"order_id\": \"769206471845261312\",\n \"err_code\": 1061,\n \"err_msg\": \"This order doesnt exist.\"\n }\n ],\n \"successes\": \"1258075374411399168,1258075393254871040\"\n }" ], "line_end" => 6242, "line_start" => 6186, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "id", "value" => "order" }, %{ "comment" => nil, "key" => "status", "value" => "'canceled'" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (order, 'order-id', 'order_id')" }, %{ "comment" => nil, "key" => "status", "value" => "'failed'" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString (order, 'client-order-id')" } ], "name" => "parseCancelOrders", "signature" => "parseCancelOrders (orders)", "source" => "parseCancelOrders (orders) {\n //\n // {\n // \"success\": [\n // \"5983466\"\n // ],\n // \"failed\": [\n // {\n // \"err-msg\": \"Incorrect order state\",\n // \"order-state\": 7,\n // \"order-id\": \"\",\n // \"err-code\": \"order-orderstate-error\",\n // \"client-order-id\": \"first\"\n // },\n // ...\n // ]\n // }\n //\n // {\n // \"errors\": [\n // {\n // \"order_id\": \"769206471845261312\",\n // \"err_code\": 1061,\n // \"err_msg\": \"This order doesnt exist.\"\n // }\n // ],\n // \"successes\": \"1258075374411399168,1258075393254871040\"\n // }\n //\n const successes = this.safeString (orders, 'successes');\n let success = undefined;\n if (successes !== undefined) {\n success = successes.split (',');\n } else {\n success = this.safeList (orders, 'success', []);\n }\n const failed = this.safeList2 (orders, 'errors', 'failed', []);\n const result = [];\n for (let i = 0; i < success.length; i++) {\n const order = success[i];\n result.push (this.safeOrder ({\n 'info': order,\n 'id': order,\n 'status': 'canceled',\n }));\n }\n for (let i = 0; i < failed.length; i++) {\n const order = failed[i];\n result.push (this.safeOrder ({\n 'info': order,\n 'id': this.safeString2 (order, 'order-id', 'order_id'),\n 'status': 'failed',\n 'clientOrderId': this.safeString (order, 'client-order-id'),\n }));\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"currency\": \"usdt\",\n \"address\": \"0xf7292eb9ba7bc50358e27f0e025a4d225a64127b\",\n \"addressTag\": \"\",\n \"chain\": \"usdterc20\", // trc20usdt, hrc20usdt, usdt, algousdt\n }" ], "line_end" => 6429, "line_start" => 6404, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (networkId)" }, %{ "comment" => nil, "key" => "note", "value" => "note" }, %{ "comment" => nil, "key" => "info", "value" => "depositAddress" } ], "name" => "parseDepositAddress", "signature" => "parseDepositAddress (depositAddress, currency: Currency = undefined)", "source" => "parseDepositAddress (depositAddress, currency: Currency = undefined) {\n //\n // {\n // \"currency\": \"usdt\",\n // \"address\": \"0xf7292eb9ba7bc50358e27f0e025a4d225a64127b\",\n // \"addressTag\": \"\",\n // \"chain\": \"usdterc20\", // trc20usdt, hrc20usdt, usdt, algousdt\n // }\n //\n const address = this.safeString (depositAddress, 'address');\n const tag = this.safeString (depositAddress, 'addressTag');\n const currencyId = this.safeString (depositAddress, 'currency');\n currency = this.safeCurrency (currencyId, currency);\n const code = this.safeCurrencyCode (currencyId, currency);\n const note = this.safeString (depositAddress, 'note');\n const networkId = this.safeString (depositAddress, 'chain');\n this.checkAddress (address);\n return {\n 'currency': code,\n 'address': address,\n 'tag': tag,\n 'network': this.networkIdToCode (networkId),\n 'note': note,\n 'info': depositAddress,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"currency\": \"sxp\",\n \"assetType\": \"1\",\n \"chains\": [\n {\n \"chain\": \"sxp\",\n \"displayName\": \"ERC20\",\n \"baseChain\": \"ETH\",\n \"baseChainProtocol\": \"ERC20\",\n \"isDynamic\": true,\n \"numOfConfirmations\": \"12\",\n \"numOfFastConfirmations\": \"12\",\n \"depositStatus\": \"allowed\",\n \"minDepositAmt\": \"0.23\",\n \"withdrawStatus\": \"allowed\",\n \"minWithdrawAmt\": \"0.23\",\n \"withdrawPrecision\": \"8\",\n \"maxWithdrawAmt\": \"227000.000000000000000000\",\n \"withdrawQuotaPerDay\": \"227000.000000000000000000\",\n \"withdrawQuotaPerYear\": null,\n \"withdrawQuotaTotal\": null,\n \"withdrawFeeType\": \"fixed\",\n \"transactFeeWithdraw\": \"11.1653\",\n \"addrWithTag\": false,\n \"addrDepositTag\": false\n }\n ],\n \"instStatus\": \"normal\"\n }" ], "line_end" => 9259, "line_start" => 9195, "mappings" => [ %{ "comment" => nil, "key" => "fee", "value" => "withdrawFee" }, %{ "comment" => nil, "key" => "percentage", "value" => "false" }, %{ "comment" => nil, "key" => "percentage", "value" => "true" } ], "name" => "parseDepositWithdrawFee", "signature" => "parseDepositWithdrawFee (fee, currency: Currency = undefined)", "source" => "parseDepositWithdrawFee (fee, currency: Currency = undefined) {\n //\n // {\n // \"currency\": \"sxp\",\n // \"assetType\": \"1\",\n // \"chains\": [\n // {\n // \"chain\": \"sxp\",\n // \"displayName\": \"ERC20\",\n // \"baseChain\": \"ETH\",\n // \"baseChainProtocol\": \"ERC20\",\n // \"isDynamic\": true,\n // \"numOfConfirmations\": \"12\",\n // \"numOfFastConfirmations\": \"12\",\n // \"depositStatus\": \"allowed\",\n // \"minDepositAmt\": \"0.23\",\n // \"withdrawStatus\": \"allowed\",\n // \"minWithdrawAmt\": \"0.23\",\n // \"withdrawPrecision\": \"8\",\n // \"maxWithdrawAmt\": \"227000.000000000000000000\",\n // \"withdrawQuotaPerDay\": \"227000.000000000000000000\",\n // \"withdrawQuotaPerYear\": null,\n // \"withdrawQuotaTotal\": null,\n // \"withdrawFeeType\": \"fixed\",\n // \"transactFeeWithdraw\": \"11.1653\",\n // \"addrWithTag\": false,\n // \"addrDepositTag\": false\n // }\n // ],\n // \"instStatus\": \"normal\"\n // }\n //\n const chains = this.safeValue (fee, 'chains', []);\n let result = this.depositWithdrawFee (fee);\n for (let j = 0; j < chains.length; j++) {\n const chainEntry = chains[j];\n const networkId = this.safeString (chainEntry, 'chain');\n const withdrawFeeType = this.safeString (chainEntry, 'withdrawFeeType');\n const networkCode = this.networkIdToCode (networkId);\n let withdrawFee = undefined;\n let withdrawResult = undefined;\n if (withdrawFeeType === 'fixed') {\n withdrawFee = this.safeNumber (chainEntry, 'transactFeeWithdraw');\n withdrawResult = {\n 'fee': withdrawFee,\n 'percentage': false,\n };\n } else {\n withdrawFee = this.safeNumber (chainEntry, 'transactFeeRateWithdraw');\n withdrawResult = {\n 'fee': withdrawFee,\n 'percentage': true,\n };\n }\n result['networks'][networkCode] = {\n 'withdraw': withdrawResult,\n 'deposit': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n };\n result = this.assignDefaultDepositWithdrawFees (result, currency);\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 7162, "line_start" => 7153, "mappings" => [], "name" => "parseFundingInterval", "signature" => "parseFundingInterval (interval)", "source" => "parseFundingInterval (interval) {\n const intervals: Dict = {\n '3600000': '1h',\n '14400000': '4h',\n '28800000': '8h',\n '57600000': '16h',\n '86400000': '24h',\n };\n return this.safeString (intervals, interval, interval);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"status\": \"ok\",\n \"data\": {\n \"estimated_rate\": \"0.000100000000000000\",\n \"funding_rate\": \"0.000100000000000000\",\n \"contract_code\": \"BCH-USD\",\n \"symbol\": \"BCH\",\n \"fee_asset\": \"BCH\",\n \"funding_time\": \"1639094400000\",\n \"next_funding_time\": \"1639123200000\"\n },\n \"ts\": 1639085854775\n }" ], "line_end" => 7151, "line_start" => 7107, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "interestRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "this.safeNumber (contract, 'funding_rate')" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "fundingTimestamp" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "this.iso8601 (fundingTimestamp)" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "nextFundingRate" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "nextFundingTimestamp" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "this.iso8601 (nextFundingTimestamp)" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "interval", "value" => "this.parseFundingInterval (millisecondsInterval)" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n //\n // {\n // \"status\": \"ok\",\n // \"data\": {\n // \"estimated_rate\": \"0.000100000000000000\",\n // \"funding_rate\": \"0.000100000000000000\",\n // \"contract_code\": \"BCH-USD\",\n // \"symbol\": \"BCH\",\n // \"fee_asset\": \"BCH\",\n // \"funding_time\": \"1639094400000\",\n // \"next_funding_time\": \"1639123200000\"\n // },\n // \"ts\": 1639085854775\n // }\n //\n const nextFundingRate = this.safeNumber (contract, 'estimated_rate');\n const fundingTimestamp = this.safeInteger (contract, 'funding_time');\n const nextFundingTimestamp = this.safeInteger (contract, 'next_funding_time');\n const fundingTimeString = this.safeString (contract, 'funding_time');\n const nextFundingTimeString = this.safeString (contract, 'next_funding_time');\n const millisecondsInterval = Precise.stringSub (nextFundingTimeString, fundingTimeString);\n const marketId = this.safeString (contract, 'contract_code');\n const symbol = this.safeSymbol (marketId, market);\n return {\n 'info': contract,\n 'symbol': symbol,\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'fundingRate': this.safeNumber (contract, 'funding_rate'),\n 'fundingTimestamp': fundingTimestamp,\n 'fundingDatetime': this.iso8601 (fundingTimestamp),\n 'nextFundingRate': nextFundingRate,\n 'nextFundingTimestamp': nextFundingTimestamp,\n 'nextFundingDatetime': this.iso8601 (nextFundingTimestamp),\n 'previousFundingRate': undefined,\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n 'interval': this.parseFundingInterval (millisecondsInterval),\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": \"1667161118\",\n \"symbol\": \"BTC\",\n \"type\": \"31\",\n \"amount\": \"-2.11306593188E-7\",\n \"ts\": \"1641139308983\",\n \"contract_code\": \"BTC-USD\"\n }" ], "line_end" => 7755, "line_start" => 7728, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "income" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "code", "value" => "code" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" } ], "name" => "parseIncome", "signature" => "parseIncome (income, market: Market = undefined)", "source" => "parseIncome (income, market: Market = undefined) {\n //\n // {\n // \"id\": \"1667161118\",\n // \"symbol\": \"BTC\",\n // \"type\": \"31\",\n // \"amount\": \"-2.11306593188E-7\",\n // \"ts\": \"1641139308983\",\n // \"contract_code\": \"BTC-USD\"\n // }\n //\n const marketId = this.safeString (income, 'contract_code');\n const symbol = this.safeSymbol (marketId, market);\n const amount = this.safeNumber (income, 'amount');\n const timestamp = this.safeInteger (income, 'ts');\n const id = this.safeString (income, 'id');\n const currencyId = this.safeString2 (income, 'symbol', 'asset');\n const code = this.safeCurrencyCode (currencyId);\n return {\n 'info': income,\n 'symbol': symbol,\n 'code': code,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': id,\n 'amount': amount,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"1inchusdt\",\n \"currencies\": [\n {\n \"currency\": \"1inch\",\n \"interest-rate\": \"0.00098\",\n \"min-loan-amt\": \"90.000000000000000000\",\n \"max-loan-amt\": \"1000.000000000000000000\",\n \"loanable-amt\": \"0.0\",\n \"actual-rate\": \"0.00098\"\n },\n {\n \"currency\": \"usdt\",\n \"interest-rate\": \"0.00098\",\n \"min-loan-amt\": \"100.000000000000000000\",\n \"max-loan-amt\": \"1000.000000000000000000\",\n \"loanable-amt\": \"0.0\",\n \"actual-rate\": \"0.00098\"\n }\n ]\n }," ], "line_end" => 7021, "line_start" => 6979, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "base", "value" => "this.safeCurrencyCode (baseId)" }, %{ "comment" => nil, "key" => "baseRate", "value" => "this.safeNumber (baseData, 'actual-rate')" }, %{ "comment" => nil, "key" => "quote", "value" => "this.safeCurrencyCode (quoteId)" }, %{ "comment" => nil, "key" => "quoteRate", "value" => "this.safeNumber (quoteData, 'actual-rate')" }, %{ "comment" => nil, "key" => "period", "value" => "86400000" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseIsolatedBorrowRate", "signature" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate", "source" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate {\n //\n // {\n // \"symbol\": \"1inchusdt\",\n // \"currencies\": [\n // {\n // \"currency\": \"1inch\",\n // \"interest-rate\": \"0.00098\",\n // \"min-loan-amt\": \"90.000000000000000000\",\n // \"max-loan-amt\": \"1000.000000000000000000\",\n // \"loanable-amt\": \"0.0\",\n // \"actual-rate\": \"0.00098\"\n // },\n // {\n // \"currency\": \"usdt\",\n // \"interest-rate\": \"0.00098\",\n // \"min-loan-amt\": \"100.000000000000000000\",\n // \"max-loan-amt\": \"1000.000000000000000000\",\n // \"loanable-amt\": \"0.0\",\n // \"actual-rate\": \"0.00098\"\n // }\n // ]\n // },\n //\n const marketId = this.safeString (info, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n const currencies = this.safeValue (info, 'currencies', []);\n const baseData = this.safeValue (currencies, 0);\n const quoteData = this.safeValue (currencies, 1);\n const baseId = this.safeString (baseData, 'currency');\n const quoteId = this.safeString (quoteData, 'currency');\n return {\n 'symbol': symbol,\n 'base': this.safeCurrencyCode (baseId),\n 'baseRate': this.safeNumber (baseData, 'actual-rate'),\n 'quote': this.safeCurrencyCode (quoteId),\n 'quoteRate': this.safeNumber (quoteData, 'actual-rate'),\n 'period': 86400000,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2594, "line_start" => 2579, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "side", "value" => "direction" }, %{ "comment" => nil, "key" => "info", "value" => "entry" } ], "name" => "parseLastPrice", "signature" => "parseLastPrice (entry, market: Market = undefined)", "source" => "parseLastPrice (entry, market: Market = undefined) {\n // example responses are documented in fetchLastPrices\n const marketId = this.safeString2 (entry, 'symbol', 'contract_code');\n market = this.safeMarket (marketId, market);\n const price = this.safeNumber (entry, 'price');\n const direction = this.safeString (entry, 'direction'); // \"buy\" or \"sell\"\n // group timestamp should not be assigned to the individual trades' times\n return {\n 'symbol': market['symbol'],\n 'timestamp': undefined,\n 'datetime': undefined,\n 'price': price,\n 'side': direction,\n 'info': entry,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"accountId\": 10000001,\n \"currency\": \"usdt\",\n \"transactAmt\": 10.000000000000000000,\n \"transactType\": \"transfer\",\n \"transferType\": \"margin-transfer-out\",\n \"transactId\": 0,\n \"transactTime\": 1629882331066,\n \"transferer\": 28483123,\n \"transferee\": 13496526\n }" ], "line_end" => 8311, "line_start" => 8273, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "direction", "value" => "this.safeString (item, 'direction')" }, %{ "comment" => nil, "key" => "account", "value" => "account" }, %{ "comment" => nil, "key" => "referenceId", "value" => "id" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "account" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseLedgerEntryType (transferType)" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (item, 'transactAmt')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // {\n // \"accountId\": 10000001,\n // \"currency\": \"usdt\",\n // \"transactAmt\": 10.000000000000000000,\n // \"transactType\": \"transfer\",\n // \"transferType\": \"margin-transfer-out\",\n // \"transactId\": 0,\n // \"transactTime\": 1629882331066,\n // \"transferer\": 28483123,\n // \"transferee\": 13496526\n // }\n //\n const currencyId = this.safeString (item, 'currency');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const id = this.safeString (item, 'transactId');\n const transferType = this.safeString (item, 'transferType');\n const timestamp = this.safeInteger (item, 'transactTime');\n const account = this.safeString (item, 'accountId');\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': id,\n 'direction': this.safeString (item, 'direction'),\n 'account': account,\n 'referenceId': id,\n 'referenceAccount': account,\n 'type': this.parseLedgerEntryType (transferType),\n 'currency': code,\n 'amount': this.safeNumber (item, 'transactAmt'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'before': undefined,\n 'after': undefined,\n 'status': undefined,\n 'fee': undefined,\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 8271, "line_start" => 8253, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const types: Dict = {\n 'trade': 'trade',\n 'etf': 'trade',\n 'transact-fee': 'fee',\n 'fee-deduction': 'fee',\n 'transfer': 'transfer',\n 'credit': 'credit',\n 'liquidation': 'trade',\n 'interest': 'credit',\n 'deposit': 'deposit',\n 'withdraw': 'withdrawal',\n 'withdraw-fee': 'fee',\n 'exchange': 'exchange',\n 'other-types': 'transfer',\n 'rebate': 'rebate',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"query_id\": 452057,\n \"contract_code\": \"BTC-USDT-211210\",\n \"symbol\": \"USDT\",\n \"direction\": \"sell\",\n \"offset\": \"close\",\n \"volume\": 479.000000000000000000,\n \"price\": 51441.700000000000000000,\n \"created_at\": 1638593647864,\n \"amount\": 0.479000000000000000,\n \"trade_turnover\": 24640.574300000000000000,\n \"business_type\": \"futures\",\n \"pair\": \"BTC-USDT\"\n }" ], "line_end" => 9453, "line_start" => 9422, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "liquidation" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.safeNumber (liquidation, 'volume')" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.safeNumber (market, 'contractSize')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (liquidation, 'price')" }, %{ "comment" => nil, "key" => "side", "value" => "this.safeStringLower (liquidation, 'direction')" }, %{ "comment" => nil, "key" => "baseValue", "value" => "this.safeNumber (liquidation, 'amount')" }, %{ "comment" => nil, "key" => "quoteValue", "value" => "this.safeNumber (liquidation, 'trade_turnover')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseLiquidation", "signature" => "parseLiquidation (liquidation, market: Market = undefined)", "source" => "parseLiquidation (liquidation, market: Market = undefined) {\n //\n // {\n // \"query_id\": 452057,\n // \"contract_code\": \"BTC-USDT-211210\",\n // \"symbol\": \"USDT\",\n // \"direction\": \"sell\",\n // \"offset\": \"close\",\n // \"volume\": 479.000000000000000000,\n // \"price\": 51441.700000000000000000,\n // \"created_at\": 1638593647864,\n // \"amount\": 0.479000000000000000,\n // \"trade_turnover\": 24640.574300000000000000,\n // \"business_type\": \"futures\",\n // \"pair\": \"BTC-USDT\"\n // }\n //\n const marketId = this.safeString (liquidation, 'contract_code');\n const timestamp = this.safeInteger (liquidation, 'created_at');\n return this.safeLiquidation ({\n 'info': liquidation,\n 'symbol': this.safeSymbol (marketId, market),\n 'contracts': this.safeNumber (liquidation, 'volume'),\n 'contractSize': this.safeNumber (market, 'contractSize'),\n 'price': this.safeNumber (liquidation, 'price'),\n 'side': this.safeStringLower (liquidation, 'direction'),\n 'baseValue': this.safeNumber (liquidation, 'amount'),\n 'quoteValue': this.safeNumber (liquidation, 'trade_turnover'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n });\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4143, "line_start" => 4129, "mappings" => [], "name" => "parseMarginBalanceHelper", "signature" => "parseMarginBalanceHelper (balance, code, result)", "source" => "parseMarginBalanceHelper (balance, code, result) {\n let account = undefined;\n if (code in result) {\n account = result[code];\n } else {\n account = this.account ();\n }\n if (balance['type'] === 'trade') {\n account['free'] = this.safeString (balance, 'balance');\n }\n if (balance['type'] === 'frozen') {\n account['used'] = this.safeString (balance, 'balance');\n }\n return account;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"status\": \"ok\",\n \"data\": null\n }", "{\n \"data\": 1000\n }", "{\n \"repayId\":1174424,\n \"repayTime\":1600747722018\n }" ], "line_end" => 9035, "line_start" => 9003, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (info, 'repayId', 'data')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (undefined, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseMarginLoan", "signature" => "parseMarginLoan (info, currency: Currency = undefined)", "source" => "parseMarginLoan (info, currency: Currency = undefined) {\n //\n // borrowMargin cross\n //\n // {\n // \"status\": \"ok\",\n // \"data\": null\n // }\n //\n // borrowMargin isolated\n //\n // {\n // \"data\": 1000\n // }\n //\n // repayMargin\n //\n // {\n // \"repayId\":1174424,\n // \"repayTime\":1600747722018\n // }\n //\n const timestamp = this.safeInteger (info, 'repayTime');\n return {\n 'id': this.safeString2 (info, 'repayId', 'data'),\n 'currency': this.safeCurrencyCode (undefined, currency),\n 'amount': undefined,\n 'symbol': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 8462, "line_start" => 8437, "mappings" => [ %{ "comment" => nil, "key" => "tier", "value" => "this.safeInteger (bracket, 'ladder')" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'swap')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId)" }, %{ "comment" => nil, "key" => "minNotional", "value" => "this.safeNumber (bracket, 'min_size')" }, %{ "comment" => nil, "key" => "maxNotional", "value" => "this.safeNumber (bracket, 'max_size')" }, %{ "comment" => nil, "key" => "maintenanceMarginRate", "value" => "this.parseNumber (Precise.stringDiv (adjustFactor, leverage))" }, %{ "comment" => nil, "key" => "maxLeverage", "value" => "this.parseNumber (leverage)" }, %{ "comment" => nil, "key" => "info", "value" => "bracket" } ], "name" => "parseMarketLeverageTiers", "signature" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[]", "source" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[] {\n const currencyId = this.safeString (info, 'trade_partition');\n const marketId = this.safeString (info, 'contract_code');\n const tiers = [];\n const brackets = this.safeList (info, 'list', []);\n for (let i = 0; i < brackets.length; i++) {\n const item = brackets[i];\n const leverage = this.safeString (item, 'lever_rate');\n const ladders = this.safeList (item, 'ladders', []);\n for (let k = 0; k < ladders.length; k++) {\n const bracket = ladders[k];\n const adjustFactor = this.safeString (bracket, 'adjust_factor');\n tiers.push ({\n 'tier': this.safeInteger (bracket, 'ladder'),\n 'symbol': this.safeSymbol (marketId, market, undefined, 'swap'),\n 'currency': this.safeCurrencyCode (currencyId),\n 'minNotional': this.safeNumber (bracket, 'min_size'),\n 'maxNotional': this.safeNumber (bracket, 'max_size'),\n 'maintenanceMarginRate': this.parseNumber (Precise.stringDiv (adjustFactor, leverage)),\n 'maxLeverage': this.parseNumber (leverage),\n 'info': bracket,\n });\n }\n }\n return tiers as LeverageTier[];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amount\":1.2082,\n \"open\":0.025096,\n \"close\":0.025095,\n \"high\":0.025096,\n \"id\":1591515300,\n \"count\":6,\n \"low\":0.025095,\n \"vol\":0.0303205097\n }" ], "line_end" => 3155, "line_start" => 3134, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // {\n // \"amount\":1.2082,\n // \"open\":0.025096,\n // \"close\":0.025095,\n // \"high\":0.025096,\n // \"id\":1591515300,\n // \"count\":6,\n // \"low\":0.025095,\n // \"vol\":0.0303205097\n // }\n //\n return [\n this.safeTimestamp (ohlcv, 'id'),\n this.safeNumber (ohlcv, 'open'),\n this.safeNumber (ohlcv, 'high'),\n this.safeNumber (ohlcv, 'low'),\n this.safeNumber (ohlcv, 'close'),\n this.safeNumber (ohlcv, 'amount'),\n ];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"volume\": \"4385.4350000000000000\",\n \"amount_type\": \"2\",\n \"ts\": \"1648220400000\",\n \"value\": \"194059884.1850000000000000\"\n }", "{\n \"volume\": 7192610.000000000000000000,\n \"amount\": 7192.610000000000000000,\n \"symbol\": \"BTC\",\n \"value\": 134654290.332000000000000000,\n \"contract_code\": \"BTC-USDT\",\n \"trade_amount\": 70692.804,\n \"trade_volume\": 70692804,\n \"trade_turnover\": 1379302592.9518,\n \"business_type\": \"swap\",\n \"pair\": \"BTC-USDT\",\n \"contract_type\": \"swap\",\n \"trade_partition\": \"USDT\"\n }", "{\n \"volume\": 518018.000000000000000000,\n \"amount\": 2769.675777407074725180,\n \"symbol\": \"BTC\",\n \"contract_code\": \"BTC-USD\",\n \"trade_amount\": 9544.4032080046491323463688602729806842458,\n \"trade_volume\": 1848448,\n \"trade_turnover\": 184844800.000000000000000000\n }", "{\n \"volume\": 118850.000000000000000000,\n \"amount\": 635.502025211544374189,\n \"symbol\": \"BTC\",\n \"contract_type\": \"this_week\",\n \"contract_code\": \"BTC220930\",\n \"trade_amount\": 1470.9400749347598691119206024033947897351,\n \"trade_volume\": 286286,\n \"trade_turnover\": 28628600.000000000000000000\n }" ], "line_end" => 8852, "line_start" => 8785, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "amount" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "value" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "interest" } ], "name" => "parseOpenInterest", "signature" => "parseOpenInterest (interest, market: Market = undefined)", "source" => "parseOpenInterest (interest, market: Market = undefined) {\n //\n // fetchOpenInterestHistory\n //\n // {\n // \"volume\": \"4385.4350000000000000\",\n // \"amount_type\": \"2\",\n // \"ts\": \"1648220400000\",\n // \"value\": \"194059884.1850000000000000\"\n // }\n //\n // fetchOpenInterest: USDT-M\n //\n // {\n // \"volume\": 7192610.000000000000000000,\n // \"amount\": 7192.610000000000000000,\n // \"symbol\": \"BTC\",\n // \"value\": 134654290.332000000000000000,\n // \"contract_code\": \"BTC-USDT\",\n // \"trade_amount\": 70692.804,\n // \"trade_volume\": 70692804,\n // \"trade_turnover\": 1379302592.9518,\n // \"business_type\": \"swap\",\n // \"pair\": \"BTC-USDT\",\n // \"contract_type\": \"swap\",\n // \"trade_partition\": \"USDT\"\n // }\n //\n // fetchOpenInterest: COIN-M Swap\n //\n // {\n // \"volume\": 518018.000000000000000000,\n // \"amount\": 2769.675777407074725180,\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USD\",\n // \"trade_amount\": 9544.4032080046491323463688602729806842458,\n // \"trade_volume\": 1848448,\n // \"trade_turnover\": 184844800.000000000000000000\n // }\n //\n // fetchOpenInterest: COIN-M Futures\n //\n // {\n // \"volume\": 118850.000000000000000000,\n // \"amount\": 635.502025211544374189,\n // \"symbol\": \"BTC\",\n // \"contract_type\": \"this_week\",\n // \"contract_code\": \"BTC220930\",\n // \"trade_amount\": 1470.9400749347598691119206024033947897351,\n // \"trade_volume\": 286286,\n // \"trade_turnover\": 28628600.000000000000000000\n // }\n //\n const timestamp = this.safeInteger (interest, 'ts');\n const amount = this.safeNumber (interest, 'volume');\n const value = this.safeNumber (interest, 'value');\n const marketId = this.safeString (interest, 'contract_code');\n return this.safeOpenInterest ({\n 'symbol': this.safeSymbol (marketId, market),\n 'baseVolume': amount, // deprecated\n 'quoteVolume': value, // deprecated\n 'openInterestAmount': amount,\n 'openInterestValue': value,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": 13997833014,\n \"symbol\": \"ethbtc\",\n \"account-id\": 3398321,\n \"amount\": \"0.045000000000000000\",\n \"price\": \"0.034014000000000000\",\n \"created-at\": 1545836976871,\n \"type\": \"sell-limit\",\n \"field-amount\": \"0.045000000000000000\", // they have fixed it for filled-amount\n \"field-cash-amount\": \"0.001530630000000000\", // they have fixed it for filled-cash-amount\n \"field-fees\": \"0.000003061260000000\", // they have fixed it for filled-fees\n \"finished-at\": 1545837948214,\n \"source\": \"spot-api\",\n \"state\": \"filled\",\n \"canceled-at\": 0\n }", "{\n \"id\": 20395337822,\n \"symbol\": \"ethbtc\",\n \"account-id\": 5685075,\n \"amount\": \"0.001000000000000000\",\n \"price\": \"0.0\",\n \"created-at\": 1545831584023,\n \"type\": \"buy-market\",\n \"field-amount\": \"0.029100000000000000\", // they have fixed it for filled-amount\n \"field-cash-amount\": \"0.000999788700000000\", // they have fixed it for filled-cash-amount\n \"field-fees\": \"0.000058200000000000\", // they have fixed it for filled-fees\n \"finished-at\": 1545831584181,\n \"source\": \"spot-api\",\n \"state\": \"filled\",\n \"canceled-at\": 0\n }", "{\n \"order_id\":924660854912552960,\n \"order_id_str\":\"924660854912552960\"\n }", "{\n \"business_type\":\"swap\",\n \"contract_type\":\"swap\",\n \"pair\":\"BTC-USDT\",\n \"symbol\":\"BTC\",\n \"contract_code\":\"BTC-USDT\",\n \"volume\":1,\n \"price\":3000,\n \"order_price_type\":\"limit\",\n \"order_type\":1,\n \"direction\":\"buy\",\n \"offset\":\"open\",\n \"lever_rate\":1,\n \"order_id\":924912513206878210,\n \"client_order_id\":null,\n \"created_at\":1640557927189,\n \"trade_volume\":0,\n \"trade_turnover\":0,\n \"fee\":0,\n \"trade_avg_price\":null,\n \"margin_frozen\":3.000000000000000000,\n \"profit\":0,\n \"status\":3,\n \"order_source\":\"api\",\n \"order_id_str\":\"924912513206878210\",\n \"fee_asset\":\"USDT\",\n \"liquidation_type\":\"0\",\n \"canceled_at\":0,\n \"margin_asset\":\"USDT\",\n \"margin_account\":\"USDT\",\n \"margin_mode\":\"cross\",\n \"is_tpsl\":0,\n \"real_profit\":0\n }", "{\n \"symbol\": \"BTC\",\n \"contract_code\": \"BTC-USDT\",\n \"instrument_price\": 0,\n \"final_interest\": 0,\n \"adjust_value\": 0,\n \"lever_rate\": 10,\n \"direction\": \"sell\",\n \"offset\": \"open\",\n \"volume\": 1.000000000000000000,\n \"price\": 13059.800000000000000000,\n \"created_at\": 1603703614712,\n \"canceled_at\": 0,\n \"order_source\": \"api\",\n \"order_price_type\": \"opponent\",\n \"margin_frozen\": 0,\n \"profit\": 0,\n \"trades\": [\n {\n \"trade_id\": 131560927,\n \"trade_price\": 13059.800000000000000000,\n \"trade_volume\": 1.000000000000000000,\n \"trade_turnover\": 13.059800000000000000,\n \"trade_fee\": -0.005223920000000000,\n \"created_at\": 1603703614715,\n \"role\": \"taker\",\n \"fee_asset\": \"USDT\",\n \"profit\": 0,\n \"real_profit\": 0,\n \"id\": \"131560927-770334322963152896-1\"\n }\n ],\n \"total_page\": 1,\n \"current_page\": 1,\n \"total_size\": 1,\n \"liquidation_type\": \"0\",\n \"fee_asset\": \"USDT\",\n \"fee\": -0.005223920000000000,\n \"order_id\": 770334322963152896,\n \"order_id_str\": \"770334322963152896\",\n \"client_order_id\": 57012021045,\n \"order_type\": \"1\",\n \"status\": 6,\n \"trade_avg_price\": 13059.800000000000000000,\n \"trade_turnover\": 13.059800000000000000,\n \"trade_volume\": 1.000000000000000000,\n \"margin_asset\": \"USDT\",\n \"margin_mode\": \"isolated\",\n \"margin_account\": \"BTC-USDT\",\n \"real_profit\": 0,\n \"is_tpsl\": 0\n }" ], "line_end" => 5306, "line_start" => 4873, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "clientOrderId" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "undefined" }, %{ "comment" => nil, "key" => "postOnly", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "this.safeString2 (order, 'stop-price', 'trigger_price')" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "filled", "value" => "filled" }, %{ "comment" => nil, "key" => "remaining", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "reduceOnly" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "trades", "value" => "trades" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // spot\n //\n // {\n // \"id\": 13997833014,\n // \"symbol\": \"ethbtc\",\n // \"account-id\": 3398321,\n // \"amount\": \"0.045000000000000000\",\n // \"price\": \"0.034014000000000000\",\n // \"created-at\": 1545836976871,\n // \"type\": \"sell-limit\",\n // \"field-amount\": \"0.045000000000000000\", // they have fixed it for filled-amount\n // \"field-cash-amount\": \"0.001530630000000000\", // they have fixed it for filled-cash-amount\n // \"field-fees\": \"0.000003061260000000\", // they have fixed it for filled-fees\n // \"finished-at\": 1545837948214,\n // \"source\": \"spot-api\",\n // \"state\": \"filled\",\n // \"canceled-at\": 0\n // }\n //\n // {\n // \"id\": 20395337822,\n // \"symbol\": \"ethbtc\",\n // \"account-id\": 5685075,\n // \"amount\": \"0.001000000000000000\",\n // \"price\": \"0.0\",\n // \"created-at\": 1545831584023,\n // \"type\": \"buy-market\",\n // \"field-amount\": \"0.029100000000000000\", // they have fixed it for filled-amount\n // \"field-cash-amount\": \"0.000999788700000000\", // they have fixed it for filled-cash-amount\n // \"field-fees\": \"0.000058200000000000\", // they have fixed it for filled-fees\n // \"finished-at\": 1545831584181,\n // \"source\": \"spot-api\",\n // \"state\": \"filled\",\n // \"canceled-at\": 0\n // }\n //\n // linear swap cross margin createOrder\n //\n // {\n // \"order_id\":924660854912552960,\n // \"order_id_str\":\"924660854912552960\"\n // }\n //\n // contracts fetchOrder\n //\n // {\n // \"business_type\":\"swap\",\n // \"contract_type\":\"swap\",\n // \"pair\":\"BTC-USDT\",\n // \"symbol\":\"BTC\",\n // \"contract_code\":\"BTC-USDT\",\n // \"volume\":1,\n // \"price\":3000,\n // \"order_price_type\":\"limit\",\n // \"order_type\":1,\n // \"direction\":\"buy\",\n // \"offset\":\"open\",\n // \"lever_rate\":1,\n // \"order_id\":924912513206878210,\n // \"client_order_id\":null,\n // \"created_at\":1640557927189,\n // \"trade_volume\":0,\n // \"trade_turnover\":0,\n // \"fee\":0,\n // \"trade_avg_price\":null,\n // \"margin_frozen\":3.000000000000000000,\n // \"profit\":0,\n // \"status\":3,\n // \"order_source\":\"api\",\n // \"order_id_str\":\"924912513206878210\",\n // \"fee_asset\":\"USDT\",\n // \"liquidation_type\":\"0\",\n // \"canceled_at\":0,\n // \"margin_asset\":\"USDT\",\n // \"margin_account\":\"USDT\",\n // \"margin_mode\":\"cross\",\n // \"is_tpsl\":0,\n // \"real_profit\":0\n // }\n //\n // contracts fetchOrder detailed\n //\n // {\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USDT\",\n // \"instrument_price\": 0,\n // \"final_interest\": 0,\n // \"adjust_value\": 0,\n // \"lever_rate\": 10,\n // \"direction\": \"sell\",\n // \"offset\": \"open\",\n // \"volume\": 1.000000000000000000,\n // \"price\": 13059.800000000000000000,\n // \"created_at\": 1603703614712,\n // \"canceled_at\": 0,\n // \"order_source\": \"api\",\n // \"order_price_type\": \"opponent\",\n // \"margin_frozen\": 0,\n // \"profit\": 0,\n // \"trades\": [\n // {\n // \"trade_id\": 131560927,\n // \"trade_price\": 13059.800000000000000000,\n // \"trade_volume\": 1.000000000000000000,\n // \"trade_turnover\": 13.059800000000000000,\n // \"trade_fee\": -0.005223920000000000,\n // \"created_at\": 1603703614715,\n // \"role\": \"taker\",\n // \"fee_asset\": \"USDT\",\n // \"profit\": 0,\n // \"real_profit\": 0,\n // \"id\": \"131560927-770334322963152896-1\"\n // }\n // ],\n // \"total_page\": 1,\n // \"current_page\": 1,\n // \"total_size\": 1,\n // \"liquidation_type\": \"0\",\n // \"fee_asset\": \"USDT\",\n // \"fee\": -0.005223920000000000,\n // \"order_id\": 770334322963152896,\n // \"order_id_str\": \"770334322963152896\",\n // \"client_order_id\": 57012021045,\n // \"order_type\": \"1\",\n // \"status\": 6,\n // \"trade_avg_price\": 13059.800000000000000000,\n // \"trade_turnover\": 13.059800000000000000,\n // \"trade_volume\": 1.000000000000000000,\n // \"margin_asset\": \"USDT\",\n // \"margin_mode\": \"isolated\",\n // \"margin_account\": \"BTC-USDT\",\n // \"real_profit\": 0,\n // \"is_tpsl\": 0\n // }\n //\n // future and swap: fetchOrders\n //\n // {\n // \"order_id\": 773131315209248768,\n // \"contract_code\": \"ADA201225\",\n // \"symbol\": \"ADA\",\n // \"lever_rate\": 20,\n // \"direction\": \"buy\",\n // \"offset\": \"close\",\n // \"volume\": 1,\n // \"price\": 0.0925,\n // \"create_date\": 1604370469629,\n // \"update_time\": 1603704221118,\n // \"order_source\": \"web\",\n // \"order_price_type\": 6,\n // \"order_type\": 1,\n // \"margin_frozen\": 0,\n // \"profit\": 0,\n // \"contract_type\": \"quarter\",\n // \"trade_volume\": 0,\n // \"trade_turnover\": 0,\n // \"fee\": 0,\n // \"trade_avg_price\": 0,\n // \"status\": 3,\n // \"order_id_str\": \"773131315209248768\",\n // \"fee_asset\": \"ADA\",\n // \"liquidation_type\": \"0\",\n // \"is_tpsl\": 0,\n // \"real_profit\": 0\n // \"margin_asset\": \"USDT\",\n // \"margin_mode\": \"cross\",\n // \"margin_account\": \"USDT\",\n // \"trade_partition\": \"USDT\", // only in isolated & cross of linear\n // \"reduce_only\": \"1\", // only in isolated & cross of linear\n // \"contract_type\": \"quarter\", // only in cross-margin (inverse & linear)\n // \"pair\": \"BTC-USDT\", // only in cross-margin (inverse & linear)\n // \"business_type\": \"futures\" // only in cross-margin (inverse & linear)\n // }\n //\n // trigger: fetchOpenOrders\n //\n // {\n // \"contract_type\": \"swap\",\n // \"business_type\": \"swap\",\n // \"pair\": \"BTC-USDT\",\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USDT\",\n // \"trigger_type\": \"le\",\n // \"volume\": 1.000000000000000000,\n // \"order_type\": 1,\n // \"direction\": \"buy\",\n // \"offset\": \"open\",\n // \"lever_rate\": 1,\n // \"order_id\": 1103670703588327424,\n // \"order_id_str\": \"1103670703588327424\",\n // \"order_source\": \"web\",\n // \"trigger_price\": 25000.000000000000000000,\n // \"order_price\": 24000.000000000000000000,\n // \"created_at\": 1683177200945,\n // \"order_price_type\": \"limit\",\n // \"status\": 2,\n // \"margin_mode\": \"cross\",\n // \"margin_account\": \"USDT\",\n // \"trade_partition\": \"USDT\",\n // \"reduce_only\": 0\n // }\n //\n // stop-loss and take-profit: fetchOpenOrders\n //\n // {\n // \"contract_type\": \"swap\",\n // \"business_type\": \"swap\",\n // \"pair\": \"BTC-USDT\",\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USDT\",\n // \"margin_mode\": \"cross\",\n // \"margin_account\": \"USDT\",\n // \"volume\": 1.000000000000000000,\n // \"order_type\": 1,\n // \"direction\": \"sell\",\n // \"order_id\": 1103680386844839936,\n // \"order_id_str\": \"1103680386844839936\",\n // \"order_source\": \"web\",\n // \"trigger_type\": \"le\",\n // \"trigger_price\": 25000.000000000000000000,\n // \"order_price\": 0E-18,\n // \"created_at\": 1683179509613,\n // \"order_price_type\": \"market\",\n // \"status\": 2,\n // \"tpsl_order_type\": \"sl\",\n // \"source_order_id\": null,\n // \"relation_tpsl_order_id\": \"-1\",\n // \"trade_partition\": \"USDT\"\n // }\n //\n // trailing: fetchOpenOrders\n //\n // {\n // \"contract_type\": \"swap\",\n // \"business_type\": \"swap\",\n // \"pair\": \"BTC-USDT\",\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USDT\",\n // \"volume\": 1.000000000000000000,\n // \"order_type\": 1,\n // \"direction\": \"sell\",\n // \"offset\": \"close\",\n // \"lever_rate\": 1,\n // \"order_id\": 1192021437253877761,\n // \"order_id_str\": \"1192021437253877761\",\n // \"order_source\": \"api\",\n // \"created_at\": 1704241657328,\n // \"order_price_type\": \"formula_price\",\n // \"status\": 2,\n // \"callback_rate\": 0.050000000000000000,\n // \"active_price\": 50000.000000000000000000,\n // \"is_active\": 0,\n // \"margin_mode\": \"cross\",\n // \"margin_account\": \"USDT\",\n // \"trade_partition\": \"USDT\",\n // \"reduce_only\": 1\n // }\n //\n // trigger: fetchOrders\n //\n // {\n // \"contract_type\": \"swap\",\n // \"business_type\": \"swap\",\n // \"pair\": \"BTC-USDT\",\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USDT\",\n // \"trigger_type\": \"le\",\n // \"volume\": 1.000000000000000000,\n // \"order_type\": 1,\n // \"direction\": \"buy\",\n // \"offset\": \"open\",\n // \"lever_rate\": 1,\n // \"order_id\": 1103670703588327424,\n // \"order_id_str\": \"1103670703588327424\",\n // \"relation_order_id\": \"-1\",\n // \"order_price_type\": \"limit\",\n // \"status\": 6,\n // \"order_source\": \"web\",\n // \"trigger_price\": 25000.000000000000000000,\n // \"triggered_price\": null,\n // \"order_price\": 24000.000000000000000000,\n // \"created_at\": 1683177200945,\n // \"triggered_at\": null,\n // \"order_insert_at\": 0,\n // \"canceled_at\": 1683179075234,\n // \"fail_code\": null,\n // \"fail_reason\": null,\n // \"margin_mode\": \"cross\",\n // \"margin_account\": \"USDT\",\n // \"update_time\": 1683179075958,\n // \"trade_partition\": \"USDT\",\n // \"reduce_only\": 0\n // }\n //\n // stop-loss and take-profit: fetchOrders\n //\n // {\n // \"contract_type\": \"swap\",\n // \"business_type\": \"swap\",\n // \"pair\": \"BTC-USDT\",\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USDT\",\n // \"margin_mode\": \"cross\",\n // \"margin_account\": \"USDT\",\n // \"volume\": 1.000000000000000000,\n // \"order_type\": 1,\n // \"tpsl_order_type\": \"sl\",\n // \"direction\": \"sell\",\n // \"order_id\": 1103680386844839936,\n // \"order_id_str\": \"1103680386844839936\",\n // \"order_source\": \"web\",\n // \"trigger_type\": \"le\",\n // \"trigger_price\": 25000.000000000000000000,\n // \"created_at\": 1683179509613,\n // \"order_price_type\": \"market\",\n // \"status\": 11,\n // \"source_order_id\": null,\n // \"relation_tpsl_order_id\": \"-1\",\n // \"canceled_at\": 0,\n // \"fail_code\": null,\n // \"fail_reason\": null,\n // \"triggered_price\": null,\n // \"relation_order_id\": \"-1\",\n // \"update_time\": 1683179968231,\n // \"order_price\": 0E-18,\n // \"trade_partition\": \"USDT\"\n // }\n //\n // spot: createOrders\n //\n // [\n // {\n // \"order-id\": 936847569789079,\n // \"client-order-id\": \"AA03022abc3a55e82c-0087-4fc2-beac-112fdebb1ee9\"\n // },\n // {\n // \"client-order-id\": \"AA03022abcdb3baefb-3cfa-4891-8009-082b3d46ca82\",\n // \"err-code\": \"account-frozen-balance-insufficient-error\",\n // \"err-msg\": \"trade account balance is not enough, left: `89`\"\n // }\n // ]\n //\n // swap and future: createOrders\n //\n // [\n // {\n // \"index\": 2,\n // \"err_code\": 1047,\n // \"err_msg\": \"Insufficient margin available.\"\n // },\n // {\n // \"order_id\": 1172923090632953857,\n // \"index\": 1,\n // \"order_id_str\": \"1172923090632953857\"\n // }\n // ]\n //\n const rejectedCreateOrders = this.safeString2 (order, 'err_code', 'err-code');\n let status = this.parseOrderStatus (this.safeString2 (order, 'state', 'status'));\n if (rejectedCreateOrders !== undefined) {\n status = 'rejected';\n }\n const id = this.safeStringN (order, [ 'id', 'order_id_str', 'order-id' ]);\n let side = this.safeString (order, 'direction');\n let type = this.safeString (order, 'order_price_type');\n if ('type' in order) {\n const orderType = order['type'].split ('-');\n side = orderType[0];\n type = orderType[1];\n }\n const marketId = this.safeString2 (order, 'contract_code', 'symbol');\n market = this.safeMarket (marketId, market);\n const timestamp = this.safeIntegerN (order, [ 'created_at', 'created-at', 'create_date' ]);\n const clientOrderId = this.safeString2 (order, 'client_order_id', 'client-or' + 'der-id'); // transpiler regex trick for php issue\n let cost = undefined;\n let amount = undefined;\n if ((type !== undefined) && (type.indexOf ('market') >= 0)) {\n cost = this.safeString (order, 'field-cash-amount');\n } else {\n amount = this.safeString2 (order, 'volume', 'amount');\n cost = this.safeStringN (order, [ 'filled-cash-amount', 'field-cash-amount', 'trade_turnover' ]); // same typo here\n }\n const filled = this.safeStringN (order, [ 'filled-amount', 'field-amount', 'trade_volume' ]); // typo in their API, filled amount\n const price = this.safeString2 (order, 'price', 'order_price');\n let feeCost = this.safeString2 (order, 'filled-fees', 'field-fees'); // typo in their API, filled feeSide\n feeCost = this.safeString (order, 'fee', feeCost);\n let fee = undefined;\n if (feeCost !== undefined) {\n let feeCurrency = undefined;\n const feeCurrencyId = this.safeString (order, 'fee_asset');\n if (feeCurrencyId !== undefined) {\n feeCurrency = this.safeCurrencyCode (feeCurrencyId);\n } else {\n feeCurrency = (side === 'sell') ? market['quote'] : market['base'];\n }\n fee = {\n 'cost': feeCost,\n 'currency': feeCurrency,\n };\n }\n const average = this.safeString (order, 'trade_avg_price');\n const trades = this.safeValue (order, 'trades');\n const reduceOnlyInteger = this.safeInteger (order, 'reduce_only');\n let reduceOnly = undefined;\n if (reduceOnlyInteger !== undefined) {\n reduceOnly = (reduceOnlyInteger === 0) ? false : true;\n }\n return this.safeOrder ({\n 'info': order,\n 'id': id,\n 'clientOrderId': clientOrderId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': undefined,\n 'symbol': market['symbol'],\n 'type': type,\n 'timeInForce': undefined,\n 'postOnly': undefined,\n 'side': side,\n 'price': price,\n 'triggerPrice': this.safeString2 (order, 'stop-price', 'trigger_price'),\n 'average': average,\n 'cost': cost,\n 'amount': amount,\n 'filled': filled,\n 'remaining': undefined,\n 'status': status,\n 'reduceOnly': reduceOnly,\n 'fee': fee,\n 'trades': trades,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4871, "line_start" => 4851, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n // spot\n 'partial-filled': 'open',\n 'partial-canceled': 'canceled',\n 'filled': 'closed',\n 'canceled': 'canceled',\n 'submitted': 'open',\n 'created': 'open', // For stop orders\n // contract\n '1': 'open',\n '2': 'open',\n '3': 'open',\n '4': 'open',\n '5': 'canceled', // partially matched\n '6': 'closed',\n '7': 'canceled',\n '11': 'canceling',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC\",\n \"contract_code\": \"BTC-USDT\",\n \"volume\": \"1.000000000000000000\",\n \"available\": \"1.000000000000000000\",\n \"frozen\": \"0E-18\",\n \"cost_open\": \"47162.000000000000000000\",\n \"cost_hold\": \"47151.300000000000000000\",\n \"profit_unreal\": \"0.007300000000000000\",\n \"profit_rate\": \"-0.000144183876850008\",\n \"lever_rate\": \"2\",\n \"position_margin\": \"23.579300000000000000\",\n \"direction\": \"buy\",\n \"profit\": \"-0.003400000000000000\",\n \"last_price\": \"47158.6\",\n \"margin_asset\": \"USDT\",\n \"margin_mode\": \"isolated\",\n \"margin_account\": \"BTC-USDT\",\n \"margin_balance\": \"24.973020070000000000\",\n \"margin_position\": \"23.579300000000000000\",\n \"margin_frozen\": \"0\",\n \"margin_available\": \"1.393720070000000000\",\n \"profit_real\": \"0E-18\",\n \"risk_rate\": \"1.044107779705080303\",\n \"withdraw_available\": \"1.386420070000000000000000000000000000\",\n \"liquidation_price\": \"22353.229148614609571788\",\n \"adjust_factor\": \"0.015000000000000000\",\n \"margin_static\": \"24.965720070000000000\"\n }" ], "line_end" => 7847, "line_start" => 7757, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (contracts)" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contractSize" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "entryPrice" }, %{ "comment" => nil, "key" => "collateral", "value" => "this.parseNumber (collateral)" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "unrealizedProfit" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.parseNumber (leverage)" }, %{ "comment" => nil, "key" => "percentage", "value" => "this.parseNumber (percentage)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "notional", "value" => "this.parseNumber (notional)" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "liquidationPrice" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "this.parseNumber (initialMargin)" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "this.parseNumber (intialMarginPercentage)" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "this.parseNumber (maintenanceMargin)" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "this.parseNumber (maintenanceMarginPercentage)" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "this.parseNumber (marginRatio)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "hedged", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"symbol\": \"BTC\",\n // \"contract_code\": \"BTC-USDT\",\n // \"volume\": \"1.000000000000000000\",\n // \"available\": \"1.000000000000000000\",\n // \"frozen\": \"0E-18\",\n // \"cost_open\": \"47162.000000000000000000\",\n // \"cost_hold\": \"47151.300000000000000000\",\n // \"profit_unreal\": \"0.007300000000000000\",\n // \"profit_rate\": \"-0.000144183876850008\",\n // \"lever_rate\": \"2\",\n // \"position_margin\": \"23.579300000000000000\",\n // \"direction\": \"buy\",\n // \"profit\": \"-0.003400000000000000\",\n // \"last_price\": \"47158.6\",\n // \"margin_asset\": \"USDT\",\n // \"margin_mode\": \"isolated\",\n // \"margin_account\": \"BTC-USDT\",\n // \"margin_balance\": \"24.973020070000000000\",\n // \"margin_position\": \"23.579300000000000000\",\n // \"margin_frozen\": \"0\",\n // \"margin_available\": \"1.393720070000000000\",\n // \"profit_real\": \"0E-18\",\n // \"risk_rate\": \"1.044107779705080303\",\n // \"withdraw_available\": \"1.386420070000000000000000000000000000\",\n // \"liquidation_price\": \"22353.229148614609571788\",\n // \"adjust_factor\": \"0.015000000000000000\",\n // \"margin_static\": \"24.965720070000000000\"\n // }\n //\n market = this.safeMarket (this.safeString (position, 'contract_code'));\n const symbol = market['symbol'];\n const contracts = this.safeString (position, 'volume');\n const contractSize = this.safeValue (market, 'contractSize');\n const contractSizeString = this.numberToString (contractSize);\n const entryPrice = this.safeNumber (position, 'cost_open');\n const initialMargin = this.safeString (position, 'position_margin');\n const rawSide = this.safeString (position, 'direction');\n const side = (rawSide === 'buy') ? 'long' : 'short';\n const unrealizedProfit = this.safeNumber (position, 'profit_unreal');\n let marginMode = this.safeString (position, 'margin_mode');\n const leverage = this.safeString (position, 'lever_rate');\n const percentage = Precise.stringMul (this.safeString (position, 'profit_rate'), '100');\n const lastPrice = this.safeString (position, 'last_price');\n const faceValue = Precise.stringMul (contracts, contractSizeString);\n let notional = undefined;\n if (market['linear']) {\n notional = Precise.stringMul (faceValue, lastPrice);\n } else {\n notional = Precise.stringDiv (faceValue, lastPrice);\n marginMode = 'cross';\n }\n const intialMarginPercentage = Precise.stringDiv (initialMargin, notional);\n const collateral = this.safeString (position, 'margin_balance');\n const liquidationPrice = this.safeNumber (position, 'liquidation_price');\n const adjustmentFactor = this.safeString (position, 'adjust_factor');\n const maintenanceMarginPercentage = Precise.stringDiv (adjustmentFactor, leverage);\n const maintenanceMargin = Precise.stringMul (maintenanceMarginPercentage, notional);\n const marginRatio = Precise.stringDiv (maintenanceMargin, collateral);\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': symbol,\n 'contracts': this.parseNumber (contracts),\n 'contractSize': contractSize,\n 'entryPrice': entryPrice,\n 'collateral': this.parseNumber (collateral),\n 'side': side,\n 'unrealizedPnl': unrealizedProfit,\n 'leverage': this.parseNumber (leverage),\n 'percentage': this.parseNumber (percentage),\n 'marginMode': marginMode,\n 'notional': this.parseNumber (notional),\n 'markPrice': undefined,\n 'lastPrice': undefined,\n 'liquidationPrice': liquidationPrice,\n 'initialMargin': this.parseNumber (initialMargin),\n 'initialMarginPercentage': this.parseNumber (intialMarginPercentage),\n 'maintenanceMargin': this.parseNumber (maintenanceMargin),\n 'maintenanceMarginPercentage': this.parseNumber (maintenanceMarginPercentage),\n 'marginRatio': this.parseNumber (marginRatio),\n 'timestamp': undefined,\n 'datetime': undefined,\n 'hedged': undefined,\n 'lastUpdateTimestamp': undefined,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ADA\",\n \"contract_code\": \"ADA-USDT\",\n \"settlement_time\": 1652313600000,\n \"clawback_ratio\": 0E-18,\n \"settlement_price\": 0.512303000000000000,\n \"settlement_type\": \"settlement\",\n \"business_type\": \"swap\",\n \"pair\": \"ADA-USDT\",\n \"trade_partition\": \"USDT\"\n }", "{\n \"contract_code\": \"FIL220513\",\n \"settlement_price\": 7.016000000000000000,\n \"settlement_type\": \"settlement\"\n }" ], "line_end" => 9353, "line_start" => 9320, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "settlement" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (settlement, 'settlement_price')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseSettlement", "signature" => "parseSettlement (settlement, market)", "source" => "parseSettlement (settlement, market) {\n //\n // linear swap, coin-m swap, fetchSettlementHistory\n //\n // {\n // \"symbol\": \"ADA\",\n // \"contract_code\": \"ADA-USDT\",\n // \"settlement_time\": 1652313600000,\n // \"clawback_ratio\": 0E-18,\n // \"settlement_price\": 0.512303000000000000,\n // \"settlement_type\": \"settlement\",\n // \"business_type\": \"swap\",\n // \"pair\": \"ADA-USDT\",\n // \"trade_partition\": \"USDT\"\n // }\n //\n // coin-m future, fetchSettlementHistory\n //\n // {\n // \"contract_code\": \"FIL220513\",\n // \"settlement_price\": 7.016000000000000000,\n // \"settlement_type\": \"settlement\"\n // }\n //\n const timestamp = this.safeInteger (settlement, 'settlement_time');\n const marketId = this.safeString (settlement, 'contract_code');\n return {\n 'info': settlement,\n 'symbol': this.safeSymbol (marketId, market),\n 'price': this.safeNumber (settlement, 'settlement_price'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"symbol\": \"ADA\",\n \"contract_code\": \"ADA-USDT\",\n \"settlement_time\": 1652313600000,\n \"clawback_ratio\": 0E-18,\n \"settlement_price\": 0.512303000000000000,\n \"settlement_type\": \"settlement\",\n \"business_type\": \"swap\",\n \"pair\": \"ADA-USDT\",\n \"trade_partition\": \"USDT\"\n },\n ...\n ]", "[\n {\n \"symbol\": \"FIL\",\n \"settlement_time\": 1652342400000,\n \"clawback_ratio\": 0E-18,\n \"list\": [\n {\n \"contract_code\": \"FIL220513\",\n \"settlement_price\": 7.016000000000000000,\n \"settlement_type\": \"settlement\"\n },\n ...\n ]\n },\n ]" ], "line_end" => 9318, "line_start" => 9261, "mappings" => [ %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseSettlements", "signature" => "parseSettlements (settlements, market)", "source" => "parseSettlements (settlements, market) {\n //\n // linear swap, coin-m swap, fetchSettlementHistory\n //\n // [\n // {\n // \"symbol\": \"ADA\",\n // \"contract_code\": \"ADA-USDT\",\n // \"settlement_time\": 1652313600000,\n // \"clawback_ratio\": 0E-18,\n // \"settlement_price\": 0.512303000000000000,\n // \"settlement_type\": \"settlement\",\n // \"business_type\": \"swap\",\n // \"pair\": \"ADA-USDT\",\n // \"trade_partition\": \"USDT\"\n // },\n // ...\n // ]\n //\n // coin-m future, fetchSettlementHistory\n //\n // [\n // {\n // \"symbol\": \"FIL\",\n // \"settlement_time\": 1652342400000,\n // \"clawback_ratio\": 0E-18,\n // \"list\": [\n // {\n // \"contract_code\": \"FIL220513\",\n // \"settlement_price\": 7.016000000000000000,\n // \"settlement_type\": \"settlement\"\n // },\n // ...\n // ]\n // },\n // ]\n //\n const result = [];\n for (let i = 0; i < settlements.length; i++) {\n const settlement = settlements[i];\n const list = this.safeValue (settlement, 'list');\n if (list !== undefined) {\n const timestamp = this.safeInteger (settlement, 'settlement_time');\n const timestampDetails: Dict = {\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n for (let j = 0; j < list.length; j++) {\n const item = list[j];\n const parsedSettlement = this.parseSettlement (item, market);\n result.push (this.extend (parsedSettlement, timestampDetails));\n }\n } else {\n result.push (this.parseSettlement (settlements[i], market));\n }\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amount\": 26228.672978342216,\n \"open\": 9078.95,\n \"close\": 9146.86,\n \"high\": 9155.41,\n \"id\": 209988544334,\n \"count\": 265846,\n \"low\": 8988.0,\n \"version\": 209988544334,\n \"ask\": [ 9146.87, 0.156134 ],\n \"vol\": 2.3822168242201668E8,\n \"bid\": [ 9146.86, 0.080758 ],\n }", "{\n \"symbol\": \"bhdht\",\n \"open\": 2.3938,\n \"high\": 2.4151,\n \"low\": 2.3323,\n \"close\": 2.3909,\n \"amount\": 628.992,\n \"vol\": 1493.71841095,\n \"count\": 2088,\n \"bid\": 2.3643,\n \"bidSize\": 0.7136,\n \"ask\": 2.4061,\n \"askSize\": 0.4156\n }", "{\n \"seqId\": 161499562790,\n \"ask\": 16829.51,\n \"askSize\": 0.707776,\n \"bid\": 16829.5,\n \"bidSize\": 1.685945,\n \"quoteTime\": 1671941599612,\n \"symbol\": \"btcusdt\"\n }" ], "line_end" => 2279, "line_start" => 2181, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "this.safeString (ticker, 'high')" }, %{ "comment" => nil, "key" => "low", "value" => "this.safeString (ticker, 'low')" }, %{ "comment" => nil, "key" => "bid", "value" => "bid" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "bidVolume" }, %{ "comment" => nil, "key" => "ask", "value" => "ask" }, %{ "comment" => nil, "key" => "askVolume", "value" => "askVolume" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "open" }, %{ "comment" => nil, "key" => "close", "value" => "close" }, %{ "comment" => nil, "key" => "last", "value" => "close" }, %{ "comment" => nil, "key" => "previousClose", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "baseVolume" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "quoteVolume" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker", "source" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker {\n //\n // fetchTicker\n //\n // {\n // \"amount\": 26228.672978342216,\n // \"open\": 9078.95,\n // \"close\": 9146.86,\n // \"high\": 9155.41,\n // \"id\": 209988544334,\n // \"count\": 265846,\n // \"low\": 8988.0,\n // \"version\": 209988544334,\n // \"ask\": [ 9146.87, 0.156134 ],\n // \"vol\": 2.3822168242201668E8,\n // \"bid\": [ 9146.86, 0.080758 ],\n // }\n //\n // fetchTickers\n //\n // {\n // \"symbol\": \"bhdht\",\n // \"open\": 2.3938,\n // \"high\": 2.4151,\n // \"low\": 2.3323,\n // \"close\": 2.3909,\n // \"amount\": 628.992,\n // \"vol\": 1493.71841095,\n // \"count\": 2088,\n // \"bid\": 2.3643,\n // \"bidSize\": 0.7136,\n // \"ask\": 2.4061,\n // \"askSize\": 0.4156\n // }\n //\n // watchTikcer - bbo\n // {\n // \"seqId\": 161499562790,\n // \"ask\": 16829.51,\n // \"askSize\": 0.707776,\n // \"bid\": 16829.5,\n // \"bidSize\": 1.685945,\n // \"quoteTime\": 1671941599612,\n // \"symbol\": \"btcusdt\"\n // }\n //\n const marketId = this.safeString2 (ticker, 'symbol', 'contract_code');\n let symbol = this.safeSymbol (marketId, market);\n symbol = this.tryGetSymbolFromFutureMarkets (symbol);\n const timestamp = this.safeInteger2 (ticker, 'ts', 'quoteTime');\n let bid = undefined;\n let bidVolume = undefined;\n let ask = undefined;\n let askVolume = undefined;\n if ('bid' in ticker) {\n if (ticker['bid'] !== undefined && Array.isArray (ticker['bid'])) {\n bid = this.safeString (ticker['bid'], 0);\n bidVolume = this.safeString (ticker['bid'], 1);\n } else {\n bid = this.safeString (ticker, 'bid');\n bidVolume = this.safeString (ticker, 'bidSize');\n }\n }\n if ('ask' in ticker) {\n if (ticker['ask'] !== undefined && Array.isArray (ticker['ask'])) {\n ask = this.safeString (ticker['ask'], 0);\n askVolume = this.safeString (ticker['ask'], 1);\n } else {\n ask = this.safeString (ticker, 'ask');\n askVolume = this.safeString (ticker, 'askSize');\n }\n }\n const open = this.safeString (ticker, 'open');\n const close = this.safeString (ticker, 'close');\n const baseVolume = this.safeString (ticker, 'amount');\n const quoteVolume = this.safeString (ticker, 'vol');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': this.safeString (ticker, 'high'),\n 'low': this.safeString (ticker, 'low'),\n 'bid': bid,\n 'bidVolume': bidVolume,\n 'ask': ask,\n 'askVolume': askVolume,\n 'vwap': undefined,\n 'open': open,\n 'close': close,\n 'last': close,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': undefined,\n 'average': undefined,\n 'baseVolume': baseVolume,\n 'quoteVolume': quoteVolume,\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amount\": 0.010411000000000000,\n \"trade-id\": 102090736910,\n \"ts\": 1583497692182,\n \"id\": 10500517034273194594947,\n \"price\": 9096.050000000000000000,\n \"direction\": \"sell\"\n }", "{\n \"symbol\": \"swftcbtc\",\n \"fee-currency\": \"swftc\",\n \"filled-fees\": \"0\",\n \"source\": \"spot-api\",\n \"id\": 83789509854000,\n \"type\": \"buy-limit\",\n \"order-id\": 83711103204909,\n 'filled-points': \"0.005826843283532154\",\n \"fee-deduct-currency\": \"ht\",\n 'filled-amount': \"45941.53\",\n \"price\": \"0.0000001401\",\n \"created-at\": 1597933260729,\n \"match-id\": 100087455560,\n \"role\": \"maker\",\n \"trade-id\": 100050305348\n }", "{\n \"trade_id\": 131560927,\n \"trade_price\": 13059.800000000000000000,\n \"trade_volume\": 1.000000000000000000,\n \"trade_turnover\": 13.059800000000000000,\n \"trade_fee\": -0.005223920000000000,\n \"created_at\": 1603703614715,\n \"role\": \"taker\",\n \"fee_asset\": \"USDT\",\n \"profit\": 0,\n \"real_profit\": 0,\n \"id\": \"131560927-770334322963152896-1\"\n }", "{\n \"contract_type\":\"swap\",\n \"pair\":\"O3-USDT\",\n \"business_type\":\"swap\",\n \"query_id\":652123190,\n \"match_id\":28306009409,\n \"order_id\":941137865226903553,\n \"symbol\":\"O3\",\n \"contract_code\":\"O3-USDT\",\n \"direction\":\"sell\",\n \"offset\":\"open\",\n \"trade_volume\":100.000000000000000000,\n \"trade_price\":0.398500000000000000,\n \"trade_turnover\":39.850000000000000000,\n \"trade_fee\":-0.007970000000000000,\n \"offset_profitloss\":0E-18,\n \"create_date\":1644426352999,\n \"role\":\"Maker\",\n \"order_source\":\"api\",\n \"order_id_str\":\"941137865226903553\",\n \"id\":\"28306009409-941137865226903553-1\",\n \"fee_asset\":\"USDT\",\n \"margin_mode\":\"cross\",\n \"margin_account\":\"USDT\",\n \"real_profit\":0E-18,\n \"trade_partition\":\"USDT\"\n }" ], "line_end" => 2835, "line_start" => 2690, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "order", "value" => "order" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "price", "value" => "priceString" }, %{ "comment" => nil, "key" => "amount", "value" => "amountString" }, %{ "comment" => nil, "key" => "cost", "value" => "costString" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // spot fetchTrades (public)\n //\n // {\n // \"amount\": 0.010411000000000000,\n // \"trade-id\": 102090736910,\n // \"ts\": 1583497692182,\n // \"id\": 10500517034273194594947,\n // \"price\": 9096.050000000000000000,\n // \"direction\": \"sell\"\n // }\n //\n // spot fetchMyTrades (private)\n //\n // {\n // \"symbol\": \"swftcbtc\",\n // \"fee-currency\": \"swftc\",\n // \"filled-fees\": \"0\",\n // \"source\": \"spot-api\",\n // \"id\": 83789509854000,\n // \"type\": \"buy-limit\",\n // \"order-id\": 83711103204909,\n // 'filled-points': \"0.005826843283532154\",\n // \"fee-deduct-currency\": \"ht\",\n // 'filled-amount': \"45941.53\",\n // \"price\": \"0.0000001401\",\n // \"created-at\": 1597933260729,\n // \"match-id\": 100087455560,\n // \"role\": \"maker\",\n // \"trade-id\": 100050305348\n // }\n //\n // linear swap isolated margin fetchOrder details\n //\n // {\n // \"trade_id\": 131560927,\n // \"trade_price\": 13059.800000000000000000,\n // \"trade_volume\": 1.000000000000000000,\n // \"trade_turnover\": 13.059800000000000000,\n // \"trade_fee\": -0.005223920000000000,\n // \"created_at\": 1603703614715,\n // \"role\": \"taker\",\n // \"fee_asset\": \"USDT\",\n // \"profit\": 0,\n // \"real_profit\": 0,\n // \"id\": \"131560927-770334322963152896-1\"\n // }\n //\n // inverse swap cross margin fetchMyTrades\n //\n // {\n // \"contract_type\":\"swap\",\n // \"pair\":\"O3-USDT\",\n // \"business_type\":\"swap\",\n // \"query_id\":652123190,\n // \"match_id\":28306009409,\n // \"order_id\":941137865226903553,\n // \"symbol\":\"O3\",\n // \"contract_code\":\"O3-USDT\",\n // \"direction\":\"sell\",\n // \"offset\":\"open\",\n // \"trade_volume\":100.000000000000000000,\n // \"trade_price\":0.398500000000000000,\n // \"trade_turnover\":39.850000000000000000,\n // \"trade_fee\":-0.007970000000000000,\n // \"offset_profitloss\":0E-18,\n // \"create_date\":1644426352999,\n // \"role\":\"Maker\",\n // \"order_source\":\"api\",\n // \"order_id_str\":\"941137865226903553\",\n // \"id\":\"28306009409-941137865226903553-1\",\n // \"fee_asset\":\"USDT\",\n // \"margin_mode\":\"cross\",\n // \"margin_account\":\"USDT\",\n // \"real_profit\":0E-18,\n // \"trade_partition\":\"USDT\"\n // }\n //\n const marketId = this.safeString2 (trade, 'contract_code', 'symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n let timestamp = this.safeInteger2 (trade, 'ts', 'created-at');\n timestamp = this.safeInteger2 (trade, 'created_at', 'create_date', timestamp);\n const order = this.safeString2 (trade, 'order-id', 'order_id');\n let side = this.safeString (trade, 'direction');\n let type = this.safeString (trade, 'type');\n if (type !== undefined) {\n const typeParts = type.split ('-');\n side = typeParts[0];\n type = typeParts[1];\n }\n const takerOrMaker = this.safeStringLower (trade, 'role');\n const priceString = this.safeString2 (trade, 'price', 'trade_price');\n let amountString = this.safeString2 (trade, 'filled-amount', 'amount');\n amountString = this.safeString (trade, 'trade_volume', amountString);\n const costString = this.safeString (trade, 'trade_turnover');\n let fee = undefined;\n let feeCost = this.safeString (trade, 'filled-fees');\n if (feeCost === undefined) {\n feeCost = Precise.stringNeg (this.safeString (trade, 'trade_fee'));\n }\n const feeCurrencyId = this.safeString2 (trade, 'fee-currency', 'fee_asset');\n let feeCurrency = this.safeCurrencyCode (feeCurrencyId);\n const filledPoints = this.safeString (trade, 'filled-points');\n if (filledPoints !== undefined) {\n if ((feeCost === undefined) || Precise.stringEquals (feeCost, '0')) {\n const feeDeductCurrency = this.safeString (trade, 'fee-deduct-currency');\n if (feeDeductCurrency !== undefined) {\n feeCost = filledPoints;\n feeCurrency = this.safeCurrencyCode (feeDeductCurrency);\n }\n }\n }\n if (feeCost !== undefined) {\n fee = {\n 'cost': feeCost,\n 'currency': feeCurrency,\n };\n }\n // htx's multi-market trade-id is a bit complex to parse accordingly.\n // - for `id` which contains hyphen, it would be the unique id, eg. xxxxxx-1, xxxxxx-2 (this happens mostly for contract markets)\n // - otherwise the least priority is given to the `id` key\n let id: Str = undefined;\n const safeId = this.safeString (trade, 'id');\n if (safeId !== undefined && safeId.indexOf ('-') >= 0) {\n id = safeId;\n } else {\n id = this.safeStringN (trade, [ 'trade_id', 'trade-id', 'id' ]);\n }\n return this.safeTrade ({\n 'id': id,\n 'info': trade,\n 'order': order,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'type': type,\n 'side': side,\n 'takerOrMaker': takerOrMaker,\n 'price': priceString,\n 'amount': amountString,\n 'cost': costString,\n 'fee': fee,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\":\"btcusdt\",\n \"actualMakerRate\":\"0.002\",\n \"actualTakerRate\":\"0.002\",\n \"takerFeeRate\":\"0.002\",\n \"makerFeeRate\":\"0.002\"\n }" ], "line_end" => 1683, "line_start" => 1664, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (fee, 'actualMakerRate')" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (fee, 'actualTakerRate')" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "tierBased", "value" => "undefined" } ], "name" => "parseTradingFee", "signature" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface", "source" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface {\n //\n // {\n // \"symbol\":\"btcusdt\",\n // \"actualMakerRate\":\"0.002\",\n // \"actualTakerRate\":\"0.002\",\n // \"takerFeeRate\":\"0.002\",\n // \"makerFeeRate\":\"0.002\"\n // }\n //\n const marketId = this.safeString (fee, 'symbol');\n return {\n 'info': fee,\n 'symbol': this.safeSymbol (marketId, market),\n 'maker': this.safeNumber (fee, 'actualMakerRate'),\n 'taker': this.safeNumber (fee, 'actualTakerRate'),\n 'percentage': undefined,\n 'tierBased': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{ \"symbol\": \"aidocbtc\",\n \"buy-limit-must-less-than\": 1.1,\n \"sell-limit-must-greater-than\": 0.9,\n \"limit-order-must-greater-than\": 1,\n \"limit-order-must-less-than\": 5000000,\n \"market-buy-order-must-greater-than\": 0.0001,\n \"market-buy-order-must-less-than\": 100,\n \"market-sell-order-must-greater-than\": 1,\n \"market-sell-order-must-less-than\": 500000,\n \"circuit-break-when-greater-than\": 10000,\n \"circuit-break-when-less-than\": 10,\n \"market-sell-order-rate-must-less-than\": 0.1,\n \"market-buy-order-rate-must-less-than\": 0.1 }" ], "line_end" => 1795, "line_start" => 1770, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "limits" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'amount': {\n 'min': this.safeNumber (limits, 'limit-order-must-greater-than'),\n 'max': this.safeNumber (limits, 'limit-order-must-less-than'),\n },\n }" } ], "name" => "parseTradingLimits", "signature" => "parseTradingLimits (limits, symbol: Str = undefined, params = {})", "source" => "parseTradingLimits (limits, symbol: Str = undefined, params = {}) {\n //\n // { \"symbol\": \"aidocbtc\",\n // \"buy-limit-must-less-than\": 1.1,\n // \"sell-limit-must-greater-than\": 0.9,\n // \"limit-order-must-greater-than\": 1,\n // \"limit-order-must-less-than\": 5000000,\n // \"market-buy-order-must-greater-than\": 0.0001,\n // \"market-buy-order-must-less-than\": 100,\n // \"market-sell-order-must-greater-than\": 1,\n // \"market-sell-order-must-less-than\": 500000,\n // \"circuit-break-when-greater-than\": 10000,\n // \"circuit-break-when-less-than\": 10,\n // \"market-sell-order-rate-must-less-than\": 0.1,\n // \"market-buy-order-rate-must-less-than\": 0.1 }\n //\n return {\n 'info': limits,\n 'limits': {\n 'amount': {\n 'min': this.safeNumber (limits, 'limit-order-must-greater-than'),\n 'max': this.safeNumber (limits, 'limit-order-must-less-than'),\n },\n },\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": \"75115912\",\n \"type\": \"deposit\",\n \"sub-type\": \"NORMAL\",\n \"request-id\": \"trc20usdt-a2e229a44ef2a948c874366230bb56aa73631cc0a03d177bd8b4c9d38262d7ff-200\",\n \"currency\": \"usdt\",\n \"chain\": \"trc20usdt\",\n \"tx-hash\": \"a2e229a44ef2a948c874366230bb56aa73631cc0a03d177bd8b4c9d38262d7ff\",\n \"amount\": \"2849.000000000000000000\",\n \"from-addr-tag\": \"\",\n \"address-id\": \"0\",\n \"address\": \"TRFTd1FxepQE6CnpwzUEMEbFaLm5bJK67s\",\n \"address-tag\": \"\",\n \"fee\": \"0\",\n \"state\": \"safe\",\n \"wallet-confirm\": \"2\",\n \"created-at\": \"1621843808662\",\n \"updated-at\": \"1621843857137\"\n },", "{\n \"id\": \"61335312\",\n \"type\": \"withdraw\",\n \"sub-type\": \"NORMAL\",\n \"currency\": \"usdt\",\n \"chain\": \"trc20usdt\",\n \"tx-hash\": \"30a3111f2fead74fae45c6218ca3150fc33cab2aa59cfe41526b96aae79ce4ec\",\n \"amount\": \"12.000000000000000000\",\n \"from-addr-tag\": \"\",\n \"address-id\": \"27321591\",\n \"address\": \"TRf5JacJQRsF4Nm2zu11W6maDGeiEWQu9e\",\n \"address-tag\": \"\",\n \"fee\": \"1.000000000000000000\",\n \"state\": \"confirmed\",\n \"created-at\": \"1621852316553\",\n \"updated-at\": \"1621852467041\"\n }", "{\n \"status\": \"ok\",\n \"data\": \"99562054\"\n }" ], "line_end" => 6732, "line_start" => 6638, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (transaction, 'id', 'data')" }, %{ "comment" => nil, "key" => "txid", "value" => "txHash" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (networkId)" }, %{ "comment" => nil, "key" => "address", "value" => "this.safeString (transaction, 'address')" }, %{ "comment" => nil, "key" => "addressTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tag", "value" => "this.safeString (transaction, 'address-tag')" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (transaction, 'amount')" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransactionStatus (this.safeString (transaction, 'state'))" }, %{ "comment" => nil, "key" => "updated", "value" => "this.safeInteger (transaction, 'updated-at')" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "internal", "value" => "internal" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': code,\n 'cost': this.parseNumber (feeCost),\n 'rate': undefined,\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "this.parseNumber (feeCost)" }, %{ "comment" => nil, "key" => "rate", "value" => "undefined" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // fetchDeposits\n //\n // {\n // \"id\": \"75115912\",\n // \"type\": \"deposit\",\n // \"sub-type\": \"NORMAL\",\n // \"request-id\": \"trc20usdt-a2e229a44ef2a948c874366230bb56aa73631cc0a03d177bd8b4c9d38262d7ff-200\",\n // \"currency\": \"usdt\",\n // \"chain\": \"trc20usdt\",\n // \"tx-hash\": \"a2e229a44ef2a948c874366230bb56aa73631cc0a03d177bd8b4c9d38262d7ff\",\n // \"amount\": \"2849.000000000000000000\",\n // \"from-addr-tag\": \"\",\n // \"address-id\": \"0\",\n // \"address\": \"TRFTd1FxepQE6CnpwzUEMEbFaLm5bJK67s\",\n // \"address-tag\": \"\",\n // \"fee\": \"0\",\n // \"state\": \"safe\",\n // \"wallet-confirm\": \"2\",\n // \"created-at\": \"1621843808662\",\n // \"updated-at\": \"1621843857137\"\n // },\n //\n // fetchWithdrawals\n //\n // {\n // \"id\": \"61335312\",\n // \"type\": \"withdraw\",\n // \"sub-type\": \"NORMAL\",\n // \"currency\": \"usdt\",\n // \"chain\": \"trc20usdt\",\n // \"tx-hash\": \"30a3111f2fead74fae45c6218ca3150fc33cab2aa59cfe41526b96aae79ce4ec\",\n // \"amount\": \"12.000000000000000000\",\n // \"from-addr-tag\": \"\",\n // \"address-id\": \"27321591\",\n // \"address\": \"TRf5JacJQRsF4Nm2zu11W6maDGeiEWQu9e\",\n // \"address-tag\": \"\",\n // \"fee\": \"1.000000000000000000\",\n // \"state\": \"confirmed\",\n // \"created-at\": \"1621852316553\",\n // \"updated-at\": \"1621852467041\"\n // }\n //\n // withdraw\n //\n // {\n // \"status\": \"ok\",\n // \"data\": \"99562054\"\n // }\n //\n const timestamp = this.safeInteger (transaction, 'created-at');\n const code = this.safeCurrencyCode (this.safeString (transaction, 'currency'));\n let type = this.safeString (transaction, 'type');\n if (type === 'withdraw') {\n type = 'withdrawal';\n }\n let feeCost = this.safeString (transaction, 'fee');\n if (feeCost !== undefined) {\n feeCost = Precise.stringAbs (feeCost);\n }\n const networkId = this.safeString (transaction, 'chain');\n let txHash = this.safeString (transaction, 'tx-hash');\n if (networkId === 'ETH' && txHash.indexOf ('0x') < 0) {\n txHash = '0x' + txHash;\n }\n const subType = this.safeString (transaction, 'sub-type');\n const internal = subType === 'FAST';\n return {\n 'info': transaction,\n 'id': this.safeString2 (transaction, 'id', 'data'),\n 'txid': txHash,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'network': this.networkIdToCode (networkId),\n 'address': this.safeString (transaction, 'address'),\n 'addressTo': undefined,\n 'addressFrom': undefined,\n 'tag': this.safeString (transaction, 'address-tag'),\n 'tagTo': undefined,\n 'tagFrom': undefined,\n 'type': type,\n 'amount': this.safeNumber (transaction, 'amount'),\n 'currency': code,\n 'status': this.parseTransactionStatus (this.safeString (transaction, 'state')),\n 'updated': this.safeInteger (transaction, 'updated-at'),\n 'comment': undefined,\n 'internal': internal,\n 'fee': {\n 'currency': code,\n 'cost': this.parseNumber (feeCost),\n 'rate': undefined,\n },\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 6757, "line_start" => 6734, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: Str)", "source" => "parseTransactionStatus (status: Str) {\n const statuses: Dict = {\n // deposit statuses\n 'unknown': 'failed',\n 'confirming': 'pending',\n 'confirmed': 'ok',\n 'safe': 'ok',\n 'orphan': 'failed',\n // withdrawal statuses\n 'submitted': 'pending',\n 'canceled': 'canceled',\n 'reexamine': 'pending',\n 'reject': 'failed',\n 'pass': 'pending',\n 'wallet-reject': 'failed',\n // 'confirmed': 'ok', // present in deposit statuses\n 'confirm-error': 'failed',\n 'repealed': 'failed',\n 'wallet-transfer': 'pending',\n 'pre-transfer': 'pending',\n 'verifying': 'pending',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"data\": 12345,\n \"status\": \"ok\"\n }" ], "line_end" => 6843, "line_start" => 6821, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transfer" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "toAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry", "source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n //\n // transfer\n //\n // {\n // \"data\": 12345,\n // \"status\": \"ok\"\n // }\n //\n const id = this.safeString (transfer, 'data');\n const code = this.safeCurrencyCode (undefined, currency);\n return {\n 'info': transfer,\n 'id': id,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'currency': code,\n 'amount': undefined,\n 'fromAccount': undefined,\n 'toAccount': undefined,\n 'status': undefined,\n };\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 100, period: 1000, requests: 10, rolling_window_size: 60000 }, raw_endpoints: %{ private: [ %{ auth: false, cost: 0.2, method: :get, path: "/account/accounts" }, %{ auth: false, cost: 0.2, method: :get, path: "/account/accounts/{id}/balance" }, %{ auth: false, cost: 1, method: :get, path: "/account/accounts/{sub-uid}" }, %{ auth: false, cost: 4, method: :get, path: "/account/history" }, %{ auth: false, cost: 1, method: :get, path: "/cross-margin/accounts/balance" }, %{ auth: false, cost: 1, method: :get, path: "/cross-margin/loan-info" }, %{ auth: false, cost: 1, method: :get, path: "/cross-margin/loan-orders" }, %{ auth: false, cost: 1, method: :get, path: "/fee/fee-rate/get" }, %{ auth: false, cost: 0.2, method: :get, path: "/margin/accounts/balance" }, %{ auth: false, cost: 1, method: :get, path: "/margin/loan-info" }, %{ auth: false, cost: 0.2, method: :get, path: "/margin/loan-orders" }, %{ auth: false, cost: 1, method: :get, path: "/order/history" }, %{ auth: false, cost: 1, method: :get, path: "/order/matchresults" }, %{ auth: false, cost: 0.4, method: :get, path: "/order/openOrders" }, %{ auth: false, cost: 0.4, method: :get, path: "/order/orders" }, %{ auth: false, cost: 0.4, method: :get, path: "/order/orders/getClientOrder" }, %{ auth: false, cost: 0.4, method: :get, path: "/order/orders/{id}" }, %{ auth: false, cost: 0.4, method: :get, path: "/order/orders/{id}/matchresults" }, %{ auth: false, cost: 1, method: :get, path: "/points/actions" }, %{ auth: false, cost: 1, method: :get, path: "/points/orders" }, %{ auth: false, cost: 1, method: :get, path: "/query/deposit-withdraw" }, %{ auth: false, cost: 1, method: :get, path: "/stable-coin/exchange_rate" }, %{ auth: false, cost: 1, method: :get, path: "/stable-coin/quote" }, %{ auth: false, cost: 10, method: :get, path: "/subuser/aggregate-balance" }, %{ auth: false, cost: 1, method: :post, path: "/account/transfer" }, %{ auth: false, cost: 1, method: :post, path: "/cross-margin/orders" }, %{ auth: false, cost: 1, method: :post, path: "/cross-margin/orders/{id}/repay" }, %{ auth: false, cost: 1, method: :post, path: "/cross-margin/transfer-in" }, %{ auth: false, cost: 1, method: :post, path: "/cross-margin/transfer-out" }, %{ auth: false, cost: 10, method: :post, path: "/dw/transfer-in/margin" }, %{ auth: false, cost: 10, method: :post, path: "/dw/transfer-out/margin" }, %{ auth: false, cost: 1, method: :post, path: "/dw/withdraw-virtual/{id}/cancel" }, %{ auth: false, cost: 1, method: :post, path: "/dw/withdraw/api/create" }, %{ auth: false, cost: 1, method: :post, path: "/futures/transfer" }, %{ auth: false, cost: 10, method: :post, path: "/margin/orders" }, %{ auth: false, cost: 10, method: :post, path: "/margin/orders/{id}/repay" }, %{ auth: false, cost: 0.4, method: :post, path: "/order/batch-orders" }, %{ auth: false, cost: 0.4, method: :post, path: "/order/orders/batchCancelOpenOrders" }, %{ auth: false, cost: 0.4, method: :post, path: "/order/orders/batchcancel" }, %{ auth: false, cost: 0.2, method: :post, path: "/order/orders/place" }, %{ auth: false, cost: 0.2, method: :post, path: "/order/orders/submitCancelClientOrder" }, %{ auth: false, cost: 0.2, method: :post, path: "/order/orders/{id}/submitcancel" }, %{ auth: false, cost: 1, method: :post, path: "/stable-coin/exchange" }, %{ auth: false, cost: 10, method: :post, path: "/subuser/transfer" } ], public: [ %{ auth: false, cost: 1, method: :get, path: "/common/currencys" }, %{ auth: false, cost: 1, method: :get, path: "/common/exchange" }, %{ auth: false, cost: 1, method: :get, path: "/common/symbols" }, %{ auth: false, cost: 1, method: :get, path: "/common/timestamp" }, %{ auth: false, cost: 1, method: :get, path: "/settings/currencys" } ] }, required_credentials: %{ api_key: true, password: false, secret: true, uid: false }, requires_eddsa: false, response_error: %{ code_field: "err-code", field: "status", message_field: "err-msg", success_values: [ "ok" ], type: :success_code }, signing: %{ confidence: :high, pattern: :hmac_sha256_query, signature_encoding: :base64 }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ future: %{ base: "BTC", base_id: "btc", case: :upper, contract: true, contract_size: 0.001, expiry: 1772179200000, expiry_datetime: "2026-02-27T08:00:00.000Z", id: "BTC-USDT-260227", inverse: false, limits: %{ "amount" => %{ "min" => 0.001 }, "cost" => %{}, "leverage" => %{ "max" => 1, "min" => 1, "superMax" => 1 }, "price" => %{} }, linear: true, maker: 0.0002, precision: %{ "amount" => 1, "price" => 0.1 }, quote: "USDT", quote_id: "usdt", separator: "-", settle: "USDT", settle_id: "usdt", symbol: "BTC/USDT:USDT-260227", taker: 0.0005 }, precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 29411764, "min" => 0.1 }, "cost" => %{ "min" => 10 }, "price" => %{} }, sample_precision: %{ "amount" => 0.0001, "price" => 1.0e-5 }, spot: %{ base: "USTC", base_id: "ustc", case: :lower, contract: false, id: "ustcusdt", limits: %{ "amount" => %{ "max" => 29411764, "min" => 0.1 }, "cost" => %{ "min" => 10 }, "leverage" => %{ "max" => 1, "min" => 1, "superMax" => 1 }, "price" => %{} }, maker: 0.002, precision: %{ "amount" => 0.0001, "cost" => 1.0e-8, "price" => 1.0e-5 }, quote: "USDT", quote_id: "usdt", separator: "", symbol: "USTC/USDT", taker: 0.002 }, swap: %{ base: "BTC", base_id: "btc", case: :upper, contract: true, contract_size: 0.001, id: "BTC-USDT", inverse: false, limits: %{ "amount" => %{ "min" => 0.001 }, "cost" => %{}, "leverage" => %{ "max" => 1, "min" => 1, "superMax" => 1 }, "price" => %{} }, linear: true, maker: 0.0002, precision: %{ "amount" => 1, "price" => 0.1 }, quote: "USDT", quote_id: "usdt", separator: "-", settle: "USDT", settle_id: "usdt", symbol: "BTC/USDT:USDT", taker: 0.0005 } }, symbol_patterns: %{ future: %{ case: :upper, component_order: [ :base, :quote, :date ], date_format: :yymmdd, pattern: :future_yymmdd, separator: "-", suffix: nil }, spot: %{ case: :lower, component_order: nil, date_format: nil, pattern: :no_separator_lower, separator: "", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, separator: "-", suffix: nil } }, timeframes: %{ "15m" => "15min", "1M" => "1mon", "1d" => "1day", "1h" => "60min", "1m" => "1min", "1w" => "1week", "1y" => "1year", "30m" => "30min", "4h" => "4hour", "5m" => "5min" }, url_strategy: %{ detected_from: "sign_method", pattern: :version_slash, prefix: "/v1/" }, urls: %{ api: "https://api.huobi.pro", api_sections: %{ "contract" => "https://api.huobi.pro", "private" => "https://api.huobi.pro", "public" => "https://api.huobi.pro", "spot" => "https://api.huobi.pro", "status" => "https://api.huobi.pro", "v2Private" => "https://api.huobi.pro", "v2Public" => "https://api.huobi.pro" }, doc: [ "https://huobiapi.github.io/docs/spot/v1/en/", "https://huobiapi.github.io/docs/dm/v1/en/", "https://huobiapi.github.io/docs/coin_margined_swap/v1/en/", "https://huobiapi.github.io/docs/usdt_swap/v1/en/", "https://www.huobi.com/en-us/opend/newApiPages/" ], other: %{ "hostnames" => %{ "contract" => "api.hbdm.vn", "spot" => "api.huobi.pro", "status" => %{ "future" => %{ "inverse" => "status-dm.huobigroup.com", "linear" => "status-linear-swap.huobigroup.com" }, "spot" => "status.huobigroup.com", "swap" => %{ "inverse" => "status-swap.huobigroup.com", "linear" => "status-linear-swap.huobigroup.com" } } } }, sandbox: nil, www: "https://www.huobi.com" }, version: "v1", ws: %{ auth: %{ algorithm: :sha256, encoding: :base64, market_specific: true, message_format: :action_auth, pattern: :htx_variant, payload_format: "GET\\nhostname\\npath\\nquery_params", requires_passphrase: false, timestamp_unit: :custom }, channel_templates: %{ watch_balance: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "currency" }, %{ "default" => "cross", "name" => "margin" } ], pattern: :sub_based, separator: "." }, watch_my_trades: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :sub_based, separator: "." }, watch_ohlcv: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "interval" }, %{ "default" => nil, "name" => "limit" } ], pattern: :sub_based, separator: "." }, watch_order_book: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :sub_based, separator: "." }, watch_order_book_snapshot: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :sub_based, separator: "." }, watch_orders: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :sub_based, separator: "." }, watch_positions: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :sub_based, separator: "." }, watch_ticker: %{ channel_name: "market.{marketId}.detail", market_id_format: :lowercase, params: [], pattern: :sub_based, separator: "." }, watch_trades: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :sub_based, separator: "." } }, has: %{ watch_balance: true, watch_bids_asks: nil, watch_liquidations: nil, watch_liquidations_for_symbols: nil, watch_my_liquidations: nil, watch_my_liquidations_for_symbols: nil, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: nil, watch_order_book: true, watch_order_book_for_symbols: nil, watch_orders: true, watch_orders_for_symbols: nil, watch_position: nil, watch_positions: nil, watch_status: nil, watch_ticker: true, watch_tickers: false, watch_trades: true, watch_trades_for_symbols: false }, hostname: "api.huobi.pro", message_patterns: [ %{ args_field: "params", format: :action, keys: [ "action", "ch", "params" ], kind_field: "action", kind_value: "req", sources: [ :send, :watch ] }, %{ format: :action, keys: [ "action", "ch" ], kind_field: "action", kind_value: "sub", sources: [ :send, :watch ] }, %{ format: :custom, id_field: "id", keys: [ "id", "sub" ], sources: [ :send, :watch ] } ], options: %{ "watchOrderBook" => %{ "checksum" => true, "depth" => 150, "maxRetries" => 3 }, "watchTicker" => %{ "name" => "market.{marketId}.detail" }, "ws" => %{ "gunzip" => true } }, subscription_config: %{ args_field: "sub", args_format: :string, market_id_format: :lowercase, op_field: "sub", separator: "." }, subscription_pattern: :sub_subscribe, urls: %{ "api" => %{ "future" => %{ "inverse" => %{ "private" => "wss://api.hbdm.com/notification", "public" => "wss://api.hbdm.com/ws" }, "linear" => %{ "private" => "wss://api.hbdm.com/linear-swap-notification", "public" => "wss://api.hbdm.com/linear-swap-ws" } }, "spot" => %{ "feed" => "wss://{hostname}/feed", "private" => "wss://{hostname}/ws/v2", "public" => "wss://{hostname}/ws" }, "swap" => %{ "inverse" => %{ "private" => "wss://api.hbdm.com/swap-notification", "public" => "wss://api.hbdm.com/swap-ws" }, "linear" => %{ "private" => "wss://api.hbdm.com/linear-swap-notification", "public" => "wss://api.hbdm.com/linear-swap-ws" } } }, "api-aws" => %{ "future" => %{ "inverse" => %{ "private" => "wss://api.hbdm.vn/notification", "public" => "wss://api.hbdm.vn/ws" }, "linear" => %{ "private" => "wss://api.hbdm.vn/linear-swap-notification", "public" => "wss://api.hbdm.vn/linear-swap-ws" } }, "spot" => %{ "feed" => "wss://{hostname}/feed", "private" => "wss://api-aws.huobi.pro/ws/v2", "public" => "wss://api-aws.huobi.pro/ws" }, "swap" => %{ "inverse" => %{ "private" => "wss://api.hbdm.vn/swap-notification", "public" => "wss://api.hbdm.vn/swap-ws" }, "linear" => %{ "private" => "wss://api.hbdm.vn/linear-swap-notification", "public" => "wss://api.hbdm.vn/linear-swap-ws" } } } }, watch_methods: [ "watchBalance", "watchMyTrades", "watchOHLCV", "watchOrderBook", "watchOrderBookSnapshot", "watchOrders", "watchPositions", "watchTicker", "watchTrades" ] } }