UNPKG

@proton/ccxt

Version:

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges

891 lines (889 loc) 379 kB
// ---------------------------------------------------------------------------- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code // EDIT THE CORRESPONDENT .ts FILE INSTEAD // --------------------------------------------------------------------------- import Exchange from './abstract/huobi.js'; import { AccountNotEnabled, ArgumentsRequired, AuthenticationError, ExchangeError, PermissionDenied, ExchangeNotAvailable, OnMaintenance, InvalidOrder, OrderNotFound, InsufficientFunds, BadSymbol, BadRequest, RateLimitExceeded, RequestTimeout, NetworkError, NotSupported } from './base/errors.js'; import { Precise } from './base/Precise.js'; import { TICK_SIZE, TRUNCATE } from './base/functions/number.js'; import { sha256 } from './static_dependencies/noble-hashes/sha256.js'; // --------------------------------------------------------------------------- export default class huobi extends Exchange { describe() { return this.deepExtend(super.describe(), { 'id': 'huobi', 'name': 'Huobi', 'countries': ['CN'], 'rateLimit': 100, 'userAgent': this.userAgents['chrome100'], 'certified': true, 'version': 'v1', 'hostname': 'api.huobi.pro', 'pro': true, 'has': { 'CORS': undefined, 'spot': true, 'margin': true, 'swap': true, 'future': true, 'option': undefined, 'addMargin': undefined, 'borrowMargin': true, 'cancelAllOrders': true, 'cancelOrder': true, 'cancelOrders': true, 'createDepositAddress': undefined, 'createOrder': true, 'createReduceOnlyOrder': false, 'createStopLimitOrder': true, 'createStopMarketOrder': true, 'createStopOrder': true, 'fetchAccounts': true, 'fetchBalance': true, 'fetchBidsAsks': undefined, 'fetchBorrowInterest': true, 'fetchBorrowRate': undefined, 'fetchBorrowRateHistories': undefined, 'fetchBorrowRateHistory': undefined, 'fetchBorrowRates': true, 'fetchBorrowRatesPerSymbol': true, 'fetchCanceledOrders': undefined, 'fetchClosedOrder': undefined, 'fetchClosedOrders': true, 'fetchCurrencies': true, 'fetchDeposit': undefined, 'fetchDepositAddress': true, 'fetchDepositAddresses': undefined, 'fetchDepositAddressesByNetwork': true, 'fetchDeposits': true, 'fetchDepositWithdrawFee': 'emulated', 'fetchDepositWithdrawFees': true, 'fetchFundingHistory': true, 'fetchFundingRate': true, 'fetchFundingRateHistory': true, 'fetchFundingRates': true, 'fetchIndexOHLCV': true, 'fetchL3OrderBook': undefined, 'fetchLedger': true, 'fetchLedgerEntry': undefined, 'fetchLeverage': false, 'fetchLeverageTiers': true, 'fetchMarketLeverageTiers': true, 'fetchMarkets': true, 'fetchMarkOHLCV': true, 'fetchMyTrades': true, 'fetchOHLCV': true, 'fetchOpenInterest': true, 'fetchOpenInterestHistory': true, 'fetchOpenOrder': undefined, 'fetchOpenOrders': true, 'fetchOrder': true, 'fetchOrderBook': true, 'fetchOrderBooks': undefined, 'fetchOrders': true, 'fetchOrderTrades': true, 'fetchPosition': true, 'fetchPositions': true, 'fetchPositionsRisk': false, 'fetchPremiumIndexOHLCV': true, 'fetchSettlementHistory': true, 'fetchStatus': true, 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFee': true, 'fetchTradingFees': false, 'fetchTradingLimits': true, 'fetchTransactionFee': undefined, 'fetchTransactionFees': undefined, 'fetchTransactions': undefined, 'fetchTransfers': undefined, 'fetchWithdrawAddresses': true, 'fetchWithdrawal': undefined, 'fetchWithdrawals': true, 'fetchWithdrawalWhitelist': undefined, 'reduceMargin': undefined, 'repayMargin': true, 'setLeverage': true, 'setMarginMode': false, 'setPositionMode': false, 'signIn': undefined, 'transfer': true, 'withdraw': true, }, 'timeframes': { '1m': '1min', '5m': '5min', '15m': '15min', '30m': '30min', '1h': '60min', '4h': '4hour', '1d': '1day', '1w': '1week', '1M': '1mon', '1y': '1year', }, 'urls': { // 'test': { // 'market': 'https://api.testnet.huobi.pro', // 'public': 'https://api.testnet.huobi.pro', // 'private': 'https://api.testnet.huobi.pro', // }, 'logo': 'https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg', 'hostnames': { 'contract': 'api.hbdm.com', 'spot': 'api.huobi.pro', 'status': { 'spot': 'status.huobigroup.com', 'future': { 'inverse': 'status-dm.huobigroup.com', 'linear': 'status-linear-swap.huobigroup.com', // USDT-Margined Contracts }, 'swap': { 'inverse': 'status-swap.huobigroup.com', 'linear': 'status-linear-swap.huobigroup.com', // USDT-Margined Contracts }, }, // recommended for AWS // 'contract': 'api.hbdm.vn', // 'spot': 'api-aws.huobi.pro', }, 'api': { 'status': 'https://{hostname}', 'contract': 'https://{hostname}', 'spot': 'https://{hostname}', 'public': 'https://{hostname}', 'private': 'https://{hostname}', 'v2Public': 'https://{hostname}', 'v2Private': 'https://{hostname}', }, 'www': 'https://www.huobi.com', 'referral': { 'url': 'https://www.huobi.com/en-us/v/register/double-invite/?inviter_id=11343840&invite_code=6rmm2223', 'discount': 0.15, }, '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/', ], 'fees': 'https://www.huobi.com/about/fee/', }, 'api': { // ------------------------------------------------------------ // old api definitions 'v2Public': { 'get': { 'reference/currencies': 1, 'market-status': 1, // 获取当前市场状态 }, }, 'v2Private': { 'get': { 'account/ledger': 1, 'account/withdraw/quota': 1, 'account/withdraw/address': 1, 'account/deposit/address': 1, 'account/repayment': 5, 'reference/transact-fee-rate': 1, 'account/asset-valuation': 0.2, 'point/account': 5, 'sub-user/user-list': 1, 'sub-user/user-state': 1, 'sub-user/account-list': 1, 'sub-user/deposit-address': 1, 'sub-user/query-deposit': 1, 'user/api-key': 1, 'user/uid': 1, 'algo-orders/opening': 1, 'algo-orders/history': 1, 'algo-orders/specific': 1, 'c2c/offers': 1, 'c2c/offer': 1, 'c2c/transactions': 1, 'c2c/repayment': 1, 'c2c/account': 1, 'etp/reference': 1, 'etp/transactions': 5, 'etp/transaction': 5, 'etp/rebalance': 1, 'etp/limit': 1, // 获取ETP持仓限额 }, 'post': { 'account/transfer': 1, 'account/repayment': 5, 'point/transfer': 5, 'sub-user/management': 1, 'sub-user/creation': 1, 'sub-user/tradable-market': 1, 'sub-user/transferability': 1, 'sub-user/api-key-generation': 1, 'sub-user/api-key-modification': 1, 'sub-user/api-key-deletion': 1, 'sub-user/deduct-mode': 1, 'algo-orders': 1, 'algo-orders/cancel-all-after': 1, 'algo-orders/cancellation': 1, 'c2c/offer': 1, 'c2c/cancellation': 1, 'c2c/cancel-all': 1, 'c2c/repayment': 1, 'c2c/transfer': 1, 'etp/creation': 5, 'etp/redemption': 5, 'etp/{transactId}/cancel': 10, 'etp/batch-cancel': 50, // 杠杆ETP批量撤单 }, }, 'public': { 'get': { 'common/symbols': 1, 'common/currencys': 1, 'common/timestamp': 1, 'common/exchange': 1, 'settings/currencys': 1, // ?language=en-US }, }, 'private': { 'get': { 'account/accounts': 0.2, 'account/accounts/{id}/balance': 0.2, 'account/accounts/{sub-uid}': 1, 'account/history': 4, 'cross-margin/loan-info': 1, 'margin/loan-info': 1, 'fee/fee-rate/get': 1, 'order/openOrders': 0.4, 'order/orders': 0.4, 'order/orders/{id}': 0.4, 'order/orders/{id}/matchresults': 0.4, 'order/orders/getClientOrder': 0.4, 'order/history': 1, 'order/matchresults': 1, // 'dw/withdraw-virtual/addresses', // 查询虚拟币提现地址(Deprecated) 'query/deposit-withdraw': 1, // 'margin/loan-info', // duplicate 'margin/loan-orders': 0.2, 'margin/accounts/balance': 0.2, 'cross-margin/loan-orders': 1, 'cross-margin/accounts/balance': 1, 'points/actions': 1, 'points/orders': 1, 'subuser/aggregate-balance': 10, 'stable-coin/exchange_rate': 1, 'stable-coin/quote': 1, }, 'post': { 'account/transfer': 1, 'futures/transfer': 1, 'order/batch-orders': 0.4, 'order/orders/place': 0.2, 'order/orders/submitCancelClientOrder': 0.2, 'order/orders/batchCancelOpenOrders': 0.4, // 'order/orders', // 创建一个新的订单请求 (仅创建订单,不执行下单) // 'order/orders/{id}/place', // 执行一个订单 (仅执行已创建的订单) 'order/orders/{id}/submitcancel': 0.2, 'order/orders/batchcancel': 0.4, // 'dw/balance/transfer', // 资产划转 'dw/withdraw/api/create': 1, // 'dw/withdraw-virtual/create', // 申请提现虚拟币 // 'dw/withdraw-virtual/{id}/place', // 确认申请虚拟币提现(Deprecated) 'dw/withdraw-virtual/{id}/cancel': 1, 'dw/transfer-in/margin': 10, 'dw/transfer-out/margin': 10, 'margin/orders': 10, 'margin/orders/{id}/repay': 10, 'cross-margin/transfer-in': 1, 'cross-margin/transfer-out': 1, 'cross-margin/orders': 1, 'cross-margin/orders/{id}/repay': 1, 'stable-coin/exchange': 1, 'subuser/transfer': 10, }, }, // ------------------------------------------------------------ // new api definitions // 'https://status.huobigroup.com/api/v2/summary.json': 1, // 'https://status-dm.huobigroup.com/api/v2/summary.json': 1, // 'https://status-swap.huobigroup.com/api/v2/summary.json': 1, // 'https://status-linear-swap.huobigroup.com/api/v2/summary.json': 1, 'status': { 'public': { 'spot': { 'get': { 'api/v2/summary.json': 1, }, }, 'future': { 'inverse': { 'get': { 'api/v2/summary.json': 1, }, }, 'linear': { 'get': { 'api/v2/summary.json': 1, }, }, }, 'swap': { 'inverse': { 'get': { 'api/v2/summary.json': 1, }, }, 'linear': { 'get': { 'api/v2/summary.json': 1, }, }, }, }, }, 'spot': { 'public': { 'get': { 'v2/market-status': 1, 'v1/common/symbols': 1, 'v1/common/currencys': 1, 'v2/settings/common/currencies': 1, 'v2/reference/currencies': 1, 'v1/common/timestamp': 1, 'v1/common/exchange': 1, 'v1/settings/common/chains': 1, 'v1/settings/common/currencys': 1, 'v1/settings/common/symbols': 1, 'v2/settings/common/symbols': 1, 'v1/settings/common/market-symbols': 1, // Market Data 'market/history/candles': 1, 'market/history/kline': 1, 'market/detail/merged': 1, 'market/tickers': 1, 'market/detail': 1, 'market/depth': 1, 'market/trade': 1, 'market/history/trade': 1, 'market/etp': 1, // ETP 'v2/etp/reference': 1, 'v2/etp/rebalance': 1, }, }, 'private': { 'get': { // Account 'v1/account/accounts': 0.2, 'v1/account/accounts/{account-id}/balance': 0.2, 'v2/account/valuation': 1, 'v2/account/asset-valuation': 0.2, 'v1/account/history': 4, 'v2/account/ledger': 1, 'v2/point/account': 5, // Wallet (Deposit and Withdraw) 'v2/account/deposit/address': 1, 'v2/account/withdraw/quota': 1, 'v2/account/withdraw/address': 1, 'v2/reference/currencies': 1, 'v1/query/deposit-withdraw': 1, 'v1/query/withdraw/client-order-id': 1, // Sub user management 'v2/user/api-key': 1, 'v2/user/uid': 1, 'v2/sub-user/user-list': 1, 'v2/sub-user/user-state': 1, 'v2/sub-user/account-list': 1, 'v2/sub-user/deposit-address': 1, 'v2/sub-user/query-deposit': 1, 'v1/subuser/aggregate-balance': 10, 'v1/account/accounts/{sub-uid}': 1, // Trading 'v1/order/openOrders': 0.4, 'v1/order/orders/{order-id}': 0.4, 'v1/order/orders/getClientOrder': 0.4, 'v1/order/orders/{order-id}/matchresult': 0.4, 'v1/order/orders/{order-id}/matchresults': 0.4, 'v1/order/orders': 0.4, 'v1/order/history': 1, 'v1/order/matchresults': 1, 'v2/reference/transact-fee-rate': 1, // Conditional Order 'v2/algo-orders/opening': 1, 'v2/algo-orders/history': 1, 'v2/algo-orders/specific': 1, // Margin Loan (Cross/Isolated) 'v1/margin/loan-info': 1, 'v1/margin/loan-orders': 0.2, 'v1/margin/accounts/balance': 0.2, 'v1/cross-margin/loan-info': 1, 'v1/cross-margin/loan-orders': 1, 'v1/cross-margin/accounts/balance': 1, 'v2/account/repayment': 5, // Stable Coin Exchange 'v1/stable-coin/quote': 1, 'v1/stable_coin/exchange_rate': 1, // ETP 'v2/etp/transactions': 5, 'v2/etp/transaction': 5, 'v2/etp/limit': 1, }, 'post': { // Account 'v1/account/transfer': 1, 'v1/futures/transfer': 1, 'v2/point/transfer': 5, 'v2/account/transfer': 1, // Wallet (Deposit and Withdraw) 'v1/dw/withdraw/api/create': 1, 'v1/dw/withdraw-virtual/{withdraw-id}/cancel': 1, // Sub user management 'v2/sub-user/deduct-mode': 1, 'v2/sub-user/creation': 1, 'v2/sub-user/management': 1, 'v2/sub-user/tradable-market': 1, 'v2/sub-user/transferability': 1, 'v2/sub-user/api-key-generation': 1, 'v2/sub-user/api-key-modification': 1, 'v2/sub-user/api-key-deletion': 1, 'v1/subuser/transfer': 10, // Trading 'v1/order/orders/place': 0.2, 'v1/order/batch-orders': 0.4, 'v1/order/orders/{order-id}/submitcancel': 0.2, 'v1/order/orders/submitCancelClientOrder': 0.2, 'v1/order/orders/batchCancelOpenOrders': 0.4, 'v1/order/orders/batchcancel': 0.4, 'v2/algo-orders/cancel-all-after': 1, // Conditional Order 'v2/algo-orders': 1, 'v2/algo-orders/cancellation': 1, // Margin Loan (Cross/Isolated) 'v2/account/repayment': 5, 'v1/dw/transfer-in/margin': 10, 'v1/dw/transfer-out/margin': 10, 'v1/margin/orders': 10, 'v1/margin/orders/{order-id}/repay': 10, 'v1/cross-margin/transfer-in': 1, 'v1/cross-margin/transfer-out': 1, 'v1/cross-margin/orders': 1, 'v1/cross-margin/orders/{order-id}/repay': 1, // Stable Coin Exchange 'v1/stable-coin/exchange': 1, // ETP 'v2/etp/creation': 5, 'v2/etp/redemption': 5, 'v2/etp/{transactId}/cancel': 10, 'v2/etp/batch-cancel': 50, }, }, }, 'contract': { 'public': { 'get': { 'api/v1/timestamp': 1, 'heartbeat/': 1, // Future Market Data interface 'api/v1/contract_contract_info': 1, 'api/v1/contract_index': 1, 'api/v1/contract_price_limit': 1, 'api/v1/contract_open_interest': 1, 'api/v1/contract_delivery_price': 1, 'market/depth': 1, 'market/bbo': 1, 'market/history/kline': 1, 'index/market/history/mark_price_kline': 1, 'market/detail/merged': 1, 'market/detail/batch_merged': 1, 'v2/market/detail/batch_merged': 1, 'market/trade': 1, 'market/history/trade': 1, 'api/v1/contract_risk_info': 1, 'api/v1/contract_insurance_fund': 1, 'api/v1/contract_adjustfactor': 1, 'api/v1/contract_his_open_interest': 1, 'api/v1/contract_ladder_margin': 1, 'api/v1/contract_api_state': 1, 'api/v1/contract_elite_account_ratio': 1, 'api/v1/contract_elite_position_ratio': 1, 'api/v1/contract_liquidation_orders': 1, 'api/v1/contract_settlement_records': 1, 'index/market/history/index': 1, 'index/market/history/basis': 1, 'api/v1/contract_estimated_settlement_price': 1, 'api/v3/contract_liquidation_orders': 1, // Swap Market Data interface 'swap-api/v1/swap_contract_info': 1, 'swap-api/v1/swap_index': 1, 'swap-api/v1/swap_price_limit': 1, 'swap-api/v1/swap_open_interest': 1, 'swap-ex/market/depth': 1, 'swap-ex/market/bbo': 1, 'swap-ex/market/history/kline': 1, 'index/market/history/swap_mark_price_kline': 1, 'swap-ex/market/detail/merged': 1, 'v2/swap-ex/market/detail/batch_merged': 1, 'index/market/history/swap_premium_index_kline': 1, 'swap-ex/market/detail/batch_merged': 1, 'swap-ex/market/trade': 1, 'swap-ex/market/history/trade': 1, 'swap-api/v1/swap_risk_info': 1, 'swap-api/v1/swap_insurance_fund': 1, 'swap-api/v1/swap_adjustfactor': 1, 'swap-api/v1/swap_his_open_interest': 1, 'swap-api/v1/swap_ladder_margin': 1, 'swap-api/v1/swap_api_state': 1, 'swap-api/v1/swap_elite_account_ratio': 1, 'swap-api/v1/swap_elite_position_ratio': 1, 'swap-api/v1/swap_estimated_settlement_price': 1, 'swap-api/v1/swap_liquidation_orders': 1, 'swap-api/v1/swap_settlement_records': 1, 'swap-api/v1/swap_funding_rate': 1, 'swap-api/v1/swap_batch_funding_rate': 1, 'swap-api/v1/swap_historical_funding_rate': 1, 'swap-api/v3/swap_liquidation_orders': 1, 'index/market/history/swap_estimated_rate_kline': 1, 'index/market/history/swap_basis': 1, // Swap Market Data interface 'linear-swap-api/v1/swap_contract_info': 1, 'linear-swap-api/v1/swap_index': 1, 'linear-swap-api/v1/swap_price_limit': 1, 'linear-swap-api/v1/swap_open_interest': 1, 'linear-swap-ex/market/depth': 1, 'linear-swap-ex/market/bbo': 1, 'linear-swap-ex/market/history/kline': 1, 'index/market/history/linear_swap_mark_price_kline': 1, 'linear-swap-ex/market/detail/merged': 1, 'linear-swap-ex/market/detail/batch_merged': 1, 'v2/linear-swap-ex/market/detail/batch_merged': 1, 'linear-swap-ex/market/trade': 1, 'linear-swap-ex/market/history/trade': 1, 'linear-swap-api/v1/swap_risk_info': 1, 'swap-api/v1/linear-swap-api/v1/swap_insurance_fund': 1, 'linear-swap-api/v1/swap_adjustfactor': 1, 'linear-swap-api/v1/swap_cross_adjustfactor': 1, 'linear-swap-api/v1/swap_his_open_interest': 1, 'linear-swap-api/v1/swap_ladder_margin': 1, 'linear-swap-api/v1/swap_cross_ladder_margin': 1, 'linear-swap-api/v1/swap_api_state': 1, 'linear-swap-api/v1/swap_cross_transfer_state': 1, 'linear-swap-api/v1/swap_cross_trade_state': 1, 'linear-swap-api/v1/swap_elite_account_ratio': 1, 'linear-swap-api/v1/swap_elite_position_ratio': 1, 'linear-swap-api/v1/swap_liquidation_orders': 1, 'linear-swap-api/v1/swap_settlement_records': 1, 'linear-swap-api/v1/swap_funding_rate': 1, 'linear-swap-api/v1/swap_batch_funding_rate': 1, 'linear-swap-api/v1/swap_historical_funding_rate': 1, 'linear-swap-api/v3/swap_liquidation_orders': 1, 'index/market/history/linear_swap_premium_index_kline': 1, 'index/market/history/linear_swap_estimated_rate_kline': 1, 'index/market/history/linear_swap_basis': 1, 'linear-swap-api/v1/swap_estimated_settlement_price': 1, }, }, 'private': { 'get': { // Future Account Interface 'api/v1/contract_api_trading_status': 1, // Swap Account Interface 'swap-api/v1/swap_api_trading_status': 1, // Swap Account Interface 'linear-swap-api/v1/swap_api_trading_status': 1, 'linear-swap-api/v3/unified_account_info': 1, 'linear-swap-api/v3/swap_unified_account_type': 1, }, 'post': { // Future Account Interface 'api/v1/contract_balance_valuation': 1, 'api/v1/contract_account_info': 1, 'api/v1/contract_position_info': 1, 'api/v1/contract_sub_auth': 1, 'api/v1/contract_sub_account_list': 1, 'api/v1/contract_sub_account_info_list': 1, 'api/v1/contract_sub_account_info': 1, 'api/v1/contract_sub_position_info': 1, 'api/v1/contract_financial_record': 1, 'api/v1/contract_financial_record_exact': 1, 'api/v1/contract_user_settlement_records': 1, 'api/v1/contract_order_limit': 1, 'api/v1/contract_fee': 1, 'api/v1/contract_transfer_limit': 1, 'api/v1/contract_position_limit': 1, 'api/v1/contract_account_position_info': 1, 'api/v1/contract_master_sub_transfer': 1, 'api/v1/contract_master_sub_transfer_record': 1, 'api/v1/contract_available_level_rate': 1, 'api/v3/contract_financial_record': 1, 'api/v3/contract_financial_record_exact': 1, // Future Trade Interface 'api/v1/contract_order': 1, 'v1/contract_batchorder': 1, 'api/v1/contract_cancel': 1, 'api/v1/contract_cancelall': 1, 'api/v1/contract_switch_lever_rate': 1, 'api/v1/lightning_close_position': 1, 'api/v1/contract_order_info': 1, 'api/v1/contract_order_detail': 1, 'api/v1/contract_openorders': 1, 'api/v1/contract_hisorders': 1, 'api/v1/contract_hisorders_exact': 1, 'api/v1/contract_matchresults': 1, 'api/v1/contract_matchresults_exact': 1, 'api/v3/contract_hisorders': 1, 'api/v3/contract_hisorders_exact': 1, 'api/v3/contract_matchresults': 1, 'api/v3/contract_matchresults_exact': 1, // Contract Strategy Order Interface 'api/v1/contract_trigger_order': 1, 'api/v1/contract_trigger_cancel': 1, 'api/v1/contract_trigger_cancelall': 1, 'api/v1/contract_trigger_openorders': 1, 'api/v1/contract_trigger_hisorders': 1, 'api/v1/contract_tpsl_order': 1, 'api/v1/contract_tpsl_cancel': 1, 'api/v1/contract_tpsl_cancelall': 1, 'api/v1/contract_tpsl_openorders': 1, 'api/v1/contract_tpsl_hisorders': 1, 'api/v1/contract_relation_tpsl_order': 1, 'api/v1/contract_track_order': 1, 'api/v1/contract_track_cancel': 1, 'api/v1/contract_track_cancelall': 1, 'api/v1/contract_track_openorders': 1, 'api/v1/contract_track_hisorders': 1, // Swap Account Interface 'swap-api/v1/swap_balance_valuation': 1, 'swap-api/v1/swap_account_info': 1, 'swap-api/v1/swap_position_info': 1, 'swap-api/v1/swap_account_position_info': 1, 'swap-api/v1/swap_sub_auth': 1, 'swap-api/v1/swap_sub_account_list': 1, 'swap-api/v1/swap_sub_account_info_list': 1, 'swap-api/v1/swap_sub_account_info': 1, 'swap-api/v1/swap_sub_position_info': 1, 'swap-api/v1/swap_financial_record': 1, 'swap-api/v1/swap_financial_record_exact': 1, 'swap-api/v1/swap_user_settlement_records': 1, 'swap-api/v1/swap_available_level_rate': 1, 'swap-api/v1/swap_order_limit': 1, 'swap-api/v1/swap_fee': 1, 'swap-api/v1/swap_transfer_limit': 1, 'swap-api/v1/swap_position_limit': 1, 'swap-api/v1/swap_master_sub_transfer': 1, 'swap-api/v1/swap_master_sub_transfer_record': 1, 'swap-api/v3/swap_financial_record': 1, 'swap-api/v3/swap_financial_record_exact': 1, // Swap Trade Interface 'swap-api/v1/swap_order': 1, 'swap-api/v1/swap_batchorder': 1, 'swap-api/v1/swap_cancel': 1, 'swap-api/v1/swap_cancelall': 1, 'swap-api/v1/swap_lightning_close_position': 1, 'swap-api/v1/swap_switch_lever_rate': 1, 'swap-api/v1/swap_order_info': 1, 'swap-api/v1/swap_order_detail': 1, 'swap-api/v1/swap_openorders': 1, 'swap-api/v1/swap_hisorders': 1, 'swap-api/v1/swap_hisorders_exact': 1, 'swap-api/v1/swap_matchresults': 1, 'swap-api/v1/swap_matchresults_exact': 1, 'swap-api/v3/swap_matchresults': 1, 'swap-api/v3/swap_matchresults_exact': 1, 'swap-api/v3/swap_hisorders': 1, 'swap-api/v3/swap_hisorders_exact': 1, // Swap Strategy Order Interface 'swap-api/v1/swap_trigger_order': 1, 'swap-api/v1/swap_trigger_cancel': 1, 'swap-api/v1/swap_trigger_cancelall': 1, 'swap-api/v1/swap_trigger_openorders': 1, 'swap-api/v1/swap_trigger_hisorders': 1, 'swap-api/v1/swap_tpsl_order': 1, 'swap-api/v1/swap_tpsl_cancel': 1, 'swap-api/v1/swap_tpsl_cancelall': 1, 'swap-api/v1/swap_tpsl_openorders': 1, 'swap-api/v1/swap_tpsl_hisorders': 1, 'swap-api/v1/swap_relation_tpsl_order': 1, 'swap-api/v1/swap_track_order': 1, 'swap-api/v1/swap_track_cancel': 1, 'swap-api/v1/swap_track_cancelall': 1, 'swap-api/v1/swap_track_openorders': 1, 'swap-api/v1/swap_track_hisorders': 1, // Swap Account Interface 'linear-swap-api/v1/swap_lever_position_limit': 1, 'linear-swap-api/v1/swap_cross_lever_position_limit': 1, 'linear-swap-api/v1/swap_balance_valuation': 1, 'linear-swap-api/v1/swap_account_info': 1, 'linear-swap-api/v1/swap_cross_account_info': 1, 'linear-swap-api/v1/swap_position_info': 1, 'linear-swap-api/v1/swap_cross_position_info': 1, 'linear-swap-api/v1/swap_account_position_info': 1, 'linear-swap-api/v1/swap_cross_account_position_info': 1, 'linear-swap-api/v1/swap_sub_auth': 1, 'linear-swap-api/v1/swap_sub_account_list': 1, 'linear-swap-api/v1/swap_cross_sub_account_list': 1, 'linear-swap-api/v1/swap_sub_account_info_list': 1, 'linear-swap-api/v1/swap_cross_sub_account_info_list': 1, 'linear-swap-api/v1/swap_sub_account_info': 1, 'linear-swap-api/v1/swap_cross_sub_account_info': 1, 'linear-swap-api/v1/swap_sub_position_info': 1, 'linear-swap-api/v1/swap_cross_sub_position_info': 1, 'linear-swap-api/v1/swap_financial_record': 1, 'linear-swap-api/v1/swap_financial_record_exact': 1, 'linear-swap-api/v1/swap_user_settlement_records': 1, 'linear-swap-api/v1/swap_cross_user_settlement_records': 1, 'linear-swap-api/v1/swap_available_level_rate': 1, 'linear-swap-api/v1/swap_cross_available_level_rate': 1, 'linear-swap-api/v1/swap_order_limit': 1, 'linear-swap-api/v1/swap_fee': 1, 'linear-swap-api/v1/swap_transfer_limit': 1, 'linear-swap-api/v1/swap_cross_transfer_limit': 1, 'linear-swap-api/v1/swap_position_limit': 1, 'linear-swap-api/v1/swap_cross_position_limit': 1, 'linear-swap-api/v1/swap_master_sub_transfer': 1, 'linear-swap-api/v1/swap_master_sub_transfer_record': 1, 'linear-swap-api/v1/swap_transfer_inner': 1, 'linear-swap-api/v3/swap_financial_record': 1, 'linear-swap-api/v3/swap_financial_record_exact': 1, // Swap Trade Interface 'linear-swap-api/v1/swap_order': 1, 'linear-swap-api/v1/swap_cross_order': 1, 'linear-swap-api/v1/swap_batchorder': 1, 'linear-swap-api/v1/swap_cross_batchorder': 1, 'linear-swap-api/v1/swap_cancel': 1, 'linear-swap-api/v1/swap_cross_cancel': 1, 'linear-swap-api/v1/swap_cancelall': 1, 'linear-swap-api/v1/swap_cross_cancelall': 1, 'linear-swap-api/v1/swap_switch_lever_rate': 1, 'linear-swap-api/v1/swap_cross_switch_lever_rate': 1, 'linear-swap-api/v1/swap_lightning_close_position': 1, 'linear-swap-api/v1/swap_cross_lightning_close_position': 1, 'linear-swap-api/v1/swap_order_info': 1, 'linear-swap-api/v1/swap_cross_order_info': 1, 'linear-swap-api/v1/swap_order_detail': 1, 'linear-swap-api/v1/swap_cross_order_detail': 1, 'linear-swap-api/v1/swap_openorders': 1, 'linear-swap-api/v1/swap_cross_openorders': 1, 'linear-swap-api/v1/swap_hisorders': 1, 'linear-swap-api/v1/swap_cross_hisorders': 1, 'linear-swap-api/v1/swap_hisorders_exact': 1, 'linear-swap-api/v1/swap_cross_hisorders_exact': 1, 'linear-swap-api/v1/swap_matchresults': 1, 'linear-swap-api/v1/swap_cross_matchresults': 1, 'linear-swap-api/v1/swap_matchresults_exact': 1, 'linear-swap-api/v1/swap_cross_matchresults_exact': 1, 'linear-swap-api/v1/swap_switch_position_mode': 1, 'linear-swap-api/v1/swap_cross_switch_position_mode': 1, 'linear-swap-api/v3/swap_matchresults': 1, 'linear-swap-api/v3/swap_cross_matchresults': 1, 'linear-swap-api/v3/swap_matchresults_exact': 1, 'linear-swap-api/v3/swap_cross_matchresults_exact': 1, 'linear-swap-api/v3/swap_hisorders': 1, 'linear-swap-api/v3/swap_cross_hisorders': 1, 'linear-swap-api/v3/swap_hisorders_exact': 1, 'linear-swap-api/v3/swap_cross_hisorders_exact': 1, 'linear-swap-api/v3/swap_switch_account_type': 1, // Swap Strategy Order Interface 'linear-swap-api/v1/swap_trigger_order': 1, 'linear-swap-api/v1/swap_cross_trigger_order': 1, 'linear-swap-api/v1/swap_trigger_cancel': 1, 'linear-swap-api/v1/swap_cross_trigger_cancel': 1, 'linear-swap-api/v1/swap_trigger_cancelall': 1, 'linear-swap-api/v1/swap_cross_trigger_cancelall': 1, 'linear-swap-api/v1/swap_trigger_openorders': 1, 'linear-swap-api/v1/swap_cross_trigger_openorders': 1, 'linear-swap-api/v1/swap_trigger_hisorders': 1, 'linear-swap-api/v1/swap_cross_trigger_hisorders': 1, 'linear-swap-api/v1/swap_tpsl_order': 1, 'linear-swap-api/v1/swap_cross_tpsl_order': 1, 'linear-swap-api/v1/swap_tpsl_cancel': 1, 'linear-swap-api/v1/swap_cross_tpsl_cancel': 1, 'linear-swap-api/v1/swap_tpsl_cancelall': 1, 'linear-swap-api/v1/swap_cross_tpsl_cancelall': 1, 'linear-swap-api/v1/swap_tpsl_openorders': 1, 'linear-swap-api/v1/swap_cross_tpsl_openorders': 1, 'linear-swap-api/v1/swap_tpsl_hisorders': 1, 'linear-swap-api/v1/swap_cross_tpsl_hisorders': 1, 'linear-swap-api/v1/swap_relation_tpsl_order': 1, 'linear-swap-api/v1/swap_cross_relation_tpsl_order': 1, 'linear-swap-api/v1/swap_track_order': 1, 'linear-swap-api/v1/swap_cross_track_order': 1, 'linear-swap-api/v1/swap_track_cancel': 1, 'linear-swap-api/v1/swap_cross_track_cancel': 1, 'linear-swap-api/v1/swap_track_cancelall': 1, 'linear-swap-api/v1/swap_cross_track_cancelall': 1, 'linear-swap-api/v1/swap_track_openorders': 1, 'linear-swap-api/v1/swap_cross_track_openorders': 1, 'linear-swap-api/v1/swap_track_hisorders': 1, 'linear-swap-api/v1/swap_cross_track_hisorders': 1, }, }, }, }, 'fees': { 'trading': { 'feeSide': 'get', 'tierBased': false, 'percentage': true, 'maker': this.parseNumber('0.002'), 'taker': this.parseNumber('0.002'), }, }, 'exceptions': { 'broad': { 'contract is restricted of closing positions on API. Please contact customer service': OnMaintenance, 'maintain': OnMaintenance, }, 'exact': { // err-code '403': AuthenticationError, '1010': AccountNotEnabled, '1003': AuthenticationError, '1013': BadSymbol, '1017': OrderNotFound, '1034': InvalidOrder, '1036': InvalidOrder, '1039': InvalidOrder, '1041': InvalidOrder, '1047': InsufficientFunds, '1048': InsufficientFunds, '1051': InvalidOrder, '1066': BadSymbol, '1067': InvalidOrder, '1094': InvalidOrder, '1220': AccountNotEnabled, '1303': BadRequest, '1461': InvalidOrder, 'bad-request': BadRequest, 'validation-format-error': BadRequest, 'validation-constraints-required': BadRequest, 'base-date-limit-error': BadRequest, 'api-not-support-temp-addr': PermissionDenied, 'timeout': RequestTimeout, 'gateway-internal-error': ExchangeNotAvailable, 'account-frozen-balance-insufficient-error': InsufficientFunds, 'invalid-amount': InvalidOrder, 'order-limitorder-amount-min-error': InvalidOrder, 'order-limitorder-amount-max-error': InvalidOrder, 'order-marketorder-amount-min-error': InvalidOrder, 'order-limitorder-price-min-error': InvalidOrder, 'order-limitorder-price-max-error': InvalidOrder, 'order-stop-order-hit-trigger': InvalidOrder, 'order-value-min-error': InvalidOrder, 'order-invalid-price': InvalidOrder, 'order-holding-limit-failed': InvalidOrder, 'order-orderprice-precision-error': InvalidOrder, 'order-etp-nav-price-max-error': InvalidOrder, 'order-orderstate-error': OrderNotFound, 'order-queryorder-invalid': OrderNotFound, 'order-update-error': ExchangeNotAvailable, 'api-signature-check-failed': AuthenticationError, 'api-signature-not-valid': AuthenticationError, 'base-record-invalid': OrderNotFound, 'base-symbol-trade-disabled': BadSymbol, 'base-symbol-error': BadSymbol, 'system-maintenance': OnMaintenance, 'base-request-exceed-frequency-limit': RateLimitExceeded, // err-msg 'inv