# HashKey Global Exchange Specification # # Auto-generated by: mix ccxt.extract hashkey # CCXT version: 4.5.34 # Spec format version: 1 # # Review before use: # - signing: Detected from sign() method, verify with testnet # - endpoints: Raw paths extracted, map to unified API as needed # - exceptions: Extracted (exact, broad, HTTP status codes) # - features/options: Extracted from describe() # - classification: Set to :supported initially, promote after validation # %{ api_param_requirements: nil, certified: true, classification: :certified_pro, comment: nil, countries: [ "BM" ], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 44, "coveragePercent" => 100, "enabledMethods" => 48, "excluded" => [ %{ "method" => "fetchCanceledOrders", "reason" => "hashkey fetchCanceledOrders() is not supported yet" }, %{ "method" => "editOrder", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchMarketLeverageTiers", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 3, "extractableMethods" => 45, "failures" => [ %{ "error" => "hashkey fetchClosedOrder() is not implemented (has.fetchClosedOrder: true but method is undefined)", "method" => "fetchClosedOrder" } ] }, endpoints: [ %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :delete, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/api/v1/spot/openOrders", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :delete, name: :cancel_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/api/v1/spot/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "ids" => "test-order-id" }, market_type: :spot, method: :delete, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/api/v1/spot/cancelOrderByIds", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "type" => "LIMIT" }, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/api/v1/spot/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "side" => "BUY", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{ "cost" => "quantity" }, params: [ :symbol, :cost ], path: "/api/v1/spot/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/api/v1.1/spot/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/api/v1/spot/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clientOrderId" => "", "priceType" => "INPUT", "reduceOnly" => true, "side" => "BUY_CLOSE" }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/api/v1/futures/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clientOrderId" => "", "priceType" => "INPUT", "side" => "BUY_OPEN", "triggerDirection" => "below", "type" => "LIMIT" }, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/api/v1/futures/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clientOrderId" => "", "priceType" => "MARKET", "side" => "BUY_OPEN", "triggerDirection" => "below", "type" => "LIMIT" }, market_type: :swap, method: :post, name: :create_stop_market_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :side, :amount, :triggerPrice ], path: "/api/v1/futures/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clientOrderId" => "", "priceType" => "INPUT", "side" => "BUY_OPEN", "triggerDirection" => "below" }, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/api/v1/futures/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clientOrderId" => "", "priceType" => "INPUT", "side" => "BUY_OPEN", "triggerDirection" => "below", "type" => "STOP" }, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/api/v1/futures/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :get, name: :fetch_accounts, param_mappings: %{}, params: [], path: "/api/v1/account/type", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/api/v1/account", source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :get, name: :fetch_canceled_and_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/v1/spot/tradeOrders", source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/api/v1/exchangeInfo", response_transformer: {:extract_path, ["coins"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "chainType" => "ETH" }, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/api/v1/account/deposit/address", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/api/v1/account/depositOrders", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "timestamp" => "" }, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/api/v1/futures/fundingRate", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_funding_rate_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/v1/futures/historyFundingRate", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "timestamp" => "" }, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/api/v1/futures/fundingRate", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/quote/v1/depth", response_transformer: {:extract_path, ["t"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "endTime" => "" }, market_type: :spot, method: :get, name: :fetch_ledger, param_mappings: %{ "since" => "startTime" }, params: [ :code, :since, :limit ], path: "/api/v1/account/balanceFlow", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{}, params: [ :symbol ], path: "/api/v1/futures/leverage", source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, market_type: :swap, method: :get, name: :fetch_leverage_tiers, param_mappings: %{}, params: [ :symbols ], path: "/api/v1/exchangeInfo", response_transformer: {:extract_path, ["contracts"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/api/v1/exchangeInfo", source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :get, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/v1/account/trades", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_ohlcv, param_mappings: %{ "since" => "startTime", "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/quote/v1/klines", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/v1/spot/openOrders", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/api/v1/spot/order", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/quote/v1/depth", response_transformer: {:extract_path_unwrap, ["t"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/api/v1/futures/positions", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_positions_for_symbol, param_mappings: %{}, params: [ :symbol ], path: "/api/v1/futures/positions", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_status, param_mappings: %{}, params: [], path: "/api/v1/ping", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/quote/v1/ticker/24hr", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/quote/v1/ticker/24hr", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/api/v1/time", response_transformer: {:extract_path, ["serverTime"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/quote/v1/trades", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{}, params: [ :symbol ], path: "/api/v1/account/vipInfo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_trading_fees, param_mappings: %{}, params: [], path: "/api/v1/account/vipInfo", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/api/v1/account/withdrawOrders", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/api/v1/futures/leverage", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "amount" => "quantity", "code" => "coin", "fromAccount" => "fromAccountId", "toAccount" => "toAccountId" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/api/v1/account/assetTransfer", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :withdraw, param_mappings: %{ "amount" => "quantity", "code" => "coin" }, params: [ :code, :amount, :address, :tag ], path: "/api/v1/account/withdraw", source: :intercepted } ], error_code_details: %{ -1000 => %{ description: "An unknown error occurred while processing the request", type: :exchange_error }, -100010 => %{ description: "Invalid Symbols!", type: :invalid_order }, -100012 => %{ description: "Parameter symbol [String] missing!", type: :invalid_order }, -1001 => %{ description: "Internal error", type: :exchange_error }, -1002 => %{ description: "Unauthorized operation", type: :invalid_credentials }, -1004 => %{ description: "Bad request", type: :invalid_parameters }, -1005 => %{ description: "No permission", type: :access_restricted }, -1006 => %{ description: "Execution status unknown", type: :exchange_error }, -1007 => %{ description: "Timeout waiting for response from server", type: :network_error }, -1014 => %{ description: "Unsupported order combination", type: :invalid_order }, -1015 => %{ description: "Too many new orders", type: :invalid_order }, -1020 => %{ description: "Unsupported operation", type: :exchange_error }, -1021 => %{ description: "Timestamp for this request is outside of the recvWindow", type: :invalid_credentials }, -1024 => %{ description: "Duplicate request", type: :invalid_parameters }, -1101 => %{ description: "Feature has been offline", type: :network_error }, -1115 => %{ description: "Invalid timeInForce", type: :invalid_order }, -1117 => %{ description: "Invalid order side", type: :invalid_order }, -1123 => %{ description: "Invalid client order id", type: :invalid_order }, -1124 => %{ description: "Invalid price", type: :invalid_order }, -1126 => %{ description: "Invalid quantity", type: :invalid_order }, -1129 => %{ description: "Invalid parameters, quantity and amount are not allowed to be sent at the same time.", type: :invalid_parameters }, -1130 => %{ description: "Illegal parameter '%s'", type: :invalid_parameters }, -1132 => %{ description: "Order price greater than the maximum", type: :invalid_parameters }, -1133 => %{ description: "Order price lower than the minimum", type: :invalid_parameters }, -1135 => %{ description: "Order quantity greater than the maximum", type: :invalid_parameters }, -1136 => %{ description: "Order quantity lower than the minimum", type: :invalid_parameters }, -1137 => %{ description: "Order quantity precision too large", type: :invalid_order }, -1138 => %{ description: "Order has been partially cancelled", type: :invalid_order }, -1139 => %{ description: "Order has been filled", type: :invalid_order }, -1140 => %{ description: "Order amount lower than the minimum", type: :invalid_order }, -1141 => %{ description: "Duplicate order", type: :invalid_order }, -1142 => %{ description: "Order has been cancelled", type: :invalid_order }, -1143 => %{ description: "Order not found on order book", type: :order_not_found }, -1144 => %{ description: "Order has been locked", type: :exchange_error }, -1145 => %{ description: "Cancellation on this order type not supported", type: :exchange_error }, -1146 => %{ description: "Order creation timeout", type: :network_error }, -1147 => %{ description: "Order cancellation timeout", type: :network_error }, -1148 => %{ description: "Order amount precision too large", type: :invalid_order }, -1149 => %{ description: "Order creation failed", type: :exchange_error }, -1150 => %{ description: "Order cancellation failed", type: :exchange_error }, -1151 => %{ description: "The trading pair is not open yet", type: :exchange_error }, -1152 => %{ description: "User does not exist", type: :access_restricted }, -1153 => %{ description: "Invalid price type", type: :invalid_order }, -1154 => %{ description: "Invalid position side", type: :invalid_order }, -1155 => %{ description: "The trading pair is not available for api trading", type: :exchange_error }, -1156 => %{ description: "Limit maker order creation failed", type: :exchange_error }, -1157 => %{ description: "Modify futures margin failed", type: :exchange_error }, -1158 => %{ description: "Reduce margin is forbidden", type: :exchange_error }, -1159 => %{ description: "Finance account already exists", type: :access_restricted }, -1160 => %{ description: "Account does not exist", type: :access_restricted }, -1161 => %{ description: "Balance transfer failed", type: :exchange_error }, -1162 => %{ description: "Unsupport contract address", type: :market_closed }, -1163 => %{ description: "Illegal withdrawal address", type: :invalid_parameters }, -1164 => %{ description: "Withdraw failed", type: :exchange_error }, -1165 => %{ description: "Withdrawal amount cannot be null", type: :invalid_parameters }, -1166 => %{ description: "Withdrawal amount exceeds the daily limit", type: :exchange_error }, -1167 => %{ description: "Withdrawal amount less than the minimum", type: :invalid_parameters }, -1168 => %{ description: "Illegal withdrawal amount", type: :invalid_parameters }, -1169 => %{ description: "Withdraw not allowed", type: :access_restricted }, -1170 => %{ description: "Deposit not allowed", type: :access_restricted }, -1171 => %{ description: "Withdrawal address not in whitelist", type: :access_restricted }, -1172 => %{ description: "Invalid from account id", type: :invalid_parameters }, -1173 => %{ description: "Invalid to account i", type: :invalid_parameters }, -1174 => %{ description: "Transfer not allowed between the same account", type: :access_restricted }, -1175 => %{ description: "Invalid fiat deposit status", type: :invalid_parameters }, -1176 => %{ description: "Invalid fiat withdrawal status", type: :invalid_parameters }, -1177 => %{ description: "Invalid fiat order type", type: :invalid_order }, -1178 => %{ description: "Brokerage account does not exist", type: :access_restricted }, -1179 => %{ description: "Address owner is not true", type: :access_restricted }, -1181 => %{ description: "System error", type: :exchange_error }, -1193 => %{ description: "Order creation count exceeds the limit", type: :exchange_error }, -1194 => %{ description: "Market order creation forbidden", type: :exchange_error }, -1195 => %{ description: "Market order long position cannot exceed %s above the market price", type: :invalid_parameters }, -1196 => %{ description: "Market order short position cannot be below %s of the market price", type: :invalid_parameters }, -1200 => %{ description: "Order buy quantity too small", type: :invalid_parameters }, -1201 => %{ description: "Order buy quantity too large", type: :invalid_parameters }, -1202 => %{ description: "Order sell quantity too small", type: :invalid_parameters }, -1203 => %{ description: "Order sell quantity too large", type: :invalid_parameters }, -1204 => %{ description: "From account must be a main account", type: :invalid_parameters }, -1205 => %{ description: "Account not authorized", type: :access_restricted }, -1206 => %{ description: "Order amount greater than the maximum", type: :invalid_parameters }, -1207 => %{ description: "The status of deposit is invalid", type: :invalid_parameters }, -1208 => %{ description: "The orderType of fiat is invalid", type: :invalid_parameters }, -1209 => %{ description: "The status of withdraw is invalid", type: :invalid_parameters }, -2001 => %{ description: "Platform is yet to open trading", type: :network_error }, -2002 => %{ description: "The number of open orders exceeds the limit 300", type: :exchange_error }, -2003 => %{ description: "Position size cannot meet target leverage", type: :exchange_error }, -2004 => %{ description: "Adjust leverage fail", type: :exchange_error }, -2005 => %{ description: "Adjust leverage timeout", type: :network_error }, -2010 => %{ description: "New order rejected", type: :exchange_error }, -2011 => %{ description: "Order cancellation rejected", type: :exchange_error }, -2016 => %{ description: "API key creation exceeds the limit", type: :exchange_error }, -2017 => %{ description: "Open orders exceeds the limit of the trading pair", type: :exchange_error }, -2018 => %{ description: "Trade user creation exceeds the limit", type: :exchange_error }, -2019 => %{ description: "Trader and omnibus user not allowed to login app", type: :access_restricted }, -2020 => %{ description: "Not allowed to trade this trading pair", type: :access_restricted }, -2021 => %{ description: "Not allowed to trade this trading pair", type: :access_restricted }, -2022 => %{ description: "Order batch size exceeds the limit", type: :exchange_error }, -2023 => %{ description: "Need to pass KYC verification", type: :invalid_credentials }, -2024 => %{ description: "Fiat account does not exist", type: :access_restricted }, -2025 => %{ description: "Custody account not exist", type: :access_restricted }, -2026 => %{ description: "Invalid type", type: :invalid_parameters }, -2027 => %{ description: "Exceed maximum time range of 30 days", type: :exchange_error }, -2028 => %{ description: "The search is limited to data within the last one month", type: :exchange_error }, -2029 => %{ description: "The search is limited to data within the last three months", type: :exchange_error }, -2030 => %{ description: "Insufficient margin", type: :insufficient_balance }, -2031 => %{ description: "Leverage reduction is not supported in Isolated Margin Mode with open positions", type: :exchange_error }, -2032 => %{ description: "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?", type: :exchange_error }, -2033 => %{ description: "Order creation failed. Please verify if the order parameters comply with the trading rules", type: :exchange_error }, -2034 => %{ description: "Trade account holding limit is zero", type: :insufficient_balance }, -2035 => %{ description: "The sub account has been frozen and cannot transfer", type: :exchange_error }, -2036 => %{ description: "We do not support queries for records exceeding 30 days", type: :exchange_error }, -2037 => %{ description: "Position and order data error", type: :exchange_error }, -2038 => %{ description: "Insufficient margin", type: :insufficient_balance }, -2039 => %{ description: "Leverage reduction is not supported in Isolated Margin Mode with open positions", type: :exchange_error }, -2040 => %{ description: "There is a request being processed. Please try again later", type: :network_error }, -2041 => %{ description: "Token does not exist", type: :invalid_parameters }, -2042 => %{ description: "You have passed the trade limit, please pay attention to the risks", type: :exchange_error }, -2043 => %{ description: "Maximum allowed leverage reached, please lower your leverage", type: :exchange_error }, -2044 => %{ description: "This order price is unreasonable to exceed (or be lower than) the liquidation price", type: :invalid_parameters }, -2045 => %{ description: "Price too low, please order again!", type: :invalid_parameters }, -2046 => %{ description: "Price too high, please order again!", type: :invalid_parameters }, -2048 => %{ description: "Exceed the maximum number of conditional orders of %s", type: :invalid_parameters }, -2049 => %{ description: "Create stop order buy price too big", type: :invalid_parameters }, -2050 => %{ description: "Create stop order sell price too small", type: :invalid_parameters }, -2051 => %{ description: "Create order rejected", type: :exchange_error }, -2052 => %{ description: "Create stop profit-loss plan order reject", type: :exchange_error }, -2053 => %{ description: "Position not enough", type: :exchange_error }, -2054 => %{ description: "Invalid long stop profit price", type: :invalid_parameters }, -2055 => %{ description: "Invalid long stop loss price", type: :invalid_parameters }, -2056 => %{ description: "Invalid short stop profit price", type: :invalid_parameters }, -2057 => %{ description: "Invalid short stop loss price", type: :invalid_parameters }, -3117 => %{ description: "Invalid permission", type: :access_restricted }, -3143 => %{ description: "According to KYC and risk assessment, your trading account has exceeded the limit.", type: :access_restricted }, -3144 => %{ description: "Currently, your trading account has exceeded its limit and is temporarily unable to perform transfers", type: :access_restricted }, -3145 => %{ description: "Please DO NOT submit request too frequently", type: :rate_limited }, -4001 => %{ description: "Invalid asset", type: :invalid_parameters }, -4002 => %{ description: "Withdrawal amount less than Minimum Withdrawal Amount", type: :invalid_parameters }, -4003 => %{ description: "Insufficient Balance", type: :insufficient_balance }, -4004 => %{ description: "Invalid bank account number", type: :invalid_parameters }, -4005 => %{ description: "Assets are not listed", type: :invalid_parameters }, -4006 => %{ description: "KYC is not certified", type: :access_restricted }, -4007 => %{ description: "Withdrawal channels are not supported", type: :exchange_error }, -4008 => %{ description: "This currency does not support this customer type", type: :access_restricted }, -4009 => %{ description: "No withdrawal permission", type: :access_restricted }, -4010 => %{ description: "Withdrawals on the same day exceed the maximum limit for a single day", type: :access_restricted }, -4011 => %{ description: "System error", type: :exchange_error }, -4012 => %{ description: "Parameter error", type: :exchange_error }, -4013 => %{ description: "Withdraw repeatly", type: :exchange_error }, 1 => %{ description: "Required field '%s' missing or invalid.", type: :invalid_parameters }, 102 => %{ description: "Invalid APIKey", type: :invalid_credentials }, 103 => %{ description: "APIKey expired", type: :invalid_credentials }, 104 => %{ description: "The accountId defined is not permissible", type: :access_restricted }, 2 => %{ description: "Incorrect signature", type: :invalid_credentials }, 201 => %{ description: "Instrument not found", type: :exchange_error }, 202 => %{ description: "Invalid IP", type: :access_restricted }, 206 => %{ description: "Unsupported order type", type: :invalid_parameters }, 207 => %{ description: "Invalid price", type: :invalid_parameters }, 209 => %{ description: "Invalid price precision", type: :invalid_parameters }, 210 => %{ description: "Price outside of allowed range", type: :invalid_parameters }, 211 => %{ description: "Order not found", type: :order_not_found }, 3 => %{ description: "Rate limit exceeded", type: :rate_limited }, 401 => %{ description: "Insufficient asset", type: :insufficient_balance }, 402 => %{ description: "Invalid asset", type: :invalid_parameters } }, error_codes: %{ -1000 => :exchange_error, -100010 => :invalid_order, -100012 => :invalid_order, -1001 => :exchange_error, -1002 => :invalid_credentials, -1004 => :invalid_parameters, -1005 => :access_restricted, -1006 => :exchange_error, -1007 => :network_error, -1014 => :invalid_order, -1015 => :invalid_order, -1020 => :exchange_error, -1021 => :invalid_credentials, -1024 => :invalid_parameters, -1101 => :network_error, -1115 => :invalid_order, -1117 => :invalid_order, -1123 => :invalid_order, -1124 => :invalid_order, -1126 => :invalid_order, -1129 => :invalid_parameters, -1130 => :invalid_parameters, -1132 => :invalid_parameters, -1133 => :invalid_parameters, -1135 => :invalid_parameters, -1136 => :invalid_parameters, -1137 => :invalid_order, -1138 => :invalid_order, -1139 => :invalid_order, -1140 => :invalid_order, -1141 => :invalid_order, -1142 => :invalid_order, -1143 => :order_not_found, -1144 => :exchange_error, -1145 => :exchange_error, -1146 => :network_error, -1147 => :network_error, -1148 => :invalid_order, -1149 => :exchange_error, -1150 => :exchange_error, -1151 => :exchange_error, -1152 => :access_restricted, -1153 => :invalid_order, -1154 => :invalid_order, -1155 => :exchange_error, -1156 => :exchange_error, -1157 => :exchange_error, -1158 => :exchange_error, -1159 => :access_restricted, -1160 => :access_restricted, -1161 => :exchange_error, -1162 => :market_closed, -1163 => :invalid_parameters, -1164 => :exchange_error, -1165 => :invalid_parameters, -1166 => :exchange_error, -1167 => :invalid_parameters, -1168 => :invalid_parameters, -1169 => :access_restricted, -1170 => :access_restricted, -1171 => :access_restricted, -1172 => :invalid_parameters, -1173 => :invalid_parameters, -1174 => :access_restricted, -1175 => :invalid_parameters, -1176 => :invalid_parameters, -1177 => :invalid_order, -1178 => :access_restricted, -1179 => :access_restricted, -1181 => :exchange_error, -1193 => :exchange_error, -1194 => :exchange_error, -1195 => :invalid_parameters, -1196 => :invalid_parameters, -1200 => :invalid_parameters, -1201 => :invalid_parameters, -1202 => :invalid_parameters, -1203 => :invalid_parameters, -1204 => :invalid_parameters, -1205 => :access_restricted, -1206 => :invalid_parameters, -1207 => :invalid_parameters, -1208 => :invalid_parameters, -1209 => :invalid_parameters, -2001 => :network_error, -2002 => :exchange_error, -2003 => :exchange_error, -2004 => :exchange_error, -2005 => :network_error, -2010 => :exchange_error, -2011 => :exchange_error, -2016 => :exchange_error, -2017 => :exchange_error, -2018 => :exchange_error, -2019 => :access_restricted, -2020 => :access_restricted, -2021 => :access_restricted, -2022 => :exchange_error, -2023 => :invalid_credentials, -2024 => :access_restricted, -2025 => :access_restricted, -2026 => :invalid_parameters, -2027 => :exchange_error, -2028 => :exchange_error, -2029 => :exchange_error, -2030 => :insufficient_balance, -2031 => :exchange_error, -2032 => :exchange_error, -2033 => :exchange_error, -2034 => :insufficient_balance, -2035 => :exchange_error, -2036 => :exchange_error, -2037 => :exchange_error, -2038 => :insufficient_balance, -2039 => :exchange_error, -2040 => :network_error, -2041 => :invalid_parameters, -2042 => :exchange_error, -2043 => :exchange_error, -2044 => :invalid_parameters, -2045 => :invalid_parameters, -2046 => :invalid_parameters, -2048 => :invalid_parameters, -2049 => :invalid_parameters, -2050 => :invalid_parameters, -2051 => :exchange_error, -2052 => :exchange_error, -2053 => :exchange_error, -2054 => :invalid_parameters, -2055 => :invalid_parameters, -2056 => :invalid_parameters, -2057 => :invalid_parameters, -3117 => :access_restricted, -3143 => :access_restricted, -3144 => :access_restricted, -3145 => :rate_limited, -4001 => :invalid_parameters, -4002 => :invalid_parameters, -4003 => :insufficient_balance, -4004 => :invalid_parameters, -4005 => :invalid_parameters, -4006 => :access_restricted, -4007 => :exchange_error, -4008 => :access_restricted, -4009 => :access_restricted, -4010 => :access_restricted, -4011 => :exchange_error, -4012 => :exchange_error, -4013 => :exchange_error, 1 => :invalid_parameters, 102 => :invalid_credentials, 103 => :invalid_credentials, 104 => :access_restricted, 2 => :invalid_credentials, 201 => :exchange_error, 202 => :access_restricted, 206 => :invalid_parameters, 207 => :invalid_parameters, 209 => :invalid_parameters, 210 => :invalid_parameters, 211 => :order_not_found, 3 => :rate_limited, 401 => :insufficient_balance, 402 => :invalid_parameters }, exceptions: %{ exact: %{ "-1000" => :exchange_error, "-100010" => :bad_symbol, "-100012" => :bad_symbol, "-1001" => :exchange_error, "-1002" => :authentication_error, "-1004" => :bad_request, "-1005" => :permission_denied, "-1006" => :exchange_error, "-1007" => :request_timeout, "-1014" => :invalid_order, "-1015" => :invalid_order, "-1020" => :operation_rejected, "-1021" => :invalid_nonce, "-1024" => :bad_request, "-1101" => :exchange_not_available, "-1115" => :invalid_order, "-1117" => :invalid_order, "-1123" => :invalid_order, "-1124" => :invalid_order, "-1126" => :invalid_order, "-1129" => :bad_request, "-1130" => :bad_request, "-1132" => :bad_request, "-1133" => :bad_request, "-1135" => :bad_request, "-1136" => :bad_request, "-1137" => :invalid_order, "-1138" => :invalid_order, "-1139" => :order_immediately_fillable, "-1140" => :invalid_order, "-1141" => :duplicate_order_id, "-1142" => :order_not_fillable, "-1143" => :order_not_found, "-1144" => :operation_rejected, "-1145" => :not_supported, "-1146" => :request_timeout, "-1147" => :request_timeout, "-1148" => :invalid_order, "-1149" => :operation_rejected, "-1150" => :operation_failed, "-1151" => :operation_rejected, "-1152" => :account_not_enabled, "-1153" => :invalid_order, "-1154" => :invalid_order, "-1155" => :operation_rejected, "-1156" => :operation_failed, "-1157" => :operation_failed, "-1158" => :operation_failed, "-1159" => :account_not_enabled, "-1160" => :account_not_enabled, "-1161" => :operation_failed, "-1162" => :contract_unavailable, "-1163" => :invalid_address, "-1164" => :operation_failed, "-1165" => :arguments_required, "-1166" => :operation_rejected, "-1167" => :bad_request, "-1168" => :bad_request, "-1169" => :permission_denied, "-1170" => :permission_denied, "-1171" => :permission_denied, "-1172" => :bad_request, "-1173" => :bad_request, "-1174" => :permission_denied, "-1175" => :bad_request, "-1176" => :bad_request, "-1177" => :invalid_order, "-1178" => :account_not_enabled, "-1179" => :account_suspended, "-1181" => :exchange_error, "-1193" => :operation_rejected, "-1194" => :operation_rejected, "-1195" => :bad_request, "-1196" => :bad_request, "-1200" => :bad_request, "-1201" => :bad_request, "-1202" => :bad_request, "-1203" => :bad_request, "-1204" => :bad_request, "-1205" => :account_not_enabled, "-1206" => :bad_request, "-1207" => :bad_request, "-1208" => :bad_request, "-1209" => :bad_request, "-2001" => :exchange_not_available, "-2002" => :operation_failed, "-2003" => :operation_failed, "-2004" => :operation_failed, "-2005" => :request_timeout, "-2010" => :operation_rejected, "-2011" => :operation_rejected, "-2016" => :operation_rejected, "-2017" => :operation_rejected, "-2018" => :operation_rejected, "-2019" => :permission_denied, "-2020" => :permission_denied, "-2021" => :permission_denied, "-2022" => :operation_rejected, "-2023" => :authentication_error, "-2024" => :account_not_enabled, "-2025" => :account_not_enabled, "-2026" => :bad_request, "-2027" => :operation_rejected, "-2028" => :operation_rejected, "-2029" => :operation_rejected, "-2030" => :insufficient_funds, "-2031" => :not_supported, "-2032" => :operation_rejected, "-2033" => :operation_failed, "-2034" => :insufficient_funds, "-2035" => :operation_rejected, "-2036" => :not_supported, "-2037" => :exchange_error, "-2038" => :insufficient_funds, "-2039" => :not_supported, "-2040" => :exchange_not_available, "-2041" => :bad_request, "-2042" => :operation_rejected, "-2043" => :operation_rejected, "-2044" => :bad_request, "-2045" => :bad_request, "-2046" => :bad_request, "-2048" => :bad_request, "-2049" => :bad_request, "-2050" => :bad_request, "-2051" => :operation_rejected, "-2052" => :operation_rejected, "-2053" => :operation_rejected, "-2054" => :bad_request, "-2055" => :bad_request, "-2056" => :bad_request, "-2057" => :bad_request, "-3117" => :permission_denied, "-3143" => :permission_denied, "-3144" => :permission_denied, "-3145" => :ddos_protection, "-4001" => :bad_request, "-4002" => :bad_request, "-4003" => :insufficient_funds, "-4004" => :bad_request, "-4005" => :bad_request, "-4006" => :account_not_enabled, "-4007" => :not_supported, "-4008" => :account_not_enabled, "-4009" => :permission_denied, "-4010" => :permission_denied, "-4011" => :exchange_error, "-4012" => :exchange_error, "-4013" => :operation_failed, "0001" => :bad_request, "0002" => :authentication_error, "0003" => :rate_limit_exceeded, "0102" => :authentication_error, "0103" => :authentication_error, "0104" => :permission_denied, "0201" => :exchange_error, "0202" => :permission_denied, "0206" => :bad_request, "0207" => :bad_request, "0209" => :bad_request, "0210" => :bad_request, "0211" => :order_not_found, "0401" => :insufficient_funds, "0402" => :bad_request } }, exchange_options: %{ "broker" => "10000700011", "defaultNetwork" => "ERC20", "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "networks" => %{ "ARB" => "Arbitrum", "ATOM" => "Cosmos", "AVAX" => "AvalancheC", "BTC" => "BTC", "DOGE" => "Dogecoin", "DOT" => "Polkadot", "ERC20" => "ETH", "KLAYTN" => "Klaytn", "LTC" => "LTC", "MATIC" => "Polygon", "MERLINCHAIN" => "Merlin Chain", "OPTIMISM" => "Optimism", "SOL" => "Solana", "TON" => "TON", "TRC20" => "Tron", "ZKSYNC" => "zkSync" }, "networksById" => %{ "AVAX C-Chain" => "AVAX", "Arbitrum" => "ARB", "AvalancheC" => "AVAX", "BSC(BEP20)" => "BSC", "BTC" => "BTC", "Bitcoin" => "BTC", "Cosmos" => "ATOM", "Dogecoin" => "DOGE", "ERC20" => "ERC20", "ETH" => "ERC20", "Klaytn" => "KLAYTN", "LTC" => "LTC", "Litecoin" => "LTC", "Merlin Chain" => "MERLINCHAIN", "Optimism" => "OPTIMISM", "Polkadot" => "DOT", "Polygon" => "MATIC", "Solana" => "SOL", "TON" => "TON", "TRC20" => "TRC20", "Tron" => "TRC20", "zkSync" => "ZKSYNC" }, "recvWindow" => nil, "sandboxMode" => false }, extended_metadata: %{ fees_url: "https://support.global.hashkey.com/hc/en-us/articles/13199900083612-HashKey-Global-Fee-Structure", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/6dd6127b-cc19-4a13-9b29-a98d81f80e98", referral_url: "https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ default: %{ create_order: %{ hedged: false, iceberg: false, leverage: false, margin_mode: false, market_buy_by_cost: true, market_buy_requires_price: true, self_trade_prevention: true, stop_loss_price: false, take_profit_price: false, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: false, trigger_direction: false, trigger_price: false }, create_orders: %{ max: 20 }, fetch_my_trades: %{ days_back: 30, limit: 1000, margin_mode: false, symbol_required: false, until_days: 30 }, fetch_ohlcv: %{ limit: 1000 }, fetch_open_orders: %{ limit: 1000, margin_mode: false, symbol_required: false, trailing: false, trigger: false }, fetch_order: %{ margin_mode: false, symbol_required: false, trailing: false, trigger: false }, sandbox: true }, for_derivatives: %{ create_order: %{ self_trade_prevention: true, trigger_price: true }, extends: "default", fetch_open_orders: %{ limit: 500, trigger: true } }, future: %{}, spot: %{ extends: "default" }, swap: %{ linear: %{ extends: "forDerivatives" } } }, fees: nil, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (response === undefined) {\n return undefined;\n }\n let errorInArray = false;\n let responseCodeString = this.safeString(response, 'code', undefined);\n const responseCodeInteger = this.safeInteger(response, 'code', undefined); // some codes in response are returned as '0000' others as 0\n if (responseCodeInteger === 0) {\n const result = this.safeList(response, 'result', []); // for batch methods\n for (let i = 0; i < result.length; i++) {\n const entry = this.safeDict(result, i);\n const entryCodeInteger = this.safeInteger(entry, 'code');\n if (entryCodeInteger !== 0) {\n errorInArray = true;\n responseCodeString = this.safeString(entry, 'code');\n }\n }\n }\n if ((code !== 200) || errorInArray) {\n const feedback = this.id + ' ' + body;\n this.throwBroadlyMatchedException(this.exceptions['broad'], responseCodeString, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], responseCodeString, feedback);\n throw new errors.ExchangeError(feedback);\n }\n return undefined;\n }", has: %{ add_margin: false, borrow_cross_margin: false, borrow_isolated_margin: false, borrow_margin: false, c_o_r_s: false, cancel_all_orders: true, cancel_all_orders_after: false, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: true, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, cancel_withdraw: false, close_all_positions: false, close_position: false, create_convert_trade: false, create_deposit_address: false, create_limit_buy_order: false, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: false, create_limit_sell_order_ws: false, create_market_buy_order: false, create_market_buy_order_with_cost: true, create_market_buy_order_with_cost_ws: false, create_market_buy_order_ws: false, create_market_order: true, create_market_order_with_cost: false, create_market_order_with_cost_ws: false, create_market_order_ws: true, create_market_sell_order: false, create_market_sell_order_with_cost: false, create_market_sell_order_with_cost_ws: false, create_market_sell_order_ws: false, create_order: true, create_order_with_take_profit_and_stop_loss: false, create_order_with_take_profit_and_stop_loss_ws: false, create_order_ws: false, create_orders: false, create_post_only_order: false, create_post_only_order_ws: false, create_reduce_only_order: true, create_reduce_only_order_ws: false, create_stop_limit_order: true, create_stop_limit_order_ws: false, create_stop_loss_order: false, create_stop_loss_order_ws: false, create_stop_market_order: true, create_stop_market_order_ws: false, create_stop_order: true, create_stop_order_ws: false, create_take_profit_order: false, create_take_profit_order_ws: false, create_trailing_amount_order: false, create_trailing_amount_order_ws: false, create_trailing_percent_order: false, create_trailing_percent_order_ws: false, create_trigger_order: true, create_trigger_order_ws: false, deposit: false, edit_order: true, edit_order_with_client_order_id: false, edit_order_ws: false, edit_orders: false, fetch_accounts: true, fetch_all_greeks: false, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: false, fetch_borrow_interest: false, fetch_borrow_rate: false, fetch_borrow_rate_histories: false, fetch_borrow_rate_history: false, fetch_borrow_rates: false, fetch_borrow_rates_per_symbol: false, fetch_canceled_and_closed_orders: true, fetch_canceled_orders: true, fetch_closed_order: true, fetch_closed_orders: false, fetch_closed_orders_ws: false, fetch_convert_currencies: false, fetch_convert_quote: false, fetch_convert_trade: false, fetch_convert_trade_history: false, fetch_cross_borrow_rate: false, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: false, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: false, fetch_deposit_withdraw_fee: false, fetch_deposit_withdraw_fees: false, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: false, fetch_funding_interval: false, fetch_funding_intervals: false, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: true, fetch_greeks: false, fetch_index_ohlcv: false, fetch_isolated_borrow_rate: false, fetch_isolated_borrow_rates: false, fetch_isolated_positions: false, fetch_l2_order_book: true, fetch_l3_order_book: false, fetch_last_prices: false, fetch_ledger: true, fetch_ledger_entry: false, fetch_leverage: true, fetch_leverage_tiers: true, fetch_leverages: false, fetch_liquidations: false, fetch_long_short_ratio: false, fetch_long_short_ratio_history: false, fetch_margin_adjustment_history: false, fetch_margin_mode: false, fetch_margin_modes: false, fetch_mark_ohlcv: false, fetch_mark_price: false, fetch_mark_prices: false, fetch_market_leverage_tiers: true, fetch_markets: true, fetch_markets_ws: false, fetch_my_liquidations: false, fetch_my_settlement_history: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: false, fetch_open_interest_history: false, fetch_open_interests: false, fetch_open_order: false, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: false, fetch_option_chain: false, fetch_order: true, fetch_order_book: true, fetch_order_book_ws: false, fetch_order_books: false, fetch_order_trades: false, fetch_order_with_client_order_id: false, fetch_order_ws: false, fetch_orders: false, fetch_orders_by_status: false, fetch_orders_ws: false, fetch_position: false, fetch_position_history: false, fetch_position_mode: false, fetch_position_ws: false, fetch_positions: true, fetch_positions_for_symbol: true, fetch_positions_for_symbol_ws: false, fetch_positions_history: false, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: false, fetch_settlement_history: false, fetch_status: true, fetch_ticker: true, fetch_ticker_ws: false, fetch_tickers: true, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: true, fetch_trading_fees: true, fetch_trading_fees_ws: false, fetch_trading_limits: false, fetch_transaction_fee: false, fetch_transaction_fees: false, fetch_transactions: false, fetch_transfer: false, fetch_transfers: false, fetch_underlying_assets: false, fetch_volatility_history: false, fetch_withdraw_addresses: false, fetch_withdrawal: false, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: false, margin: false, option: false, private_api: true, public_api: true, reduce_margin: false, repay_cross_margin: false, repay_isolated_margin: false, sandbox: false, set_leverage: true, set_margin: false, set_margin_mode: false, set_position_mode: false, sign_in: false, spot: true, swap: false, transfer: true, un_watch_my_trades: false, un_watch_ohlcv: false, un_watch_ohlcv_for_symbols: false, un_watch_order_book: false, un_watch_order_book_for_symbols: false, un_watch_orders: false, un_watch_positions: false, un_watch_ticker: false, un_watch_tickers: false, un_watch_trades: false, un_watch_trades_for_symbols: false, watch_balance: true, watch_bids_asks: false, watch_liquidations: false, watch_liquidations_for_symbols: false, watch_my_liquidations: false, watch_my_liquidations_for_symbols: false, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: false, watch_order_book: true, watch_order_book_for_symbols: false, watch_orders: true, watch_orders_for_symbols: false, watch_position: false, watch_positions: false, watch_status: false, watch_ticker: true, watch_tickers: false, watch_trades: true, watch_trades_for_symbols: false, withdraw: true, ws: false }, http_config: nil, id: "hashkey", markets: nil, name: "HashKey Global", ohlcv_timestamp_resolution: :milliseconds, options: %{ broker: "10000700011", default_network: "ERC20", networks: %{ "ARB" => "Arbitrum", "ATOM" => "Cosmos", "AVAX" => "AvalancheC", "BTC" => "BTC", "DOGE" => "Dogecoin", "DOT" => "Polkadot", "ERC20" => "ETH", "KLAYTN" => "Klaytn", "LTC" => "LTC", "MATIC" => "Polygon", "MERLINCHAIN" => "Merlin Chain", "OPTIMISM" => "Optimism", "SOL" => "Solana", "TON" => "TON", "TRC20" => "Tron", "ZKSYNC" => "zkSync" }, networks_by_id: %{ "AVAX C-Chain" => "AVAX", "Arbitrum" => "ARB", "AvalancheC" => "AVAX", "BSC(BEP20)" => "BSC", "BTC" => "BTC", "Bitcoin" => "BTC", "Cosmos" => "ATOM", "Dogecoin" => "DOGE", "ERC20" => "ERC20", "ETH" => "ERC20", "Klaytn" => "KLAYTN", "LTC" => "LTC", "Litecoin" => "LTC", "Merlin Chain" => "MERLINCHAIN", "Optimism" => "OPTIMISM", "Polkadot" => "DOT", "Polygon" => "MATIC", "Solana" => "SOL", "TON" => "TON", "TRC20" => "TRC20", "Tron" => "TRC20", "zkSync" => "ZKSYNC" }, recv_window: nil, sandbox_mode: false }, order_mappings: %{ side_format: :uppercase, side_key: "side", type_format: :uppercase, type_key: "type" }, param_mappings: %{ "amount" => "quantity", "code" => "coin", "cost" => "quantity", "fromAccount" => "fromAccountId", "id" => "orderId", "since" => "startTime", "timeframe" => "interval", "toAccount" => "toAccountId", "triggerPrice" => "stopPrice" }, parse_methods: [ %{ "comment" => nil, "examples" => [], "line_end" => 2296, "line_start" => 2280, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (account, 'accountId')" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "code", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "account" } ], "name" => "parseAccount", "signature" => "parseAccount (account)", "source" => "parseAccount (account) {\n const accountLabel = this.safeString (account, 'accountLabel');\n let label = '';\n if (accountLabel === 'Main Trading Account' || accountLabel === 'Main Future Account') {\n label = 'main';\n } else if (accountLabel === 'Sub Main Trading Account' || accountLabel === 'Sub Main Future Account') {\n label = 'sub';\n }\n const accountType = this.parseAccountType (this.safeString (account, 'accountType'));\n const type = label + ' ' + accountType;\n return {\n 'id': this.safeString (account, 'accountId'),\n 'type': type,\n 'code': undefined,\n 'info': account,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2306, "line_start" => 2298, "mappings" => [], "name" => "parseAccountType", "signature" => "parseAccountType (type)", "source" => "parseAccountType (type) {\n const types: Dict = {\n '1': 'spot account',\n '3': 'swap account',\n '5': 'custody account',\n '6': 'fiat account',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"balances\": [\n {\n \"asset\":\"USDT\",\n \"assetId\":\"USDT\",\n \"assetName\":\"USDT\",\n \"total\":\"40\",\n \"free\":\"40\",\n \"locked\":\"0\"\n },\n ...\n ],\n \"userId\": \"1732885739572845312\"\n }" ], "line_end" => 1842, "line_start" => 1810, "mappings" => [], "name" => "parseBalance", "signature" => "parseBalance (balance): Balances", "source" => "parseBalance (balance): Balances {\n //\n // {\n // \"balances\": [\n // {\n // \"asset\":\"USDT\",\n // \"assetId\":\"USDT\",\n // \"assetName\":\"USDT\",\n // \"total\":\"40\",\n // \"free\":\"40\",\n // \"locked\":\"0\"\n // },\n // ...\n // ],\n // \"userId\": \"1732885739572845312\"\n // }\n //\n const result: Dict = {\n 'info': balance,\n };\n const balances = this.safeList (balance, 'balances', []);\n for (let i = 0; i < balances.length; i++) {\n const balanceEntry = balances[i];\n const currencyId = this.safeString (balanceEntry, 'asset');\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n account['total'] = this.safeString (balanceEntry, 'total');\n account['free'] = this.safeString (balanceEntry, 'free');\n account['used'] = this.safeString (balanceEntry, 'locked');\n result[code] = account;\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"canDeposit\": true,\n \"address\": \"0x61AAd7F763e2C7fF1CC996918740F67f9dC8BF4e\",\n \"addressExt\": \"\",\n \"minQuantity\": \"1\",\n \"needAddressTag\": false,\n \"requiredConfirmTimes\": 64,\n \"canWithdrawConfirmTimes\": 64,\n \"coinType\": \"ERC20_TOKEN\"\n }" ], "line_end" => 1935, "line_start" => 1909, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "depositAddress" }, %{ "comment" => nil, "key" => "currency", "value" => "currency['code']" }, %{ "comment" => nil, "key" => "network", "value" => "undefined" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" } ], "name" => "parseDepositAddress", "signature" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress", "source" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress {\n //\n // {\n // \"canDeposit\": true,\n // \"address\": \"0x61AAd7F763e2C7fF1CC996918740F67f9dC8BF4e\",\n // \"addressExt\": \"\",\n // \"minQuantity\": \"1\",\n // \"needAddressTag\": false,\n // \"requiredConfirmTimes\": 64,\n // \"canWithdrawConfirmTimes\": 64,\n // \"coinType\": \"ERC20_TOKEN\"\n // }\n //\n const address = this.safeString (depositAddress, 'address');\n this.checkAddress (address);\n let tag = this.safeString (depositAddress, 'addressExt');\n if (tag === '') {\n tag = undefined;\n }\n return {\n 'info': depositAddress,\n 'currency': currency['code'],\n 'network': undefined,\n 'address': address,\n 'tag': tag,\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ETHUSDT-PERPETUAL\",\n \"rate\": \"0.0001\",\n \"nextSettleTime\": \"1722297600000\"\n }" ], "line_end" => 3855, "line_start" => 3823, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "interestRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "fundingRate" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "fundingTimestamp" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "this.iso8601 (fundingTimestamp)" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "interval", "value" => "undefined" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n //\n // {\n // \"symbol\": \"ETHUSDT-PERPETUAL\",\n // \"rate\": \"0.0001\",\n // \"nextSettleTime\": \"1722297600000\"\n // }\n //\n const marketId = this.safeString (contract, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'swap');\n const fundingRate = this.safeNumber (contract, 'rate');\n const fundingTimestamp = this.safeInteger (contract, 'nextSettleTime');\n return {\n 'info': contract,\n 'symbol': market['symbol'],\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'fundingRate': fundingRate,\n 'fundingTimestamp': undefined,\n 'fundingDatetime': undefined,\n 'nextFundingRate': undefined,\n 'nextFundingTimestamp': fundingTimestamp,\n 'nextFundingDatetime': this.iso8601 (fundingTimestamp),\n 'previousFundingRate': undefined,\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n 'interval': undefined,\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1752, "line_start" => 1741, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (entry, 'p')" }, %{ "comment" => nil, "key" => "side", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "entry" } ], "name" => "parseLastPrice", "signature" => "parseLastPrice (entry, market: Market = undefined): LastPrice", "source" => "parseLastPrice (entry, market: Market = undefined): LastPrice {\n const marketId = this.safeString (entry, 's');\n market = this.safeMarket (marketId, market);\n return {\n 'symbol': market['symbol'],\n 'timestamp': undefined,\n 'datetime': undefined,\n 'price': this.safeNumber (entry, 'p'),\n 'side': undefined,\n 'info': entry,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": \"1740844413612065537\",\n \"accountId\": \"1732885739589466112\",\n \"coin\": \"USDT\",\n \"coinId\": \"USDT\",\n \"coinName\": \"USDT\",\n \"flowTypeValue\": 51,\n \"flowType\": \"USER_ACCOUNT_TRANSFER\",\n \"flowName\": \"\",\n \"change\": \"-1\",\n \"total\": \"8.015680088\",\n \"created\": \"1722260825765\"\n }" ], "line_end" => 2453, "line_start" => 2403, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "account", "value" => "account" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "referenceId", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "symbol", "value" => "undefined" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "after" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // {\n // \"id\": \"1740844413612065537\",\n // \"accountId\": \"1732885739589466112\",\n // \"coin\": \"USDT\",\n // \"coinId\": \"USDT\",\n // \"coinName\": \"USDT\",\n // \"flowTypeValue\": 51,\n // \"flowType\": \"USER_ACCOUNT_TRANSFER\",\n // \"flowName\": \"\",\n // \"change\": \"-1\",\n // \"total\": \"8.015680088\",\n // \"created\": \"1722260825765\"\n // }\n //\n const id = this.safeString (item, 'id');\n const account = this.safeString (item, 'accountId');\n const timestamp = this.safeInteger (item, 'created');\n const type = this.parseLedgerEntryType (this.safeString (item, 'flowTypeValue'));\n const currencyId = this.safeString (item, 'coin');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const amountString = this.safeString (item, 'change');\n const amount = this.parseNumber (amountString);\n let direction = 'in';\n if (amountString.indexOf ('-') >= 0) {\n direction = 'out';\n }\n const afterString = this.safeString (item, 'total');\n const after = this.parseNumber (afterString);\n const status = 'ok';\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': id,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'account': account,\n 'direction': direction,\n 'referenceId': undefined,\n 'referenceAccount': undefined,\n 'type': type,\n 'currency': code,\n 'symbol': undefined,\n 'amount': amount,\n 'before': undefined,\n 'after': after,\n 'status': status,\n 'fee': undefined,\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2401, "line_start" => 2392, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const types: Dict = {\n '1': 'trade', // transfer\n '2': 'fee', // trade\n '51': 'transfer',\n '900': 'deposit',\n '904': 'withdraw',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4057, "line_start" => 4047, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "leverageValue" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "leverageValue" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage", "source" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage {\n const marginMode = this.safeStringLower (leverage, 'marginType');\n const leverageValue = this.safeNumber (leverage, 'leverage');\n return {\n 'info': leverage,\n 'symbol': market['symbol'],\n 'marginMode': marginMode,\n 'longLeverage': leverageValue,\n 'shortLeverage': leverageValue,\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"symbolName\": \"BTCUSDT\",\n \"status\": \"TRADING\",\n \"baseAsset\": \"BTC\",\n \"baseAssetName\": \"BTC\",\n \"baseAssetPrecision\": \"0.00001\",\n \"quoteAsset\": \"USDT\",\n \"quoteAssetName\": \"USDT\",\n \"quotePrecision\": \"0.0000001\",\n \"retailAllowed\": true,\n \"piAllowed\": true,\n \"corporateAllowed\": true,\n \"omnibusAllowed\": true,\n \"icebergAllowed\": false,\n \"isAggregate\": false,\n \"allowMargin\": false,\n \"filters\": [\n {\n \"minPrice\": \"0.01\",\n \"maxPrice\": \"100000.00000000\",\n \"tickSize\": \"0.01\",\n \"filterType\": \"PRICE_FILTER\"\n },\n {\n \"minQty\": \"0.00001\",\n \"maxQty\": \"8\",\n \"stepSize\": \"0.00001\",\n \"marketOrderMinQty\": \"0.00001\",\n \"marketOrderMaxQty\": \"4\",\n \"filterType\": \"LOT_SIZE\"\n },\n {\n \"minNotional\": \"1\",\n \"filterType\": \"MIN_NOTIONAL\"\n },\n {\n \"minAmount\": \"1\",\n \"maxAmount\": \"400000\",\n \"minBuyPrice\": \"0\",\n \"marketOrderMinAmount\": \"1\",\n \"marketOrderMaxAmount\": \"200000\",\n \"filterType\": \"TRADE_AMOUNT\"\n },\n {\n \"maxSellPrice\": \"0\",\n \"buyPriceUpRate\": \"0.1\",\n \"sellPriceDownRate\": \"0.1\",\n \"filterType\": \"LIMIT_TRADING\"\n },\n {\n \"buyPriceUpRate\": \"0.1\",\n \"sellPriceDownRate\": \"0.1\",\n \"filterType\": \"MARKET_TRADING\"\n },\n {\n \"noAllowMarketStartTime\": \"1710485700000\",\n \"noAllowMarketEndTime\": \"1710486000000\",\n \"limitOrderStartTime\": \"0\",\n \"limitOrderEndTime\": \"0\",\n \"limitMinPrice\": \"0\",\n \"limitMaxPrice\": \"0\",\n \"filterType\": \"OPEN_QUOTE\"\n }\n ]\n }", "{\n \"filters\": [\n {\n \"minPrice\": \"0.1\",\n \"maxPrice\": \"100000.00000000\",\n \"tickSize\": \"0.1\",\n \"filterType\": \"PRICE_FILTER\"\n },\n {\n \"minQty\": \"0.001\",\n \"maxQty\": \"10\",\n \"stepSize\": \"0.001\",\n \"marketOrderMinQty\": \"0\",\n \"marketOrderMaxQty\": \"0\",\n \"filterType\": \"LOT_SIZE\"\n },\n {\n \"minNotional\": \"0\",\n \"filterType\": \"MIN_NOTIONAL\"\n },\n {\n \"maxSellPrice\": \"999999\",\n \"buyPriceUpRate\": \"0.05\",\n \"sellPriceDownRate\": \"0.05\",\n \"maxEntrustNum\": 200,\n \"maxConditionNum\": 200,\n \"filterType\": \"LIMIT_TRADING\"\n },\n {\n \"buyPriceUpRate\": \"0.05\",\n \"sellPriceDownRate\": \"0.05\",\n \"filterType\": \"MARKET_TRADING\"\n },\n {\n \"noAllowMarketStartTime\": \"0\",\n \"noAllowMarketEndTime\": \"0\",\n \"limitOrderStartTime\": \"0\",\n \"limitOrderEndTime\": \"0\",\n \"limitMinPrice\": \"0\",\n \"limitMaxPrice\": \"0\",\n \"filterType\": \"OPEN_QUOTE\"\n }\n ],\n \"exchangeId\": \"301\",\n \"symbol\": \"BTCUSDT-PERPETUAL\",\n \"symbolName\": \"BTCUSDT-PERPETUAL\",\n \"status\": \"TRADING\",\n \"baseAsset\": \"BTCUSDT-PERPETUAL\",\n \"baseAssetPrecision\": \"0.001\",\n \"quoteAsset\": \"USDT\",\n \"quoteAssetPrecision\": \"0.1\",\n \"icebergAllowed\": false,\n \"inverse\": false,\n \"index\": \"USDT\",\n \"marginToken\": \"USDT\",\n \"marginPrecision\": \"0.0001\",\n \"contractMultiplier\": \"0.001\",\n \"underlying\": \"BTC\",\n \"riskLimits\": [\n {\n \"riskLimitId\": \"200000722\",\n \"quantity\": \"1000.00\",\n \"initialMargin\": \"0.10\",\n \"maintMargin\": \"0.005\",\n \"isWhite\": false\n },\n {\n \"riskLimitId\": \"200000723\",\n \"quantity\": \"2000.00\",\n \"initialMargin\": \"0.10\",\n \"maintMargin\": \"0.01\",\n \"isWhite\": false\n }\n ]\n }" ], "line_end" => 1137, "line_start" => 869, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "marketId" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "base", "value" => "base" }, %{ "comment" => nil, "key" => "quote", "value" => "quote" }, %{ "comment" => nil, "key" => "baseId", "value" => "baseId" }, %{ "comment" => nil, "key" => "quoteId", "value" => "quoteId" }, %{ "comment" => nil, "key" => "active", "value" => "active" }, %{ "comment" => nil, "key" => "type", "value" => "marketType" }, %{ "comment" => nil, "key" => "subType", "value" => "subType" }, %{ "comment" => nil, "key" => "spot", "value" => "isSpot" }, %{ "comment" => nil, "key" => "margin", "value" => "this.safeBool (market, 'allowMargin')" }, %{ "comment" => nil, "key" => "swap", "value" => "isSwap" }, %{ "comment" => nil, "key" => "future", "value" => "false" }, %{ "comment" => nil, "key" => "option", "value" => "false" }, %{ "comment" => nil, "key" => "contract", "value" => "isSwap" }, %{ "comment" => nil, "key" => "settle", "value" => "settle" }, %{ "comment" => nil, "key" => "settleId", "value" => "settleId" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.parseNumber (contractSizeString)" }, %{ "comment" => nil, "key" => "linear", "value" => "isLinear" }, %{ "comment" => nil, "key" => "inverse", "value" => "isInverse" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (fees, 'taker')" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (fees, 'maker')" }, %{ "comment" => nil, "key" => "percentage", "value" => "this.safeBool (fees, 'percentage')" }, %{ "comment" => nil, "key" => "tierBased", "value" => "this.safeBool (fees, 'tierBased')" }, %{ "comment" => nil, "key" => "feeSide", "value" => "this.safeString (fees, 'feeSide')" }, %{ "comment" => nil, "key" => "expiry", "value" => "undefined" }, %{ "comment" => nil, "key" => "expiryDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "strike", "value" => "undefined" }, %{ "comment" => nil, "key" => "optionType", "value" => "undefined" }, %{ "comment" => nil, "key" => "precision", "value" => "{\n 'amount': this.parseNumber (amountPrecisionString),\n 'price': this.safeNumber (priceFilter, 'tickSize'),\n }" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'amount': {\n 'min': this.parseNumber (amountMinLimitString),\n 'max': this.parseNumber (amountMaxLimitString),\n },\n 'price': {\n 'min': this.safeNumber (priceFilter, 'minPrice'),\n 'max': this.safeNumber (priceFilter, 'maxPrice'),\n },\n 'leverage': {\n 'min': minLeverage,\n 'max': maxLeverage,\n },\n 'cost': {\n 'min': this.parseNumber (minCostString),\n 'max': undefined,\n },\n }" }, %{ "comment" => nil, "key" => "created", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "market" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amountPrecisionString)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (priceFilter, 'tickSize')" }, %{ "comment" => nil, "key" => "amount", "value" => "{\n 'min': this.parseNumber (amountMinLimitString),\n 'max': this.parseNumber (amountMaxLimitString),\n }" }, %{ "comment" => nil, "key" => "price", "value" => "{\n 'min': this.safeNumber (priceFilter, 'minPrice'),\n 'max': this.safeNumber (priceFilter, 'maxPrice'),\n }" }, %{ "comment" => nil, "key" => "leverage", "value" => "{\n 'min': minLeverage,\n 'max': maxLeverage,\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "{\n 'min': this.parseNumber (minCostString),\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "min", "value" => "minLeverage" }, %{ "comment" => nil, "key" => "max", "value" => "maxLeverage" } ], "name" => "parseMarket", "signature" => "parseMarket (market: Dict): Market", "source" => "parseMarket (market: Dict): Market {\n // spot\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"symbolName\": \"BTCUSDT\",\n // \"status\": \"TRADING\",\n // \"baseAsset\": \"BTC\",\n // \"baseAssetName\": \"BTC\",\n // \"baseAssetPrecision\": \"0.00001\",\n // \"quoteAsset\": \"USDT\",\n // \"quoteAssetName\": \"USDT\",\n // \"quotePrecision\": \"0.0000001\",\n // \"retailAllowed\": true,\n // \"piAllowed\": true,\n // \"corporateAllowed\": true,\n // \"omnibusAllowed\": true,\n // \"icebergAllowed\": false,\n // \"isAggregate\": false,\n // \"allowMargin\": false,\n // \"filters\": [\n // {\n // \"minPrice\": \"0.01\",\n // \"maxPrice\": \"100000.00000000\",\n // \"tickSize\": \"0.01\",\n // \"filterType\": \"PRICE_FILTER\"\n // },\n // {\n // \"minQty\": \"0.00001\",\n // \"maxQty\": \"8\",\n // \"stepSize\": \"0.00001\",\n // \"marketOrderMinQty\": \"0.00001\",\n // \"marketOrderMaxQty\": \"4\",\n // \"filterType\": \"LOT_SIZE\"\n // },\n // {\n // \"minNotional\": \"1\",\n // \"filterType\": \"MIN_NOTIONAL\"\n // },\n // {\n // \"minAmount\": \"1\",\n // \"maxAmount\": \"400000\",\n // \"minBuyPrice\": \"0\",\n // \"marketOrderMinAmount\": \"1\",\n // \"marketOrderMaxAmount\": \"200000\",\n // \"filterType\": \"TRADE_AMOUNT\"\n // },\n // {\n // \"maxSellPrice\": \"0\",\n // \"buyPriceUpRate\": \"0.1\",\n // \"sellPriceDownRate\": \"0.1\",\n // \"filterType\": \"LIMIT_TRADING\"\n // },\n // {\n // \"buyPriceUpRate\": \"0.1\",\n // \"sellPriceDownRate\": \"0.1\",\n // \"filterType\": \"MARKET_TRADING\"\n // },\n // {\n // \"noAllowMarketStartTime\": \"1710485700000\",\n // \"noAllowMarketEndTime\": \"1710486000000\",\n // \"limitOrderStartTime\": \"0\",\n // \"limitOrderEndTime\": \"0\",\n // \"limitMinPrice\": \"0\",\n // \"limitMaxPrice\": \"0\",\n // \"filterType\": \"OPEN_QUOTE\"\n // }\n // ]\n // }\n //\n // swap\n // {\n // \"filters\": [\n // {\n // \"minPrice\": \"0.1\",\n // \"maxPrice\": \"100000.00000000\",\n // \"tickSize\": \"0.1\",\n // \"filterType\": \"PRICE_FILTER\"\n // },\n // {\n // \"minQty\": \"0.001\",\n // \"maxQty\": \"10\",\n // \"stepSize\": \"0.001\",\n // \"marketOrderMinQty\": \"0\",\n // \"marketOrderMaxQty\": \"0\",\n // \"filterType\": \"LOT_SIZE\"\n // },\n // {\n // \"minNotional\": \"0\",\n // \"filterType\": \"MIN_NOTIONAL\"\n // },\n // {\n // \"maxSellPrice\": \"999999\",\n // \"buyPriceUpRate\": \"0.05\",\n // \"sellPriceDownRate\": \"0.05\",\n // \"maxEntrustNum\": 200,\n // \"maxConditionNum\": 200,\n // \"filterType\": \"LIMIT_TRADING\"\n // },\n // {\n // \"buyPriceUpRate\": \"0.05\",\n // \"sellPriceDownRate\": \"0.05\",\n // \"filterType\": \"MARKET_TRADING\"\n // },\n // {\n // \"noAllowMarketStartTime\": \"0\",\n // \"noAllowMarketEndTime\": \"0\",\n // \"limitOrderStartTime\": \"0\",\n // \"limitOrderEndTime\": \"0\",\n // \"limitMinPrice\": \"0\",\n // \"limitMaxPrice\": \"0\",\n // \"filterType\": \"OPEN_QUOTE\"\n // }\n // ],\n // \"exchangeId\": \"301\",\n // \"symbol\": \"BTCUSDT-PERPETUAL\",\n // \"symbolName\": \"BTCUSDT-PERPETUAL\",\n // \"status\": \"TRADING\",\n // \"baseAsset\": \"BTCUSDT-PERPETUAL\",\n // \"baseAssetPrecision\": \"0.001\",\n // \"quoteAsset\": \"USDT\",\n // \"quoteAssetPrecision\": \"0.1\",\n // \"icebergAllowed\": false,\n // \"inverse\": false,\n // \"index\": \"USDT\",\n // \"marginToken\": \"USDT\",\n // \"marginPrecision\": \"0.0001\",\n // \"contractMultiplier\": \"0.001\",\n // \"underlying\": \"BTC\",\n // \"riskLimits\": [\n // {\n // \"riskLimitId\": \"200000722\",\n // \"quantity\": \"1000.00\",\n // \"initialMargin\": \"0.10\",\n // \"maintMargin\": \"0.005\",\n // \"isWhite\": false\n // },\n // {\n // \"riskLimitId\": \"200000723\",\n // \"quantity\": \"2000.00\",\n // \"initialMargin\": \"0.10\",\n // \"maintMargin\": \"0.01\",\n // \"isWhite\": false\n // }\n // ]\n // }\n //\n const marketId = this.safeString (market, 'symbol');\n const quoteId = this.safeString (market, 'quoteAsset');\n const quote = this.safeCurrencyCode (quoteId);\n const settleId = this.safeString (market, 'marginToken');\n const settle = this.safeCurrencyCode (settleId);\n let baseId = this.safeString (market, 'baseAsset');\n let marketType = 'spot' as any;\n let isSpot = true;\n let isSwap = false;\n let suffix = '';\n const parts = marketId.split ('-');\n const secondPart = this.safeString (parts, 1);\n if (secondPart === 'PERPETUAL') {\n marketType = 'swap';\n isSpot = false;\n isSwap = true;\n baseId = this.safeString (market, 'underlying');\n suffix += ':' + settleId;\n }\n const base = this.safeCurrencyCode (baseId);\n const symbol = base + '/' + quote + suffix;\n const status = this.safeString (market, 'status');\n const active = status === 'TRADING';\n let isLinear: Bool = undefined;\n let subType = undefined;\n const isInverse = this.safeBool (market, 'inverse');\n if (isInverse !== undefined) {\n if (isInverse) {\n isLinear = false;\n subType = 'inverse';\n } else {\n isLinear = true;\n subType = 'linear';\n }\n }\n const filtersList = this.safeList (market, 'filters', []);\n const filters = this.indexBy (filtersList, 'filterType');\n const priceFilter = this.safeDict (filters, 'PRICE_FILTER', {});\n const amountFilter = this.safeDict (filters, 'LOT_SIZE', {});\n const costFilter = this.safeDict (filters, 'MIN_NOTIONAL', {});\n const minCostString = this.omitZero (this.safeString (costFilter, 'min_notional'));\n const contractSizeString = this.safeString (market, 'contractMultiplier');\n let amountPrecisionString = this.safeString (amountFilter, 'stepSize');\n let amountMinLimitString = this.safeString (amountFilter, 'minQty');\n let amountMaxLimitString = this.safeString (amountFilter, 'maxQty');\n let minLeverage: Int = undefined;\n let maxLeverage: Int = undefined;\n if (isSwap) {\n amountPrecisionString = Precise.stringDiv (amountPrecisionString, contractSizeString);\n amountMinLimitString = Precise.stringDiv (amountMinLimitString, contractSizeString);\n amountMaxLimitString = Precise.stringDiv (amountMaxLimitString, contractSizeString);\n const riskLimits = this.safeList (market, 'riskLimits');\n if (riskLimits !== undefined) {\n const first = this.safeDict (riskLimits, 0);\n const arrayLength = riskLimits.length;\n const last = this.safeDict (riskLimits, arrayLength - 1);\n let minInitialMargin = this.safeString (first, 'initialMargin');\n let maxInitialMargin = this.safeString (last, 'initialMargin');\n if (Precise.stringGt (minInitialMargin, maxInitialMargin)) {\n [ minInitialMargin, maxInitialMargin ] = [ maxInitialMargin, minInitialMargin ];\n }\n minLeverage = this.parseToInt (Precise.stringDiv ('1', maxInitialMargin));\n maxLeverage = this.parseToInt (Precise.stringDiv ('1', minInitialMargin));\n }\n }\n const tradingFees = this.safeDict (this.fees, 'trading');\n const fees = isSpot ? this.safeDict (tradingFees, 'spot') : this.safeDict (tradingFees, 'swap');\n return this.safeMarketStructure ({\n 'id': marketId,\n 'symbol': symbol,\n 'base': base,\n 'quote': quote,\n 'baseId': baseId,\n 'quoteId': quoteId,\n 'active': active,\n 'type': marketType,\n 'subType': subType,\n 'spot': isSpot,\n 'margin': this.safeBool (market, 'allowMargin'),\n 'swap': isSwap,\n 'future': false,\n 'option': false,\n 'contract': isSwap,\n 'settle': settle,\n 'settleId': settleId,\n 'contractSize': this.parseNumber (contractSizeString),\n 'linear': isLinear,\n 'inverse': isInverse,\n 'taker': this.safeNumber (fees, 'taker'),\n 'maker': this.safeNumber (fees, 'maker'),\n 'percentage': this.safeBool (fees, 'percentage'),\n 'tierBased': this.safeBool (fees, 'tierBased'),\n 'feeSide': this.safeString (fees, 'feeSide'),\n 'expiry': undefined,\n 'expiryDatetime': undefined,\n 'strike': undefined,\n 'optionType': undefined,\n 'precision': {\n 'amount': this.parseNumber (amountPrecisionString),\n 'price': this.safeNumber (priceFilter, 'tickSize'),\n },\n 'limits': {\n 'amount': {\n 'min': this.parseNumber (amountMinLimitString),\n 'max': this.parseNumber (amountMaxLimitString),\n },\n 'price': {\n 'min': this.safeNumber (priceFilter, 'minPrice'),\n 'max': this.safeNumber (priceFilter, 'maxPrice'),\n },\n 'leverage': {\n 'min': minLeverage,\n 'max': maxLeverage,\n },\n 'cost': {\n 'min': this.parseNumber (minCostString),\n 'max': undefined,\n },\n },\n 'created': undefined,\n 'info': market,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"filters\": [\n {\n \"minPrice\": \"0.1\",\n \"maxPrice\": \"100000.00000000\",\n \"tickSize\": \"0.1\",\n \"filterType\": \"PRICE_FILTER\"\n },\n {\n \"minQty\": \"0.001\",\n \"maxQty\": \"10\",\n \"stepSize\": \"0.001\",\n \"marketOrderMinQty\": \"0\",\n \"marketOrderMaxQty\": \"0\",\n \"filterType\": \"LOT_SIZE\"\n },\n {\n \"minNotional\": \"0\",\n \"filterType\": \"MIN_NOTIONAL\"\n },\n {\n \"maxSellPrice\": \"999999\",\n \"buyPriceUpRate\": \"0.05\",\n \"sellPriceDownRate\": \"0.05\",\n \"maxEntrustNum\": 200,\n \"maxConditionNum\": 200,\n \"filterType\": \"LIMIT_TRADING\"\n },\n {\n \"buyPriceUpRate\": \"0.05\",\n \"sellPriceDownRate\": \"0.05\",\n \"filterType\": \"MARKET_TRADING\"\n },\n {\n \"noAllowMarketStartTime\": \"0\",\n \"noAllowMarketEndTime\": \"0\",\n \"limitOrderStartTime\": \"0\",\n \"limitOrderEndTime\": \"0\",\n \"limitMinPrice\": \"0\",\n \"limitMaxPrice\": \"0\",\n \"filterType\": \"OPEN_QUOTE\"\n }\n ],\n \"exchangeId\": \"301\",\n \"symbol\": \"BTCUSDT-PERPETUAL\",\n \"symbolName\": \"BTCUSDT-PERPETUAL\",\n \"status\": \"TRADING\",\n \"baseAsset\": \"BTCUSDT-PERPETUAL\",\n \"baseAssetPrecision\": \"0.001\",\n \"quoteAsset\": \"USDT\",\n \"quoteAssetPrecision\": \"0.1\",\n \"icebergAllowed\": false,\n \"inverse\": false,\n \"index\": \"USDT\",\n \"marginToken\": \"USDT\",\n \"marginPrecision\": \"0.0001\",\n \"contractMultiplier\": \"0.001\",\n \"underlying\": \"BTC\",\n \"riskLimits\": [\n {\n \"riskLimitId\": \"200000722\",\n \"quantity\": \"1000.00\",\n \"initialMargin\": \"0.10\",\n \"maintMargin\": \"0.005\",\n \"isWhite\": false\n },\n {\n \"riskLimitId\": \"200000723\",\n \"quantity\": \"2000.00\",\n \"initialMargin\": \"0.10\",\n \"maintMargin\": \"0.01\",\n \"isWhite\": false\n }\n ]\n }" ], "line_end" => 4205, "line_start" => 4108, "mappings" => [ %{ "comment" => nil, "key" => "tier", "value" => "this.sum (i, 1)" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "currency", "value" => "market['settle']" }, %{ "comment" => nil, "key" => "minNotional", "value" => "undefined" }, %{ "comment" => nil, "key" => "maxNotional", "value" => "this.safeNumber (tier, 'quantity')" }, %{ "comment" => nil, "key" => "maintenanceMarginRate", "value" => "this.safeNumber (tier, 'maintMargin')" }, %{ "comment" => nil, "key" => "maxLeverage", "value" => "this.parseNumber (Precise.stringDiv ('1', initialMarginRate))" }, %{ "comment" => nil, "key" => "info", "value" => "tier" } ], "name" => "parseMarketLeverageTiers", "signature" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[]", "source" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[] {\n //\n // {\n // \"filters\": [\n // {\n // \"minPrice\": \"0.1\",\n // \"maxPrice\": \"100000.00000000\",\n // \"tickSize\": \"0.1\",\n // \"filterType\": \"PRICE_FILTER\"\n // },\n // {\n // \"minQty\": \"0.001\",\n // \"maxQty\": \"10\",\n // \"stepSize\": \"0.001\",\n // \"marketOrderMinQty\": \"0\",\n // \"marketOrderMaxQty\": \"0\",\n // \"filterType\": \"LOT_SIZE\"\n // },\n // {\n // \"minNotional\": \"0\",\n // \"filterType\": \"MIN_NOTIONAL\"\n // },\n // {\n // \"maxSellPrice\": \"999999\",\n // \"buyPriceUpRate\": \"0.05\",\n // \"sellPriceDownRate\": \"0.05\",\n // \"maxEntrustNum\": 200,\n // \"maxConditionNum\": 200,\n // \"filterType\": \"LIMIT_TRADING\"\n // },\n // {\n // \"buyPriceUpRate\": \"0.05\",\n // \"sellPriceDownRate\": \"0.05\",\n // \"filterType\": \"MARKET_TRADING\"\n // },\n // {\n // \"noAllowMarketStartTime\": \"0\",\n // \"noAllowMarketEndTime\": \"0\",\n // \"limitOrderStartTime\": \"0\",\n // \"limitOrderEndTime\": \"0\",\n // \"limitMinPrice\": \"0\",\n // \"limitMaxPrice\": \"0\",\n // \"filterType\": \"OPEN_QUOTE\"\n // }\n // ],\n // \"exchangeId\": \"301\",\n // \"symbol\": \"BTCUSDT-PERPETUAL\",\n // \"symbolName\": \"BTCUSDT-PERPETUAL\",\n // \"status\": \"TRADING\",\n // \"baseAsset\": \"BTCUSDT-PERPETUAL\",\n // \"baseAssetPrecision\": \"0.001\",\n // \"quoteAsset\": \"USDT\",\n // \"quoteAssetPrecision\": \"0.1\",\n // \"icebergAllowed\": false,\n // \"inverse\": false,\n // \"index\": \"USDT\",\n // \"marginToken\": \"USDT\",\n // \"marginPrecision\": \"0.0001\",\n // \"contractMultiplier\": \"0.001\",\n // \"underlying\": \"BTC\",\n // \"riskLimits\": [\n // {\n // \"riskLimitId\": \"200000722\",\n // \"quantity\": \"1000.00\",\n // \"initialMargin\": \"0.10\",\n // \"maintMargin\": \"0.005\",\n // \"isWhite\": false\n // },\n // {\n // \"riskLimitId\": \"200000723\",\n // \"quantity\": \"2000.00\",\n // \"initialMargin\": \"0.10\",\n // \"maintMargin\": \"0.01\",\n // \"isWhite\": false\n // }\n // ]\n // }\n //\n const riskLimits = this.safeList (info, 'riskLimits', []);\n const marketId = this.safeString (info, 'symbol');\n market = this.safeMarket (marketId, market);\n const tiers = [];\n for (let i = 0; i < riskLimits.length; i++) {\n const tier = riskLimits[i];\n const initialMarginRate = this.safeString (tier, 'initialMargin');\n tiers.push ({\n 'tier': this.sum (i, 1),\n 'symbol': this.safeSymbol (marketId, market),\n 'currency': market['settle'],\n 'minNotional': undefined,\n 'maxNotional': this.safeNumber (tier, 'quantity'),\n 'maintenanceMarginRate': this.safeNumber (tier, 'maintMargin'),\n 'maxLeverage': this.parseNumber (Precise.stringDiv ('1', initialMarginRate)),\n 'info': tier,\n });\n }\n return tiers as LeverageTier[];\n }" }, %{ "comment" => nil, "examples" => [ "[\n 1721684280000,\n \"67832.49\",\n \"67862.5\",\n \"67832.49\",\n \"67861.44\",\n \"0.01122\",0,\n \"761.2763533\",68,\n \"0.00561\",\n \"380.640643\"\n ]" ], "line_end" => 1616, "line_start" => 1594, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // [\n // 1721684280000,\n // \"67832.49\",\n // \"67862.5\",\n // \"67832.49\",\n // \"67861.44\",\n // \"0.01122\",0,\n // \"761.2763533\",68,\n // \"0.00561\",\n // \"380.640643\"\n // ]\n //\n return [\n this.safeInteger (ohlcv, 0),\n this.safeNumber (ohlcv, 1),\n this.safeNumber (ohlcv, 2),\n this.safeNumber (ohlcv, 3),\n this.safeNumber (ohlcv, 4),\n this.safeNumber (ohlcv, 5),\n ];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"accountId\": \"1732885739589466112\",\n \"symbol\": \"ETHUSDT\",\n \"symbolName\": \"ETHUSDT\",\n \"clientOrderId\": \"1722004623170558\",\n \"orderId\": \"1738695230608169984\",\n \"transactTime\": \"1722004623186\",\n \"price\": \"0\",\n \"origQty\": \"0\",\n \"executedQty\": \"0.0061\",\n \"status\": \"FILLED\",\n \"timeInForce\": \"IOC\",\n \"type\": \"MARKET\",\n \"side\": \"BUY\",\n \"reqAmount\": \"20\",\n \"concentration\": \"\"\n }", "{\n \"accountId\": \"1732885739589466112\",\n \"exchangeId\": \"301\",\n \"symbol\": \"ETHUSDT\",\n \"symbolName\": \"ETHUSDT\",\n \"clientOrderId\": \"1722004623170558\",\n \"orderId\": \"1738695230608169984\",\n \"price\": \"0\",\n \"origQty\": \"0\",\n \"executedQty\": \"0.0061\",\n \"cummulativeQuoteQty\": \"19.736489\",\n \"cumulativeQuoteQty\": \"19.736489\",\n \"avgPrice\": \"3235.49\",\n \"status\": \"FILLED\",\n \"timeInForce\": \"IOC\",\n \"type\": \"MARKET\",\n \"side\": \"BUY\",\n \"stopPrice\": \"0.0\",\n \"icebergQty\": \"0.0\",\n \"time\": \"1722004623186\",\n \"updateTime\": \"1722004623406\",\n \"isWorking\": true,\n \"reqAmount\": \"20\",\n \"feeCoin\": \"\",\n \"feeAmount\": \"0\",\n \"sumFeeAmount\": \"0\"\n }", "{\n \"accountId\": \"1732885739589466112\",\n \"symbol\": \"ETHUSDT\",\n \"clientOrderId\": \"1722006209978370\",\n \"orderId\": \"1738708541676585728\",\n \"transactTime\": \"1722006209989\",\n \"price\": \"5000\",\n \"origQty\": \"0.005\",\n \"executedQty\": \"0\",\n \"status\": \"NEW\",\n \"timeInForce\": \"GTC\",\n \"type\": \"LIMIT_MAKER\",\n \"side\": \"SELL\"\n }", "{\n \"time\": \"1722429951611\",\n \"updateTime\": \"1722429951648\",\n \"orderId\": \"1742263144028363776\",\n \"clientOrderId\": \"1722429950315\",\n \"symbol\": \"ETHUSDT-PERPETUAL\",\n \"price\": \"3460.62\",\n \"leverage\": \"5\",\n \"origQty\": \"10\",\n \"executedQty\": \"10\",\n \"avgPrice\": \"0\",\n \"marginLocked\": \"6.9212\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY_OPEN\",\n \"timeInForce\": \"IOC\",\n \"status\": \"FILLED\",\n \"priceType\": \"MARKET\",\n \"contractMultiplier\": \"0.00100000\"\n }", "{\n \"time\": \"1722429951611\",\n \"updateTime\": \"1722429951700\",\n \"orderId\": \"1742263144028363776\",\n \"clientOrderId\": \"1722429950315\",\n \"symbol\": \"ETHUSDT-PERPETUAL\",\n \"price\": \"3460.62\",\n \"leverage\": \"5\",\n \"origQty\": \"10\",\n \"executedQty\": \"10\",\n \"avgPrice\": \"3327.52\",\n \"marginLocked\": \"0\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY_OPEN\",\n \"timeInForce\": \"IOC\",\n \"status\": \"FILLED\",\n \"priceType\": \"MARKET\",\n \"isLiquidationOrder\": false,\n \"indexPrice\": \"0\",\n \"liquidationType\": \"\"\n }" ], "line_end" => 3718, "line_start" => 3547, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (order, 'orderId')" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString (order, 'clientOrderId')" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "this.safeInteger (order, 'updateTime')" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseOrderStatus (status)" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "timeInForce" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "amount", "value" => "this.omitZero (this.safeString (order, 'origQty'))" }, %{ "comment" => nil, "key" => "filled", "value" => "this.safeString (order, 'executedQty')" }, %{ "comment" => nil, "key" => "remaining", "value" => "undefined" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "this.omitZero (this.safeString (order, 'stopPrice'))" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "cost", "value" => "this.omitZero (this.safeString2 (order, 'cumulativeQuoteQty', 'cummulativeQuoteQty'))" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': this.safeCurrencyCode (feeCurrncyId),\n 'amount': this.omitZero (this.safeString (order, 'feeAmount')),\n }" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "reduceOnly" }, %{ "comment" => nil, "key" => "postOnly", "value" => "postOnly" }, %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (feeCurrncyId)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.omitZero (this.safeString (order, 'feeAmount'))" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // createOrder spot\n // {\n // \"accountId\": \"1732885739589466112\",\n // \"symbol\": \"ETHUSDT\",\n // \"symbolName\": \"ETHUSDT\",\n // \"clientOrderId\": \"1722004623170558\",\n // \"orderId\": \"1738695230608169984\",\n // \"transactTime\": \"1722004623186\",\n // \"price\": \"0\",\n // \"origQty\": \"0\",\n // \"executedQty\": \"0.0061\",\n // \"status\": \"FILLED\",\n // \"timeInForce\": \"IOC\",\n // \"type\": \"MARKET\",\n // \"side\": \"BUY\",\n // \"reqAmount\": \"20\",\n // \"concentration\": \"\"\n // }\n //\n // fetchOrder spot\n // {\n // \"accountId\": \"1732885739589466112\",\n // \"exchangeId\": \"301\",\n // \"symbol\": \"ETHUSDT\",\n // \"symbolName\": \"ETHUSDT\",\n // \"clientOrderId\": \"1722004623170558\",\n // \"orderId\": \"1738695230608169984\",\n // \"price\": \"0\",\n // \"origQty\": \"0\",\n // \"executedQty\": \"0.0061\",\n // \"cummulativeQuoteQty\": \"19.736489\",\n // \"cumulativeQuoteQty\": \"19.736489\",\n // \"avgPrice\": \"3235.49\",\n // \"status\": \"FILLED\",\n // \"timeInForce\": \"IOC\",\n // \"type\": \"MARKET\",\n // \"side\": \"BUY\",\n // \"stopPrice\": \"0.0\",\n // \"icebergQty\": \"0.0\",\n // \"time\": \"1722004623186\",\n // \"updateTime\": \"1722004623406\",\n // \"isWorking\": true,\n // \"reqAmount\": \"20\",\n // \"feeCoin\": \"\",\n // \"feeAmount\": \"0\",\n // \"sumFeeAmount\": \"0\"\n // }\n //\n // cancelOrder\n // {\n // \"accountId\": \"1732885739589466112\",\n // \"symbol\": \"ETHUSDT\",\n // \"clientOrderId\": \"1722006209978370\",\n // \"orderId\": \"1738708541676585728\",\n // \"transactTime\": \"1722006209989\",\n // \"price\": \"5000\",\n // \"origQty\": \"0.005\",\n // \"executedQty\": \"0\",\n // \"status\": \"NEW\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT_MAKER\",\n // \"side\": \"SELL\"\n // }\n //\n // createOrder swap\n // {\n // \"time\": \"1722429951611\",\n // \"updateTime\": \"1722429951648\",\n // \"orderId\": \"1742263144028363776\",\n // \"clientOrderId\": \"1722429950315\",\n // \"symbol\": \"ETHUSDT-PERPETUAL\",\n // \"price\": \"3460.62\",\n // \"leverage\": \"5\",\n // \"origQty\": \"10\",\n // \"executedQty\": \"10\",\n // \"avgPrice\": \"0\",\n // \"marginLocked\": \"6.9212\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY_OPEN\",\n // \"timeInForce\": \"IOC\",\n // \"status\": \"FILLED\",\n // \"priceType\": \"MARKET\",\n // \"contractMultiplier\": \"0.00100000\"\n // }\n //\n // fetchOrder swap\n // {\n // \"time\": \"1722429951611\",\n // \"updateTime\": \"1722429951700\",\n // \"orderId\": \"1742263144028363776\",\n // \"clientOrderId\": \"1722429950315\",\n // \"symbol\": \"ETHUSDT-PERPETUAL\",\n // \"price\": \"3460.62\",\n // \"leverage\": \"5\",\n // \"origQty\": \"10\",\n // \"executedQty\": \"10\",\n // \"avgPrice\": \"3327.52\",\n // \"marginLocked\": \"0\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY_OPEN\",\n // \"timeInForce\": \"IOC\",\n // \"status\": \"FILLED\",\n // \"priceType\": \"MARKET\",\n // \"isLiquidationOrder\": false,\n // \"indexPrice\": \"0\",\n // \"liquidationType\": \"\"\n // }\n //\n const marketId = this.safeString (order, 'symbol');\n market = this.safeMarket (marketId, market);\n const timestamp = this.safeInteger2 (order, 'transactTime', 'time');\n const status = this.safeString (order, 'status');\n let type = this.safeString (order, 'type');\n const priceType = this.safeString (order, 'priceType');\n if (priceType === 'MARKET') {\n type = 'market';\n }\n let price = this.omitZero (this.safeString (order, 'price'));\n if (type === 'STOP') {\n if (price === undefined) {\n type = 'market';\n } else {\n type = 'limit';\n }\n }\n let timeInForce = this.safeString (order, 'timeInForce');\n let postOnly: Bool = undefined;\n [ type, timeInForce, postOnly ] = this.parseOrderTypeTimeInForceAndPostOnly (type, timeInForce);\n const average = this.omitZero (this.safeString (order, 'avgPrice'));\n if (price === undefined) {\n price = average;\n }\n let side = this.safeStringLower (order, 'side');\n let reduceOnly: Bool = undefined;\n [ side, reduceOnly ] = this.parseOrderSideAndReduceOnly (side);\n let feeCurrncyId = this.safeString (order, 'feeCoin');\n if (feeCurrncyId === '') {\n feeCurrncyId = undefined;\n }\n return this.safeOrder ({\n 'id': this.safeString (order, 'orderId'),\n 'clientOrderId': this.safeString (order, 'clientOrderId'),\n 'datetime': this.iso8601 (timestamp),\n 'timestamp': timestamp,\n 'lastTradeTimestamp': undefined,\n 'lastUpdateTimestamp': this.safeInteger (order, 'updateTime'),\n 'status': this.parseOrderStatus (status),\n 'symbol': market['symbol'],\n 'type': type,\n 'timeInForce': timeInForce,\n 'side': side,\n 'price': price,\n 'average': average,\n 'amount': this.omitZero (this.safeString (order, 'origQty')),\n 'filled': this.safeString (order, 'executedQty'),\n 'remaining': undefined,\n 'triggerPrice': this.omitZero (this.safeString (order, 'stopPrice')),\n 'takeProfitPrice': undefined,\n 'stopLossPrice': undefined,\n 'cost': this.omitZero (this.safeString2 (order, 'cumulativeQuoteQty', 'cummulativeQuoteQty')),\n 'trades': undefined,\n 'fee': {\n 'currency': this.safeCurrencyCode (feeCurrncyId),\n 'amount': this.omitZero (this.safeString (order, 'feeAmount')),\n },\n 'reduceOnly': reduceOnly,\n 'postOnly': postOnly,\n 'info': order,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3733, "line_start" => 3720, "mappings" => [], "name" => "parseOrderSideAndReduceOnly", "signature" => "parseOrderSideAndReduceOnly (unparsed)", "source" => "parseOrderSideAndReduceOnly (unparsed) {\n const parts = unparsed.split ('_');\n const side = parts[0];\n let reduceOnly: Bool = undefined;\n const secondPart = this.safeString (parts, 1);\n if (secondPart !== undefined) {\n if (secondPart === 'open') {\n reduceOnly = false;\n } else if ((secondPart === 'close')) {\n reduceOnly = true;\n }\n }\n return [ side, reduceOnly ];\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3748, "line_start" => 3735, "mappings" => [ %{ "comment" => nil, "key" => "NEW", "value" => "'open'" }, %{ "comment" => nil, "key" => "PARTIALLY_FILLED", "value" => "'open'" }, %{ "comment" => nil, "key" => "PARTIALLY_CANCELED", "value" => "'canceled'" }, %{ "comment" => nil, "key" => "FILLED", "value" => "'closed'" }, %{ "comment" => nil, "key" => "CANCELED", "value" => "'canceled'" }, %{ "comment" => nil, "key" => "ORDER_CANCELED", "value" => "'canceled'" }, %{ "comment" => nil, "key" => "PENDING_CANCEL", "value" => "'canceled'" }, %{ "comment" => nil, "key" => "REJECTED", "value" => "'rejected'" }, %{ "comment" => nil, "key" => "ORDER_NEW", "value" => "'open'" } ], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status)", "source" => "parseOrderStatus (status) {\n const statuses = {\n 'NEW': 'open',\n 'PARTIALLY_FILLED': 'open',\n 'PARTIALLY_CANCELED': 'canceled',\n 'FILLED': 'closed',\n 'CANCELED': 'canceled',\n 'ORDER_CANCELED': 'canceled',\n 'PENDING_CANCEL': 'canceled',\n 'REJECTED': 'rejected',\n 'ORDER_NEW': 'open',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3770, "line_start" => 3762, "mappings" => [ %{ "comment" => nil, "key" => "MARKET", "value" => "'market'" }, %{ "comment" => nil, "key" => "LIMIT", "value" => "'limit'" }, %{ "comment" => nil, "key" => "LIMIT_MAKER", "value" => "'limit'" }, %{ "comment" => nil, "key" => "MARKET_OF_BASE", "value" => "'market'" } ], "name" => "parseOrderType", "signature" => "parseOrderType (type)", "source" => "parseOrderType (type) {\n const types = {\n 'MARKET': 'market',\n 'LIMIT': 'limit',\n 'LIMIT_MAKER': 'limit',\n 'MARKET_OF_BASE': 'market',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3760, "line_start" => 3750, "mappings" => [], "name" => "parseOrderTypeTimeInForceAndPostOnly", "signature" => "parseOrderTypeTimeInForceAndPostOnly (type, timeInForce)", "source" => "parseOrderTypeTimeInForceAndPostOnly (type, timeInForce) {\n let postOnly: Bool = undefined;\n if (type === 'LIMIT_MAKER') {\n postOnly = true;\n } else if ((timeInForce === 'LIMIT_MAKER') || (timeInForce === 'MAKER')) {\n postOnly = true;\n timeInForce = 'PO';\n }\n type = this.parseOrderType (type);\n return [ type, timeInForce, postOnly ];\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4016, "line_start" => 3982, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.safeNumber (position, 'position')" }, %{ "comment" => nil, "key" => "contractSize", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "this.safeStringLower (position, 'side')" }, %{ "comment" => nil, "key" => "notional", "value" => "this.safeNumber (position, 'positionValue')" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.safeInteger (position, 'leverage')" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.safeNumber (position, 'unrealizedPnL')" }, %{ "comment" => nil, "key" => "realizedPnl", "value" => "this.safeNumber (position, 'realizedPnL')" }, %{ "comment" => nil, "key" => "collateral", "value" => "undefined" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.safeNumber (position, 'avgPrice')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "this.safeNumber (position, 'liquidationPrice')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'cross'" }, %{ "comment" => nil, "key" => "hedged", "value" => "true" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "this.safeNumber (position, 'minMargin')" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "this.safeNumber (position, 'margin')" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber (position, 'lastPrice')" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "position" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n const marketId = this.safeString (position, 'symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n return this.safePosition ({\n 'symbol': symbol,\n 'id': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'contracts': this.safeNumber (position, 'position'),\n 'contractSize': undefined,\n 'side': this.safeStringLower (position, 'side'),\n 'notional': this.safeNumber (position, 'positionValue'),\n 'leverage': this.safeInteger (position, 'leverage'),\n 'unrealizedPnl': this.safeNumber (position, 'unrealizedPnL'),\n 'realizedPnl': this.safeNumber (position, 'realizedPnL'),\n 'collateral': undefined,\n 'entryPrice': this.safeNumber (position, 'avgPrice'),\n 'markPrice': undefined,\n 'liquidationPrice': this.safeNumber (position, 'liquidationPrice'),\n 'marginMode': 'cross',\n 'hedged': true,\n 'maintenanceMargin': this.safeNumber (position, 'minMargin'),\n 'maintenanceMarginPercentage': undefined,\n 'initialMargin': this.safeNumber (position, 'margin'),\n 'initialMarginPercentage': undefined,\n 'marginRatio': undefined,\n 'lastUpdateTimestamp': undefined,\n 'lastPrice': this.safeNumber (position, 'lastPrice'),\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n 'percentage': undefined,\n 'info': position,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"balance\": \"30.63364672\",\n \"availableBalance\": \"28.85635534\",\n \"positionMargin\": \"4.3421\",\n \"orderMargin\": \"0\",\n \"asset\": \"USDT\",\n \"crossUnRealizedPnl\": \"2.5649\"\n }" ], "line_end" => 1867, "line_start" => 1844, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "balance" } ], "name" => "parseSwapBalance", "signature" => "parseSwapBalance (balance): Balances", "source" => "parseSwapBalance (balance): Balances {\n //\n // {\n // \"balance\": \"30.63364672\",\n // \"availableBalance\": \"28.85635534\",\n // \"positionMargin\": \"4.3421\",\n // \"orderMargin\": \"0\",\n // \"asset\": \"USDT\",\n // \"crossUnRealizedPnl\": \"2.5649\"\n // }\n //\n const currencyId = this.safeString (balance, 'asset');\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n account['total'] = this.safeString (balance, 'balance');\n const positionMargin = this.safeString (balance, 'positionMargin');\n const orderMargin = this.safeString (balance, 'orderMargin');\n account['used'] = Precise.stringAdd (positionMargin, orderMargin);\n const result: Dict = {\n 'info': balance,\n };\n result[code] = account;\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"t\": 1721685896846,\n \"s\": \"BTCUSDT-PERPETUAL\",\n \"c\": \"67756.7\",\n \"h\": \"68479.9\",\n \"l\": \"66594.3\",\n \"o\": \"68279.7\",\n \"b\": \"67756.6\",\n \"a\": \"67756.7\",\n \"v\": \"1604722\",\n \"qv\": \"108827258.7761\"\n }" ], "line_end" => 1712, "line_start" => 1670, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "this.safeString (ticker, 'h')" }, %{ "comment" => nil, "key" => "low", "value" => "this.safeString (ticker, 'l')" }, %{ "comment" => nil, "key" => "bid", "value" => "this.safeString (ticker, 'b')" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "undefined" }, %{ "comment" => nil, "key" => "ask", "value" => "this.safeString (ticker, 'a')" }, %{ "comment" => nil, "key" => "askVolume", "value" => "undefined" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "this.safeString (ticker, 'o')" }, %{ "comment" => nil, "key" => "close", "value" => "last" }, %{ "comment" => nil, "key" => "last", "value" => "last" }, %{ "comment" => nil, "key" => "previousClose", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeString (ticker, 'v')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "this.safeString (ticker, 'qv')" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker, market: Market = undefined): Ticker", "source" => "parseTicker (ticker, market: Market = undefined): Ticker {\n //\n // {\n // \"t\": 1721685896846,\n // \"s\": \"BTCUSDT-PERPETUAL\",\n // \"c\": \"67756.7\",\n // \"h\": \"68479.9\",\n // \"l\": \"66594.3\",\n // \"o\": \"68279.7\",\n // \"b\": \"67756.6\",\n // \"a\": \"67756.7\",\n // \"v\": \"1604722\",\n // \"qv\": \"108827258.7761\"\n // }\n //\n const timestamp = this.safeInteger (ticker, 't');\n const marketId = this.safeString (ticker, 's');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const last = this.safeString (ticker, 'c');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': this.safeString (ticker, 'h'),\n 'low': this.safeString (ticker, 'l'),\n 'bid': this.safeString (ticker, 'b'),\n 'bidVolume': undefined,\n 'ask': this.safeString (ticker, 'a'),\n 'askVolume': undefined,\n 'vwap': undefined,\n 'open': this.safeString (ticker, 'o'),\n 'close': last,\n 'last': last,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': undefined,\n 'average': undefined,\n 'baseVolume': this.safeString (ticker, 'v'),\n 'quoteVolume': this.safeString (ticker, 'qv'),\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"t\": 1721682745779,\n \"p\": \"67835.99\",\n \"q\": \"0.00017\",\n \"ibm\": true\n }", "{\n \"id\": \"1739352552862964736\",\n \"clientOrderId\": \"1722082982086472\",\n \"ticketId\": \"1739352552795029504\",\n \"symbol\": \"ETHUSDT\",\n \"symbolName\": \"ETHUSDT\",\n \"orderId\": \"1739352552762301440\",\n \"matchOrderId\": \"0\",\n \"price\": \"3289.96\",\n \"qty\": \"0.001\",\n \"commission\": \"0.0000012\",\n \"commissionAsset\": \"ETH\",\n \"time\": \"1722082982097\",\n \"isBuyer\": true,\n \"isMaker\": false,\n \"fee\": {\n \"feeCoinId\": \"ETH\",\n \"feeCoinName\": \"ETH\",\n \"fee\": \"0.0000012\"\n },\n \"feeCoinId\": \"ETH\",\n \"feeAmount\": \"0.0000012\",\n \"makerRebate\": \"0\"\n }", "{\n \"time\": \"1722429951648\",\n \"tradeId\": \"1742263144691139328\",\n \"orderId\": \"1742263144028363776\",\n \"symbol\": \"ETHUSDT-PERPETUAL\",\n \"price\": \"3327.54\",\n \"quantity\": \"4\",\n \"commissionAsset\": \"USDT\",\n \"commission\": \"0.00798609\",\n \"makerRebate\": \"0\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY_OPEN\",\n \"realizedPnl\": \"0\",\n \"isMarker\": false\n }" ], "line_end" => 1533, "line_start" => 1428, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (trade, 'id', 'tradeId')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeString2 (trade, 'p', 'price')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeStringN (trade, [ 'q', 'qty', 'quantity' ])" }, %{ "comment" => nil, "key" => "cost", "value" => "undefined" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "comment" => nil, "key" => "order", "value" => "this.safeString (trade, 'orderId')" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "info", "value" => "trade" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // fetchTrades\n //\n // {\n // \"t\": 1721682745779,\n // \"p\": \"67835.99\",\n // \"q\": \"0.00017\",\n // \"ibm\": true\n // }\n //\n // fetchMyTrades spot\n //\n // {\n // \"id\": \"1739352552862964736\",\n // \"clientOrderId\": \"1722082982086472\",\n // \"ticketId\": \"1739352552795029504\",\n // \"symbol\": \"ETHUSDT\",\n // \"symbolName\": \"ETHUSDT\",\n // \"orderId\": \"1739352552762301440\",\n // \"matchOrderId\": \"0\",\n // \"price\": \"3289.96\",\n // \"qty\": \"0.001\",\n // \"commission\": \"0.0000012\",\n // \"commissionAsset\": \"ETH\",\n // \"time\": \"1722082982097\",\n // \"isBuyer\": true,\n // \"isMaker\": false,\n // \"fee\": {\n // \"feeCoinId\": \"ETH\",\n // \"feeCoinName\": \"ETH\",\n // \"fee\": \"0.0000012\"\n // },\n // \"feeCoinId\": \"ETH\",\n // \"feeAmount\": \"0.0000012\",\n // \"makerRebate\": \"0\"\n // }\n //\n // fetchMyTrades swap\n // {\n // \"time\": \"1722429951648\",\n // \"tradeId\": \"1742263144691139328\",\n // \"orderId\": \"1742263144028363776\",\n // \"symbol\": \"ETHUSDT-PERPETUAL\",\n // \"price\": \"3327.54\",\n // \"quantity\": \"4\",\n // \"commissionAsset\": \"USDT\",\n // \"commission\": \"0.00798609\",\n // \"makerRebate\": \"0\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY_OPEN\",\n // \"realizedPnl\": \"0\",\n // \"isMarker\": false\n // }\n const timestamp = this.safeInteger2 (trade, 't', 'time');\n const marketId = this.safeString (trade, 'symbol');\n market = this.safeMarket (marketId, market);\n let side = this.safeStringLower (trade, 'side'); // swap trades have side param\n if (side !== undefined) {\n side = this.safeString (side.split ('_'), 0);\n }\n const isBuyer = this.safeBool (trade, 'isBuyer');\n if (isBuyer !== undefined) {\n side = isBuyer ? 'buy' : 'sell';\n }\n let takerOrMaker = undefined;\n const isMaker = this.safeBoolN (trade, [ 'isMaker', 'isMarker' ]);\n if (isMaker !== undefined) {\n takerOrMaker = isMaker ? 'maker' : 'taker';\n }\n const isBuyerMaker = this.safeBool (trade, 'ibm');\n // if public trade\n if (isBuyerMaker !== undefined) {\n takerOrMaker = 'taker';\n side = isBuyerMaker ? 'sell' : 'buy';\n }\n let feeCost = this.safeString (trade, 'commission');\n let feeCurrncyId = this.safeString (trade, 'commissionAsset');\n const feeInfo = this.safeDict (trade, 'fee');\n let fee = undefined;\n if (feeInfo !== undefined) {\n feeCost = this.safeString (feeInfo, 'fee');\n feeCurrncyId = this.safeString (feeInfo, 'feeCoinId');\n }\n if (feeCost !== undefined) {\n fee = {\n 'cost': this.parseNumber (feeCost),\n 'currency': this.safeCurrencyCode (feeCurrncyId),\n };\n }\n return this.safeTrade ({\n 'id': this.safeString2 (trade, 'id', 'tradeId'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': market['symbol'],\n 'side': side,\n 'price': this.safeString2 (trade, 'p', 'price'),\n 'amount': this.safeStringN (trade, [ 'q', 'qty', 'quantity' ]),\n 'cost': undefined,\n 'takerOrMaker': takerOrMaker,\n 'type': undefined,\n 'order': this.safeString (trade, 'orderId'),\n 'fee': fee,\n 'info': trade,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"UXLINKUSDT\",\n \"productType\": \"Token-Token\",\n \"buyMakerFeeCurrency\": \"UXLINK\",\n \"buyTakerFeeCurrency\": \"UXLINK\",\n \"sellMakerFeeCurrency\": \"USDT\",\n \"sellTakerFeeCurrency\": \"USDT\",\n \"actualMakerRate\": \"0.0012\",\n \"actualTakerRate\": \"0.0012\"\n }", "{\n \"openMakerFee\": \"0.00025\",\n \"openTakerFee\": \"0.0006\",\n \"closeMakerFee\": \"0.00025\",\n \"closeTakerFee\": \"0.0006\"\n }" ], "line_end" => 4316, "line_start" => 4284, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber2 (fee, 'openMakerFee', 'actualMakerRate')" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber2 (fee, 'openTakerFee', 'actualTakerRate')" }, %{ "comment" => nil, "key" => "percentage", "value" => "true" }, %{ "comment" => nil, "key" => "tierBased", "value" => "true" } ], "name" => "parseTradingFee", "signature" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface", "source" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface {\n //\n // spot\n // {\n // \"symbol\": \"UXLINKUSDT\",\n // \"productType\": \"Token-Token\",\n // \"buyMakerFeeCurrency\": \"UXLINK\",\n // \"buyTakerFeeCurrency\": \"UXLINK\",\n // \"sellMakerFeeCurrency\": \"USDT\",\n // \"sellTakerFeeCurrency\": \"USDT\",\n // \"actualMakerRate\": \"0.0012\",\n // \"actualTakerRate\": \"0.0012\"\n // }\n //\n // swap\n // {\n // \"openMakerFee\": \"0.00025\",\n // \"openTakerFee\": \"0.0006\",\n // \"closeMakerFee\": \"0.00025\",\n // \"closeTakerFee\": \"0.0006\"\n // }\n //\n const marketId = this.safeString (fee, 'symbol');\n market = this.safeMarket (marketId, market);\n return {\n 'info': fee,\n 'symbol': market['symbol'],\n 'maker': this.safeNumber2 (fee, 'openMakerFee', 'actualMakerRate'),\n 'taker': this.safeNumber2 (fee, 'openTakerFee', 'actualTakerRate'),\n 'percentage': true,\n 'tierBased': true,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"time\": \"1721641082163\",\n \"coin\": \"TRXUSDT\", // todo how to parse it?\n \"coinName\": \"TRXUSDT\",\n \"address\": \"TBA6CypYJizwA9XdC7Ubgc5F1bxrQ7SqPt\",\n \"quantity\": \"86.00000000000000000000\",\n \"status\": 4,\n \"statusCode\": \"4\",\n \"txId\": \"0970c14da4d7412295fa7b21c03a08da319e746a0d59ef14462a74183d118da4\"\n }", "{\n \"time\": \"1723545505366\",\n \"id\": \"W611267400947572736\",\n \"coin\": \"USDT\",\n \"coinId\": \"USDT\",\n \"coinName\": \"USDT\",\n \"address\": \"TQbkBMnWnJNGTAUpFS4kvv4NRLzUAnGAes\",\n \"quantity\": \"2.00000000\",\n \"arriveQuantity\": \"2.00000000\",\n \"txId\": \"f83f94e7d2e81fbec98c66c25d6615872cc2d426145629b6cf22e5e0a0753715\",\n \"addressUrl\": \"TQbkBMnWnJNGTAUpFS4kvv4NRLzUAnGAes\",\n \"feeCoinId\": \"USDT\",\n \"feeCoinName\": \"USDT\",\n \"fee\": \"1.00000000\",\n \"remark\": \"\",\n \"platform\": \"\"\n }", "{\n \"success\": true,\n \"id\": \"0\",\n \"orderId\": \"W611267400947572736\",\n \"accountId\": \"1732885739589466115\"\n }" ], "line_end" => 2179, "line_start" => 2089, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "txid", "value" => "txid" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "network", "value" => "undefined" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "addressTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tag", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransactionStatus (status)" }, %{ "comment" => nil, "key" => "updated", "value" => "undefined" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction, currency: Currency = undefined): Transaction {\n //\n // fetchDeposits\n // {\n // \"time\": \"1721641082163\",\n // \"coin\": \"TRXUSDT\", // todo how to parse it?\n // \"coinName\": \"TRXUSDT\",\n // \"address\": \"TBA6CypYJizwA9XdC7Ubgc5F1bxrQ7SqPt\",\n // \"quantity\": \"86.00000000000000000000\",\n // \"status\": 4,\n // \"statusCode\": \"4\",\n // \"txId\": \"0970c14da4d7412295fa7b21c03a08da319e746a0d59ef14462a74183d118da4\"\n // }\n //\n // fetchWithdrawals\n // {\n // \"time\": \"1723545505366\",\n // \"id\": \"W611267400947572736\",\n // \"coin\": \"USDT\",\n // \"coinId\": \"USDT\",\n // \"coinName\": \"USDT\",\n // \"address\": \"TQbkBMnWnJNGTAUpFS4kvv4NRLzUAnGAes\",\n // \"quantity\": \"2.00000000\",\n // \"arriveQuantity\": \"2.00000000\",\n // \"txId\": \"f83f94e7d2e81fbec98c66c25d6615872cc2d426145629b6cf22e5e0a0753715\",\n // \"addressUrl\": \"TQbkBMnWnJNGTAUpFS4kvv4NRLzUAnGAes\",\n // \"feeCoinId\": \"USDT\",\n // \"feeCoinName\": \"USDT\",\n // \"fee\": \"1.00000000\",\n // \"remark\": \"\",\n // \"platform\": \"\"\n // }\n //\n // withdraw\n // {\n // \"success\": true,\n // \"id\": \"0\",\n // \"orderId\": \"W611267400947572736\",\n // \"accountId\": \"1732885739589466115\"\n // }\n //\n const id = this.safeString2 (transaction, 'id', 'orderId');\n const address = this.safeString (transaction, 'address');\n let status = this.safeString (transaction, 'status'); // for fetchDeposits\n if (status === undefined) {\n const success = this.safeBool (transaction, 'success', false); // for withdraw\n if (success) {\n status = 'ok';\n } else {\n const addressUrl = this.safeString (transaction, 'addressUrl'); // for fetchWithdrawals\n if (addressUrl !== undefined) {\n status = 'ok';\n }\n }\n }\n const txid = this.safeString (transaction, 'txId');\n const coin = this.safeString (transaction, 'coin');\n const code = this.safeCurrencyCode (coin, currency);\n const timestamp = this.safeInteger (transaction, 'time');\n const amount = this.safeNumber (transaction, 'quantity');\n const feeCost = this.safeNumber (transaction, 'fee');\n let fee = undefined;\n if (feeCost !== undefined) {\n fee = {\n 'cost': feeCost,\n 'currency': code,\n };\n }\n return {\n 'info': transaction,\n 'id': id,\n 'txid': txid,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'network': undefined,\n 'address': address,\n 'addressTo': undefined,\n 'addressFrom': undefined,\n 'tag': undefined,\n 'tagTo': undefined,\n 'tagFrom': undefined,\n 'type': undefined,\n 'amount': amount,\n 'currency': code,\n 'status': this.parseTransactionStatus (status),\n 'updated': undefined,\n 'internal': undefined,\n 'comment': undefined,\n 'fee': fee,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2197, "line_start" => 2181, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status)", "source" => "parseTransactionStatus (status) {\n const statuses: Dict = {\n '1': 'pending',\n '2': 'pending',\n '3': 'failed',\n '4': 'ok',\n '5': 'pending',\n '6': 'ok',\n '7': 'failed',\n '8': 'cancelled',\n '9': 'failed',\n '10': 'failed',\n 'successful': 'ok',\n 'success': 'ok',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2253, "line_start" => 2234, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (transfer, 'orderId')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "toAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "info", "value" => "transfer" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer, currency: Currency = undefined)", "source" => "parseTransfer (transfer, currency: Currency = undefined) {\n const timestamp = this.safeInteger (transfer, 'timestamp');\n const currencyId = this.safeString (currency, 'id');\n let status: Str = undefined;\n const success = this.safeBool (transfer, 'success', false);\n if (success) {\n status = 'ok';\n }\n return {\n 'id': this.safeString (transfer, 'orderId'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'amount': undefined,\n 'fromAccount': undefined,\n 'toAccount': undefined,\n 'status': status,\n 'info': transfer,\n };\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 100, period: 1000, requests: 10, rolling_window_size: 60000 }, raw_endpoints: %{ private: [ %{ auth: false, cost: 1, method: :get, path: "/api/v1/account" }, %{ auth: false, cost: 5, method: :get, path: "/api/v1/account/balanceFlow" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/account/checkApiKey" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/account/deposit/address" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/account/depositOrders" }, %{ auth: false, cost: 5, method: :get, path: "/api/v1/account/trades" }, %{ auth: false, cost: 5, method: :get, path: "/api/v1/account/type" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/account/vipInfo" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/account/withdrawOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/balance" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/commissionRate" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/getBestOrder" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/historyOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/leverage" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/liquidationAssignStatus" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/openOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/order" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/positions" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/riskLimit" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/subAccount/historyOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/subAccount/openOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/subAccount/userTrades" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/userTrades" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/spot/openOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/spot/order" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/spot/subAccount/openOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/spot/subAccount/tradeOrders" }, %{ auth: false, cost: 5, method: :get, path: "/api/v1/spot/tradeOrders" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/subAccount/trades" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1.1/spot/order" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/account/assetTransfer" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/account/authAddress" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/account/withdraw" }, %{ auth: false, cost: 5, method: :post, path: "/api/v1/futures/batchOrders" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/futures/leverage" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/futures/order" }, %{ auth: false, cost: 3, method: :post, path: "/api/v1/futures/position/trading-stop" }, %{ auth: false, cost: 5, method: :post, path: "/api/v1/spot/batchOrders" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/spot/order" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/spot/orderTest" }, %{ auth: false, cost: 1, method: :post, path: "/api/v1/userDataStream" }, %{ auth: false, cost: 1, method: :put, path: "/api/v1/userDataStream" }, %{ auth: false, cost: 1, method: :delete, path: "/api/v1/futures/batchOrders" }, %{ auth: false, cost: 1, method: :delete, path: "/api/v1/futures/cancelOrderByIds" }, %{ auth: false, cost: 1, method: :delete, path: "/api/v1/futures/order" }, %{ auth: false, cost: 5, method: :delete, path: "/api/v1/spot/cancelOrderByIds" }, %{ auth: false, cost: 5, method: :delete, path: "/api/v1/spot/openOrders" }, %{ auth: false, cost: 1, method: :delete, path: "/api/v1/spot/order" }, %{ auth: false, cost: 1, method: :delete, path: "/api/v1/userDataStream" } ], public: [ %{ auth: false, cost: 5, method: :get, path: "/api/v1/exchangeInfo" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/fundingRate" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/futures/historyFundingRate" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/ping" }, %{ auth: false, cost: 1, method: :get, path: "/api/v1/time" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/depth" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/depth/merged" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/index" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/klines" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/markPrice" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/ticker/24hr" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/ticker/bookTicker" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/ticker/price" }, %{ auth: false, cost: 1, method: :get, path: "/quote/v1/trades" } ] }, required_credentials: %{ api_key: true, password: false, secret: true, uid: false }, requires_eddsa: false, response_error: %{ code_field: "code", field: "code", message_field: "msg", success_values: [ "0", "0000" ], type: :success_code }, signing: %{ api_key_header: "X-HK-APIKEY", broker_config: %{ header: "INPUT-SOURCE", option_key: "broker" }, confidence: :high, pattern: :hmac_sha256_query, recv_window: 5000, uses_recv_window: true }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 10000, "min" => 0.3 }, "cost" => %{}, "price" => %{ "max" => 100000, "min" => 0.0001 } }, sample_precision: %{ "amount" => 0.01, "price" => 0.0001 }, spot: %{ base: "0G", base_id: "0G", case: :upper, contract: false, id: "0GUSDT", limits: %{ "amount" => %{ "max" => 10000, "min" => 0.3 }, "cost" => %{}, "leverage" => %{}, "price" => %{ "max" => 100000, "min" => 0.0001 } }, maker: 0.0012, precision: %{ "amount" => 0.01, "price" => 0.0001 }, quote: "USDT", quote_id: "USDT", separator: "", symbol: "0G/USDT", taker: 0.0012 }, swap: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 0.001, id: "BTCUSDT-PERPETUAL", inverse: false, limits: %{ "amount" => %{ "max" => 10000, "min" => 1 }, "cost" => %{}, "leverage" => %{ "max" => 20, "min" => 1 }, "price" => %{ "max" => 100000, "min" => 0.1 } }, linear: true, maker: 2.5e-4, precision: %{ "amount" => 1, "price" => 0.1 }, quote: "USDT", quote_id: "USDT", separator: "-", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT", taker: 0.0006 } }, symbol_patterns: %{ spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :no_separator_upper, separator: "", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :suffix_perpetual, separator: "", suffix: "-PERPETUAL" } }, timeframes: %{ "12h" => "12h", "15m" => "15m", "1M" => "1M", "1d" => "1d", "1h" => "1h", "1m" => "1m", "1w" => "1w", "2h" => "2h", "30m" => "30m", "3m" => "3m", "4h" => "4h", "5m" => "5m", "6h" => "6h", "8h" => "8h" }, url_strategy: %{ detected_from: "fallback", pattern: :no_prefix, prefix: nil }, urls: %{ api: "https://api-glb.hashkey.com", api_sections: %{ "private" => "https://api-glb.hashkey.com", "public" => "https://api-glb.hashkey.com" }, doc: "https://hashkeyglobal-apidoc.readme.io/", other: nil, sandbox: %{ "private" => "https://api-glb.sim.hashkeydev.com", "public" => "https://api-glb.sim.hashkeydev.com" }, www: "https://global.hashkey.com/" }, version: "v1", ws: %{ channel_templates: %{ watch_balance: %{ auth_required: true, market_id_format: :native, params: [], pattern: :event_sub }, watch_my_trades: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_sub }, watch_ohlcv: %{ channel_name: "kline_", market_id_format: :native, params: [ %{ "default" => nil, "name" => "interval" }, %{ "default" => nil, "name" => "limit" } ], pattern: :event_sub }, watch_order_book: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_sub }, watch_orders: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_sub }, watch_positions: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_sub }, watch_private: %{ auth_required: true, market_id_format: :native, params: [], pattern: :event_sub }, watch_ticker: %{ market_id_format: :native, params: [], pattern: :event_sub }, watch_trades: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_sub } }, has: %{ watch_balance: true, watch_bids_asks: nil, watch_liquidations: nil, watch_liquidations_for_symbols: nil, watch_my_liquidations: nil, watch_my_liquidations_for_symbols: nil, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: nil, watch_order_book: true, watch_order_book_for_symbols: nil, watch_orders: true, watch_orders_for_symbols: nil, watch_position: nil, watch_positions: false, watch_status: nil, watch_ticker: true, watch_tickers: nil, watch_trades: true, watch_trades_for_symbols: false }, message_patterns: [ %{ args_field: "topic", format: :event, keys: [ "event", "symbol", "topic" ], kind_field: "event", kind_value: "sub", sources: [ :send, :watch ] } ], options: %{ "watchBalance" => %{ "awaitBalanceSnapshot" => false, "fetchBalanceSnapshot" => true } }, streaming: %{ keep_alive: 10000 }, subscription_config: %{ args_field: "topic", args_format: :string, market_id_format: :native, op_field: "event" }, subscription_pattern: :event_subscribe, urls: %{ "private" => "wss://stream-glb.hashkey.com/api/v1/ws", "public" => "wss://stream-glb.hashkey.com/quote/ws/v1" }, watch_methods: [ "watchBalance", "watchMyTrades", "watchOHLCV", "watchOrderBook", "watchOrders", "watchPositions", "watchPrivate", "watchTicker", "watchTrades" ] } }