UNPKG

ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

843 lines (841 loc) 497 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 { sha256 } from '@noble/hashes/sha2.js'; import Exchange from './abstract/htx.js'; import { AccountNotEnabled, ArgumentsRequired, AuthenticationError, ExchangeError, PermissionDenied, ExchangeNotAvailable, OnMaintenance, InvalidOrder, OrderNotFound, InsufficientFunds, BadSymbol, BadRequest, RateLimitExceeded, RequestTimeout, OperationFailed, NotSupported, NullResponse } from './base/errors.js'; import { Precise } from './base/Precise.js'; import { TICK_SIZE, TRUNCATE } from './base/functions/number.js'; // --------------------------------------------------------------------------- /** * @class htx * @augments Exchange */ export default class htx extends Exchange { describe() { return this.deepExtend(super.describe(), { 'id': 'htx', 'name': 'HTX', 'countries': ['CN'], 'rateLimit': 100, 'userAgent': this.userAgents['chrome100'], 'certified': true, 'version': 'v1', 'hostname': 'api.huobi.pro', // api.testnet.huobi.pro 'pro': true, 'has': { 'CORS': undefined, 'spot': true, 'margin': true, 'swap': true, 'future': true, 'option': undefined, 'addMargin': undefined, 'borrowCrossMargin': true, 'borrowIsolatedMargin': true, 'cancelAllOrders': true, 'cancelAllOrdersAfter': true, 'cancelOrder': true, 'cancelOrders': true, 'closeAllPositions': false, 'closePosition': true, 'createDepositAddress': undefined, 'createMarketBuyOrderWithCost': true, 'createMarketOrderWithCost': false, 'createMarketSellOrderWithCost': false, 'createOrder': true, 'createOrders': true, 'createReduceOnlyOrder': false, 'createStopLimitOrder': true, 'createStopLossOrder': true, 'createStopMarketOrder': true, 'createStopOrder': true, 'createTakeProfitOrder': true, 'createTrailingPercentOrder': true, 'createTriggerOrder': true, 'fetchAccounts': true, 'fetchBalance': true, 'fetchBidsAsks': undefined, 'fetchBorrowInterest': true, 'fetchBorrowRateHistories': undefined, 'fetchBorrowRateHistory': undefined, 'fetchCanceledOrders': true, 'fetchClosedOrder': undefined, 'fetchClosedOrders': true, 'fetchCrossBorrowRate': false, 'fetchCrossBorrowRates': false, '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, 'fetchIsolatedBorrowRate': false, 'fetchIsolatedBorrowRates': true, 'fetchL3OrderBook': undefined, 'fetchLastPrices': true, 'fetchLedger': true, 'fetchLedgerEntry': undefined, 'fetchLeverage': false, 'fetchLeverageTiers': true, 'fetchLiquidations': true, 'fetchMarginAdjustmentHistory': false, 'fetchMarketLeverageTiers': 'emulated', 'fetchMarkets': true, 'fetchMarkOHLCV': true, 'fetchMyLiquidations': false, 'fetchMyTrades': true, 'fetchOHLCV': true, 'fetchOpenInterest': true, 'fetchOpenInterestHistory': true, 'fetchOpenInterests': true, 'fetchOpenOrder': undefined, 'fetchOpenOrders': true, 'fetchOrder': true, 'fetchOrderBook': true, 'fetchOrderBooks': undefined, 'fetchOrders': true, 'fetchOrderTrades': true, 'fetchPosition': true, 'fetchPositionADLRank': true, 'fetchPositionHistory': 'emulated', 'fetchPositions': true, 'fetchPositionsADLRank': true, 'fetchPositionsHistory': false, 'fetchPositionsRisk': false, 'fetchPremiumIndexOHLCV': true, 'fetchSettlementHistory': true, 'fetchStatus': false, // none of `summary.json` endpoint work atm. revise in near future 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFee': true, 'fetchTradingFees': false, 'fetchTradingLimits': true, 'fetchTransactionFee': undefined, 'fetchTransactionFees': undefined, 'fetchTransactions': undefined, 'fetchTransfers': true, 'fetchWithdrawAddresses': true, 'fetchWithdrawal': undefined, 'fetchWithdrawals': true, 'fetchWithdrawalWhitelist': undefined, 'reduceMargin': undefined, 'repayCrossMargin': true, 'repayIsolatedMargin': true, 'setLeverage': true, 'setMarginMode': false, 'setPositionMode': true, '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.vn', // alternatively use 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.htx.com/invite/en-us/1h?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/', 'https://www.huobi.com/en-us/opend/newApiPages/', ], '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, // 母子用户API key信息查询 'user/uid': 1, // 母子用户获取用户UID 'algo-orders/opening': 1, // 查询未触发OPEN策略委托 '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申赎记录 'etp/transaction': 5, // 获取特定杠杆ETP申赎记录 'etp/rebalance': 1, // 获取杠杆ETP调仓记录 '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, // 子用户API key创建 'sub-user/api-key-modification': 1, // 修改子用户API key 'sub-user/api-key-deletion': 1, // 删除子用户API key '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换入 'etp/redemption': 5, // 杠杆ETP换出 'etp/{transactId}/cancel': 10, // 杠杆ETP单个撤单 'etp/batch-cancel': 50, // 杠杆ETP批量撤单 }, }, 'public': { 'get': { 'common/symbols': 1, // 查询系统支持的所有交易对 'common/currencys': 1, // 查询系统支持的所有币种 'common/timestamp': 1, // 查询系统当前时间 'common/exchange': 1, // order limits 'settings/currencys': 1, // ?language=en-US }, }, 'private': { 'get': { 'account/accounts': 0.2, // 查询当前用户的所有账户(即account-id) '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, // order limits '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, // Get real-time equity of leveraged ETP // 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, // Universal Transfer 'v5/account/universal_transfer_records': 4, // 5 requests per 2 seconds // 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, // future transfers 'v2/point/transfer': 5, 'v2/account/transfer': 1, // swap transfers // 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, 'v1/trust/user/active/credit': 10, // Trading 'v1/order/orders/place': 0.2, 'v1/order/batch-orders': 0.4, 'v1/order/auto/place': 0.2, '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, // backslash is not a typo // Future Market Data interface 'api/v1/contract_contract_info': 1, 'api/v1/contract_index': 1, 'api/v1/contract_query_elements': 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_query_elements': 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, // Linear Swap Market Data interface 'linear-swap-api/v1/swap_contract_info': 1, 'linear-swap-api/v1/swap_index': 1, 'linear-swap-api/v1/swap_query_elements': 1, 'linear-swap-api/v1/swap_price_limit': 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, '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_elite_account_ratio': 1, 'linear-swap-api/v1/swap_elite_position_ratio': 1, 'linear-swap-api/v1/swap_settlement_records': 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, 'v5/market/funding_rate': 0.125, // 80 requests per second = 1000ms / ( 100 * 0.125) 'v5/market/funding_rate_history': 0.125, 'v5/market/open_interest': 0.125, 'v5/market/liquidation_orders': 0.125, 'v5/market/settlement_history': 0.125, 'v5/market/elite_account_ratio': 0.125, 'v5/market/elite_position_ratio': 0.125, 'v5/market/estimated_settlement_price': 0.125, 'v5/market/price_limit': 0.125, }, }, 'private': { 'get': { // Future Account Interface 'api/v1/contract_sub_auth_list': 1, 'api/v1/contract_api_trading_status': 1, // Swap Account Interface 'swap-api/v1/swap_sub_auth_list': 1, 'swap-api/v1/swap_api_trading_status': 1, // Linear Swap Interface 'v5/account/asset_mode': 0.20834, // 48 requests per second = 1000ms / ( 100 * 0.20834) 'v5/account/balance': 0.20834, 'v5/account/bills': 0.20834, 'v5/account/fee_deduction_currency': 0.20834, 'v5/trade/position/opens': 0.41679, // 24 requests per second = 1000ms / ( 100 * 0.41679) 'v5/trade/order/opens': 0.41679, 'v5/trade/order/details': 0.41679, 'v5/trade/order/history': 0.41679, 'v5/trade/order': 0.41679, 'v5/position/lever': 0.20834, 'v5/position/mode': 0.20834, 'v5/position/risk/limit': 0.20834, 'v5/position/risk/limit_tier': 0.20834, 'v5/market/risk/limit': 0.125, 'v5/market/assets_deduction_currency': 0.125, 'v5/market/multi_assets_margin': 0.125, 'v5/algo/order/opens': 0.41679, 'v5/algo/order': 0.41679, 'v5/algo/order/history': 0.41679, }, '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-cancel-after': 1, 'api/v1/contract_order': 1, 'api/v1/contract_batchorder': 1, 'api/v1/contract_cancel': 1, 'api/v1/contract_cancelall': 1, 'api/v1/contract_switch_lever_rate': 30, '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-cancel-after': 1, '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': 30, '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, // Linear Swap Interface 'v5/account/asset_mode': 100, // 0.1 requests per second = 1000ms / (100 * 100) 'v5/trade/order': 0.41679, 'v5/trade/batch_orders': 0.41679, 'v5/trade/cancel_order': 0.41679, 'v5/trade/cancel_batch_orders': 0.41679, 'v5/trade/cancel_all_orders': 0.41679, 'v5/trade/cancel-after': 0.41679, 'v5/trade/position': 0.41679, 'v5/trade/position_all': 0.41679, 'v5/position/lever': 0.20834, 'v5/position/mode': 0.20834, 'v5/position/margin': 0.20834, 'v5/account/fee_deduction_currency': 0.20834, 'v5/algo/order': 0.41679, 'v5/algo/cancel_orders': 0.41679, }, }, }, }, '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, 'API key has no permission': PermissionDenied, // {"status":"error","err-code":"api-signature-not-valid","err-msg":"Signature not valid: API key has no permission [API Key没有权限]","data":null} }, 'exact': { // err-code '403': AuthenticationError, // {"status":"error","err_code":403,"err_msg":"Incorrect Access key [Access key错误]","ts":1652774224344} '1010': AccountNotEnabled, // {"status":"error","err_code":1010,"err_msg":"Account doesnt exist.","ts":1648137970490} '1003': AuthenticationError, // {code: '1003', message: 'invalid signature'} '1013': BadSymbol, // {"status":"error","err_code":1013,"err_msg":"This contract symbol doesnt exist.","ts":1640550459583} '1017': OrderNotFound, // {"status":"error","err_code":1017,"err_msg":"Order doesnt exist.","ts":1640550859242} '1034': InvalidOrder, // {"status":"error","err_code":1034,"err_msg":"Incorrect field of order price type.","ts":1643802870182} '1036': InvalidOrder, // {"status":"error","err_code":1036,"err_msg":"Incorrect field of open long form.","ts":1643802518986} '1039': InvalidOrder, // {"status":"error","err_code":1039,"err_msg":"Buy price must be lower than 39270.9USDT. Sell price must exceed 37731USDT.","ts":1643802374403} '1041': InvalidOrder, // {"status":"error","err_code":1041,"err_msg":"The order amount exceeds the limit (170000Cont), please modify and order again.","ts":1643802784940} '1047': InsufficientFunds, // {"status":"error","err_code":1047,"err_msg":"Insufficient margin available.","ts":1643802672652} '1048': InsufficientFunds, // {"status":"error","err_code":1048,"err_msg":"Insufficient close amount available.","ts":1652772408864} '1061': OrderNotFound, // {"status":"ok","data":{"errors":[{"order_id":"1349442392365359104","err_code":1061,"err_msg":"The order does not exist."}],"successes":""},"ts":1741773744526} '1051': InvalidOrder, // {"status":"error","err_code":1051,"err_msg":"No orders to cancel.","ts":1652552125876} '1066': BadSymbol, // {"status":"error","err_code":1066,"err_msg":"The symbol field cannot be empty. Please re-enter.","ts":1640550819147} '1067': InvalidOrder, // {"status":"error","err_code":1067,"err_msg":"The client_order_id field is invalid. Please re-enter.","ts":1643802119413} '1094': InvalidOrder, // {"status":"error","err_code":1094,"err_msg":"The leverage cannot be empty, please switch the leverage or contact customer service","ts":1640496946243} '1220': AccountNotEnabled, // {"status":"error","err_code":1220,"err_msg":"You don’t have access permission as you have not opened contracts trading.","ts":1645096660718} '1303': BadRequest, // {"code":1303,"data":null,"message":"Each transfer-out cannot be less than 5USDT.","success":false,"print-log":true} '1461': InvalidOrder, // {"status":"error","err_code":1461,"err_msg":"Current positions have triggered position limits (5000USDT). Please modify.","ts":1652554651234} '4007': BadRequest, // {"code":"4007","msg":"Unified account special interface, non - one account is not available","data":null,"ts":"1698413427651"}' 'bad-request': BadRequest, 'validation-format-error': BadRequest, // {"status":"error","err-code":"validation-format-error","err-msg":"Format Error: order-id.","data":null} 'validation-constraints-required': BadRequest, // {"status":"error","err-code":"validation-constraints-required","err-msg":"Field is missing: client-order-id.","data":null} 'base-date-limit-error': BadRequest, // {"status":"error","err-code":"base-date-limit-error","err-msg":"date less than system limit","data":null} 'api-not-support-temp-addr': PermissionDenied, // {"status":"error","err-code":"api-not-support-temp-addr","err-msg":"API withdrawal does not support temporary addresses","data":null} 'timeout': RequestTimeout, // {"ts":1571653730865,"status":"error","err-code":"timeout","err-msg":"Request Timeout"} 'gateway-internal-error': ExchangeNotAvailable, // {"status":"error","err-code":"gateway-internal-error","err-msg":"Failed to load data. Try again later.","data":null} 'account-frozen-balance-insufficient-error': InsufficientFunds, // {"status":"error","err-code":"account-frozen-balance-insufficient-error","err-msg":"trade account balance is not enough, left: `0.0027`","data":null} 'invalid-amount': InvalidOrder, // eg "Paramemter `amount` is invalid." 'order-limitorder-amount-min-error': InvalidOrder, // limit order amount error, min: `0.001` 'order-limitorder-amount-max-error': InvalidOrder, // market order amount error, max: `1000000` 'order-marketorder-amount-min-error': InvalidOrder, // market order amount error, min: `0.01` 'order-limitorder-price-min-error': InvalidOrder, // limit order price error 'order-limitorder-price-max-error': InvalidOrder, // limit order price error 'order-limitorder-price-buy-min-error': InvalidOrder, // {"status":"error","err-code":"order-limitorder-price-buy-min-error","err-msg":"The price cannot be lower than 0.0006 USDT","data":null} 'o