UNPKG

ccxt

Version:

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

827 lines (824 loc) 455 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/okx.js'; import { ExchangeError, ExchangeNotAvailable, OnMaintenance, ArgumentsRequired, BadRequest, AccountSuspended, InvalidAddress, DDoSProtection, PermissionDenied, InsufficientFunds, InvalidNonce, InvalidOrder, OrderNotFound, AuthenticationError, RequestTimeout, BadSymbol, RateLimitExceeded, NetworkError, CancelPending, NotSupported, AccountNotEnabled, ContractUnavailable, ManualInteractionNeeded, OperationRejected, RestrictedLocation, NullResponse } from './base/errors.js'; import { Precise } from './base/Precise.js'; import { TICK_SIZE } from './base/functions/number.js'; // --------------------------------------------------------------------------- /** * @class okx * @augments Exchange */ export default class okx extends Exchange { describe() { return this.deepExtend(super.describe(), { 'id': 'okx', 'name': 'OKX', 'countries': ['CN', 'US'], 'version': 'v5', 'rateLimit': 100 * 1.10, // 10% tolerance because of #26973 'pro': true, 'certified': true, 'has': { 'CORS': undefined, 'spot': true, 'margin': true, 'swap': true, 'future': true, 'option': true, 'addMargin': true, 'cancelAllOrders': false, 'cancelAllOrdersAfter': true, 'cancelOrder': true, 'cancelOrders': true, 'cancelOrdersForSymbols': true, 'closeAllPositions': false, 'closePosition': true, 'createConvertTrade': true, 'createDepositAddress': false, 'createMarketBuyOrderWithCost': true, 'createMarketSellOrderWithCost': true, 'createOrder': true, 'createOrders': true, 'createOrderWithTakeProfitAndStopLoss': true, 'createPostOnlyOrder': true, 'createReduceOnlyOrder': true, 'createStopLimitOrder': true, 'createStopLossOrder': true, 'createStopMarketOrder': true, 'createStopOrder': true, 'createTakeProfitOrder': true, 'createTrailingPercentOrder': true, 'createTriggerOrder': true, 'editOrder': true, 'fetchAccounts': true, 'fetchAllGreeks': true, 'fetchBalance': true, 'fetchBidsAsks': undefined, 'fetchBorrowInterest': true, 'fetchBorrowRateHistories': true, 'fetchBorrowRateHistory': true, 'fetchCanceledOrders': true, 'fetchClosedOrder': undefined, 'fetchClosedOrders': true, 'fetchConvertCurrencies': true, 'fetchConvertQuote': true, 'fetchConvertTrade': true, 'fetchConvertTradeHistory': true, 'fetchCrossBorrowRate': true, 'fetchCrossBorrowRates': true, 'fetchCurrencies': true, 'fetchDeposit': true, 'fetchDepositAddress': true, 'fetchDepositAddresses': false, 'fetchDepositAddressesByNetwork': true, 'fetchDeposits': true, 'fetchDepositsWithdrawals': false, 'fetchDepositWithdrawFee': 'emulated', 'fetchDepositWithdrawFees': true, 'fetchFundingHistory': true, 'fetchFundingInterval': true, 'fetchFundingIntervals': false, 'fetchFundingRate': true, 'fetchFundingRateHistory': true, 'fetchFundingRates': true, 'fetchGreeks': true, 'fetchIndexOHLCV': true, 'fetchIsolatedBorrowRate': false, 'fetchIsolatedBorrowRates': false, 'fetchL3OrderBook': false, 'fetchLedger': true, 'fetchLedgerEntry': undefined, 'fetchLeverage': true, 'fetchLeverageTiers': false, 'fetchLongShortRatio': false, 'fetchLongShortRatioHistory': true, 'fetchMarginAdjustmentHistory': true, 'fetchMarketLeverageTiers': true, 'fetchMarkets': true, 'fetchMarkOHLCV': true, 'fetchMarkPrice': true, 'fetchMarkPrices': true, 'fetchMySettlementHistory': false, 'fetchMyTrades': true, 'fetchOHLCV': true, 'fetchOpenInterest': true, 'fetchOpenInterestHistory': true, 'fetchOpenInterests': true, 'fetchOpenOrder': undefined, 'fetchOpenOrders': true, 'fetchOption': true, 'fetchOptionChain': true, 'fetchOrder': true, 'fetchOrderBook': true, 'fetchOrderBooks': false, 'fetchOrders': false, 'fetchOrderTrades': true, 'fetchPosition': true, 'fetchPositionHistory': 'emulated', 'fetchPositions': true, 'fetchPositionsForSymbol': true, 'fetchPositionsHistory': true, 'fetchPositionsRisk': false, 'fetchPremiumIndexOHLCV': false, 'fetchSettlementHistory': true, 'fetchStatus': true, 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFee': true, 'fetchTradingFees': false, 'fetchTradingLimits': false, 'fetchTransactionFee': false, 'fetchTransactionFees': false, 'fetchTransactions': false, 'fetchTransfer': true, 'fetchTransfers': true, 'fetchUnderlyingAssets': true, 'fetchVolatilityHistory': false, 'fetchWithdrawal': true, 'fetchWithdrawals': true, 'fetchWithdrawalWhitelist': false, 'reduceMargin': true, 'repayCrossMargin': true, 'sandbox': true, 'setLeverage': true, 'setMargin': false, 'setMarginMode': true, 'setPositionMode': true, 'signIn': false, 'transfer': true, 'withdraw': true, }, 'timeframes': { '1m': '1m', '3m': '3m', '5m': '5m', '15m': '15m', '30m': '30m', '1h': '1H', '2h': '2H', '4h': '4H', '6h': '6H', '12h': '12H', '1d': '1D', '1w': '1W', '1M': '1M', '3M': '3M', }, 'hostname': 'www.okx.com', // or aws.okx.com 'urls': { 'logo': 'https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg', 'api': { 'rest': 'https://{hostname}', }, 'www': 'https://www.okx.com', 'doc': 'https://www.okx.com/docs-v5/en/', 'fees': 'https://www.okx.com/pages/products/fees.html', 'referral': { // old reflink 0% discount https://www.okx.com/join/1888677 // new reflink 20% discount https://www.okx.com/join/CCXT2023 'url': 'https://www.okx.com/join/CCXTCOM', 'discount': 0.2, }, 'test': { 'rest': 'https://{hostname}', }, }, 'api': { 'public': { 'get': { // market 'market/tickers': 1, 'market/ticker': 1, 'market/books': 1 / 2, 'market/books-full': 2, 'market/candles': 1 / 2, 'market/history-candles': 1, 'market/trades': 1 / 5, 'market/history-trades': 2, 'market/option/instrument-family-trades': 1, 'market/platform-24-volume': 10, 'market/call-auction-detail': 1, // deprecated, use call-auction-details 'market/call-auction-details': 1, 'market/books-sbe': 10, 'market/block-tickers': 1, 'market/block-ticker': 1, 'market/sprd-ticker': 1, 'market/sprd-candles': 1 / 2, 'market/sprd-history-candles': 1, 'market/index-tickers': 1, 'market/index-candles': 1, 'market/history-index-candles': 2, 'market/mark-price-candles': 1, 'market/history-mark-price-candles': 1, 'market/exchange-rate': 20, 'market/index-components': 1, 'market/open-oracle': 50, // not documented 'market/books-lite': 5 / 3, // deprecated // public 'public/option-trades': 1, 'public/block-trades': 1, 'public/instruments': 1, 'public/estimated-price': 2, 'public/delivery-exercise-history': 1 / 2, 'public/estimated-settlement-info': 2, 'public/settlement-history': 1 / 2, 'public/funding-rate': 2, 'public/funding-rate-history': 2, 'public/open-interest': 1, 'public/price-limit': 1, 'public/opt-summary': 1, 'public/discount-rate-interest-free-quota': 10, 'public/time': 2, 'public/mark-price': 2, 'public/position-tiers': 2, 'public/interest-rate-loan-quota': 10, 'public/underlying': 1, 'public/insurance-fund': 2, 'public/convert-contract-coin': 2, 'public/instrument-tick-bands': 4, 'public/premium-history': 1, 'public/economic-calendar': 50, 'public/market-data-history': 4, 'public/event-contract/events': 1, 'public/event-contract/markets': 1, 'public/event-contract/series': 1, 'public/vip-interest-rate-loan-quota': 10, // not documented // rubik 'rubik/stat/trading-data/support-coin': 4, 'rubik/stat/contracts/open-interest-history': 2, 'rubik/stat/taker-volume': 4, 'rubik/stat/taker-volume-contract': 4, 'rubik/stat/margin/loan-ratio': 4, 'rubik/stat/contracts/long-short-account-ratio-contract-top-trader': 4, 'rubik/stat/contracts/long-short-position-ratio-contract-top-trader': 4, 'rubik/stat/contracts/long-short-account-ratio-contract': 4, 'rubik/stat/contracts/long-short-account-ratio': 4, 'rubik/stat/contracts/open-interest-volume': 4, 'rubik/stat/option/open-interest-volume': 4, 'rubik/stat/option/open-interest-volume-ratio': 4, 'rubik/stat/option/open-interest-volume-expiry': 4, 'rubik/stat/option/open-interest-volume-strike': 4, 'rubik/stat/option/taker-block-volume': 4, // system 'system/status': 50, // sprd 'sprd/spreads': 1, 'sprd/books': 1, 'sprd/public-trades': 1, 'sprd/ticker': 1, // not documented 'tradingBot/grid/ai-param': 1, 'tradingBot/grid/min-investment': 1, 'tradingBot/public/rsi-back-testing': 1, 'tradingBot/grid/grid-quantity': 4, 'asset/exchange-list': 5 / 3, 'finance/staking-defi/eth/apy-history': 5 / 3, 'finance/staking-defi/sol/apy-history': 5 / 3, 'finance/savings/lending-rate-summary': 5 / 3, 'finance/savings/lending-rate-history': 5 / 3, 'finance/fixed-loan/lending-offers': 10 / 3, // not documented 'finance/fixed-loan/lending-apy-history': 10 / 3, // not documented 'finance/fixed-loan/pending-lending-volume': 10 / 3, // not documented // public broker 'finance/sfp/dcd/products': 2 / 3, // not documented // copytrading 'copytrading/public-config': 4, 'copytrading/public-lead-traders': 4, 'copytrading/public-weekly-pnl': 4, 'copytrading/public-pnl': 4, 'copytrading/public-stats': 4, 'copytrading/public-preference-currency': 4, 'copytrading/public-current-subpositions': 4, 'copytrading/public-subpositions-history': 4, 'copytrading/public-copy-traders': 4, 'support/announcements': 4, 'support/announcements-types': 20, // typo, use announcement-types 'support/announcement-types': 20, }, 'post': { 'tradingBot/grid/min-investment': 1, // public }, }, 'private': { 'get': { // rfq 'rfq/counterparties': 4, 'rfq/maker-instrument-settings': 4, 'rfq/mmp-config': 4, 'rfq/rfqs': 10, 'rfq/quotes': 10, 'rfq/trades': 4, 'rfq/public-trades': 4, // sprd 'sprd/order': 1, 'sprd/orders-pending': 2, 'sprd/orders-history': 1, 'sprd/orders-history-archive': 1, 'sprd/trades': 1, // trade 'trade/order': 1 / 3, 'trade/orders-pending': 1 / 3, 'trade/orders-history': 1 / 2, 'trade/orders-history-archive': 1, 'trade/fills': 1 / 3, 'trade/fills-history': 2, 'trade/fills-archive': 2, // not documented 'trade/order-algo': 1, 'trade/orders-algo-pending': 1, 'trade/orders-algo-history': 1, 'trade/easy-convert-currency-list': 20, 'trade/easy-convert-history': 20, 'trade/one-click-repay-currency-list': 20, 'trade/one-click-repay-currency-list-v2': 20, 'trade/one-click-repay-history': 20, 'trade/one-click-repay-history-v2': 20, 'trade/account-rate-limit': 1, // asset 'asset/currencies': 5 / 3, 'asset/balances': 5 / 3, 'asset/non-tradable-assets': 5 / 3, 'asset/asset-valuation': 10, 'asset/transfer-state': 1, 'asset/bills': 5 / 3, 'asset/bills-history': 10, 'asset/deposit-lightning': 5, // not documented 'asset/deposit-address': 5 / 3, 'asset/deposit-history': 5 / 3, 'asset/withdrawal-history': 5 / 3, 'asset/deposit-withdraw-status': 20, 'asset/monthly-statement': 2, 'asset/convert/currencies': 5 / 3, 'asset/convert/currency-pair': 5 / 3, 'asset/convert/history': 5 / 3, // account 'account/instruments': 1, 'account/balance': 2, 'account/positions': 2, 'account/positions-history': 2, 'account/account-position-risk': 2, 'account/bills': 2, 'account/bills-archive': 4, 'account/bills-history-archive': 2, 'account/config': 4, 'account/subtypes': 4, 'account/max-size': 1, 'account/max-avail-size': 1, 'account/leverage-info': 1, 'account/adjust-leverage-info': 4, 'account/max-loan': 1, 'account/trade-fee': 4, 'account/interest-accrued': 4, 'account/interest-rate': 4, 'account/max-withdrawal': 1, 'account/risk-state': 2, 'account/interest-limits': 4, 'account/spot-borrow-repay-history': 4, 'account/greeks': 2, 'account/position-tiers': 2, 'account/set-account-switch-precheck': 4, 'account/collateral-assets': 4, 'account/mmp-config': 4, 'account/move-positions-history': 10, 'account/precheck-set-delta-neutral': 20, 'account/quick-margin-borrow-repay-history': 4, 'account/borrow-repay-history': 4, 'account/vip-interest-accrued': 4, // not documented 'account/vip-interest-deducted': 4, // not documented 'account/vip-loan-order-list': 4, // not documented 'account/vip-loan-order-detail': 4, // not documented 'account/fixed-loan/borrowing-limit': 4, // not documented 'account/fixed-loan/borrowing-quote': 5, // not documented 'account/fixed-loan/borrowing-orders-list': 5, // not documented 'account/spot-manual-borrow-repay': 30, // not documented 'account/set-auto-repay': 4, // not documented // subaccount 'users/subaccount/list': 10, 'account/subaccount/balances': 10 / 3, 'asset/subaccount/balances': 10 / 3, 'account/subaccount/max-withdrawal': 1, 'asset/subaccount/bills': 5 / 3, 'asset/subaccount/managed-subaccount-bills': 5 / 3, 'users/entrust-subaccount-list': 10, 'account/subaccount/interest-limits': 4, 'users/subaccount/apikey': 10, // grid trading 'tradingBot/grid/orders-algo-pending': 1, 'tradingBot/grid/orders-algo-history': 1, 'tradingBot/grid/orders-algo-details': 1, 'tradingBot/grid/sub-orders': 1, 'tradingBot/grid/positions': 1, 'tradingBot/grid/ai-param': 1, 'tradingBot/signal/signals': 1, 'tradingBot/signal/orders-algo-details': 1, 'tradingBot/signal/orders-algo-pending': 1, 'tradingBot/signal/orders-algo-history': 1, 'tradingBot/signal/positions': 1, 'tradingBot/signal/positions-history': 2, 'tradingBot/signal/sub-orders': 1, 'tradingBot/signal/event-history': 1, 'tradingBot/recurring/orders-algo-pending': 1, 'tradingBot/recurring/orders-algo-history': 1, 'tradingBot/recurring/orders-algo-details': 1, 'tradingBot/recurring/sub-orders': 1, 'tradingBot/dca/ongoing-list': 1, 'tradingBot/dca/history-list': 1, 'tradingBot/dca/orders': 1, 'tradingBot/dca/position-details': 1, 'tradingBot/dca/cycle-list': 1, // earn 'finance/savings/balance': 5 / 3, 'finance/savings/lending-history': 5 / 3, 'finance/staking-defi/offers': 10 / 3, 'finance/staking-defi/orders-active': 10 / 3, 'finance/staking-defi/orders-history': 10 / 3, // eth staking 'finance/staking-defi/eth/product-info': 10 / 3, 'finance/staking-defi/eth/balance': 5 / 3, 'finance/staking-defi/eth/purchase-redeem-history': 5 / 3, 'finance/staking-defi/sol/product-info': 10 / 3, 'finance/staking-defi/sol/balance': 5 / 3, 'finance/staking-defi/sol/purchase-redeem-history': 5 / 3, 'finance/flexible-loan/borrow-currencies': 4, 'finance/flexible-loan/collateral-assets': 4, 'finance/flexible-loan/max-collateral-redeem-amount': 4, 'finance/flexible-loan/loan-info': 4, 'finance/flexible-loan/loan-history': 4, 'finance/flexible-loan/interest-accrued': 4, // copytrading 'copytrading/current-subpositions': 1, 'copytrading/subpositions-history': 1, 'copytrading/instruments': 4, 'copytrading/profit-sharing-details': 4, 'copytrading/total-profit-sharing': 4, 'copytrading/unrealized-profit-sharing-details': 4, 'copytrading/total-unrealized-profit-sharing': 4, 'copytrading/config': 4, 'copytrading/copy-settings': 4, 'copytrading/current-lead-traders': 4, 'copytrading/batch-leverage-info': 4, // not documented 'copytrading/lead-traders-history': 4, // not documented // broker 'broker/dma/subaccount-info': 2, 'broker/dma/subaccount-trade-fee': 10, 'broker/dma/subaccount/apikey': 10, 'broker/dma/rebate-per-orders': 300, 'broker/fd/rebate-per-orders': 300, 'broker/fd/if-rebate': 5, 'broker/nd/info': 10, // not documented 'broker/nd/subaccount-info': 10, // not documented 'broker/nd/subaccount/apikey': 10, // not documented 'asset/broker/nd/subaccount-deposit-address': 5 / 3, // not documented 'asset/broker/nd/subaccount-deposit-history': 4, // not documented 'asset/broker/nd/subaccount-withdrawal-history': 4, // not documented 'broker/nd/rebate-daily': 100, // not documented 'broker/nd/rebate-per-orders': 300, // not documented 'finance/sfp/dcd/order': 2, // not documented 'finance/sfp/dcd/orders': 2, // not documented 'finance/sfp/dcd/currency-pair': 2, 'finance/sfp/dcd/order-status': 2, 'finance/sfp/dcd/order-history': 2, // affiliate 'affiliate/invitee/detail': 1, 'users/partner/if-rebate': 1, // not documented 'support/announcements': 4, }, 'post': { // rfq 'rfq/create-rfq': 4, 'rfq/cancel-rfq': 4, 'rfq/cancel-batch-rfqs': 10, 'rfq/cancel-all-rfqs': 10, 'rfq/execute-quote': 15, 'rfq/maker-instrument-settings': 4, 'rfq/mmp-reset': 4, 'rfq/mmp-config': 100, 'rfq/create-quote': 0.4, 'rfq/cancel-quote': 0.4, 'rfq/cancel-batch-quotes': 10, 'rfq/cancel-all-quotes': 10, 'rfq/cancel-all-after': 10, // sprd 'sprd/order': 1, 'sprd/cancel-order': 1, 'sprd/mass-cancel': 1, 'sprd/amend-order': 1, 'sprd/cancel-all-after': 10, // trade 'trade/order': 1 / 3, 'trade/batch-orders': 1 / 15, 'trade/cancel-order': 1 / 3, 'trade/cancel-batch-orders': 1 / 15, 'trade/amend-order': 1 / 3, 'trade/amend-batch-orders': 1 / 150, 'trade/close-position': 1, 'trade/fills-archive': 172800, // not documented 'trade/cancel-advance-algos': 1, // not documented 'trade/easy-convert': 20, 'trade/one-click-repay': 20, 'trade/one-click-repay-v2': 20, 'trade/mass-cancel': 4, 'trade/cancel-all-after': 10, 'trade/order-precheck': 4, 'trade/order-algo': 1, 'trade/cancel-algos': 1, 'trade/amend-algos': 1, // asset 'asset/transfer': 5, 'asset/withdrawal': 5 / 3, 'asset/withdrawal-lightning': 5, // not documented 'asset/cancel-withdrawal': 5 / 3, 'asset/convert-dust-assets': 10, 'asset/monthly-statement': 1296000, // 20 req/month, 10/20*30*24*60*60 = 1296000 'asset/convert/estimate-quote': 50, 'asset/convert/trade': 1, // account 'account/bills-history-archive': 72000, // 12 req/day 'account/set-position-mode': 4, 'account/set-leverage': 1, 'account/position/margin-balance': 1, 'account/set-fee-type': 4, 'account/set-greeks': 4, 'account/set-isolated-mode': 4, 'account/spot-manual-borrow-repay': 30, 'account/set-auto-repay': 4, 'account/quick-margin-borrow-repay': 4, // not documented 'account/borrow-repay': 5 / 3, // not documented 'account/simulated_margin': 10, // not documented 'account/position-builder': 10, 'account/position-builder-graph': 50, 'account/set-riskOffset-type': 2, 'account/set-riskOffset-amt': 2, 'account/activate-option': 4, 'account/set-auto-loan': 4, 'account/account-level-switch-preset': 4, 'account/set-account-level': 4, 'account/set-collateral-assets': 4, 'account/mmp-reset': 4, 'account/mmp-config': 50, 'account/fixed-loan/borrowing-order': 5, // not documented 'account/fixed-loan/amend-borrowing-order': 5, // not documented 'account/fixed-loan/manual-reborrow': 5, // not documented 'account/fixed-loan/repay-borrowing-order': 5, // not documented 'account/move-positions': 10, 'account/set-auto-earn': 10, 'account/set-settle-currency': 1, 'account/set-trading-config': 20, 'account/demo-adjust-balance': 20, // 3 requests per day but we don't use that weight for now, set to 20 to be safe // subaccount 'asset/subaccount/transfer': 10, 'account/subaccount/set-loan-allocation': 4, // not documented 'users/subaccount/create-subaccount': 10, 'users/subaccount/apikey': 10, 'users/subaccount/modify-apikey': 10, 'users/subaccount/subaccount-apikey': 10, // not documented 'users/subaccount/delete-apikey': 10, 'users/subaccount/set-transfer-out': 10, // grid trading 'tradingBot/grid/order-algo': 1, 'tradingBot/grid/copy-order-algo': 1, 'tradingBot/grid/amend-algo-basic-param': 1, 'tradingBot/grid/amend-order-algo': 1, 'tradingBot/grid/stop-order-algo': 1, 'tradingBot/grid/close-position': 1, 'tradingBot/grid/cancel-close-order': 1, 'tradingBot/grid/order-instant-trigger': 1, 'tradingBot/grid/withdraw-income': 1, 'tradingBot/grid/compute-margin-balance': 1, 'tradingBot/grid/margin-balance': 1, 'tradingBot/grid/min-investment': 1, // public 'tradingBot/grid/adjust-investment': 1, 'tradingBot/signal/create-signal': 1, 'tradingBot/signal/order-algo': 1, 'tradingBot/signal/stop-order-algo': 1, 'tradingBot/signal/margin-balance': 1, 'tradingBot/signal/amendTPSL': 1, 'tradingBot/signal/set-instruments': 1, 'tradingBot/signal/close-position': 1, 'tradingBot/signal/sub-order': 1, 'tradingBot/signal/cancel-sub-order': 1, 'tradingBot/recurring/order-algo': 1, 'tradingBot/recurring/amend-order-algo': 1, 'tradingBot/recurring/stop-order-algo': 1, 'tradingBot/dca/create': 1, 'tradingBot/dca/amend-order-algo': 1, 'tradingBot/dca/stop': 1, 'tradingBot/dca/orders/manual-buy': 1, 'tradingBot/dca/settings/reinvestment': 1, 'tradingBot/dca/settings/take-profit': 1, 'tradingBot/dca/margin/add': 1, 'tradingBot/dca/margin/reduce': 1, 'tradingBot/recurring/add-investment': 1, 'tradingBot/recurring/amend-price-range': 1, 'tradingBot/recurring/amend-recurring-amount': 1, 'tradingBot/recurring/amend-recurring-time': 1, 'tradingBot/recurring/pause': 1, 'tradingBot/recurring/restart': 1, // earn 'finance/savings/purchase-redempt': 5 / 3, 'finance/savings/set-lending-rate': 5 / 3, 'finance/staking-defi/purchase': 5, 'finance/staking-defi/redeem': 5, 'finance/staking-defi/cancel': 5, // eth staking 'finance/staking-defi/eth/purchase': 5, 'finance/staking-defi/eth/redeem': 5, 'finance/staking-defi/eth/cancel-redeem': 5, 'finance/staking-defi/sol/purchase': 5, 'finance/staking-defi/sol/redeem': 5, 'finance/staking-defi/sol/cancel-redeem': 5, 'finance/flexible-loan/max-loan': 4, 'finance/flexible-loan/adjust-collateral': 4, // copytrading 'copytrading/algo-order': 1, 'copytrading/close-subposition': 1, 'copytrading/set-instruments': 4, 'copytrading/amend-profit-sharing-ratio': 4, 'copytrading/first-copy-settings': 4, 'copytrading/amend-copy-settings': 4, 'copytrading/stop-copy-trading': 4, 'copytrading/batch-set-leverage': 4, // not documented // broker 'broker/nd/create-subaccount': 0.25, // not documented 'broker/nd/delete-subaccount': 1, // not documented 'broker/nd/subaccount/apikey': 0.25, // not documented 'broker/nd/subaccount/modify-apikey': 1, // not documented 'broker/nd/subaccount/delete-apikey': 1, // not documented 'broker/nd/set-subaccount-level': 4, // not documented 'broker/nd/set-subaccount-fee-rate': 4, // not documented 'broker/nd/set-subaccount-assets': 0.25, // not documented 'asset/broker/nd/subaccount-deposit-address': 1, // not documented 'asset/broker/nd/modify-subaccount-deposit-address': 5 / 3, // not documented 'broker/nd/rebate-per-orders': 36000, // not documented 'finance/sfp/dcd/quote': 10, // not documented 'finance/sfp/dcd/order': 10, // not documented 'finance/sfp/dcd/trade': 10, 'finance/sfp/dcd/redeem-quote': 10, 'finance/sfp/dcd/redeem': 10, 'broker/nd/report-subaccount-ip': 0.25, // not documented 'broker/dma/subaccount/apikey': 1 / 4, 'broker/dma/trades': 36000, 'broker/fd/rebate-per-orders': 36000, }, }, }, 'fees': { 'trading': { 'taker': this.parseNumber('0.0015'), 'maker': this.parseNumber('0.0010'), }, 'spot': { 'taker': this.parseNumber('0.0015'), 'maker': this.parseNumber('0.0010'), }, 'future': { 'taker': this.parseNumber('0.0005'), 'maker': this.parseNumber('0.0002'), }, 'swap': { 'taker': this.parseNumber('0.00050'), 'maker': this.parseNumber('0.00020'), }, }, 'requiredCredentials': { 'apiKey': true, 'secret': true, 'password': true, }, 'exceptions': { 'exact': { // Public error codes from 50000-53999 // General Class '1': ExchangeError, // Operation failed '2': ExchangeError, // Bulk operation partially succeeded '4088': ManualInteractionNeeded, // {"code":"4088","data":[],"msg":"You can’t trade or deposit until you’ve verified your identity again. Head to Identity Verification to complete it."} '50000': BadRequest, // Body can not be empty '50001': OnMaintenance, // Matching engine upgrading. Please try again later '50002': BadRequest, // Json data format error '50004': RequestTimeout, // Endpoint request timeout (does not indicate success or failure of order, please check order status) '50005': ExchangeNotAvailable, // API is offline or unavailable '50006': BadRequest, // Invalid Content_Type, please use "application/json" format '50007': AccountSuspended, // Account blocked '50008': AuthenticationError, // User does not exist '50009': AccountSuspended, // Account is suspended due to ongoing liquidation '50010': ExchangeError, // User ID can not be empty '50011': RateLimitExceeded, // Request too frequent '50012': ExchangeError, // Account status invalid '50013': ExchangeNotAvailable, // System is busy, please try again later '50014': BadRequest, // Parameter {0} can not be empty '50015': ExchangeError, // Either parameter {0} or {1} is required '50016': ExchangeError, // Parameter {0} does not match parameter {1} '50017': ExchangeError, // The position is frozen due to ADL. Operation restricted '50018': ExchangeError, // Currency {0} is frozen due to ADL. Operation restricted '50019': ExchangeError, // The account is frozen due to ADL. Operation restricted '50020': ExchangeError, // The position is frozen due to liquidation. Operation restricted '50021': ExchangeError, // Currency {0} is frozen due to liquidation. Operation restricted '50022': ExchangeError, // The account is frozen due to liquidation. Operation restricted '50023': ExchangeError, // Funding fee frozen. Operation restricted '50024': BadRequest, // Parameter {0} and {1} can not exist at the same time '50025': ExchangeError, // Parameter {0} count exceeds the limit {1} '50026': ExchangeNotAvailable, // System error, please try again later. '50027': PermissionDenied, // The account is restricted from trading '50028': ExchangeError, // Unable to take the order, please reach out to support center for details '50044': BadRequest, // Must select one broker type '50061': ExchangeError, // You've reached the maximum order rate limit for this account. '50062': ExchangeError, // This feature is currently unavailable. // API Class '50100': ExchangeError, // API frozen, please contact customer service '50101': AuthenticationError, // Broker id of APIKey does not match current environment '50102': InvalidNonce, // Timestamp request expired '50103': AuthenticationError, // Request header "OK_ACCESS_KEY" can not be empty '50104': AuthenticationError, // Request header "OK_ACCESS_PASSPHRASE" can not be empty '50105': AuthenticationError, // Request header "OK_ACCESS_PASSPHRASE" incorrect '50106': AuthenticationError, // Request header "OK_ACCESS_SIGN" can not be empty '50107': AuthenticationError, // Request header "OK_ACCESS_TIMESTAMP" can not be empty '50108': ExchangeError, // Exchange ID does not exist '50109': ExchangeError, // Exchange domain does not exist '50110': PermissionDenied, // Invalid IP '50111': AuthenticationError, // Invalid OK_ACCESS_KEY '50112': AuthenticationError, // Invalid OK_ACCESS_TIMESTAMP '50113': AuthenticationError, // Invalid signature '50114': AuthenticationError, // Invalid authorization '50115': BadRequest, // Invalid request method // Trade Class '51000': BadRequest, // Parameter {0} error '51001': BadSymbol, // Instrument ID does not exist '51002': BadSymbol, // Instrument ID does not match underlying index '51003': BadRequest, // Either client order ID or order ID is required '51004': InvalidOrder, // Order amount exceeds current tier limit '51005': InvalidOrder, // Order amount exceeds the limit '51006': InvalidOrder, // Order price out of the limit '51007': InvalidOrder, // Order placement failed. Order amount should be at least 1 contract (showing up when placing an order with less than 1 contract) '51008': InsufficientFunds, // Order placement failed due to insufficient balance or margin '51009': AccountSuspended, // Order placement function is blocked by the platform '51010': AccountNotEnabled, // Account level too low {"code":"1","data":[{"clOrdId":"uJrfGFth9F","ordId":"","sCode":"51010","sMsg":"The current account mode does not support this API interface. ","tag":""}],"msg":"Operation failed."} '51011': InvalidOrder, // Duplicated order ID '51012': BadSymbol, // Token does not exist '51014': BadSymbol, // Index does not exist '51015': BadSymbol, // Instrument ID does not match instrument type '51016': InvalidOrder, // Duplicated client order ID '51017': ExchangeError, // Borrow amount exceeds the limit '51018': ExchangeError, // User with option account can not hold net short positions '51019': ExchangeError, // No net long positions can be held under isolated margin mode in options '51020': InvalidOrder, // Order amount should be greater than the min available amount '51021': ContractUnavailable, // Contract to be listed '51022': ContractUnavailable, // Contract suspended '51023': ExchangeError, // Position does not exist '51024': AccountSuspended, // Unified accountblocked '51025': ExchangeError, // Order count exceeds the limit '51026': BadSymbol, // Instrument type does not match underlying index '51027': ContractUnavailable, // Contract expired '51028': ContractUnavailable, // Contract under delivery '51029': ContractUnavailable, // Contract is being settled '51030': ContractUnavailable, // Funding fee is being settled '51031': InvalidOrder, // This order price is not within the closing price range '51046': InvalidOrder, // The take profit trigger price must be higher than the order price '51047': InvalidOrder, // The stop loss trigger price must be lower than the order price '51051': InvalidOrder, // Your SL price should be lower than the primary order price '51072': InvalidOrder, // As a spot lead trader, you need to set tdMode to 'spot_isolated' when configured buying lead trade pairs '51073': InvalidOrder, // As a spot lead trader, you need to use '/copytrading/close-subposition' for selling assets through lead trades '51074': InvalidOrder, // Only the tdMode for lead trade pairs configured by spot lead traders can be set to 'spot_isolated' '51090': InvalidOrder, // You can't modify the amount of an SL order placed with a TP limit order. '51091': InvalidOrder, // All TP orders in one order must be of the same type. '51092': InvalidOrder, // TP order prices (tpOrdPx) in one order must be different. '51093': InvalidOrder, // TP limit order prices (tpOrdPx) in one order can't be –1 (market price). '51094': InvalidOrder, // You can't place TP limit orders in spot, margin, or options trading. '51095': InvalidOrder, // To place TP limit orders at this endpoint, you must place an SL order at the same time. '51096': InvalidOrder, // cxlOnClosePos needs to be true to place a TP limit order '51098': InvalidOrder, // You can't add a new TP order to an SL order placed with a TP limit order. '51099': InvalidOrder, // You can't place TP limit orders as a lead trader. '51100': InvalidOrder, // Trading amount does not meet the min tradable amount '51101': InvalidOrder, // Entered amount exceeds the max pending order amount (Cont) per transaction '51102': InvalidOrder, // Entered amount exceeds the max pending count '51103': InvalidOrder, // Entered amount exceeds the max pending order count of the underlying asset '51104': InvalidOrder, // Entered amount exceeds the max pending order amount (Cont) of the underlying asset '51105': InvalidOrder, // Entered amount exceeds the max order amount (Cont) of the contract '51106': InvalidOrder, // Entered amount exceeds the max order amount (Cont) of the underlying asset '51107': InvalidOrder, // Entered amount exceeds the max holding amount (Cont) '51108': InvalidOrder, // Positions exceed the limit for closing out with the market price '51109': InvalidOrder, // No available offer '51110': InvalidOrder, // You can only place a limit order after Call Auction has started '51111': BadRequest, // Maximum {0} orders can be placed in bulk '51112': InvalidOrder, // Close order size exceeds your available size '51113': RateLimitExceeded, // Market-price liquidation requests too frequent '51115': InvalidOrder, // Cancel all pending close-orders before liquidation '51116': InvalidOrder, // Order price or trigger price exceeds {0} '51117': InvalidOrder, // Pending close-orders count exceeds limit '51118': InvalidOrder, // Total amount should exceed the min amount per order '51119': InsufficientFunds, // Order placement failed due to insufficient balance '51120': InvalidOrder, // Order quantity is less than {0}, please try again '51121': InvalidOrder, // Order count should be the integer multiples of the lot size '51122': InvalidOrder, // Order price should be higher than the min price {0} '51124': InvalidOrder, // You can only place limit orders during call auction '51125': InvalidOrder, // Currently there are reduce + reverse position pending orders in margin trading. Please cancel all reduce + reverse position pending orders and continue '51126': InvalidOrder, // Currently there are reduce only pending orders in margin trading.Please cancel all reduce only pending orders and continue '51127': InsufficientFunds, // Available balance is 0 '51128': InvalidOrder, // Multi-currency margin account can not do cross-margin trading '51129': InvalidOrder, // The value of the position and buy order has reached the position limit, and no further buying is allowed '51130': BadSymbol, // Fixed margin currency error '51131': InsufficientFunds, // Insufficient balance