UNPKG

sfccxt

Version:

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

699 lines (695 loc) 350 kB
// --------------------------------------------------------------------------- const Exchange = require ('./base/Exchange'); const { TICK_SIZE } = require ('./base/functions/number'); const { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported } = require ('./base/errors'); const Precise = require ('./base/Precise'); // --------------------------------------------------------------------------- module.exports = class bybit extends Exchange { describe () { return this.deepExtend (super.describe (), { 'id': 'bybit', 'name': 'Bybit', 'countries': [ 'VG' ], // British Virgin Islands 'version': 'v3', 'userAgent': undefined, 'rateLimit': 20, 'hostname': 'bybit.com', // bybit.com, bytick.com 'pro': true, 'certified': true, 'has': { 'CORS': true, 'spot': true, 'margin': true, 'swap': true, 'future': true, 'option': undefined, 'cancelAllOrders': true, 'cancelOrder': true, 'createOrder': true, 'createStopLimitOrder': true, 'createStopMarketOrder': true, 'createStopOrder': true, 'editOrder': true, 'fetchBalance': true, 'fetchBorrowInterest': false, // temporarily disabled, as it does not work 'fetchBorrowRate': true, 'fetchBorrowRateHistories': false, 'fetchBorrowRateHistory': false, 'fetchBorrowRates': false, 'fetchClosedOrders': true, 'fetchCurrencies': true, 'fetchDepositAddress': true, 'fetchDepositAddresses': false, 'fetchDepositAddressesByNetwork': true, 'fetchDeposits': true, 'fetchFundingRate': true, 'fetchFundingRateHistory': true, 'fetchIndexOHLCV': true, 'fetchLedger': true, 'fetchMarketLeverageTiers': true, 'fetchMarkets': true, 'fetchMarkOHLCV': true, 'fetchMyTrades': true, 'fetchOHLCV': true, 'fetchOpenInterest': true, 'fetchOpenInterestHistory': true, 'fetchOpenOrders': true, 'fetchOrder': true, 'fetchOrderBook': true, 'fetchOrders': true, 'fetchOrderTrades': true, 'fetchPosition': true, 'fetchPositions': true, 'fetchPremiumIndexOHLCV': true, 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFee': true, 'fetchTradingFees': true, 'fetchTransactions': undefined, 'fetchTransfers': true, 'fetchWithdrawals': true, 'setLeverage': true, 'setMarginMode': true, 'setPositionMode': true, 'transfer': true, 'withdraw': true, }, 'timeframes': { '1m': '1', '3m': '3', '5m': '5', '15m': '15', '30m': '30', '1h': '60', '2h': '120', '4h': '240', '6h': '360', '12h': '720', '1d': 'D', '1w': 'W', '1M': 'M', '1y': 'Y', }, 'urls': { 'test': { 'spot': 'https://api-testnet.{hostname}', 'futures': 'https://api-testnet.{hostname}', 'v2': 'https://api-testnet.{hostname}', 'public': 'https://api-testnet.{hostname}', 'private': 'https://api-testnet.{hostname}', }, 'logo': 'https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg', 'api': { 'spot': 'https://api.{hostname}', 'futures': 'https://api.{hostname}', 'v2': 'https://api.{hostname}', 'public': 'https://api.{hostname}', 'private': 'https://api.{hostname}', }, 'www': 'https://www.bybit.com', 'doc': [ 'https://bybit-exchange.github.io/docs/inverse/', 'https://bybit-exchange.github.io/docs/linear/', 'https://github.com/bybit-exchange', ], 'fees': 'https://help.bybit.com/hc/en-us/articles/360039261154', 'referral': 'https://www.bybit.com/register?affiliate_id=35953', }, 'api': { 'public': { 'get': { // inverse swap 'v2/public/orderBook/L2': 1, 'v2/public/kline/list': 3, 'v2/public/tickers': 1, 'v2/public/trading-records': 1, 'v2/public/symbols': 1, 'v2/public/mark-price-kline': 3, 'v2/public/index-price-kline': 3, 'v2/public/premium-index-kline': 2, 'v2/public/open-interest': 1, 'v2/public/big-deal': 1, 'v2/public/account-ratio': 1, 'v2/public/funding-rate': 1, 'v2/public/elite-ratio': 1, 'v2/public/funding/prev-funding-rate': 1, 'v2/public/risk-limit/list': 1, // linear swap USDT 'public/linear/kline': 3, 'public/linear/recent-trading-records': 1, 'public/linear/risk-limit': 1, 'public/linear/funding/prev-funding-rate': 1, 'public/linear/mark-price-kline': 1, 'public/linear/index-price-kline': 1, 'public/linear/premium-index-kline': 1, // spot 'spot/v1/time': 1, 'spot/v1/symbols': 1, 'spot/quote/v1/depth': 1, 'spot/quote/v1/depth/merged': 1, 'spot/quote/v1/trades': 1, 'spot/quote/v1/kline': 1, 'spot/quote/v1/ticker/24hr': 1, 'spot/quote/v1/ticker/price': 1, 'spot/quote/v1/ticker/book_ticker': 1, 'spot/v3/public/symbols': 1, 'spot/v3/public/quote/depth': 1, 'spot/v3/public/quote/depth/merged': 1, 'spot/v3/public/quote/trades': 1, 'spot/v3/public/quote/kline': 1, 'spot/v3/public/quote/ticker/24hr': 1, 'spot/v3/public/quote/ticker/price': 1, 'spot/v3/public/quote/ticker/bookTicker': 1, 'spot/v3/public/server-time': 1, 'spot/v3/public/infos': 1, // data 'v2/public/time': 1, 'v3/public/time': 1, 'v2/public/announcement': 1, // USDC endpoints // option USDC 'option/usdc/openapi/public/v1/order-book': 1, 'option/usdc/openapi/public/v1/symbols': 1, 'option/usdc/openapi/public/v1/tick': 1, 'option/usdc/openapi/public/v1/delivery-price': 1, 'option/usdc/openapi/public/v1/query-trade-latest': 1, 'option/usdc/openapi/public/v1/query-historical-volatility': 1, 'option/usdc/openapi/public/v1/all-tickers': 1, // perpetual swap USDC 'perpetual/usdc/openapi/public/v1/order-book': 1, 'perpetual/usdc/openapi/public/v1/symbols': 1, 'perpetual/usdc/openapi/public/v1/tick': 1, 'perpetual/usdc/openapi/public/v1/kline/list': 1, 'perpetual/usdc/openapi/public/v1/mark-price-kline': 1, 'perpetual/usdc/openapi/public/v1/index-price-kline': 1, 'perpetual/usdc/openapi/public/v1/premium-index-kline': 1, 'perpetual/usdc/openapi/public/v1/open-interest': 1, 'perpetual/usdc/openapi/public/v1/big-deal': 1, 'perpetual/usdc/openapi/public/v1/account-ratio': 1, 'perpetual/usdc/openapi/public/v1/prev-funding-rate': 1, 'perpetual/usdc/openapi/public/v1/risk-limit/list': 1, // account 'asset/v1/public/deposit/allowed-deposit-list': 1, 'contract/v3/public/copytrading/symbol/list': 1, // derivative 'derivatives/v3/public/order-book/L2': 1, 'derivatives/v3/public/kline': 1, 'derivatives/v3/public/tickers': 1, 'derivatives/v3/public/instruments-info': 1, 'derivatives/v3/public/mark-price-kline': 1, 'derivatives/v3/public/index-price-kline': 1, 'derivatives/v3/public/funding/history-funding-rate': 1, 'derivatives/v3/public/risk-limit/list': 1, 'derivatives/v3/public/delivery-price': 1, 'derivatives/v3/public/recent-trade': 1, 'derivatives/v3/public/open-interest': 1, 'derivatives/v3/public/insurance': 1, }, }, 'private': { 'get': { // inverse swap 'v2/private/order/list': 5, 'v2/private/order': 5, 'v2/private/stop-order/list': 5, 'v2/private/stop-order': 1, 'v2/private/position/list': 25, 'v2/private/position/fee-rate': 40, 'v2/private/execution/list': 25, 'v2/private/trade/closed-pnl/list': 1, 'v2/public/risk-limit/list': 1, // TODO check 'v2/public/funding/prev-funding-rate': 25, // TODO check 'v2/private/funding/prev-funding': 25, 'v2/private/funding/predicted-funding': 25, 'v2/private/account/api-key': 5, 'v2/private/account/lcp': 1, 'v2/private/wallet/balance': 25, // 120 per minute = 2 per second => cost = 50 / 2 = 25 'v2/private/wallet/fund/records': 25, 'v2/private/wallet/withdraw/list': 25, 'v2/private/exchange-order/list': 1, // linear swap USDT 'private/linear/order/list': 5, // 600 per minute = 10 per second => cost = 50 / 10 = 5 'private/linear/order/search': 5, 'private/linear/stop-order/list': 5, 'private/linear/stop-order/search': 5, 'private/linear/position/list': 25, 'private/linear/trade/execution/list': 25, 'private/linear/trade/closed-pnl/list': 25, 'public/linear/risk-limit': 1, 'private/linear/funding/predicted-funding': 25, 'private/linear/funding/prev-funding': 25, // inverse futures 'futures/private/order/list': 5, 'futures/private/order': 5, 'futures/private/stop-order/list': 5, 'futures/private/stop-order': 5, 'futures/private/position/list': 25, 'futures/private/execution/list': 25, 'futures/private/trade/closed-pnl/list': 1, // spot 'spot/v1/account': 2.5, 'spot/v1/order': 2.5, 'spot/v1/open-orders': 2.5, 'spot/v1/history-orders': 2.5, 'spot/v1/myTrades': 2.5, 'spot/v1/cross-margin/order': 10, 'spot/v1/cross-margin/accounts/balance': 10, 'spot/v1/cross-margin/loan-info': 10, 'spot/v1/cross-margin/repay/history': 10, 'spot/v3/private/order': 2.5, 'spot/v3/private/open-orders': 2.5, 'spot/v3/private/history-orders': 2.5, 'spot/v3/private/my-trades': 2.5, 'spot/v3/private/account': 2.5, 'spot/v3/private/reference': 2.5, 'spot/v3/private/record': 2.5, 'spot/v3/private/cross-margin-orders': 10, 'spot/v3/private/cross-margin-account': 10, 'spot/v3/private/cross-margin-loan-info': 10, 'spot/v3/private/cross-margin-repay-history': 10, // account 'asset/v1/private/transfer/list': 50, // 60 per minute = 1 per second => cost = 50 / 1 = 50 'asset/v3/private/transfer/inter-transfer/list/query': 0.84, // 60/s 'asset/v1/private/sub-member/transfer/list': 50, 'asset/v3/private/transfer/sub-member/list/query': 0.84, // 60/s 'asset/v3/private/transfer/sub-member-transfer/list/query': 0.84, // 60/s 'asset/v3/private/transfer/universal-transfer/list/query': 0.84, // 60/s 'asset/v1/private/sub-member/member-ids': 50, 'asset/v1/private/deposit/record/query': 50, 'asset/v1/private/withdraw/record/query': 25, 'asset/v1/private/coin-info/query': 25, 'asset/v3/private/coin-info/query': 25, // 2/s 'asset/v1/private/asset-info/query': 50, 'asset/v1/private/deposit/address': 100, 'asset/v3/private/deposit/address/query': 0.17, // 300/s 'asset/v1/private/universal/transfer/list': 50, 'contract/v3/private/copytrading/order/list': 1, 'contract/v3/private/copytrading/position/list': 1, 'contract/v3/private/copytrading/wallet/balance': 1, 'contract/v3/private/position/limit-info': 25, // 120 per minute = 2 per second => cost = 50 / 2 = 25 'contract/v3/private/order/unfilled-orders': 1, 'contract/v3/private/order/list': 1, 'contract/v3/private/position/list': 1, 'contract/v3/private/execution/list': 1, 'contract/v3/private/position/closed-pnl': 1, 'contract/v3/private/account/wallet/balance': 1, 'contract/v3/private/account/fee-rate': 1, 'contract/v3/private/account/wallet/fund-records': 1, // derivative 'unified/v3/private/order/unfilled-orders': 1, 'unified/v3/private/order/list': 1, 'unified/v3/private/position/list': 1, 'unified/v3/private/execution/list': 1, 'unified/v3/private/delivery-record': 1, 'unified/v3/private/settlement-record': 1, 'unified/v3/private/account/wallet/balance': 1, 'unified/v3/private/account/transaction-log': 1, 'asset/v2/private/exchange/exchange-order-all': 1, 'unified/v3/private/account/borrow-history': 1, 'unified/v3/private/account/borrow-rate': 1, 'user/v3/private/frozen-sub-member': 10, // 5/s 'user/v3/private/query-sub-members': 5, // 10/s 'user/v3/private/query-api': 5, // 10/s 'asset/v3/private/transfer/transfer-coin/list/query': 0.84, // 60/s 'asset/v3/private/transfer/account-coin/balance/query': 0.84, // 60/s 'asset/v3/private/transfer/asset-info/query': 0.84, // 60/s 'asset/v3/public/deposit/allowed-deposit-list/query': 0.17, // 300/s 'asset/v3/private/deposit/record/query': 0.17, // 300/s 'asset/v3/private/withdraw/record/query': 0.17, // 300/s }, 'post': { // inverse swap 'v2/private/order/create': 30, 'v2/private/order/cancel': 30, 'v2/private/order/cancelAll': 300, // 100 per minute + 'consumes 10 requests' 'v2/private/order/replace': 30, 'v2/private/stop-order/create': 30, 'v2/private/stop-order/cancel': 30, 'v2/private/stop-order/cancelAll': 300, 'v2/private/stop-order/replace': 30, 'v2/private/position/change-position-margin': 40, 'v2/private/position/trading-stop': 40, 'v2/private/position/leverage/save': 40, 'v2/private/tpsl/switch-mode': 40, 'v2/private/position/switch-isolated': 2.5, 'v2/private/position/risk-limit': 2.5, 'v2/private/position/switch-mode': 2.5, // linear swap USDT 'private/linear/order/create': 30, // 100 per minute = 1.666 per second => cost = 50 / 1.6666 = 30 'private/linear/order/cancel': 30, 'private/linear/order/cancel-all': 300, // 100 per minute + 'consumes 10 requests' 'private/linear/order/replace': 30, 'private/linear/stop-order/create': 30, 'private/linear/stop-order/cancel': 30, 'private/linear/stop-order/cancel-all': 300, 'private/linear/stop-order/replace': 30, 'private/linear/position/set-auto-add-margin': 40, 'private/linear/position/switch-isolated': 40, 'private/linear/position/switch-mode': 40, 'private/linear/tpsl/switch-mode': 2.5, 'private/linear/position/add-margin': 40, 'private/linear/position/set-leverage': 40, // 75 per minute = 1.25 per second => cost = 50 / 1.25 = 40 'private/linear/position/trading-stop': 40, 'private/linear/position/set-risk': 2.5, // inverse futures 'futures/private/order/create': 30, 'futures/private/order/cancel': 30, 'futures/private/order/cancelAll': 30, 'futures/private/order/replace': 30, 'futures/private/stop-order/create': 30, 'futures/private/stop-order/cancel': 30, 'futures/private/stop-order/cancelAll': 30, 'futures/private/stop-order/replace': 30, 'futures/private/position/change-position-margin': 40, 'futures/private/position/trading-stop': 40, 'futures/private/position/leverage/save': 40, 'futures/private/position/switch-mode': 40, 'futures/private/tpsl/switch-mode': 40, 'futures/private/position/switch-isolated': 40, 'futures/private/position/risk-limit': 2.5, // spot 'spot/v1/order': 2.5, 'spot/v1/cross-margin/loan': 10, 'spot/v1/cross-margin/repay': 10, 'spot/v3/private/order': 2.5, 'spot/v3/private/cancel-order': 2.5, 'spot/v3/private/cancel-orders': 2.5, 'spot/v3/private/cancel-orders-by-ids': 2.5, 'spot/v3/private/purchase': 2.5, 'spot/v3/private/redeem': 2.5, 'spot/v3/private/cross-margin-loan': 10, 'spot/v3/private/cross-margin-repay': 10, // account 'asset/v1/private/transfer': 150, // 20 per minute = 0.333 per second => cost = 50 / 0.3333 = 150 'asset/v3/private/transfer/inter-transfer': 2.5, // 20/s 'asset/v1/private/sub-member/transfer': 150, 'asset/v1/private/withdraw': 50, 'asset/v3/private/withdraw/create': 1, // 10/s 'asset/v1/private/withdraw/cancel': 50, 'asset/v3/private/withdraw/cancel': 0.84, // 60/s 'asset/v1/private/transferable-subs/save': 3000, 'asset/v1/private/universal/transfer': 1500, 'asset/v3/private/transfer/sub-member-transfer': 2.5, // 20/s 'asset/v3/private/transfer/transfer-sub-member-save': 2.5, // 20/s 'asset/v3/private/transfer/universal-transfer': 2.5, // 20/s 'user/v3/private/create-sub-member': 10, // 5/s 'user/v3/private/create-sub-api': 10, // 5/s 'user/v3/private/update-api': 10, // 5/s 'user/v3/private/delete-api': 10, // 5/s 'user/v3/private/update-sub-api': 10, // 5/s 'user/v3/private/delete-sub-api': 10, // 5/s // USDC endpoints // option USDC 'option/usdc/openapi/private/v1/place-order': 2.5, 'option/usdc/openapi/private/v1/batch-place-order': 2.5, 'option/usdc/openapi/private/v1/replace-order': 2.5, 'option/usdc/openapi/private/v1/batch-replace-orders': 2.5, 'option/usdc/openapi/private/v1/cancel-order': 2.5, 'option/usdc/openapi/private/v1/batch-cancel-orders': 2.5, 'option/usdc/openapi/private/v1/cancel-all': 2.5, 'option/usdc/openapi/private/v1/query-active-orders': 2.5, 'option/usdc/openapi/private/v1/query-order-history': 2.5, 'option/usdc/openapi/private/v1/execution-list': 2.5, 'option/usdc/openapi/private/v1/query-transaction-log': 2.5, 'option/usdc/openapi/private/v1/query-wallet-balance': 2.5, 'option/usdc/openapi/private/v1/query-asset-info': 2.5, 'option/usdc/openapi/private/v1/query-margin-info': 2.5, 'option/usdc/openapi/private/v1/query-position': 2.5, 'option/usdc/openapi/private/v1/query-delivery-list': 2.5, 'option/usdc/openapi/private/v1/query-position-exp-date': 2.5, 'option/usdc/openapi/private/v1/mmp-modify': 2.5, 'option/usdc/openapi/private/v1/mmp-reset': 2.5, // perpetual swap USDC 'perpetual/usdc/openapi/private/v1/place-order': 2.5, 'perpetual/usdc/openapi/private/v1/replace-order': 2.5, 'perpetual/usdc/openapi/private/v1/cancel-order': 2.5, 'perpetual/usdc/openapi/private/v1/cancel-all': 2.5, 'perpetual/usdc/openapi/private/v1/position/leverage/save': 2.5, 'option/usdc/openapi/private/v1/session-settlement': 2.5, 'option/usdc/private/asset/account/setMarginMode': 2.5, 'perpetual/usdc/openapi/public/v1/risk-limit/list': 2.5, 'perpetual/usdc/openapi/private/v1/position/set-risk-limit': 2.5, 'perpetual/usdc/openapi/private/v1/predicted-funding': 2.5, 'contract/v3/private/copytrading/order/create': 2.5, 'contract/v3/private/copytrading/order/cancel': 2.5, 'contract/v3/private/copytrading/order/close': 2.5, 'contract/v3/private/copytrading/position/close': 2.5, 'contract/v3/private/copytrading/position/set-leverage': 2.5, 'contract/v3/private/copytrading/wallet/transfer': 2.5, 'contract/v3/private/copytrading/order/trading-stop': 2.5, 'contract/v3/private/order/create': 1, 'contract/v3/private/order/cancel': 1, 'contract/v3/private/order/cancel-all': 1, 'contract/v3/private/order/replace': 1, 'contract/v3/private/position/set-auto-add-margin': 1, 'contract/v3/private/position/switch-isolated': 1, 'contract/v3/private/position/switch-mode': 1, 'contract/v3/private/position/switch-tpsl-mode': 1, 'contract/v3/private/position/set-leverage': 1, 'contract/v3/private/position/trading-stop': 1, 'contract/v3/private/position/set-risk-limit': 1, 'contract/v3/private/account/setMarginMode': 1, // derivative 'unified/v3/private/order/create': 2.5, 'unified/v3/private/order/replace': 2.5, 'unified/v3/private/order/cancel': 2.5, 'unified/v3/private/order/create-batch': 2.5, 'unified/v3/private/order/replace-batch': 2.5, 'unified/v3/private/order/cancel-batch': 2.5, 'unified/v3/private/order/cancel-all': 2.5, 'unified/v3/private/position/set-leverage': 2.5, 'unified/v3/private/position/tpsl/switch-mode': 2.5, 'unified/v3/private/position/set-risk-limit': 2.5, 'unified/v3/private/position/trading-stop': 2.5, 'unified/v3/private/account/upgrade-unified-account': 2.5, }, 'delete': { // spot 'spot/v1/order': 2.5, 'spot/v1/order/fast': 2.5, 'spot/order/batch-cancel': 2.5, 'spot/order/batch-fast-cancel': 2.5, 'spot/order/batch-cancel-by-ids': 2.5, }, }, }, 'httpExceptions': { '403': RateLimitExceeded, // Forbidden -- You request too many times }, 'exceptions': { // Uncodumented explanation of error strings: // - oc_diff: order cost needed to place this order // - new_oc: total order cost of open orders including the order you are trying to open // - ob: order balance - the total cost of current open orders // - ab: available balance 'exact': { '-10009': BadRequest, // {"ret_code":-10009,"ret_msg":"Invalid period!","result":null,"token":null} '-1004': BadRequest, // {"ret_code":-1004,"ret_msg":"Missing required parameter \u0027symbol\u0027","ext_code":null,"ext_info":null,"result":null} '-1021': BadRequest, // {"ret_code":-1021,"ret_msg":"Timestamp for this request is outside of the recvWindow.","ext_code":null,"ext_info":null,"result":null} '-1103': BadRequest, // An unknown parameter was sent. '-1140': InvalidOrder, // {"ret_code":-1140,"ret_msg":"Transaction amount lower than the minimum.","result":{},"ext_code":"","ext_info":null,"time_now":"1659204910.248576"} '-1197': InvalidOrder, // {"ret_code":-1197,"ret_msg":"Your order quantity to buy is too large. The filled price may deviate significantly from the market price. Please try again","result":{},"ext_code":"","ext_info":null,"time_now":"1659204531.979680"} '-2013': InvalidOrder, // {"ret_code":-2013,"ret_msg":"Order does not exist.","ext_code":null,"ext_info":null,"result":null} '-2015': AuthenticationError, // Invalid API-key, IP, or permissions for action. '-6017': BadRequest, // Repayment amount has exceeded the total liability '-6025': BadRequest, // Amount to borrow cannot be lower than the min. amount to borrow (per transaction) '-6029': BadRequest, // Amount to borrow has exceeded the user's estimated max amount to borrow '5004': ExchangeError, // {"retCode":5004,"retMsg":"Server Timeout","result":null,"retExtInfo":{},"time":1667577060106} '7001': BadRequest, // {"retCode":7001,"retMsg":"request params type error"} '10001': BadRequest, // parameter error '10002': InvalidNonce, // request expired, check your timestamp and recv_window '10003': AuthenticationError, // Invalid apikey '10004': AuthenticationError, // invalid sign '10005': PermissionDenied, // permission denied for current apikey '10006': RateLimitExceeded, // too many requests '10007': AuthenticationError, // api_key not found in your request parameters '10008': AuthenticationError, // User had been banned '10009': AuthenticationError, // IP had been banned '10010': PermissionDenied, // request ip mismatch '10014': BadRequest, // Request is duplicate '10016': ExchangeError, // {"retCode":10016,"retMsg":"System error. Please try again later."} '10017': BadRequest, // request path not found or request method is invalid '10018': RateLimitExceeded, // exceed ip rate limit '10020': PermissionDenied, // {"retCode":10020,"retMsg":"your account is not a unified margin account, please update your account","result":null,"retExtInfo":null,"time":1664783731123} '10027': PermissionDenied, // Trading Banned '12201': BadRequest, // {"retCode":12201,"retMsg":"Invalid orderCategory parameter.","result":{},"retExtInfo":null,"time":1666699391220} '110001': InvalidOrder, // Order does not exist '110003': InvalidOrder, // Order price is out of permissible range '110004': InsufficientFunds, // Insufficient wallet balance '110005': InvalidOrder, // position status '110006': InsufficientFunds, // cannot afford estimated position_margin '110007': InsufficientFunds, // {"retCode":110007,"retMsg":"ab not enough for new order","result":{},"retExtInfo":{},"time":1668838414793} '110008': InvalidOrder, // Order has been finished or canceled '110009': InvalidOrder, // The number of stop orders exceeds maximum limit allowed '110010': InvalidOrder, // Order already cancelled '110011': InvalidOrder, // Any adjustments made will trigger immediate liquidation '110012': InsufficientFunds, // Available balance not enough '110013': BadRequest, // Due to risk limit, cannot set leverage '110014': InsufficientFunds, // Available balance not enough to add margin '110015': BadRequest, // the position is in cross_margin '110016': InvalidOrder, // Requested quantity of contracts exceeds risk limit, please adjust your risk limit level before trying again '110017': InvalidOrder, // Reduce-only rule not satisfied '110018': BadRequest, // userId illegal '110019': InvalidOrder, // orderId illegal '110020': InvalidOrder, // number of active orders greater than 500 '110021': InvalidOrder, // Open Interest exceeded '110022': InvalidOrder, // qty has been limited, cannot modify the order to add qty '110023': InvalidOrder, // This contract only supports position reduction operation, please contact customer service for details '110024': InvalidOrder, // You have an existing position, so position mode cannot be switched '110025': InvalidOrder, // Position mode is not modified '110026': InvalidOrder, // Cross/isolated margin mode is not modified '110027': InvalidOrder, // Margin is not modified '110028': InvalidOrder, // Open orders exist, so you cannot change position mode '110029': InvalidOrder, // Hedge mode is not available for this symbol '110030': InvalidOrder, // Duplicate orderId '110031': InvalidOrder, // risk limit info does not exists '110032': InvalidOrder, // Illegal order '110033': InvalidOrder, // Margin cannot be set without open position '110034': InvalidOrder, // There is no net position '110035': InvalidOrder, // Cancel order is not completed before liquidation '110036': InvalidOrder, // Cross margin mode is not allowed to change leverage '110037': InvalidOrder, // User setting list does not have this symbol '110038': InvalidOrder, // Portfolio margin mode is not allowed to change leverage '110039': InvalidOrder, // Maintain margin rate is too high, which may trigger liquidation '110040': InvalidOrder, // Order will trigger forced liquidation, please resubmit the order '110041': InvalidOrder, // Skip liquidation is not allowed when a position or maker order exists '110042': InvalidOrder, // Pre-delivery status can only reduce positions '110043': BadRequest, // Set leverage not modified '110044': InsufficientFunds, // Insufficient available margin '110045': InsufficientFunds, // Insufficient wallet balance '110046': BadRequest, // Any adjustments made will trigger immediate liquidation '110047': BadRequest, // Risk limit cannot be adjusted due to insufficient available margin '110048': BadRequest, // Risk limit cannot be adjusted as the current/expected position value held exceeds the revised risk limit '110049': BadRequest, // Tick notes can only be numbers '110050': BadRequest, // Coin is not in the range of selected '110051': InsufficientFunds, // The user's available balance cannot cover the lowest price of the current market '110052': InsufficientFunds, // User's available balance is insufficient to set a price '110053': InsufficientFunds, // The user's available balance cannot cover the current market price and upper limit price '110054': InvalidOrder, // This position has at least one take profit link order, so the take profit and stop loss mode cannot be switched '110055': InvalidOrder, // This position has at least one stop loss link order, so the take profit and stop loss mode cannot be switched '110056': InvalidOrder, // This position has at least one trailing stop link order, so the take profit and stop loss mode cannot be switched '110057': InvalidOrder, // Conditional order or limit order contains TP/SL related params '110058': InvalidOrder, // Insufficient number of remaining position size to set take profit and stop loss '110059': InvalidOrder, // In the case of partial filled of the open order, it is not allowed to modify the take profit and stop loss settings of the open order '110060': BadRequest, // Under full TP/SL mode, it is not allowed to modify TP/SL '110061': BadRequest, // Under partial TP/SL mode, TP/SL set more than 20 '110062': BadRequest, // Institution MMP profile not found. '110063': ExchangeError, // Settlement in progress! xxx not available for trades. '110064': InvalidOrder, // The number of contracts modified cannot be less than or equal to the filled quantity '110065': PermissionDenied, // MMP hasn't yet been enabled for your account. Please contact your BD manager. '110066': ExchangeError, // No trading is allowed at the current time '110067': PermissionDenied, // unified account is not support '110068': PermissionDenied, // Leveraged user trading is not allowed '110069': PermissionDenied, // Do not allow OTC lending users to trade '110070': InvalidOrder, // ETP symbols are not allowed to be traded '130006': InvalidOrder, // {"ret_code":130006,"ret_msg":"The number of contracts exceeds maximum limit allowed: too large","ext_code":"","ext_info":"","result":null,"time_now":"1658397095.099030","rate_limit_status":99,"rate_limit_reset_ms":1658397095097,"rate_limit":100} '130021': InsufficientFunds, // {"ret_code":130021,"ret_msg":"orderfix price failed for CannotAffordOrderCost.","ext_code":"","ext_info":"","result":null,"time_now":"1644588250.204878","rate_limit_status":98,"rate_limit_reset_ms":1644588250200,"rate_limit":100} | {"ret_code":130021,"ret_msg":"oc_diff[1707966351], new_oc[1707966351] with ob[....]+AB[....]","ext_code":"","ext_info":"","result":null,"time_now":"1658395300.872766","rate_limit_status":99,"rate_limit_reset_ms":1658395300855,"rate_limit":100} caused issues/9149#issuecomment-1146559498 '130074': InvalidOrder, // {"ret_code":130074,"ret_msg":"expect Rising, but trigger_price[190000000] \u003c= current[211280000]??LastPrice","ext_code":"","ext_info":"","result":null,"time_now":"1655386638.067076","rate_limit_status":97,"rate_limit_reset_ms":1655386638065,"rate_limit":100} '131001': InsufficientFunds, // {"retCode":131001,"retMsg":"the available balance is not sufficient to cover the handling fee","result":{},"retExtInfo":{},"time":1666892821245} '140003': InvalidOrder, // Order price is out of permissible range '140004': InsufficientFunds, // Insufficient wallet balance '140005': InvalidOrder, // position status '140006': InsufficientFunds, // cannot afford estimated position_margin '140007': InsufficientFunds, // Insufficient available balance '140008': InvalidOrder, // Order has been finished or canceled '140009': InvalidOrder, // The number of stop orders exceeds maximum limit allowed '140010': InvalidOrder, // Order already cancelled '140011': InvalidOrder, // Any adjustments made will trigger immediate liquidation '140012': InsufficientFunds, // Available balance not enough '140013': BadRequest, // Due to risk limit, cannot set leverage '140014': InsufficientFunds, // Available balance not enough to add margin '140015': InvalidOrder, // the position is in cross_margin '140016': InvalidOrder, // Requested quantity of contracts exceeds risk limit, please adjust your risk limit level before trying again '140017': InvalidOrder, // Reduce-only rule not satisfied '140018': BadRequest, // userId illegal '140019': InvalidOrder, // orderId illegal '140020': InvalidOrder, // number of active orders greater than 500 '140021': InvalidOrder, // Open Interest exceeded '140022': InvalidOrder, // qty has been limited, cannot modify the order to add qty '140023': InvalidOrder, // This contract only supports position reduction operation, please contact customer service for details '140024': BadRequest, // You have an existing position, so position mode cannot be switched '140025': BadRequest, // Position mode is not modified '140026': BadRequest, // Cross/isolated margin mode is not modified '140027': BadRequest, // Margin is not modified '140028': InvalidOrder, // Open orders exist, so you cannot change position mode '140029': BadRequest, // Hedge mode is not available for this symbol '140030': InvalidOrder, // Duplicate orderId '140031': BadRequest, // risk limit info does not exists '140032': InvalidOrder, // Illegal order '140033': InvalidOrder, // Margin cannot be set without open position '140034': InvalidOrder, // There is no net position '140035': InvalidOrder, // Cancel order is not completed before liquidation '140036': BadRequest, // Cross margin mode is not allowed to change leverage '140037': InvalidOrder, // User setting list does not have this symbol '140038': BadRequest, // Portfolio margin mode is not allowed to change leverage '140039': BadRequest, // Maintain margin rate is too high, which may trigger liquidation '140040': InvalidOrder, // Order will trigger forced liquidation, please resubmit the order '140041': InvalidOrder, // Skip liquidation is not allowed when a position or maker order exists '140042': InvalidOrder, // Pre-delivery status can only reduce positions '140043': BadRequest, // Set leverage not modified '140044': InsufficientFunds, // Insufficient available margin '140045': InsufficientFunds, // Insufficient wallet balance '140046': BadRequest, // Any adjustments made will trigger immediate liquidation '140047': BadRequest, // Risk limit cannot be adjusted due to insufficient available margin '140048': BadRequest, // Risk limit cannot be adjusted as the current/expected position value held exceeds the revised risk limit '140049': BadRequest, // Tick notes can only be numbers '140050': InvalidOrder, // Coin is not in the range of selected '140051': InsufficientFunds, // The user's available balance cannot cover the lowest price of the current market '140052': InsufficientFunds, // User's available balance is insufficient to set a price '140053': InsufficientFunds, // The user's available balance cannot cover the current market price and upper limit price '140054': InvalidOrder, // This position has at least one take profit link order, so the take profit and stop loss mode cannot be switched '140055': InvalidOrder, // This position has at least one stop loss link order, so the take profit and stop loss mode cannot be switched '140056': InvalidOrder, // This position has at least one trailing stop link order, so the take profit and stop loss mode cannot be switched '140057': InvalidOrder, // Conditional order or limit order contains TP/SL related params '140058': InvalidOrder, // Insufficient number of remaining position size to set take profit and stop loss '140059': InvalidOrder, // In the case of partial filled of the open order, it is not allowed to modify the take profit and stop loss settings of the open order '140060': BadRequest, // Under full TP/SL mode, it is not allowed to modify TP/SL '140061': BadRequest, // Under partial TP/SL mode, TP/SL set more than 20 '140062': BadRequest, // Institution MMP profile not found. '140063': ExchangeError, // Settlement in progress! xxx not available for trades. '140064': InvalidOrder, // The number of contracts modified cannot be less than or equal to the filled quantity '140065': PermissionDenied, // MMP hasn't yet been enabled for your account. Please contact your BD manager. '140066': ExchangeError, // No trading is allowed at the current time '140067': PermissionDenied, // unified account is not support '140068': PermissionDenied, // Leveraged user trading is not allowed '140069': PermissionDenied, // Do not allow OTC lending users to trade '140070': InvalidOrder, // ETP symbols are not allowed to be traded '20001': OrderNotFound, // Order not exists '20003': InvalidOrder, // missing parameter side '20004': InvalidOrder, // invalid parameter side '20005': InvalidOrder, // missing parameter symbol '20006': InvalidOrder, // invalid parameter symbol '20007': InvalidOrder, // missing parameter order_type '20008': InvalidOrder, // invalid parameter order_type '20009': InvalidOrder, // missing parameter qty '20010': InvalidOrder, // qty must be greater than 0 '20011': InvalidOrder, // qty must be an integer '20012': InvalidOrder, // qty must be greater than zero and less than 1 million '20013': InvalidOrder, // missing parameter price '20014': InvalidOrder, // price must be greater than 0 '20015': InvalidOrder, // missing parameter time_in_force '20016': InvalidOrder, // invalid value for parameter time_in_force '20017': InvalidOrder, // missing parameter order_id '20018': InvalidOrder, // invalid date format '20019': InvalidOrder, // missing parameter stop_px '20020': InvalidOrder, // missing parameter base_price '20021': InvalidOrder, // missing parameter stop_order_id '20022': BadRequest, // missing parameter leverage '20023': BadRequest, // leverage must be a number '20031': BadRequest, // leverage must be greater than zero '20070': BadRequest, // missing parameter margin '20071': BadRequest, // margin must be greater than zero '20084': BadRequest, // order_id or order_link_id is required '30001': BadRequest, // order_link_id is repeated '30003': InvalidOrder, // qty must be more than the minimum allowed '30004': InvalidOrder, // qty must be less than the maximum allowed '30005': InvalidOrder, // price exceeds maximum allowed '30007': InvalidOrder, // price exceeds minimum allowed '30008': InvalidOrder, // invalid order_type '30009': ExchangeError, // no position found '30010': InsufficientFunds, // insufficient wallet balance '30011': PermissionDenied, // operation not allowed as position is undergoing liquidation '30012': PermissionDenied, // operation not allowed as position is undergoing ADL '30013': PermissionDenied, // position is in liq