UNPKG

ccxt

Version:

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

951 lines (948 loc) • 211 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var sha2_js = require('@noble/hashes/sha2.js'); var hashkey$1 = require('./abstract/hashkey.js'); var errors = require('./base/errors.js'); var Precise = require('./base/Precise.js'); var number = require('./base/functions/number.js'); // ---------------------------------------------------------------------------- // --------------------------------------------------------------------------- /** * @class hashkey * @augments Exchange */ class hashkey extends hashkey$1["default"] { describe() { return this.deepExtend(super.describe(), { 'id': 'hashkey', 'name': 'HashKey Global', 'countries': ['BM'], // Bermuda 'rateLimit': 100, 'version': 'v1', 'certified': true, 'pro': true, 'has': { 'CORS': undefined, 'spot': true, 'margin': false, 'swap': true, 'future': false, 'option': false, 'addMargin': true, 'borrowCrossMargin': false, 'borrowIsolatedMargin': false, 'borrowMargin': false, 'cancelAllOrders': true, 'cancelAllOrdersAfter': false, 'cancelOrder': true, 'cancelOrders': true, 'cancelWithdraw': false, 'closeAllPositions': false, 'closePosition': false, 'createConvertTrade': false, 'createDepositAddress': false, 'createMarketBuyOrderWithCost': true, 'createMarketOrder': true, 'createMarketOrderWithCost': false, 'createMarketSellOrderWithCost': false, 'createOrder': true, 'createOrderWithTakeProfitAndStopLoss': false, 'createReduceOnlyOrder': true, 'createStopLimitOrder': true, 'createStopLossOrder': false, 'createStopMarketOrder': true, 'createStopOrder': true, 'createTakeProfitOrder': false, 'createTrailingAmountOrder': false, 'createTrailingPercentOrder': false, 'createTriggerOrder': true, 'fetchAccounts': true, 'fetchAllGreeks': false, 'fetchBalance': true, 'fetchBorrowInterest': false, 'fetchBorrowRate': false, 'fetchBorrowRateHistories': false, 'fetchBorrowRateHistory': false, 'fetchBorrowRates': false, 'fetchBorrowRatesPerSymbol': false, 'fetchCanceledAndClosedOrders': true, 'fetchCanceledOrders': true, 'fetchClosedOrder': true, 'fetchClosedOrders': false, 'fetchConvertCurrencies': false, 'fetchConvertQuote': false, 'fetchConvertTrade': false, 'fetchConvertTradeHistory': false, 'fetchCrossBorrowRate': false, 'fetchCrossBorrowRates': false, 'fetchCurrencies': true, 'fetchDepositAddress': true, 'fetchDepositAddresses': false, 'fetchDepositAddressesByNetwork': false, 'fetchDeposits': true, 'fetchDepositsWithdrawals': false, 'fetchFundingHistory': false, 'fetchFundingInterval': false, 'fetchFundingIntervals': false, 'fetchFundingRate': true, 'fetchFundingRateHistory': true, 'fetchFundingRates': true, 'fetchGreeks': false, 'fetchIndexOHLCV': false, 'fetchIsolatedBorrowRate': false, 'fetchIsolatedBorrowRates': false, 'fetchIsolatedPositions': false, 'fetchLedger': true, 'fetchLeverage': true, 'fetchLeverages': false, 'fetchLeverageTiers': true, 'fetchLiquidations': false, 'fetchLongShortRatio': false, 'fetchLongShortRatioHistory': false, 'fetchMarginAdjustmentHistory': false, 'fetchMarginMode': false, 'fetchMarginModes': false, 'fetchMarketLeverageTiers': 'emulated', 'fetchMarkets': true, 'fetchMarkOHLCV': false, 'fetchMarkPrice': false, 'fetchMarkPrices': false, 'fetchMyLiquidations': false, 'fetchMySettlementHistory': false, 'fetchMyTrades': true, 'fetchOHLCV': true, 'fetchOpenInterest': false, 'fetchOpenInterestHistory': false, 'fetchOpenInterests': false, 'fetchOpenOrder': false, 'fetchOpenOrders': true, 'fetchOption': false, 'fetchOptionChain': false, 'fetchOrder': true, 'fetchOrderBook': true, 'fetchOrders': false, 'fetchOrderTrades': false, 'fetchPosition': false, 'fetchPositionHistory': false, 'fetchPositionMode': false, 'fetchPositions': true, 'fetchPositionsForSymbol': true, 'fetchPositionsHistory': false, 'fetchPositionsRisk': false, 'fetchPremiumIndexOHLCV': false, 'fetchSettlementHistory': false, 'fetchStatus': true, 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFee': true, // emulated for spot markets 'fetchTradingFees': true, // for spot markets only 'fetchTransactions': false, 'fetchTransfers': false, 'fetchUnderlyingAssets': false, 'fetchVolatilityHistory': false, 'fetchWithdrawals': true, 'reduceMargin': true, 'repayCrossMargin': false, 'repayIsolatedMargin': false, 'sandbox': false, 'setLeverage': true, 'setMargin': false, 'setMarginMode': true, 'setPositionMode': false, 'transfer': true, 'withdraw': true, }, 'timeframes': { '1m': '1m', '3m': '3m', '5m': '5m', '15m': '15m', '30m': '30m', '1h': '1h', '2h': '2h', '4h': '4h', '6h': '6h', '8h': '8h', '12h': '12h', '1d': '1d', '1w': '1w', '1M': '1M', }, 'urls': { 'logo': 'https://github.com/user-attachments/assets/3dd65db2-5da9-4ecc-93ac-6d420f36261c', 'api': { 'public': 'https://api-glb.hashkey.com', 'private': 'https://api-glb.hashkey.com', }, 'test': { 'public': 'https://api-glb.sim.hashkeydev.com', 'private': 'https://api-glb.sim.hashkeydev.com', }, 'www': 'https://global.hashkey.com/', 'doc': 'https://hashkeyglobal-apidoc.readme.io/', 'fees': 'https://support.global.hashkey.com/hc/en-us/articles/13199900083612-HashKey-Global-Fee-Structure', 'referral': 'https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN', }, 'api': { 'public': { 'get': { 'api/v1/exchangeInfo': 5, 'quote/v1/depth': 1, 'quote/v1/trades': 1, 'quote/v1/klines': 1, 'quote/v1/ticker/24hr': 1, 'quote/v1/ticker/price': 1, 'quote/v1/ticker/bookTicker': 1, // not unified 'quote/v1/depth/merged': 1, 'quote/v1/markPrice': 1, 'quote/v1/index': 1, 'api/v1/futures/fundingRate': 1, 'api/v1/futures/historyFundingRate': 1, 'api/v1/ping': 1, 'api/v1/time': 1, }, }, 'private': { 'get': { 'api/v1/spot/order': 1, 'api/v1/spot/openOrders': 1, 'api/v1/spot/tradeOrders': 5, 'api/v1/futures/leverage': 1, 'api/v1/futures/order': 1, 'api/v1/futures/openOrders': 1, 'api/v1/futures/userTrades': 1, 'api/v1/futures/positions': 1, 'api/v1/futures/historyOrders': 1, 'api/v1/futures/balance': 1, 'api/v1/futures/liquidationAssignStatus': 1, 'api/v1/futures/riskLimit': 1, 'api/v1/futures/commissionRate': 1, 'api/v1/futures/getBestOrder': 1, 'api/v1/coinInfo': 1, 'api/v1/account/vipInfo': 1, 'api/v1/account': 1, 'api/v1/account/trades': 5, 'api/v1/account/type': 5, 'api/v1/account/chainType': 1, 'api/v1/account/checkApiKey': 1, 'api/v1/account/balanceFlow': 5, 'api/v1/spot/subAccount/openOrders': 1, 'api/v1/spot/subAccount/tradeOrders': 1, 'api/v1/subAccount/trades': 1, 'api/v1/futures/subAccount/openOrders': 1, 'api/v1/futures/subAccount/historyOrders': 1, 'api/v1/futures/subAccount/userTrades': 1, 'api/v1/account/deposit/address': 1, 'api/v1/account/depositOrders': 1, 'api/v1/account/withdrawOrders': 1, }, 'post': { 'api/v1/userDataStream': 1, 'api/v1/spot/orderTest': 1, 'api/v1/spot/order': 1, 'api/v1.1/spot/order': 1, 'api/v1/spot/batchOrders': 5, 'api/v1/futures/leverage': 1, 'api/v1/futures/order': 1, 'api/v1/futures/marginType': 1, 'api/v1/futures/positionMargin': 1, 'api/v1/futures/position/trading-stop': 3, 'api/v1/futures/batchOrders': 5, 'api/v1/account/assetTransfer': 1, 'api/v1/account/authAddress': 1, 'api/v1/account/withdraw': 1, }, 'put': { 'api/v1/userDataStream': 1, }, 'delete': { 'api/v1/spot/order': 1, 'api/v1/spot/openOrders': 5, 'api/v1/spot/cancelOrderByIds': 5, 'api/v1/futures/order': 1, 'api/v1/futures/batchOrders': 1, 'api/v1/futures/cancelOrderByIds': 1, 'api/v1/userDataStream': 1, }, }, }, 'fees': { 'trading': { 'spot': { 'tierBased': true, 'percentage': true, 'feeSide': 'get', 'maker': this.parseNumber('0.0012'), 'taker': this.parseNumber('0.0012'), 'tiers': { 'maker': [ [this.parseNumber('0'), this.parseNumber('0.0012')], [this.parseNumber('1000000'), this.parseNumber('0.00080')], [this.parseNumber('5000000'), this.parseNumber('0.00070')], [this.parseNumber('10000000'), this.parseNumber('0.00060')], [this.parseNumber('50000000'), this.parseNumber('0.00040')], [this.parseNumber('200000000'), this.parseNumber('0.00030')], [this.parseNumber('400000000'), this.parseNumber('0.00010')], [this.parseNumber('800000000'), this.parseNumber('0.00')], ], 'taker': [ [this.parseNumber('0'), this.parseNumber('0.0012')], [this.parseNumber('1000000'), this.parseNumber('0.00090')], [this.parseNumber('5000000'), this.parseNumber('0.00085')], [this.parseNumber('10000000'), this.parseNumber('0.00075')], [this.parseNumber('50000000'), this.parseNumber('0.00065')], [this.parseNumber('200000000'), this.parseNumber('0.00045')], [this.parseNumber('400000000'), this.parseNumber('0.00040')], [this.parseNumber('800000000'), this.parseNumber('0.00035')], ], }, }, 'swap': { 'tierBased': true, 'percentage': true, 'feeSide': 'get', 'maker': this.parseNumber('0.00025'), 'taker': this.parseNumber('0.00060'), 'tiers': { 'maker': [ [this.parseNumber('0'), this.parseNumber('0.00025')], [this.parseNumber('1000000'), this.parseNumber('0.00016')], [this.parseNumber('5000000'), this.parseNumber('0.00014')], [this.parseNumber('10000000'), this.parseNumber('0.00012')], [this.parseNumber('50000000'), this.parseNumber('0.000080')], [this.parseNumber('200000000'), this.parseNumber('0.000060')], [this.parseNumber('400000000'), this.parseNumber('0.000020')], [this.parseNumber('800000000'), this.parseNumber('0.00')], ], 'taker': [ [this.parseNumber('0'), this.parseNumber('0.00060')], [this.parseNumber('1000000'), this.parseNumber('0.00050')], [this.parseNumber('5000000'), this.parseNumber('0.00045')], [this.parseNumber('10000000'), this.parseNumber('0.00040')], [this.parseNumber('50000000'), this.parseNumber('0.00035')], [this.parseNumber('200000000'), this.parseNumber('0.00030')], [this.parseNumber('400000000'), this.parseNumber('0.00025')], [this.parseNumber('800000000'), this.parseNumber('0.00020')], ], }, }, }, }, 'options': { 'broker': '10000700011', 'recvWindow': undefined, 'sandboxMode': false, 'networks': { 'BTC': 'BTC', 'ERC20': 'ETH', 'AVAX': 'AvalancheC', 'SOL': 'Solana', 'MATIC': 'Polygon', 'ATOM': 'Cosmos', 'DOT': 'Polkadot', 'LTC': 'LTC', 'OPTIMISM': 'Optimism', 'ARB': 'Arbitrum', 'DOGE': 'Dogecoin', 'TRC20': 'Tron', 'ZKSYNC': 'zkSync', 'TON': 'TON', 'KLAYTN': 'Klaytn', 'MERLINCHAIN': 'Merlin Chain', }, 'networksById': { 'BTC': 'BTC', 'Bitcoin': 'BTC', 'ETH': 'ERC20', 'ERC20': 'ERC20', 'AvalancheC': 'AVAX', 'AVAX C-Chain': 'AVAX', 'Solana': 'SOL', 'Cosmos': 'ATOM', 'Arbitrum': 'ARB', 'Polygon': 'MATIC', 'Optimism': 'OPTIMISM', 'Polkadot': 'DOT', 'LTC': 'LTC', 'Litecoin': 'LTC', 'Dogecoin': 'DOGE', 'Merlin Chain': 'MERLINCHAIN', 'zkSync': 'ZKSYNC', 'TRC20': 'TRC20', 'Tron': 'TRC20', 'TON': 'TON', 'BSC(BEP20)': 'BSC', 'Klaytn': 'KLAYTN', }, 'defaultNetwork': 'ERC20', }, 'features': { 'default': { 'sandbox': true, 'createOrder': { 'marginMode': false, 'triggerPrice': false, 'triggerPriceType': undefined, 'triggerDirection': false, 'stopLossPrice': false, 'takeProfitPrice': false, 'attachedStopLossTakeProfit': undefined, 'timeInForce': { 'IOC': true, 'FOK': true, 'PO': true, 'GTD': false, }, 'hedged': false, 'trailing': false, 'leverage': false, 'marketBuyByCost': true, 'marketBuyRequiresPrice': true, // todo fix 'selfTradePrevention': true, // todo implement 'iceberg': false, }, 'createOrders': { 'max': 20, }, 'fetchMyTrades': { 'marginMode': false, 'limit': 1000, 'daysBack': 30, 'untilDays': 30, 'symbolRequired': false, }, 'fetchOrder': { 'marginMode': false, 'trigger': false, 'trailing': false, 'symbolRequired': false, }, 'fetchOpenOrders': { 'marginMode': false, 'limit': 1000, 'trigger': false, 'trailing': false, 'symbolRequired': false, }, 'fetchOrders': undefined, 'fetchClosedOrders': undefined, // todo 'fetchOHLCV': { 'limit': 1000, }, }, 'spot': { 'extends': 'default', }, 'forDerivatives': { 'extends': 'default', 'createOrder': { 'triggerPrice': true, 'selfTradePrevention': true, }, 'fetchOpenOrders': { 'trigger': true, 'limit': 500, }, }, 'swap': { 'linear': { 'extends': 'forDerivatives', }, 'inverse': undefined, }, 'future': { 'linear': undefined, 'inverse': undefined, }, }, 'commonCurrencies': {}, 'exceptions': { 'exact': { '0001': errors.BadRequest, // Required field '%s' missing or invalid. '0002': errors.AuthenticationError, // Incorrect signature '0003': errors.RateLimitExceeded, // Rate limit exceeded '0102': errors.AuthenticationError, // Invalid APIKey '0103': errors.AuthenticationError, // APIKey expired '0104': errors.PermissionDenied, // The accountId defined is not permissible '0201': errors.ExchangeError, // Instrument not found '0202': errors.PermissionDenied, // Invalid IP '0206': errors.BadRequest, // Unsupported order type '0207': errors.BadRequest, // Invalid price '0209': errors.BadRequest, // Invalid price precision '0210': errors.BadRequest, // Price outside of allowed range '0211': errors.OrderNotFound, // Order not found '0401': errors.InsufficientFunds, // Insufficient asset '0402': errors.BadRequest, // Invalid asset '-1000': errors.ExchangeError, // An unknown error occurred while processing the request '-1001': errors.ExchangeError, // Internal error '-100010': errors.BadSymbol, // Invalid Symbols! '-100012': errors.BadSymbol, // Parameter symbol [String] missing! '-1002': errors.AuthenticationError, // Unauthorized operation '-1004': errors.BadRequest, // Bad request '-1005': errors.PermissionDenied, // No permission '-1006': errors.ExchangeError, // Execution status unknown '-1007': errors.RequestTimeout, // Timeout waiting for response from server '-1014': errors.InvalidOrder, // Unsupported order combination '-1015': errors.InvalidOrder, // Too many new orders '-1020': errors.OperationRejected, // Unsupported operation '-1021': errors.InvalidNonce, // Timestamp for this request is outside of the recvWindow '-1024': errors.BadRequest, // Duplicate request '-1101': errors.ExchangeNotAvailable, // Feature has been offline '-1115': errors.InvalidOrder, // Invalid timeInForce '-1117': errors.InvalidOrder, // Invalid order side '-1123': errors.InvalidOrder, // Invalid client order id '-1124': errors.InvalidOrder, // Invalid price '-1126': errors.InvalidOrder, // Invalid quantity '-1129': errors.BadRequest, // Invalid parameters, quantity and amount are not allowed to be sent at the same time. '-1130': errors.BadRequest, // Illegal parameter '%s' '-1132': errors.BadRequest, // Order price greater than the maximum '-1133': errors.BadRequest, // Order price lower than the minimum '-1135': errors.BadRequest, // Order quantity greater than the maximum '-1136': errors.BadRequest, // Order quantity lower than the minimum '-1138': errors.InvalidOrder, // Order has been partially cancelled '-1137': errors.InvalidOrder, // Order quantity precision too large '-1139': errors.OrderImmediatelyFillable, // Order has been filled '-1140': errors.InvalidOrder, // Order amount lower than the minimum '-1141': errors.DuplicateOrderId, // Duplicate order '-1142': errors.OrderNotFillable, // Order has been cancelled '-1143': errors.OrderNotFound, // Order not found on order book '-1144': errors.OperationRejected, // Order has been locked '-1145': errors.NotSupported, // Cancellation on this order type not supported '-1146': errors.RequestTimeout, // Order creation timeout '-1147': errors.RequestTimeout, // Order cancellation timeout '-1148': errors.InvalidOrder, // Order amount precision too large '-1149': errors.OperationRejected, // Order creation failed '-1150': errors.OperationFailed, // Order cancellation failed '-1151': errors.OperationRejected, // The trading pair is not open yet '-1152': errors.AccountNotEnabled, // User does not exist '-1153': errors.InvalidOrder, // Invalid price type '-1154': errors.InvalidOrder, // Invalid position side '-1155': errors.OperationRejected, // The trading pair is not available for api trading '-1156': errors.OperationFailed, // Limit maker order creation failed '-1157': errors.OperationFailed, // Modify futures margin failed '-1158': errors.OperationFailed, // Reduce margin is forbidden '-1159': errors.AccountNotEnabled, // Finance account already exists '-1160': errors.AccountNotEnabled, // Account does not exist '-1161': errors.OperationFailed, // Balance transfer failed '-1162': errors.ContractUnavailable, // Unsupport contract address '-1163': errors.InvalidAddress, // Illegal withdrawal address '-1164': errors.OperationFailed, // Withdraw failed '-1165': errors.ArgumentsRequired, // Withdrawal amount cannot be null '-1166': errors.OperationRejected, // Withdrawal amount exceeds the daily limit '-1167': errors.BadRequest, // Withdrawal amount less than the minimum '-1168': errors.BadRequest, // Illegal withdrawal amount '-1169': errors.PermissionDenied, // Withdraw not allowed '-1170': errors.PermissionDenied, // Deposit not allowed '-1171': errors.PermissionDenied, // Withdrawal address not in whitelist '-1172': errors.BadRequest, // Invalid from account id '-1173': errors.BadRequest, // Invalid to account i '-1174': errors.PermissionDenied, // Transfer not allowed between the same account '-1175': errors.BadRequest, // Invalid fiat deposit status '-1176': errors.BadRequest, // Invalid fiat withdrawal status '-1177': errors.InvalidOrder, // Invalid fiat order type '-1178': errors.AccountNotEnabled, // Brokerage account does not exist '-1179': errors.AccountSuspended, // Address owner is not true '-1181': errors.ExchangeError, // System error '-1193': errors.OperationRejected, // Order creation count exceeds the limit '-1194': errors.OperationRejected, // Market order creation forbidden '-1195': errors.BadRequest, // Market order long position cannot exceed %s above the market price '-1196': errors.BadRequest, // Market order short position cannot be below %s of the market price '-1200': errors.BadRequest, // Order buy quantity too small '-1201': errors.BadRequest, // Order buy quantity too large '-1202': errors.BadRequest, // Order sell quantity too small '-1203': errors.BadRequest, // Order sell quantity too large '-1204': errors.BadRequest, // From account must be a main account '-1205': errors.AccountNotEnabled, // Account not authorized '-1206': errors.BadRequest, // Order amount greater than the maximum '-1207': errors.BadRequest, // The status of deposit is invalid '-1208': errors.BadRequest, // The orderType of fiat is invalid '-1209': errors.BadRequest, // The status of withdraw is invalid '-2001': errors.ExchangeNotAvailable, // Platform is yet to open trading '-2002': errors.OperationFailed, // The number of open orders exceeds the limit 300 '-2003': errors.OperationFailed, // Position size cannot meet target leverage '-2004': errors.OperationFailed, // Adjust leverage fail '-2005': errors.RequestTimeout, // Adjust leverage timeout '-2010': errors.OperationRejected, // New order rejected '-2011': errors.OperationRejected, // Order cancellation rejected '-2016': errors.OperationRejected, // API key creation exceeds the limit '-2017': errors.OperationRejected, // Open orders exceeds the limit of the trading pair '-2018': errors.OperationRejected, // Trade user creation exceeds the limit '-2019': errors.PermissionDenied, // Trader and omnibus user not allowed to login app '-2020': errors.PermissionDenied, // Not allowed to trade this trading pair '-2021': errors.PermissionDenied, // Not allowed to trade this trading pair '-2022': errors.OperationRejected, // Order batch size exceeds the limit '-2023': errors.AuthenticationError, // Need to pass KYC verification '-2024': errors.AccountNotEnabled, // Fiat account does not exist '-2025': errors.AccountNotEnabled, // Custody account not exist '-2026': errors.BadRequest, // Invalid type '-2027': errors.OperationRejected, // Exceed maximum time range of 30 days '-2028': errors.OperationRejected, // The search is limited to data within the last one month '-2029': errors.OperationRejected, // The search is limited to data within the last three months '-2030': errors.InsufficientFunds, // Insufficient margin '-2031': errors.NotSupported, // Leverage reduction is not supported in Isolated Margin Mode with open positions '-2032': errors.OperationRejected, // After the transaction, your %s position will account for %s of the total position, which poses concentration risk. Do you want to continue with the transaction? '-2033': errors.OperationFailed, // Order creation failed. Please verify if the order parameters comply with the trading rules '-2034': errors.InsufficientFunds, // Trade account holding limit is zero '-2035': errors.OperationRejected, // The sub account has been frozen and cannot transfer '-2036': errors.NotSupported, // We do not support queries for records exceeding 30 days '-2037': errors.ExchangeError, // Position and order data error '-2038': errors.InsufficientFunds, // Insufficient margin '-2039': errors.NotSupported, // Leverage reduction is not supported in Isolated Margin Mode with open positions '-2040': errors.ExchangeNotAvailable, // There is a request being processed. Please try again later '-2041': errors.BadRequest, // Token does not exist '-2042': errors.OperationRejected, // You have passed the trade limit, please pay attention to the risks '-2043': errors.OperationRejected, // Maximum allowed leverage reached, please lower your leverage '-2044': errors.BadRequest, // This order price is unreasonable to exceed (or be lower than) the liquidation price '-2045': errors.BadRequest, // Price too low, please order again! '-2046': errors.BadRequest, // Price too high, please order again! '-2048': errors.BadRequest, // Exceed the maximum number of conditional orders of %s '-2049': errors.BadRequest, // Create stop order buy price too big '-2050': errors.BadRequest, // Create stop order sell price too small '-2051': errors.OperationRejected, // Create order rejected '-2052': errors.OperationRejected, // Create stop profit-loss plan order reject '-2053': errors.OperationRejected, // Position not enough '-2054': errors.BadRequest, // Invalid long stop profit price '-2055': errors.BadRequest, // Invalid long stop loss price '-2056': errors.BadRequest, // Invalid short stop profit price '-2057': errors.BadRequest, // Invalid short stop loss price '-3117': errors.PermissionDenied, // Invalid permission '-3143': errors.PermissionDenied, // According to KYC and risk assessment, your trading account has exceeded the limit. '-3144': errors.PermissionDenied, // Currently, your trading account has exceeded its limit and is temporarily unable to perform transfers '-3145': errors.DDoSProtection, // Please DO NOT submit request too frequently '-4001': errors.BadRequest, // Invalid asset '-4002': errors.BadRequest, // Withdrawal amount less than Minimum Withdrawal Amount '-4003': errors.InsufficientFunds, // Insufficient Balance '-4004': errors.BadRequest, // Invalid bank account number '-4005': errors.BadRequest, // Assets are not listed '-4006': errors.AccountNotEnabled, // KYC is not certified '-4007': errors.NotSupported, // Withdrawal channels are not supported '-4008': errors.AccountNotEnabled, // This currency does not support this customer type '-4009': errors.PermissionDenied, // No withdrawal permission '-4010': errors.PermissionDenied, // Withdrawals on the same day exceed the maximum limit for a single day '-4011': errors.ExchangeError, // System error '-4012': errors.ExchangeError, // Parameter error '-4013': errors.OperationFailed, // Withdraw repeatly }, 'broad': {}, }, 'precisionMode': number.TICK_SIZE, }); } /** * @method * @name hashkey#fetchTime * @description fetches the current integer timestamp in milliseconds from the exchange server * @see https://hashkeyglobal-apidoc.readme.io/reference/check-server-time * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int} the current integer timestamp in milliseconds from the exchange server */ async fetchTime(params = {}) { const response = await this.publicGetApiV1Time(params); // // { // "serverTime": 1721661553214 // } // return this.safeInteger(response, 'serverTime'); } /** * @method * @name hashkey#fetchStatus * @description the latest known information on the availability of the exchange API * @see https://hashkeyglobal-apidoc.readme.io/reference/test-connectivity * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [status structure]{@link https://docs.ccxt.com/?id=exchange-status-structure} */ async fetchStatus(params = {}) { const response = await this.publicGetApiV1Ping(params); // // {} // return { 'status': 'ok', 'updated': undefined, 'eta': undefined, 'url': undefined, 'info': response, }; } /** * @method * @name hashkey#fetchMarkets * @description retrieves data on all markets for the exchange * @see https://hashkeyglobal-apidoc.readme.io/reference/exchangeinfo * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.symbol] the id of the market to fetch * @returns {object[]} an array of objects representing market data */ async fetchMarkets(params = {}) { const request = {}; const response = await this.publicGetApiV1ExchangeInfo(this.extend(request, params)); // // { // "timezone": "UTC", // "serverTime": "1721661653952", // "brokerFilters": [], // "symbols": [ // { // "symbol": "BTCUSDT", // "symbolName": "BTCUSDT", // "status": "TRADING", // "baseAsset": "BTC", // "baseAssetName": "BTC", // "baseAssetPrecision": "0.00001", // "quoteAsset": "USDT", // "quoteAssetName": "USDT", // "quotePrecision": "0.0000001", // "retailAllowed": true, // "piAllowed": true, // "corporateAllowed": true, // "omnibusAllowed": true, // "icebergAllowed": false, // "isAggregate": false, // "allowMargin": false, // "filters": [ // { // "minPrice": "0.01", // "maxPrice": "100000.00000000", // "tickSize": "0.01", // "filterType": "PRICE_FILTER" // }, // { // "minQty": "0.00001", // "maxQty": "8", // "stepSize": "0.00001", // "marketOrderMinQty": "0.00001", // "marketOrderMaxQty": "4", // "filterType": "LOT_SIZE" // }, // { // "minNotional": "1", // "filterType": "MIN_NOTIONAL" // }, // { // "minAmount": "1", // "maxAmount": "400000", // "minBuyPrice": "0", // "marketOrderMinAmount": "1", // "marketOrderMaxAmount": "200000", // "filterType": "TRADE_AMOUNT" // }, // { // "maxSellPrice": "0", // "buyPriceUpRate": "0.1", // "sellPriceDownRate": "0.1", // "filterType": "LIMIT_TRADING" // }, // { // "buyPriceUpRate": "0.1", // "sellPriceDownRate": "0.1", // "filterType": "MARKET_TRADING" // }, // { // "noAllowMarketStartTime": "1710485700000", // "noAllowMarketEndTime": "1710486000000", // "limitOrderStartTime": "0", // "limitOrderEndTime": "0", // "limitMinPrice": "0", // "limitMaxPrice": "0", // "filterType": "OPEN_QUOTE" // } // ] // } // ], // "options": [ ], // "contracts": [ // { // "filters": [ // { // "minPrice": "0.1", // "maxPrice": "100000.00000000", // "tickSize": "0.1", // "filterType": "PRICE_FILTER" // }, // { // "minQty": "0.001", // "maxQty": "10", // "stepSize": "0.001", // "marketOrderMinQty": "0", // "marketOrderMaxQty": "0", // "filterType": "LOT_SIZE" // }, // { // "minNotional": "0", // "filterType": "MIN_NOTIONAL" // }, // { // "maxSellPrice": "999999", // "buyPriceUpRate": "0.05", // "sellPriceDownRate": "0.05", // "maxEntrustNum": 200, // "maxConditionNum": 200, // "filterType": "LIMIT_TRADING" // }, // { // "buyPriceUpRate": "0.05", // "sellPriceDownRate": "0.05", // "filterType": "MARKET_TRADING" // }, // { // "noAllowMarketStartTime": "0", // "noAllowMarketEndTime": "0", // "limitOrderStartTime": "0", // "limitOrderEndTime": "0", // "limitMinPrice": "0", // "limitMaxPrice": "0", // "filterType": "OPEN_QUOTE" // } // ], // "exchangeId": "301", // "symbol": "BTCUSDT-PERPETUAL", // "symbolName": "BTCUSDT-PERPETUAL", // "status": "TRADING", // "baseAsset": "BTCUSDT-PERPETUAL", // "baseAssetPrecision": "0.001", // "quoteAsset": "USDT", // "quoteAssetPrecision": "0.1", // "icebergAllowed": false, // "inverse": false, // "index": "USDT", // "marginToken": "USDT", // "marginPrecision": "0.0001", // "contractMultiplier": "0.001", // "underlying": "BTC", // "riskLimits": [ // { // "riskLimitId": "200000722", // "quantity": "1000.00", // "initialMargin": "0.10", // "maintMargin": "0.005", // "isWhite": false // }, // { // "riskLimitId": "200000723", // "quantity": "2000.00", // "initialMargin": "0.10", // "maintMargin": "0.01", // "isWhite": false // } // ] // } // ], // "coins": [ // { // "orgId": "9001", // "coinId": "BTC", // "coinName": "BTC", // "coinFullName": "Bitcoin", // "allowWithdraw": true, // "allowDeposit": true, // "tokenType": "CHAIN_TOKEN", // "chainTypes": [ // { // "chainType": "Bitcoin", // "withdrawFee": "0", // "minWithdrawQuantity": "0.002", // "maxWithdrawQuantity": "0", // "minDepositQuantity": "0.0005", // "allowDeposit": true, // "allowWithdraw": true // } // ] // } // ] // } // const spotMarkets = this.safeList(response, 'symbols', []); const swapMarkets = this.safeList(response, 'contracts', []); let markets = this.arrayConcat(spotMarkets, swapMarkets); if (this.isEmpty(markets)) { markets = [response]; // if user provides params.symbol the exchange returns a single object instead of list of objects } return this.parseMarkets(markets); } parseMarket(market) { // spot // { // "symbol": "BTCUSDT", // "symbolName": "BTCUSDT", // "status": "TRADING", // "baseAsset": "BTC", // "baseAssetName": "BTC", // "baseAssetPrecision": "0.00001", // "quoteAsset": "USDT", // "quoteAssetName": "USDT", // "quotePrecision": "0.0000001", // "retailAllowed": true, // "piAllowed": true, // "corporateAllowed": true, // "omnibusAllowed": true, // "icebergAllowed": false, // "isAggregate": false, // "allowMargin": false, // "filters": [ // { // "minPrice": "0.01", // "maxPrice": "100000.00000000", // "tickSize": "0.01", // "filterType": "PRICE_FILTER" // }, // { // "minQty": "0.00001", // "maxQty": "8", // "stepSize": "0.00001", // "marketOrderMinQty": "0.00001", // "marketOrderMaxQty": "4", // "filterType": "LOT_SIZE" // }, // { // "minNotional": "1", // "filterType": "MIN_NOTIONAL" // }, // { // "minAmount": "1", // "maxAmount": "400000", // "minBuyPrice": "0", // "marketOrderMinAmount": "1", // "marketOrderMaxAmount": "200000", // "filterType": "TRADE_AMOUNT" // }, // { // "maxSellPrice": "0", // "buyPriceUpRate": "0.1", // "sellPriceDownRate": "0.1", // "filterType": "LIMIT_TRADING" // }, // { // "buyPriceUpRate": "0.1", // "sellPriceDownRate": "0.1", // "filterType": "MARKET_TRADING" // }, // { // "noAllowMarketStartTime": "1710485700000", // "noAllowMarketEndTime": "1710486000000", // "limitOrderStartTime": "0", // "limitOrderEndTime": "0", // "limitMinPrice": "0", // "limitMaxPrice": "0", // "filterType": "OPEN_QUOTE" // } // ] // } // // swap // { // "filters": [ // { // "minPrice": "0.1", // "maxPrice": "100000.00000000", // "tickSize": "0.1", // "filterType": "PRICE_FILTER" // }, // { // "minQty": "0.001", // "maxQty": "10", // "stepSize": "0.001", //