# BingX Exchange Specification # # Auto-generated by: mix ccxt.extract bingx # 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: [ "US" ], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "NAP" => "$NAP", "OMNI" => "OmniCat", "SNOW" => "Snowman", "TRUMP" => "TRUMPMAGA", "TRUMPSOL" => "TRUMP", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 60, "coveragePercent" => 100, "enabledMethods" => 64, "excluded" => [ %{ "method" => "fetchPositionsHistory", "reason" => "bingx fetchPositionsHistory () is not supported yet" }, %{ "method" => "fetchDepositWithdrawFee", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 2, "extractableMethods" => 62, "failures" => [ %{ "error" => "bingx fromAccount & toAccount parameters are required", "method" => "fetchTransfers" }, %{ "error" => "bingx setMargin() requires a type parameter either 1 (increase margin) or 2 (decrease margin)", "method" => "setMargin" } ] }, endpoints: [ %{ api_section: "spot/v1/private", auth: true, cost: 5, market_type: :spot, method: :post, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/trade/cancelOpenOrders", response_transformer: {:extract_path, ["data", "success"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 5, default_params: %{ "timeOut" => 1, "type" => "ACTIVATE" }, market_type: :spot, method: :post, name: :cancel_all_orders_after, param_mappings: %{}, params: [ :timeout ], path: "/trade/cancelAllAfter", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, market_type: :spot, method: :post, name: :cancel_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/trade/cancel", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "orderIdList" => [ "test-order-id" ], "symbol" => "BTCUSDT" }, market_type: :spot, method: :delete, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/trade/batchOrders", response_transformer: {:extract_path, ["data", "success"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, default_params: %{ "type" => "LIMIT" }, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, default_params: %{ "side" => "BUY", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{ "cost" => "quoteOrderQty" }, params: [ :symbol, :cost ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, default_params: %{ "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, default_params: %{ "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_order_with_cost, param_mappings: %{ "cost" => "quoteOrderQty" }, params: [ :symbol, :side, :cost ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, default_params: %{ "side" => "SELL", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_sell_order_with_cost, param_mappings: %{ "cost" => "quoteOrderQty" }, params: [ :symbol, :cost ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "stopLoss" => "{\"stopPrice\":48000,\"workingType\":\"MARK_PRICE\",\"type\":\"STOP_MARKET\",\"quantity\":0.001}", "symbol" => "BTCUSDT", "takeProfit" => "{\"stopPrice\":52000,\"workingType\":\"MARK_PRICE\",\"type\":\"TAKE_PROFIT_MARKET\",\"quantity\":0.001}" }, market_type: :swap, method: :post, name: :create_order_with_take_profit_and_stop_loss, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfit, :stopLoss ], path: "/trade/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "batchOrders" => "[{\"symbol\":\"BTCUSDT\",\"type\":\"LIMIT\",\"side\":\"BUY\",\"price\":50000,\"positionSide\":\"BOTH\",\"quantity\":0.001}]" }, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/trade/batchOrders", response_transformer: {:extract_path, ["data", "orders"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "reduceOnly" => true, "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "symbol" => "BTCUSDT", "triggerDirection" => "below", "type" => "STOP" }, market_type: :swap, method: :post, name: :create_stop_loss_order, param_mappings: %{ "amount" => "quantity", "stopLossPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :stopLossPrice ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "symbol" => "BTCUSDT", "triggerDirection" => "below", "type" => "TRIGGER_LIMIT" }, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "symbol" => "BTCUSDT", "triggerDirection" => "above", "type" => "TAKE_PROFIT" }, market_type: :swap, method: :post, name: :create_take_profit_order, param_mappings: %{ "amount" => "quantity", "takeProfitPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfitPrice ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "symbol" => "BTCUSDT", "type" => "TRAILING_STOP_MARKET" }, market_type: :swap, method: :post, name: :create_trailing_amount_order, param_mappings: %{ "amount" => "quantity", "trailingAmount" => "price" }, params: [ :symbol, :type, :side, :amount, :price, :trailingAmount, :trailingTriggerPrice ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "priceRate" => 0.01, "symbol" => "BTCUSDT", "type" => "TRAILING_STOP_MARKET" }, market_type: :swap, method: :post, name: :create_trailing_percent_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price, :trailingPercent, :trailingTriggerPrice ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "positionSide" => "BOTH", "symbol" => "BTCUSDT", "triggerDirection" => "below", "type" => "TRIGGER_LIMIT" }, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/trade/order", response_transformer: {:extract_path, ["data", "order"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 5, default_params: %{ "cancelReplaceMode" => "STOP_ON_FAILURE" }, market_type: :spot, method: :post, name: :edit_order, param_mappings: %{ "amount" => "quantity", "id" => "cancelOrderId" }, params: [ :id, :symbol, :type, :side, :amount, :price ], path: "/trade/order/cancelReplace", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/account/balance", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_canceled_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trade/historyOrders", response_transformer: {:extract_path, ["data", "orders"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trade/historyOrders", response_transformer: {:extract_path, ["data", "orders"]}, source: :intercepted }, %{ api_section: "wallets/v1/private", auth: true, cost: 5, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/capital/config/getall", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "wallets/v1/private", auth: true, cost: 5, default_params: %{ "limit" => 1000, "offset" => 0, "recvWindow" => "" }, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/capital/deposit/address", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "wallets/v1/private", auth: true, cost: 5, default_params: %{ "limit" => 1000, "offset" => 0, "recvWindow" => "" }, market_type: :spot, method: :get, name: :fetch_deposit_addresses_by_network, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/capital/deposit/address", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "wallets/v1/private", auth: true, cost: 5, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fees, param_mappings: %{}, params: [ :codes ], path: "/capital/config/getall", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v3/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/capital/deposit/hisrec", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/quote/premiumIndex", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/quote/fundingRate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/quote/premiumIndex", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/market/depth", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{}, params: [ :symbol ], path: "/trade/leverage", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 5, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_margin_mode, param_mappings: %{}, params: [ :symbol ], path: "/trade/marginType", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "swap/v1/public", auth: false, cost: 1, default_params: %{ "interval" => "1m", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, param_mappings: %{ "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/market/markPriceKlines", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_mark_price, param_mappings: %{}, params: [ :symbol ], path: "/quote/premiumIndex", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_mark_prices, param_mappings: %{}, params: [ :symbols ], path: "/quote/premiumIndex", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v1/private", auth: true, cost: 2, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_market_leverage_tiers, param_mappings: %{}, params: [ :symbol ], path: "/maintMarginRatio", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/quote/contracts", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 1, default_params: %{ "autoCloseType" => "LIQUIDATION", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_my_liquidations, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trade/forceOrders", response_transformer: {:extract_path, ["data", "orders"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 2, market_type: :spot, method: :get, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trade/myTrades", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/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: "/market/kline", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{}, params: [ :symbol ], path: "/quote/openInterest", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trade/openOrders", response_transformer: {:extract_path, ["data", "orders"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/trade/query", response_transformer: {:extract_path_unwrap, ["data", "order"]}, source: :intercepted }, %{ api_section: "spot/v1/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/market/depth", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "swap/v1/private", auth: true, cost: 2, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :spot, method: :get, name: :fetch_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trade/fullOrder", response_transformer: {:extract_path, ["data", "orders"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/user/positions", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "swap/v1/private", auth: true, cost: 5, market_type: :swap, method: :get, name: :fetch_position_mode, param_mappings: %{}, params: [ :symbol ], path: "/positionSide/dual", response_transformer: {:extract_path, ["data", "dualSidePosition"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 2, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/user/positions", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/ticker/24hr", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/ticker/24hr", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/server/time", response_transformer: {:extract_path, ["data", "serverTime"]}, source: :intercepted }, %{ api_section: "spot/v1/public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/market/trades", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "spot/v1/private", auth: true, cost: 5, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{}, params: [ :symbol ], path: "/user/commissionRate", response_transformer: {:extract_path_unwrap, ["data", "commission"]}, source: :intercepted }, %{ api_section: "spot/v3/private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/capital/withdraw/history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 5, default_params: %{ "side" => "LONG", "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/trade/leverage", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v2/private", auth: true, cost: 5, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_margin_mode, param_mappings: %{ "marginMode" => "marginType" }, params: [ :marginMode, :symbol ], path: "/trade/marginType", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "swap/v1/private", auth: true, cost: 5, default_params: %{ "dualSidePosition" => "true" }, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/positionSide/dual", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "api/asset/v1/private", auth: true, cost: 5, default_params: %{ "toAccount" => "stdFutures" }, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "code" => "asset" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/transfer", response_transformer: {:extract_path, ["transferId"]}, source: :intercepted } ], error_code_details: %{ 100001 => %{ description: nil, type: :invalid_credentials }, 100202 => %{ description: nil, type: :insufficient_balance }, 100204 => %{ description: nil, type: :invalid_parameters }, 100400 => %{ description: nil, type: :invalid_parameters }, 100410 => %{ description: "The current system is busy, please try again later", type: :exchange_error }, 100412 => %{ description: nil, type: :invalid_credentials }, 100414 => %{ description: "Code: 100414, Msg: risk control check fail,code(1)", type: :access_restricted }, 100419 => %{ description: "IP does not match IP whitelist", type: :access_restricted }, 100421 => %{ description: "This pair is currently restricted from API trading", type: :invalid_order }, 100437 => %{ description: "The withdrawal amount is lower than the minimum limit, please re-enter.", type: :invalid_parameters }, 100440 => %{ description: nil, type: :exchange_error }, 100500 => %{ description: "The current system is busy, please try again later", type: :exchange_error }, 100503 => %{ description: nil, type: :exchange_error }, 101204 => %{ description: "{\"code\":101204,\"msg\":\"\",\"data\":{}}", type: :insufficient_balance }, 110425 => %{ description: "Please ensure that the minimum nominal value of the order placed must be greater than 2u", type: :invalid_order }, 400 => %{ description: nil, type: :invalid_parameters }, 401 => %{ description: nil, type: :invalid_credentials }, 403 => %{ description: nil, type: :access_restricted }, 404 => %{ description: nil, type: :invalid_parameters }, 418 => %{ description: nil, type: :access_restricted }, 429 => %{ description: nil, type: :rate_limited }, 500 => %{ description: nil, type: :exchange_error }, 504 => %{ description: nil, type: :exchange_error }, 80001 => %{ description: nil, type: :invalid_parameters }, 80012 => %{ description: "{\"code\":80012,\"msg\":\"{\\\"Code\\\":101253,\\\"Msg\\\":\\\"margin is not enough\\\"}}", type: :insufficient_balance }, 80014 => %{ description: nil, type: :invalid_parameters }, 80016 => %{ description: nil, type: :order_not_found }, 80017 => %{ description: nil, type: :order_not_found }, "Insufficient assets" => %{ description: "{\"transferErrorMsg\":\"Insufficient assets\"}", type: :insufficient_balance }, "illegal transferType" => %{ description: "{\"transferErrorMsg\":\"illegal transferType\"}", type: :invalid_parameters } }, error_codes: %{ 100001 => :invalid_credentials, 100202 => :insufficient_balance, 100204 => :invalid_parameters, 100400 => :invalid_parameters, 100410 => :exchange_error, 100412 => :invalid_credentials, 100414 => :access_restricted, 100419 => :access_restricted, 100421 => :invalid_order, 100437 => :invalid_parameters, 100440 => :exchange_error, 100500 => :exchange_error, 100503 => :exchange_error, 101204 => :insufficient_balance, 110425 => :invalid_order, 400 => :invalid_parameters, 401 => :invalid_credentials, 403 => :access_restricted, 404 => :invalid_parameters, 418 => :access_restricted, 429 => :rate_limited, 500 => :exchange_error, 504 => :exchange_error, 80001 => :invalid_parameters, 80012 => :insufficient_balance, 80014 => :invalid_parameters, 80016 => :order_not_found, 80017 => :order_not_found, "Insufficient assets" => :insufficient_balance, "illegal transferType" => :invalid_parameters }, exceptions: %{ exact: %{ "100001" => :authentication_error, "100202" => :insufficient_funds, "100204" => :bad_request, "100400" => :bad_request, "100410" => :operation_failed, "100412" => :authentication_error, "100414" => :account_suspended, "100419" => :permission_denied, "100421" => :bad_symbol, "100437" => :bad_request, "100440" => :exchange_error, "100500" => :operation_failed, "100503" => :exchange_error, "101204" => :insufficient_funds, "110425" => :invalid_order, "400" => :bad_request, "401" => :authentication_error, "403" => :permission_denied, "404" => :bad_request, "418" => :permission_denied, "429" => :ddos_protection, "500" => :exchange_error, "504" => :exchange_error, "80001" => :bad_request, "80012" => :insufficient_funds, "80014" => :bad_request, "80016" => :order_not_found, "80017" => :order_not_found, "Insufficient assets" => :insufficient_funds, "illegal transferType" => :bad_request } }, exchange_options: %{ "accountsById" => %{ "USDTMPerp" => "linear", "coinMPerp" => "inverse", "fund" => "funding", "spot" => "spot", "stdFutures" => "future" }, "accountsByType" => %{ "funding" => "fund", "future" => "stdFutures", "inverse" => "coinMPerp", "linear" => "USDTMPerp", "spot" => "spot", "swap" => "USDTMPerp" }, "broker" => "CCXT", "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "defaultNetworks" => %{ "BTC" => "BTC", "ETH" => "ETH", "LTC" => "LTC", "USDC" => "ERC20", "USDT" => "ERC20" }, "defaultType" => "spot", "networks" => %{ "ARBITRUM" => "ARB", "AVAXC" => "AVAX-C", "HBAR" => "HEDERA", "MATIC" => "POLYGON", "ZKSYNC" => "ZKSYNCERA" }, "networksById" => %{ "ARB" => "ARBITRUM", "AVAX-C" => "AVAXC", "HEDERA" => "HBAR", "POLYGON" => "MATIC", "ZKSYNCERA" => "ZKSYNC" }, "recvWindow" => 5000 }, extended_metadata: %{ limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg", referral_url: "https://bingx.com/invite/OHETOM" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ default_for_future: %{ extends: "defaultForLinear" }, default_for_inverse: %{ extends: "defaultForLinear", fetch_my_trades: %{ limit: 1000 } }, default_for_linear: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: true, trigger_price_type: %{ index: true, last: true, mark: true } }, hedged: true, iceberg: false, leverage: false, margin_mode: false, market_buy_by_cost: true, market_buy_requires_price: false, self_trade_prevention: false, stop_loss_price: true, take_profit_price: true, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: true, trigger_direction: false, trigger_price: true, trigger_price_type: %{ index: true, last: true, mark: true } }, create_orders: %{ max: 5 }, fetch_closed_orders: %{ limit: 1000, margin_mode: false, symbol_required: true, trailing: false, trigger: false, until_days: 7 }, fetch_my_trades: %{ days_back: 30, limit: 512, margin_mode: false, symbol_required: true, until_days: 30 }, fetch_ohlcv: %{ limit: 1440 }, fetch_open_orders: %{ margin_mode: false, symbol_required: false, trailing: false, trigger: false }, fetch_order: %{ margin_mode: false, symbol_required: true, trailing: false, trigger: false }, fetch_orders: %{ days_back: 20000, limit: 1000, margin_mode: false, symbol_required: true, trailing: false, trigger: false, until_days: 7 }, sandbox: true }, future: %{ inverse: %{ extends: "defaultForFuture" }, linear: %{ extends: "defaultForFuture" } }, spot: %{ create_order: %{ trailing: false }, extends: "defaultForLinear", fetch_closed_orders: %{ limit: 100 }, fetch_currencies: %{ private: true }, fetch_my_trades: %{ days_back: 1, limit: 1000, until_days: 1 } }, swap: %{ inverse: %{ extends: "defaultForInverse" }, linear: %{ extends: "defaultForLinear" } } }, fees: %{ spot: %{ fee_side: "get", maker: 0.001, taker: 0.001 }, swap: %{ fee_side: "quote", maker: 0.0002, taker: 0.0005 }, tier_based: true }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (response === undefined) {\n return undefined; // fallback to default error handler\n }\n //\n // {\n // \"code\": 80014,\n // \"msg\": \"Invalid parameters, err:Key: 'GetTickerRequest.Symbol' Error:Field validation for \"Symbol\" failed on the \"len=0|endswith=-USDT\" tag\",\n // \"data\": {\n // }\n // }\n //\n const code = this.safeString(response, 'code');\n let message = this.safeString(response, 'msg');\n const transferErrorMsg = this.safeString(response, 'transferErrorMsg'); // handling with errors from transfer endpoint\n if ((transferErrorMsg !== undefined) || (code !== undefined && code !== '0')) {\n if (transferErrorMsg !== undefined) {\n message = transferErrorMsg;\n }\n const feedback = this.id + ' ' + body;\n this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);\n this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }", has: %{ add_margin: true, borrow_cross_margin: false, borrow_isolated_margin: false, borrow_margin: false, c_o_r_s: false, cancel_all_orders: true, cancel_all_orders_after: true, 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, close_all_positions: true, close_position: true, 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: true, create_market_order_with_cost_ws: false, create_market_order_ws: true, create_market_sell_order: false, create_market_sell_order_with_cost: true, 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: true, create_order_with_take_profit_and_stop_loss_ws: false, create_order_ws: false, create_orders: true, 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: false, create_stop_limit_order_ws: false, create_stop_loss_order: true, create_stop_loss_order_ws: false, create_stop_market_order: false, create_stop_market_order_ws: false, create_stop_order: true, create_stop_order_ws: false, create_take_profit_order: true, create_take_profit_order_ws: false, create_trailing_amount_order: true, create_trailing_amount_order_ws: false, create_trailing_percent_order: true, 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: false, 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: false, fetch_canceled_orders: true, fetch_closed_order: false, fetch_closed_orders: true, 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: true, fetch_deposit_withdraw_fee: true, fetch_deposit_withdraw_fees: true, 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: false, fetch_ledger_entry: false, fetch_leverage: true, fetch_leverage_tiers: false, 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: true, fetch_margin_modes: false, fetch_mark_ohlcv: true, fetch_mark_price: true, fetch_mark_prices: true, fetch_market_leverage_tiers: true, fetch_markets: true, fetch_markets_ws: false, fetch_my_liquidations: true, fetch_my_settlement_history: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: true, 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: true, fetch_orders_by_status: false, fetch_orders_ws: false, fetch_position: true, fetch_position_history: false, fetch_position_mode: true, fetch_position_ws: false, fetch_positions: true, fetch_positions_for_symbol: false, fetch_positions_for_symbol_ws: false, fetch_positions_history: true, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: false, fetch_settlement_history: false, fetch_status: false, 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: false, 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: true, 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: true, repay_cross_margin: false, repay_isolated_margin: false, sandbox: true, set_leverage: true, set_margin: true, set_margin_mode: true, set_position_mode: true, sign_in: false, spot: true, swap: true, 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: false, ws: false }, http_config: nil, id: "bingx", markets: nil, name: "BingX", ohlcv_timestamp_resolution: :milliseconds, options: %{ accounts_by_id: %{ "USDTMPerp" => "linear", "coinMPerp" => "inverse", "fund" => "funding", "spot" => "spot", "stdFutures" => "future" }, accounts_by_type: %{ "funding" => "fund", "future" => "stdFutures", "inverse" => "coinMPerp", "linear" => "USDTMPerp", "spot" => "spot", "swap" => "USDTMPerp" }, broker: "CCXT", default_account_type: "spot", default_networks: %{ "BTC" => "BTC", "ETH" => "ETH", "LTC" => "LTC", "USDC" => "ERC20", "USDT" => "ERC20" }, default_type: "spot", networks: %{ "ARBITRUM" => "ARB", "AVAXC" => "AVAX-C", "HBAR" => "HEDERA", "MATIC" => "POLYGON", "ZKSYNC" => "ZKSYNCERA" }, recv_window: 5000 }, order_mappings: %{ side_format: :uppercase, side_key: "side", type_format: :uppercase, type_key: "type" }, param_mappings: %{ "amount" => "quantity", "code" => "asset", "cost" => "quoteOrderQty", "id" => "orderId", "marginMode" => "marginType", "since" => "startTime", "stopLossPrice" => "stopPrice", "takeProfitPrice" => "stopPrice", "timeframe" => "interval", "trailingAmount" => "price", "triggerPrice" => "stopPrice" }, parse_methods: [ %{ "comment" => nil, "examples" => [ "{\n \"code\": 0,\n \"timestamp\": 1721192833454,\n \"data\": [\n {\n \"asset\": \"USDT\",\n \"balance\": \"4.72644300000000000000\",\n \"crossWalletBalance\": \"4.72644300000000000000\",\n \"crossUnPnl\": \"0\",\n \"availableBalance\": \"4.72644300000000000000\",\n \"maxWithdrawAmount\": \"4.72644300000000000000\",\n \"marginAvailable\": false,\n \"updateTime\": 1721192833443\n },\n ]\n }", "{\n \"code\": 0,\n \"msg\": \"\",\n \"debugMsg\": \"\",\n \"data\": {\n \"balances\": [\n {\n \"asset\": \"USDT\",\n \"free\": \"45.733046995800514\",\n \"locked\": \"0\"\n },\n ]\n }\n }", "{\n \"code\": 0,\n \"msg\": \"\",\n \"timestamp\": 1721191833813,\n \"data\": [\n {\n \"asset\": \"SOL\",\n \"balance\": \"0.35707951\",\n \"equity\": \"0.35791051\",\n \"unrealizedProfit\": \"0.00083099\",\n \"availableMargin\": \"0.35160653\",\n \"usedMargin\": \"0.00630397\",\n \"freezedMargin\": \"0\",\n \"shortUid\": \"12851936\"\n }\n ]\n }", "{\n \"code\": 0,\n \"msg\": \"\",\n \"data\": [\n {\n \"userId\": \"116***295\",\n \"asset\": \"USDT\",\n \"balance\": \"194.8212\",\n \"equity\": \"196.7431\",\n \"unrealizedProfit\": \"1.9219\",\n \"realisedProfit\": \"-109.2504\",\n \"availableMargin\": \"193.7609\",\n \"usedMargin\": \"1.0602\",\n \"freezedMargin\": \"0.0000\",\n \"shortUid\": \"12851936\"\n }\n ]\n }" ], "line_end" => 2587, "line_start" => 2476, "mappings" => [], "name" => "parseBalance", "signature" => "parseBalance (response): Balances", "source" => "parseBalance (response): Balances {\n //\n // standard\n //\n // {\n // \"code\": 0,\n // \"timestamp\": 1721192833454,\n // \"data\": [\n // {\n // \"asset\": \"USDT\",\n // \"balance\": \"4.72644300000000000000\",\n // \"crossWalletBalance\": \"4.72644300000000000000\",\n // \"crossUnPnl\": \"0\",\n // \"availableBalance\": \"4.72644300000000000000\",\n // \"maxWithdrawAmount\": \"4.72644300000000000000\",\n // \"marginAvailable\": false,\n // \"updateTime\": 1721192833443\n // },\n // ]\n // }\n //\n // spot\n //\n // {\n // \"code\": 0,\n // \"msg\": \"\",\n // \"debugMsg\": \"\",\n // \"data\": {\n // \"balances\": [\n // {\n // \"asset\": \"USDT\",\n // \"free\": \"45.733046995800514\",\n // \"locked\": \"0\"\n // },\n // ]\n // }\n // }\n //\n // inverse swap\n //\n // {\n // \"code\": 0,\n // \"msg\": \"\",\n // \"timestamp\": 1721191833813,\n // \"data\": [\n // {\n // \"asset\": \"SOL\",\n // \"balance\": \"0.35707951\",\n // \"equity\": \"0.35791051\",\n // \"unrealizedProfit\": \"0.00083099\",\n // \"availableMargin\": \"0.35160653\",\n // \"usedMargin\": \"0.00630397\",\n // \"freezedMargin\": \"0\",\n // \"shortUid\": \"12851936\"\n // }\n // ]\n // }\n //\n // linear swap\n //\n // {\n // \"code\": 0,\n // \"msg\": \"\",\n // \"data\": [\n // {\n // \"userId\": \"116***295\",\n // \"asset\": \"USDT\",\n // \"balance\": \"194.8212\",\n // \"equity\": \"196.7431\",\n // \"unrealizedProfit\": \"1.9219\",\n // \"realisedProfit\": \"-109.2504\",\n // \"availableMargin\": \"193.7609\",\n // \"usedMargin\": \"1.0602\",\n // \"freezedMargin\": \"0.0000\",\n // \"shortUid\": \"12851936\"\n // }\n // ]\n // }\n //\n const result: Dict = { 'info': response };\n const contractBalances = this.safeList (response, 'data');\n const firstContractBalances = this.safeDict (contractBalances, 0);\n const isContract = firstContractBalances !== undefined;\n const spotData = this.safeDict (response, 'data', {});\n const spotBalances = this.safeList2 (spotData, 'balances', 'assets', []);\n if (isContract) {\n for (let i = 0; i < contractBalances.length; i++) {\n const balance = contractBalances[i];\n const currencyId = this.safeString (balance, 'asset');\n if (currencyId === undefined) { // linear v3 returns empty asset\n break;\n }\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n account['free'] = this.safeString2 (balance, 'availableMargin', 'availableBalance');\n account['used'] = this.safeString (balance, 'usedMargin');\n account['total'] = this.safeString (balance, 'maxWithdrawAmount');\n result[code] = account;\n }\n } else {\n for (let i = 0; i < spotBalances.length; i++) {\n const balance = spotBalances[i];\n const currencyId = this.safeString (balance, 'asset');\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n account['free'] = this.safeString (balance, 'free');\n account['used'] = this.safeString (balance, 'locked');\n result[code] = account;\n }\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coinId\":\"4\",\n \"coin\":\"USDT\",\n \"network\":\"OMNI\",\n \"address\":\"1HXyx8HVQRY7Nhqz63nwnRB7SpS9xQPzLN\",\n \"addressWithPrefix\":\"1HXyx8HVQRY7Nhqz63nwnRB7SpS9xQPzLN\"\n }" ], "line_end" => 5309, "line_start" => 5284, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "depositAddress" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "network", "value" => "networkCode" }, %{ "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 // \"coinId\":\"4\",\n // \"coin\":\"USDT\",\n // \"network\":\"OMNI\",\n // \"address\":\"1HXyx8HVQRY7Nhqz63nwnRB7SpS9xQPzLN\",\n // \"addressWithPrefix\":\"1HXyx8HVQRY7Nhqz63nwnRB7SpS9xQPzLN\"\n // }\n //\n const tag = this.safeString (depositAddress, 'tag');\n const currencyId = this.safeString (depositAddress, 'coin');\n currency = this.safeCurrency (currencyId, currency);\n const code = currency['code'];\n const address = this.safeString (depositAddress, 'addressWithPrefix');\n const networkdId = this.safeString (depositAddress, 'network');\n const networkCode = this.networkIdToCode (networkdId, code);\n this.checkAddress (address);\n return {\n 'info': depositAddress,\n 'currency': code,\n 'network': networkCode,\n 'address': address,\n 'tag': tag,\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5977, "line_start" => 5943, "mappings" => [], "name" => "parseDepositWithdrawFee", "signature" => "parseDepositWithdrawFee (fee, currency: Currency = undefined)", "source" => "parseDepositWithdrawFee (fee, currency: Currency = undefined) {\n //\n // currencie structure\n //\n const networks = this.safeDict (fee, 'networks', {});\n const networkCodes = Object.keys (networks);\n const networksLength = networkCodes.length;\n const result: Dict = {\n 'info': networks,\n 'withdraw': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n 'deposit': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n 'networks': {},\n };\n if (networksLength !== 0) {\n for (let i = 0; i < networksLength; i++) {\n const networkCode = networkCodes[i];\n const network = networks[networkCode];\n result['networks'][networkCode] = {\n 'deposit': { 'fee': undefined, 'percentage': undefined },\n 'withdraw': { 'fee': this.safeNumber (network, 'fee'), 'percentage': false },\n };\n if (networksLength === 1) {\n result['withdraw']['fee'] = this.safeNumber (network, 'withdrawFee');\n result['withdraw']['percentage'] = false;\n }\n }\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC-USDT\",\n \"markPrice\": \"16884.5\",\n \"indexPrice\": \"16886.9\",\n \"lastFundingRate\": \"0.0001\",\n \"nextFundingTime\": 1672041600000\n }" ], "line_end" => 1745, "line_start" => 1713, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, '-', 'swap')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (contract, 'markPrice')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeNumber (contract, 'indexPrice')" }, %{ "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" => "this.safeNumber (contract, 'lastFundingRate')" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "nextFundingTimestamp" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "this.iso8601 (nextFundingTimestamp)" }, %{ "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\": \"BTC-USDT\",\n // \"markPrice\": \"16884.5\",\n // \"indexPrice\": \"16886.9\",\n // \"lastFundingRate\": \"0.0001\",\n // \"nextFundingTime\": 1672041600000\n // }\n //\n const marketId = this.safeString (contract, 'symbol');\n const nextFundingTimestamp = this.safeInteger (contract, 'nextFundingTime');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (marketId, market, '-', 'swap'),\n 'markPrice': this.safeNumber (contract, 'markPrice'),\n 'indexPrice': this.safeNumber (contract, 'indexPrice'),\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'fundingRate': this.safeNumber (contract, 'lastFundingRate'),\n 'fundingTimestamp': undefined,\n 'fundingDatetime': undefined,\n 'nextFundingRate': undefined,\n 'nextFundingTimestamp': nextFundingTimestamp,\n 'nextFundingDatetime': this.iso8601 (nextFundingTimestamp),\n 'previousFundingRate': undefined,\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n 'interval': undefined,\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC-USDT\",\n \"fundingRate\": \"0.0001\",\n \"fundingTime\": 1585684800000\n }" ], "line_end" => 1820, "line_start" => 1804, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (this.safeString (contract, 'symbol'), market, '-', 'swap')" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "this.safeNumber (contract, 'fundingRate')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseFundingRateHistory", "signature" => "parseFundingRateHistory (contract, market: Market = undefined)", "source" => "parseFundingRateHistory (contract, market: Market = undefined) {\n //\n // {\n // \"symbol\": \"BTC-USDT\",\n // \"fundingRate\": \"0.0001\",\n // \"fundingTime\": 1585684800000\n // }\n //\n const timestamp = this.safeInteger (contract, 'fundingTime');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (this.safeString (contract, 'symbol'), market, '-', 'swap'),\n 'fundingRate': this.safeNumber (contract, 'fundingRate'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"LDO-USDT\",\n \"incomeType\": \"FUNDING_FEE\",\n \"income\": \"-0.0292\",\n \"asset\": \"USDT\",\n \"info\": \"Funding Fee\",\n \"time\": 1702713615000,\n \"tranId\": \"170***6*2_3*9_20***97\",\n \"tradeId\": \"170***6*2_3*9_20***97\"\n }" ], "line_end" => 1905, "line_start" => 1881, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "income" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'swap')" }, %{ "comment" => nil, "key" => "code", "value" => "this.safeCurrencyCode (currencyId)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (income, 'tranId')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (income, 'income')" }, %{ "comment" => nil, "key" => "type", "value" => "'funding'" } ], "name" => "parseIncome", "signature" => "parseIncome (income, market: Market = undefined)", "source" => "parseIncome (income, market: Market = undefined) {\n // {\n // \"symbol\": \"LDO-USDT\",\n // \"incomeType\": \"FUNDING_FEE\",\n // \"income\": \"-0.0292\",\n // \"asset\": \"USDT\",\n // \"info\": \"Funding Fee\",\n // \"time\": 1702713615000,\n // \"tranId\": \"170***6*2_3*9_20***97\",\n // \"tradeId\": \"170***6*2_3*9_20***97\"\n // }\n const marketId = this.safeString (income, 'symbol');\n const currencyId = this.safeString (income, 'asset');\n const timestamp = this.safeInteger (income, 'time');\n return {\n 'info': income,\n 'symbol': this.safeSymbol (marketId, market, undefined, 'swap'),\n 'code': this.safeCurrencyCode (currencyId),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': this.safeString (income, 'tranId'),\n 'amount': this.safeNumber (income, 'income'),\n 'type': 'funding',\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"longLeverage\": 5,\n \"shortLeverage\": 5,\n \"maxLongLeverage\": 125,\n \"maxShortLeverage\": 125,\n \"availableLongVol\": \"0.0000\",\n \"availableShortVol\": \"0.0000\",\n \"availableLongVal\": \"0.0\",\n \"availableShortVal\": \"0.0\",\n \"maxPositionLongVal\": \"0.0\",\n \"maxPositionShortVal\": \"0.0\"\n }", "{\n \"symbol\": \"SOL-USD\",\n \"longLeverage\": 5,\n \"shortLeverage\": 5,\n \"maxLongLeverage\": 50,\n \"maxShortLeverage\": 50,\n \"availableLongVol\": \"4000000\",\n \"availableShortVol\": \"4000000\"\n }" ], "line_end" => 5736, "line_start" => 5699, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "undefined" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "this.safeInteger (leverage, 'longLeverage')" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "this.safeInteger (leverage, 'shortLeverage')" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage", "source" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage {\n //\n // linear swap\n //\n // {\n // \"longLeverage\": 5,\n // \"shortLeverage\": 5,\n // \"maxLongLeverage\": 125,\n // \"maxShortLeverage\": 125,\n // \"availableLongVol\": \"0.0000\",\n // \"availableShortVol\": \"0.0000\",\n // \"availableLongVal\": \"0.0\",\n // \"availableShortVal\": \"0.0\",\n // \"maxPositionLongVal\": \"0.0\",\n // \"maxPositionShortVal\": \"0.0\"\n // }\n //\n // inverse swap\n //\n // {\n // \"symbol\": \"SOL-USD\",\n // \"longLeverage\": 5,\n // \"shortLeverage\": 5,\n // \"maxLongLeverage\": 50,\n // \"maxShortLeverage\": 50,\n // \"availableLongVol\": \"4000000\",\n // \"availableShortVol\": \"4000000\"\n // }\n //\n const marketId = this.safeString (leverage, 'symbol');\n return {\n 'info': leverage,\n 'symbol': this.safeSymbol (marketId, market),\n 'marginMode': undefined,\n 'longLeverage': this.safeInteger (leverage, 'longLeverage'),\n 'shortLeverage': this.safeInteger (leverage, 'shortLeverage'),\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"time\": \"int64\",\n \"symbol\": \"string\",\n \"side\": \"string\",\n \"type\": \"string\",\n \"positionSide\": \"string\",\n \"cumQuote\": \"string\",\n \"status\": \"string\",\n \"stopPrice\": \"string\",\n \"price\": \"string\",\n \"origQty\": \"string\",\n \"avgPrice\": \"string\",\n \"executedQty\": \"string\",\n \"orderId\": \"int64\",\n \"profit\": \"string\",\n \"commission\": \"string\",\n \"workingType\": \"string\",\n \"updateTime\": \"int64\"\n }" ], "line_end" => 6222, "line_start" => 6182, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "liquidation" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (contractsString)" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.parseNumber (contractSizeString)" }, %{ "comment" => nil, "key" => "price", "value" => "this.parseNumber (priceString)" }, %{ "comment" => nil, "key" => "baseValue", "value" => "this.parseNumber (baseValueString)" }, %{ "comment" => nil, "key" => "quoteValue", "value" => "this.parseNumber (quoteValueString)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseLiquidation", "signature" => "parseLiquidation (liquidation, market: Market = undefined)", "source" => "parseLiquidation (liquidation, market: Market = undefined) {\n //\n // {\n // \"time\": \"int64\",\n // \"symbol\": \"string\",\n // \"side\": \"string\",\n // \"type\": \"string\",\n // \"positionSide\": \"string\",\n // \"cumQuote\": \"string\",\n // \"status\": \"string\",\n // \"stopPrice\": \"string\",\n // \"price\": \"string\",\n // \"origQty\": \"string\",\n // \"avgPrice\": \"string\",\n // \"executedQty\": \"string\",\n // \"orderId\": \"int64\",\n // \"profit\": \"string\",\n // \"commission\": \"string\",\n // \"workingType\": \"string\",\n // \"updateTime\": \"int64\"\n // }\n //\n const marketId = this.safeString (liquidation, 'symbol');\n const timestamp = this.safeInteger (liquidation, 'time');\n const contractsString = this.safeString (liquidation, 'executedQty');\n const contractSizeString = this.safeString (market, 'contractSize');\n const priceString = this.safeString (liquidation, 'avgPrice');\n const baseValueString = Precise.stringMul (contractsString, contractSizeString);\n const quoteValueString = Precise.stringMul (baseValueString, priceString);\n return this.safeLiquidation ({\n 'info': liquidation,\n 'symbol': this.safeSymbol (marketId, market),\n 'contracts': this.parseNumber (contractsString),\n 'contractSize': this.parseNumber (contractSizeString),\n 'price': this.parseNumber (priceString),\n 'baseValue': this.parseNumber (baseValueString),\n 'quoteValue': this.parseNumber (quoteValueString),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n });\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 6614, "line_start" => 6605, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "marginMode" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, '-', 'swap')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginType" } ], "name" => "parseMarginMode", "signature" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode", "source" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode {\n const marketId = this.safeString (marginMode, 'symbol');\n let marginType = this.safeStringLower (marginMode, 'marginType');\n marginType = (marginType === 'crossed') ? 'cross' : marginType;\n return {\n 'info': marginMode,\n 'symbol': this.safeSymbol (marketId, market, '-', 'swap'),\n 'marginMode': marginType,\n } as MarginMode;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"code\": 0,\n \"msg\": \"\",\n \"amount\": 1,\n \"type\": 1\n }" ], "line_end" => 5637, "line_start" => 5615, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "data" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeString (market, 'symbol')" }, %{ "comment" => nil, "key" => "type", "value" => "(type === '1') ? 'add' : 'reduce'" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'isolated'" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (data, 'amount')" }, %{ "comment" => nil, "key" => "total", "value" => "this.safeNumber (data, 'margin')" }, %{ "comment" => nil, "key" => "code", "value" => "this.safeString (market, 'settle')" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" } ], "name" => "parseMarginModification", "signature" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification", "source" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification {\n //\n // {\n // \"code\": 0,\n // \"msg\": \"\",\n // \"amount\": 1,\n // \"type\": 1\n // }\n //\n const type = this.safeString (data, 'type');\n return {\n 'info': data,\n 'symbol': this.safeString (market, 'symbol'),\n 'type': (type === '1') ? 'add' : 'reduce',\n 'marginMode': 'isolated',\n 'amount': this.safeNumber (data, 'amount'),\n 'total': this.safeNumber (data, 'margin'),\n 'code': this.safeString (market, 'settle'),\n 'status': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1124, "line_start" => 1021, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "base", "value" => "base" }, %{ "comment" => nil, "key" => "quote", "value" => "quote" }, %{ "comment" => nil, "key" => "settle", "value" => "settle" }, %{ "comment" => nil, "key" => "baseId", "value" => "baseId" }, %{ "comment" => nil, "key" => "quoteId", "value" => "quoteId" }, %{ "comment" => nil, "key" => "settleId", "value" => "currency" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "spot", "value" => "spot" }, %{ "comment" => nil, "key" => "margin", "value" => "false" }, %{ "comment" => nil, "key" => "swap", "value" => "swap" }, %{ "comment" => nil, "key" => "future", "value" => "false" }, %{ "comment" => nil, "key" => "option", "value" => "false" }, %{ "comment" => nil, "key" => "active", "value" => "isActive" }, %{ "comment" => nil, "key" => "contract", "value" => "swap" }, %{ "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" => "feeSide", "value" => "this.safeString (fees, 'feeSide')" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contractSize" }, %{ "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': quantityPrecision,\n 'price': pricePrecision,\n }" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': minAmount,\n 'max': undefined,\n },\n 'price': {\n 'min': minTickSize,\n 'max': undefined,\n },\n 'cost': {\n 'min': this.safeNumberN (market, [ 'minNotional', 'tradeMinUSDT', 'minTradeValue' ]),\n 'max': this.safeNumber (market, 'maxNotional'),\n },\n }" }, %{ "comment" => nil, "key" => "created", "value" => "timeOnline" }, %{ "comment" => nil, "key" => "info", "value" => "market" }, %{ "comment" => nil, "key" => "amount", "value" => "quantityPrecision" }, %{ "comment" => nil, "key" => "price", "value" => "pricePrecision" } ], "name" => "parseMarket", "signature" => "parseMarket (market: Dict): Market", "source" => "parseMarket (market: Dict): Market {\n const id = this.safeString (market, 'symbol');\n const symbolParts = id.split ('-');\n const baseId = symbolParts[0];\n const quoteId = symbolParts[1];\n const base = this.safeCurrencyCode (baseId);\n const quote = this.safeCurrencyCode (quoteId);\n let currency = this.safeString (market, 'currency');\n let checkIsInverse = false;\n let checkIsLinear = true;\n const minTickSize = this.safeNumber (market, 'minTickSize');\n if (minTickSize !== undefined) {\n // inverse swap market\n currency = baseId;\n checkIsInverse = true;\n checkIsLinear = false;\n }\n const settle = this.safeCurrencyCode (currency);\n let pricePrecision = this.safeNumber (market, 'tickSize');\n if (pricePrecision === undefined) {\n pricePrecision = this.parseNumber (this.parsePrecision (this.safeString (market, 'pricePrecision')));\n }\n let quantityPrecision = this.safeNumber (market, 'stepSize');\n if (quantityPrecision === undefined) {\n quantityPrecision = this.parseNumber (this.parsePrecision (this.safeString (market, 'quantityPrecision')));\n }\n const type = (settle !== undefined) ? 'swap' : 'spot';\n const spot = type === 'spot';\n const swap = type === 'swap';\n let symbol = base + '/' + quote;\n if (settle !== undefined) {\n symbol += ':' + settle;\n }\n const fees = this.safeDict (this.fees, type, {});\n const contractSize = (swap) ? this.parseNumber ('1') : undefined;\n let isActive = false;\n if ((this.safeString (market, 'apiStateOpen') === 'true') && (this.safeString (market, 'apiStateClose') === 'true')) {\n isActive = true; // swap active\n } else if (this.safeBool (market, 'apiStateSell') && this.safeBool (market, 'apiStateBuy') && (this.safeString (market, 'status') === '1')) {\n isActive = true; // spot active\n }\n const isInverse = (spot) ? undefined : checkIsInverse;\n const isLinear = (spot) ? undefined : checkIsLinear;\n let minAmount = undefined;\n if (!spot) {\n minAmount = this.safeNumber2 (market, 'minQty', 'tradeMinQuantity');\n }\n let timeOnline = this.safeInteger (market, 'timeOnline');\n if (timeOnline === 0) {\n timeOnline = undefined;\n }\n return this.safeMarketStructure ({\n 'id': id,\n 'symbol': symbol,\n 'base': base,\n 'quote': quote,\n 'settle': settle,\n 'baseId': baseId,\n 'quoteId': quoteId,\n 'settleId': currency,\n 'type': type,\n 'spot': spot,\n 'margin': false,\n 'swap': swap,\n 'future': false,\n 'option': false,\n 'active': isActive,\n 'contract': swap,\n 'linear': isLinear,\n 'inverse': isInverse,\n 'taker': this.safeNumber (fees, 'taker'),\n 'maker': this.safeNumber (fees, 'maker'),\n 'feeSide': this.safeString (fees, 'feeSide'),\n 'contractSize': contractSize,\n 'expiry': undefined,\n 'expiryDatetime': undefined,\n 'strike': undefined,\n 'optionType': undefined,\n 'precision': {\n 'amount': quantityPrecision,\n 'price': pricePrecision,\n },\n 'limits': {\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': minAmount,\n 'max': undefined,\n },\n 'price': {\n 'min': minTickSize,\n 'max': undefined,\n },\n 'cost': {\n 'min': this.safeNumberN (market, [ 'minNotional', 'tradeMinUSDT', 'minTradeValue' ]),\n 'max': this.safeNumber (market, 'maxNotional'),\n },\n },\n 'created': timeOnline,\n 'info': market,\n });\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"tier\": \"Tier 1\",\n \"symbol\": \"ETH-USDT\",\n \"minPositionVal\": \"0\",\n \"maxPositionVal\": \"900000\",\n \"maintMarginRatio\": \"0.003300\",\n \"maintAmount\": \"0.000000\"\n }\n ]" ], "line_end" => 6815, "line_start" => 6783, "mappings" => [ %{ "comment" => nil, "key" => "tier", "value" => "this.safeNumber (tierParts, 1)" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeString (market, 'settle')" }, %{ "comment" => nil, "key" => "minNotional", "value" => "this.safeNumber (tier, 'minPositionVal')" }, %{ "comment" => nil, "key" => "maxNotional", "value" => "this.safeNumber (tier, 'maxPositionVal')" }, %{ "comment" => nil, "key" => "maintenanceMarginRate", "value" => "this.safeNumber (tier, 'maintMarginRatio')" }, %{ "comment" => nil, "key" => "maxLeverage", "value" => "undefined" }, %{ "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 // {\n // \"tier\": \"Tier 1\",\n // \"symbol\": \"ETH-USDT\",\n // \"minPositionVal\": \"0\",\n // \"maxPositionVal\": \"900000\",\n // \"maintMarginRatio\": \"0.003300\",\n // \"maintAmount\": \"0.000000\"\n // }\n // ]\n //\n const tiers = [];\n for (let i = 0; i < info.length; i++) {\n const tier = this.safeDict (info, i);\n const tierString = this.safeString (tier, 'tier');\n const tierParts = tierString.split (' ');\n const marketId = this.safeString (tier, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'swap');\n tiers.push ({\n 'tier': this.safeNumber (tierParts, 1),\n 'symbol': this.safeSymbol (marketId, market),\n 'currency': this.safeString (market, 'settle'),\n 'minNotional': this.safeNumber (tier, 'minPositionVal'),\n 'maxNotional': this.safeNumber (tier, 'maxPositionVal'),\n 'maintenanceMarginRate': this.safeNumber (tier, 'maintMarginRatio'),\n 'maxLeverage': undefined,\n 'info': tier,\n });\n }\n return tiers as LeverageTier[];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"open\": \"19394.4\",\n \"close\": \"19379.0\",\n \"high\": \"19394.4\",\n \"low\": \"19368.3\",\n \"volume\": \"167.44\",\n \"time\": 1666584000000\n }", "{\n \"open\": \"42191.7\",\n \"close\": \"42189.5\",\n \"high\": \"42196.5\",\n \"low\": \"42189.5\",\n \"volume\": \"0.00\",\n \"openTime\": 1706508840000,\n \"closeTime\": 1706508840000\n }", "[\n 1691402580000,\n 29093.61,\n 29093.93,\n 29087.73,\n 29093.24,\n 0.59,\n 1691402639999,\n 17221.07\n ]" ], "line_end" => 1302, "line_start" => 1250, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // {\n // \"open\": \"19394.4\",\n // \"close\": \"19379.0\",\n // \"high\": \"19394.4\",\n // \"low\": \"19368.3\",\n // \"volume\": \"167.44\",\n // \"time\": 1666584000000\n // }\n //\n // fetchMarkOHLCV\n //\n // {\n // \"open\": \"42191.7\",\n // \"close\": \"42189.5\",\n // \"high\": \"42196.5\",\n // \"low\": \"42189.5\",\n // \"volume\": \"0.00\",\n // \"openTime\": 1706508840000,\n // \"closeTime\": 1706508840000\n // }\n // spot\n // [\n // 1691402580000,\n // 29093.61,\n // 29093.93,\n // 29087.73,\n // 29093.24,\n // 0.59,\n // 1691402639999,\n // 17221.07\n // ]\n //\n if (Array.isArray (ohlcv)) {\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 }\n return [\n this.safeInteger2 (ohlcv, 'time', 'closeTime'),\n this.safeNumber (ohlcv, 'open'),\n this.safeNumber (ohlcv, 'high'),\n this.safeNumber (ohlcv, 'low'),\n this.safeNumber (ohlcv, 'close'),\n this.safeNumber (ohlcv, 'volume'),\n ];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"openInterest\": \"3289641547.10\",\n \"symbol\": \"BTC-USDT\",\n \"time\": 1672026617364\n }", "{\n \"symbol\": \"BTC-USD\",\n \"openInterest\": \"749.1160\",\n \"timestamp\": 1720310400000\n }" ], "line_end" => 1999, "line_start" => 1967, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "undefined" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "undefined" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "openInterest" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "interest" } ], "name" => "parseOpenInterest", "signature" => "parseOpenInterest (interest, market: Market = undefined)", "source" => "parseOpenInterest (interest, market: Market = undefined) {\n //\n // linear swap\n //\n // {\n // \"openInterest\": \"3289641547.10\",\n // \"symbol\": \"BTC-USDT\",\n // \"time\": 1672026617364\n // }\n //\n // inverse swap\n //\n // {\n // \"symbol\": \"BTC-USD\",\n // \"openInterest\": \"749.1160\",\n // \"timestamp\": 1720310400000\n // }\n //\n const timestamp = this.safeInteger2 (interest, 'time', 'timestamp');\n const id = this.safeString (interest, 'symbol');\n const symbol = this.safeSymbol (id, market, '-', 'swap');\n const openInterest = this.safeNumber (interest, 'openInterest');\n return this.safeOpenInterest ({\n 'symbol': symbol,\n 'baseVolume': undefined,\n 'quoteVolume': undefined, // deprecated\n 'openInterestAmount': undefined,\n 'openInterestValue': openInterest,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"XRP-USDT\",\n \"orderId\": 1514090846268424192,\n \"transactTime\": 1649822362855,\n \"price\": \"0.5\",\n \"origQty\": \"10\",\n \"executedQty\": \"0\",\n \"cummulativeQuoteQty\": \"0\",\n \"status\": \"PENDING\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY\"\n }", "{\n \"symbol\": \"ETH-USDT\",\n \"orderId\": \"1660602123001266176\",\n \"price\": \"1700\",\n \"origQty\": \"0.003\",\n \"executedQty\": \"0\",\n \"cummulativeQuoteQty\": \"0\",\n \"status\": \"PENDING\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY\",\n \"time\": \"1684753373276\",\n \"updateTime\": \"1684753373276\",\n \"origQuoteOrderQty\": \"0\",\n \"fee\": \"0\",\n \"feeAsset\": \"ETH\"\n }", "{\n \"symbol\": \"XRP-USDT\",\n \"orderId\": 1514073325788200960,\n \"price\": \"0.5\",\n \"StopPrice\": \"0\",\n \"origQty\": \"20\",\n \"executedQty\": \"10\",\n \"cummulativeQuoteQty\": \"5\",\n \"status\": \"PENDING\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY\",\n \"time\": 1649818185647,\n \"updateTime\": 1649818185647,\n \"origQuoteOrderQty\": \"0\"\n \"fee\": \"-0.01\"\n }", "{\n \"symbol\": \"BTC-USDT\",\n \"orderId\": 1590973236294713344,\n \"side\": \"BUY\",\n \"positionSide\": \"LONG\",\n \"type\": \"LIMIT\"\n }", "{\n \"orderId\": 1809841379603398656,\n \"symbol\": \"SOL-USD\",\n \"positionSide\": \"LONG\",\n \"side\": \"BUY\",\n \"type\": \"LIMIT\",\n \"price\": 100,\n \"quantity\": 1,\n \"stopPrice\": 0,\n \"workingType\": \"\",\n \"timeInForce\": \"\"\n }" ], "line_end" => 3867, "line_start" => 3489, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeStringN (order, [ 'orderId', 'i', 'mainOrderId' ])" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeStringN (order, [ 'clientOrderID', 'clientOrderId', 'origClientOrderId', 'c' ])" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, '-', marketType)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "lastTradeTimestamp" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "this.safeInteger (order, 'updateTime')" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseOrderType (rawType)" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "this.safeString (order, 'timeInForce')" }, %{ "comment" => nil, "key" => "postOnly", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "this.parseOrderSide (side)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeString2 (order, 'price', 'p')" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "triggerPrice" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "stopLossPrice" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "takeProfitPrice" }, %{ "comment" => nil, "key" => "average", "value" => "this.safeString2 (order, 'avgPrice', 'ap')" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeString (order, 'cummulativeQuoteQty')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeStringN (order, [ 'origQty', 'q', 'quantity', 'totalAmount' ])" }, %{ "comment" => nil, "key" => "filled", "value" => "this.safeString2 (order, 'executedQty', 'z')" }, %{ "comment" => nil, "key" => "remaining", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseOrderStatus (statusId)" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': feeCurrencyCode,\n 'cost': Precise.stringAbs (feeCost),\n }" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "this.safeBool2 (order, 'reduceOnly', 'ro')" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrencyCode" }, %{ "comment" => nil, "key" => "cost", "value" => "Precise.stringAbs (feeCost)" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // spot\n // createOrder, createOrders, cancelOrder\n //\n // {\n // \"symbol\": \"XRP-USDT\",\n // \"orderId\": 1514090846268424192,\n // \"transactTime\": 1649822362855,\n // \"price\": \"0.5\",\n // \"origQty\": \"10\",\n // \"executedQty\": \"0\",\n // \"cummulativeQuoteQty\": \"0\",\n // \"status\": \"PENDING\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY\"\n // }\n //\n // fetchOrder\n //\n // {\n // \"symbol\": \"ETH-USDT\",\n // \"orderId\": \"1660602123001266176\",\n // \"price\": \"1700\",\n // \"origQty\": \"0.003\",\n // \"executedQty\": \"0\",\n // \"cummulativeQuoteQty\": \"0\",\n // \"status\": \"PENDING\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY\",\n // \"time\": \"1684753373276\",\n // \"updateTime\": \"1684753373276\",\n // \"origQuoteOrderQty\": \"0\",\n // \"fee\": \"0\",\n // \"feeAsset\": \"ETH\"\n // }\n //\n // fetchOpenOrders, fetchClosedOrders\n //\n // {\n // \"symbol\": \"XRP-USDT\",\n // \"orderId\": 1514073325788200960,\n // \"price\": \"0.5\",\n // \"StopPrice\": \"0\",\n // \"origQty\": \"20\",\n // \"executedQty\": \"10\",\n // \"cummulativeQuoteQty\": \"5\",\n // \"status\": \"PENDING\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY\",\n // \"time\": 1649818185647,\n // \"updateTime\": 1649818185647,\n // \"origQuoteOrderQty\": \"0\"\n // \"fee\": \"-0.01\"\n // }\n //\n //\n // linear swap\n // createOrder, createOrders\n //\n // {\n // \"symbol\": \"BTC-USDT\",\n // \"orderId\": 1590973236294713344,\n // \"side\": \"BUY\",\n // \"positionSide\": \"LONG\",\n // \"type\": \"LIMIT\"\n // }\n //\n // inverse swap createOrder\n //\n // {\n // \"orderId\": 1809841379603398656,\n // \"symbol\": \"SOL-USD\",\n // \"positionSide\": \"LONG\",\n // \"side\": \"BUY\",\n // \"type\": \"LIMIT\",\n // \"price\": 100,\n // \"quantity\": 1,\n // \"stopPrice\": 0,\n // \"workingType\": \"\",\n // \"timeInForce\": \"\"\n // }\n //\n // fetchOrder, fetchOpenOrders, fetchClosedOrders\n //\n // {\n // \"symbol\": \"BTC-USDT\",\n // \"orderId\": 1709036527545438208,\n // \"side\": \"BUY\",\n // \"positionSide\": \"LONG\",\n // \"type\": \"TRIGGER_LIMIT\",\n // \"origQty\": \"0.0010\",\n // \"price\": \"22000.0\",\n // \"executedQty\": \"0.0000\",\n // \"avgPrice\": \"0.0\",\n // \"cumQuote\": \"\",\n // \"stopPrice\": \"23000.0\",\n // \"profit\": \"\",\n // \"commission\": \"\",\n // \"status\": \"NEW\",\n // \"time\": 1696301035187,\n // \"updateTime\": 1696301035187,\n // \"clientOrderId\": \"\",\n // \"leverage\": \"\",\n // \"takeProfit\": \"\",\n // \"stopLoss\": \"\",\n // \"advanceAttr\": 0,\n // \"positionID\": 0,\n // \"takeProfitEntrustPrice\": 0,\n // \"stopLossEntrustPrice\": 0,\n // \"orderType\": \"\",\n // \"workingType\": \"MARK_PRICE\"\n // }\n // with tp and sl\n // {\n // orderId: 1741440894764281900,\n // symbol: 'LTC-USDT',\n // positionSide: 'LONG',\n // side: 'BUY',\n // type: 'MARKET',\n // price: 0,\n // quantity: 1,\n // stopPrice: 0,\n // workingType: 'MARK_PRICE',\n // clientOrderID: '',\n // timeInForce: 'GTC',\n // priceRate: 0,\n // stopLoss: '{\"stopPrice\":50,\"workingType\":\"MARK_PRICE\",\"type\":\"STOP_MARKET\",\"quantity\":1}',\n // takeProfit: '{\"stopPrice\":150,\"workingType\":\"MARK_PRICE\",\"type\":\"TAKE_PROFIT_MARKET\",\"quantity\":1}',\n // reduceOnly: false\n // }\n //\n // editOrder (swap)\n //\n // {\n // cancelResult: 'true',\n // cancelMsg: '',\n // cancelResponse: {\n // cancelClientOrderId: '',\n // cancelOrderId: '1755336244265705472',\n // symbol: 'SOL-USDT',\n // orderId: '1755336244265705472',\n // side: 'SELL',\n // positionSide: 'SHORT',\n // type: 'LIMIT',\n // origQty: '1',\n // price: '100.000',\n // executedQty: '0',\n // avgPrice: '0.000',\n // cumQuote: '0',\n // stopPrice: '',\n // profit: '0.0000',\n // commission: '0.000000',\n // status: 'PENDING',\n // time: '1707339747860',\n // updateTime: '1707339747860',\n // clientOrderId: '',\n // leverage: '20X',\n // workingType: 'MARK_PRICE',\n // onlyOnePosition: false,\n // reduceOnly: false\n // },\n // replaceResult: 'true',\n // replaceMsg: '',\n // newOrderResponse: {\n // orderId: '1755338440612995072',\n // symbol: 'SOL-USDT',\n // positionSide: 'SHORT',\n // side: 'SELL',\n // type: 'LIMIT',\n // price: '99',\n // quantity: '2',\n // stopPrice: '0',\n // workingType: 'MARK_PRICE',\n // clientOrderID: '',\n // timeInForce: 'GTC',\n // priceRate: '0',\n // stopLoss: '',\n // takeProfit: '',\n // reduceOnly: false\n // }\n // }\n //\n // editOrder (spot)\n //\n // {\n // cancelResult: { code: '0', msg: '', result: true },\n // openResult: { code: '0', msg: '', result: true },\n // orderOpenResponse: {\n // symbol: 'SOL-USDT',\n // orderId: '1755334007697866752',\n // transactTime: '1707339214620',\n // price: '99',\n // stopPrice: '0',\n // origQty: '0.2',\n // executedQty: '0',\n // cummulativeQuoteQty: '0',\n // status: 'PENDING',\n // type: 'LIMIT',\n // side: 'SELL',\n // clientOrderID: ''\n // },\n // orderCancelResponse: {\n // symbol: 'SOL-USDT',\n // orderId: '1755117055251480576',\n // price: '100',\n // stopPrice: '0',\n // origQty: '0.2',\n // executedQty: '0',\n // cummulativeQuoteQty: '0',\n // status: 'CANCELED',\n // type: 'LIMIT',\n // side: 'SELL'\n // }\n // }\n //\n // stop loss order\n //\n // {\n // \"symbol\": \"ETH-USDT\",\n // \"orderId\": \"1792461744476422144\",\n // \"price\": \"2775.65\",\n // \"StopPrice\": \"2778.42\",\n // \"origQty\": \"0.032359\",\n // \"executedQty\": \"0\",\n // \"cummulativeQuoteQty\": \"0\",\n // \"status\": \"NEW\",\n // \"type\": \"TAKE_STOP_LIMIT\",\n // \"side\": \"SELL\",\n // \"time\": \"1716191156868\",\n // \"updateTime\": \"1716191156868\",\n // \"origQuoteOrderQty\": \"0\",\n // \"fee\": \"0\",\n // \"feeAsset\": \"USDT\",\n // \"clientOrderID\": \"\"\n // }\n //\n // inverse swap cancelAllOrders, cancelOrder, fetchOrder, fetchOpenOrders, fetchClosedOrders, fetchCanceledOrders\n //\n // {\n // \"symbol\": \"SOL-USD\",\n // \"orderId\": \"1809845251327672320\",\n // \"side\": \"BUY\",\n // \"positionSide\": \"LONG\",\n // \"type\": \"LIMIT\",\n // \"quantity\": 1,\n // \"origQty\": \"0\",\n // \"price\": \"90\",\n // \"executedQty\": \"0\",\n // \"avgPrice\": \"0\",\n // \"cumQuote\": \"0\",\n // \"stopPrice\": \"\",\n // \"profit\": \"0.0000\",\n // \"commission\": \"0.000000\",\n // \"status\": \"CANCELLED\",\n // \"time\": 1720335707872,\n // \"updateTime\": 1720335707912,\n // \"clientOrderId\": \"\",\n // \"leverage\": \"\",\n // \"takeProfit\": {\n // \"type\": \"\",\n // \"quantity\": 0,\n // \"stopPrice\": 0,\n // \"price\": 0,\n // \"workingType\": \"\",\n // \"stopGuaranteed\": \"\"\n // },\n // \"stopLoss\": {\n // \"type\": \"\",\n // \"quantity\": 0,\n // \"stopPrice\": 0,\n // \"price\": 0,\n // \"workingType\": \"\",\n // \"stopGuaranteed\": \"\"\n // },\n // \"advanceAttr\": 0,\n // \"positionID\": 0,\n // \"takeProfitEntrustPrice\": 0,\n // \"stopLossEntrustPrice\": 0,\n // \"orderType\": \"\",\n // \"workingType\": \"\"\n // }\n //\n const info = order;\n const newOrder = this.safeDict2 (order, 'newOrderResponse', 'orderOpenResponse');\n if (newOrder !== undefined) {\n order = newOrder;\n }\n const positionSide = this.safeString2 (order, 'positionSide', 'ps');\n const marketType = (positionSide === undefined) ? 'spot' : 'swap';\n const marketId = this.safeString2 (order, 'symbol', 's');\n if (market === undefined) {\n market = this.safeMarket (marketId, undefined, undefined, marketType);\n }\n const side = this.safeStringLower2 (order, 'side', 'S');\n const timestamp = this.safeIntegerN (order, [ 'time', 'transactTime', 'E', 'createdTime' ]);\n const lastTradeTimestamp = this.safeInteger2 (order, 'updateTime', 'T');\n const statusId = this.safeStringUpperN (order, [ 'status', 'X', 'orderStatus' ]);\n let feeCurrencyCode = this.safeString2 (order, 'feeAsset', 'N');\n const feeCost = this.safeStringN (order, [ 'fee', 'commission', 'n' ]);\n if ((feeCurrencyCode === undefined)) {\n if (market['spot']) {\n if (side === 'buy') {\n feeCurrencyCode = market['base'];\n } else {\n feeCurrencyCode = market['quote'];\n }\n } else {\n feeCurrencyCode = market['quote'];\n }\n }\n let stopLoss = this.safeValue (order, 'stopLoss');\n let stopLossPrice = undefined;\n if ((stopLoss !== undefined) && (stopLoss !== '')) {\n stopLossPrice = this.omitZero (this.safeString (stopLoss, 'stopLoss'));\n }\n if ((stopLoss !== undefined) && (typeof stopLoss !== 'number') && (stopLoss !== '')) {\n // stopLoss: '{\"stopPrice\":50,\"workingType\":\"MARK_PRICE\",\"type\":\"STOP_MARKET\",\"quantity\":1}',\n if (typeof stopLoss === 'string') {\n stopLoss = this.parseJson (stopLoss);\n }\n stopLossPrice = this.omitZero (this.safeString (stopLoss, 'stopPrice'));\n }\n let takeProfit = this.safeValue (order, 'takeProfit');\n let takeProfitPrice = undefined;\n if (takeProfit !== undefined && (takeProfit !== '')) {\n takeProfitPrice = this.omitZero (this.safeString (takeProfit, 'takeProfit'));\n }\n if ((takeProfit !== undefined) && (typeof takeProfit !== 'number') && (takeProfit !== '')) {\n // takeProfit: '{\"stopPrice\":150,\"workingType\":\"MARK_PRICE\",\"type\":\"TAKE_PROFIT_MARKET\",\"quantity\":1}',\n if (typeof takeProfit === 'string') {\n takeProfit = this.parseJson (takeProfit);\n }\n takeProfitPrice = this.omitZero (this.safeString (takeProfit, 'stopPrice'));\n }\n const rawType = this.safeStringLower2 (order, 'type', 'o');\n const stopPrice = this.omitZero (this.safeString2 (order, 'StopPrice', 'stopPrice'));\n let triggerPrice = stopPrice;\n if (stopPrice !== undefined) {\n if ((rawType.indexOf ('stop') > -1) && (stopLossPrice === undefined)) {\n stopLossPrice = stopPrice;\n triggerPrice = undefined;\n }\n if ((rawType.indexOf ('take') > -1) && (takeProfitPrice === undefined)) {\n takeProfitPrice = stopPrice;\n triggerPrice = undefined;\n }\n }\n return this.safeOrder ({\n 'info': info,\n 'id': this.safeStringN (order, [ 'orderId', 'i', 'mainOrderId' ]),\n 'clientOrderId': this.safeStringN (order, [ 'clientOrderID', 'clientOrderId', 'origClientOrderId', 'c' ]),\n 'symbol': this.safeSymbol (marketId, market, '-', marketType),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': lastTradeTimestamp,\n 'lastUpdateTimestamp': this.safeInteger (order, 'updateTime'),\n 'type': this.parseOrderType (rawType),\n 'timeInForce': this.safeString (order, 'timeInForce'),\n 'postOnly': undefined,\n 'side': this.parseOrderSide (side),\n 'price': this.safeString2 (order, 'price', 'p'),\n 'triggerPrice': triggerPrice,\n 'stopLossPrice': stopLossPrice,\n 'takeProfitPrice': takeProfitPrice,\n 'average': this.safeString2 (order, 'avgPrice', 'ap'),\n 'cost': this.safeString (order, 'cummulativeQuoteQty'),\n 'amount': this.safeStringN (order, [ 'origQty', 'q', 'quantity', 'totalAmount' ]),\n 'filled': this.safeString2 (order, 'executedQty', 'z'),\n 'remaining': undefined,\n 'status': this.parseOrderStatus (statusId),\n 'fee': {\n 'currency': feeCurrencyCode,\n 'cost': Precise.stringAbs (feeCost),\n },\n 'trades': undefined,\n 'reduceOnly': this.safeBool2 (order, 'reduceOnly', 'ro'),\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3475, "line_start" => 3465, "mappings" => [], "name" => "parseOrderSide", "signature" => "parseOrderSide (side)", "source" => "parseOrderSide (side) {\n const sides: Dict = {\n 'BUY': 'buy',\n 'SELL': 'sell',\n 'SHORT': 'sell',\n 'LONG': 'buy',\n 'ask': 'sell',\n 'bid': 'buy',\n };\n return this.safeString (sides, side, side);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3881, "line_start" => 3869, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n 'NEW': 'open',\n 'PENDING': 'open',\n 'PARTIALLY_FILLED': 'open',\n 'RUNNING': 'open',\n 'FILLED': 'closed',\n 'CANCELED': 'canceled',\n 'CANCELLED': 'canceled',\n 'FAILED': 'canceled',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3487, "line_start" => 3477, "mappings" => [], "name" => "parseOrderType", "signature" => "parseOrderType (type: Str)", "source" => "parseOrderType (type: Str) {\n const types: Dict = {\n 'trigger_market': 'market',\n 'trigger_limit': 'limit',\n 'stop_limit': 'limit',\n 'stop_market': 'market',\n 'take_profit_market': 'market',\n 'stop': 'limit',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 6079, "line_start" => 6058, "mappings" => [], "name" => "parseParams", "signature" => "parseParams (params)", "source" => "parseParams (params) {\n // const sortedParams = this.keysort (params);\n const rawKeys = Object.keys (params);\n const keys = this.sort (rawKeys);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = params[key];\n if (Array.isArray (value)) {\n let arrStr = '[';\n for (let j = 0; j < value.length; j++) {\n const arrayElement = value[j];\n if (j > 0) {\n arrStr += ',';\n }\n arrStr += arrayElement.toString ();\n }\n arrStr += ']';\n params[key] = arrStr;\n }\n }\n return params;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"SOL-USD\",\n \"positionId\": \"1813080351385337856\",\n \"positionSide\": \"LONG\",\n \"isolated\": false,\n \"positionAmt\": \"1\",\n \"availableAmt\": \"1\",\n \"unrealizedProfit\": \"-0.00009074\",\n \"initialMargin\": \"0.00630398\",\n \"liquidationPrice\": 23.968303426677032,\n \"avgPrice\": \"158.63\",\n \"leverage\": 10,\n \"markPrice\": \"158.402\",\n \"riskRate\": \"0.00123783\",\n \"maxMarginReduction\": \"0\",\n \"updateTime\": 1721107015848\n }", "{\n \"positionId\": \"1792480725958881280\",\n \"symbol\": \"LTC-USDT\",\n \"currency\": \"USDT\",\n \"positionAmt\": \"0.1\",\n \"availableAmt\": \"0.1\",\n \"positionSide\": \"LONG\",\n \"isolated\": false,\n \"avgPrice\": \"83.53\",\n \"initialMargin\": \"1.3922\",\n \"margin\": \"0.3528\",\n \"leverage\": 6,\n \"unrealizedProfit\": \"-1.0393\",\n \"realisedProfit\": \"-0.2119\",\n \"liquidationPrice\": 0,\n \"pnlRatio\": \"-0.7465\",\n \"maxMarginReduction\": \"0.0000\",\n \"riskRate\": \"0.0008\",\n \"markPrice\": \"73.14\",\n \"positionValue\": \"7.3136\",\n \"onlyOnePosition\": true,\n \"updateTime\": 1721088016688\n }", "{\n \"currentPrice\": \"82.91\",\n \"symbol\": \"LTC/USDT\",\n \"initialMargin\": \"5.00000000000000000000\",\n \"unrealizedProfit\": \"-0.26464500\",\n \"leverage\": \"20.000000000\",\n \"isolated\": true,\n \"entryPrice\": \"83.13\",\n \"positionSide\": \"LONG\",\n \"positionAmt\": \"1.20365912\",\n }", "{\n \"positionId\": \"1861675561156571136\",\n \"symbol\": \"LTC-USDT\",\n \"isolated\": false,\n \"positionSide\": \"LONG\",\n \"openTime\": 1732693017000,\n \"updateTime\": 1733310292000,\n \"avgPrice\": \"95.18\",\n \"avgClosePrice\": \"129.48\",\n \"realisedProfit\": \"102.89\",\n \"netProfit\": \"99.63\",\n \"positionAmt\": \"30.0\",\n \"closePositionAmt\": \"30.0\",\n \"leverage\": 6,\n \"closeAllPositions\": true,\n \"positionCommission\": \"-0.33699650000000003\",\n \"totalFunding\": \"-2.921461693902908\"\n }" ], "line_end" => 2960, "line_start" => 2839, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (position, 'positionId')" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, '-', 'swap')" }, %{ "comment" => nil, "key" => "notional", "value" => "this.safeNumber (position, 'positionValue')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.safeNumber2 (position, 'avgPrice', 'entryPrice')" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.safeNumber (position, 'unrealizedProfit')" }, %{ "comment" => nil, "key" => "realizedPnl", "value" => "this.safeNumber (position, 'realisedProfit')" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.safeNumber (position, 'positionAmt')" }, %{ "comment" => nil, "key" => "contractSize", "value" => "undefined" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (position, 'markPrice')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "this.safeStringLower (position, 'positionSide')" }, %{ "comment" => nil, "key" => "hedged", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "this.safeInteger (position, 'updateTime')" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "collateral", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "this.safeNumber (position, 'initialMargin')" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.safeNumber (position, 'leverage')" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "undefined" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // inverse swap\n //\n // {\n // \"symbol\": \"SOL-USD\",\n // \"positionId\": \"1813080351385337856\",\n // \"positionSide\": \"LONG\",\n // \"isolated\": false,\n // \"positionAmt\": \"1\",\n // \"availableAmt\": \"1\",\n // \"unrealizedProfit\": \"-0.00009074\",\n // \"initialMargin\": \"0.00630398\",\n // \"liquidationPrice\": 23.968303426677032,\n // \"avgPrice\": \"158.63\",\n // \"leverage\": 10,\n // \"markPrice\": \"158.402\",\n // \"riskRate\": \"0.00123783\",\n // \"maxMarginReduction\": \"0\",\n // \"updateTime\": 1721107015848\n // }\n //\n // linear swap\n //\n // {\n // \"positionId\": \"1792480725958881280\",\n // \"symbol\": \"LTC-USDT\",\n // \"currency\": \"USDT\",\n // \"positionAmt\": \"0.1\",\n // \"availableAmt\": \"0.1\",\n // \"positionSide\": \"LONG\",\n // \"isolated\": false,\n // \"avgPrice\": \"83.53\",\n // \"initialMargin\": \"1.3922\",\n // \"margin\": \"0.3528\",\n // \"leverage\": 6,\n // \"unrealizedProfit\": \"-1.0393\",\n // \"realisedProfit\": \"-0.2119\",\n // \"liquidationPrice\": 0,\n // \"pnlRatio\": \"-0.7465\",\n // \"maxMarginReduction\": \"0.0000\",\n // \"riskRate\": \"0.0008\",\n // \"markPrice\": \"73.14\",\n // \"positionValue\": \"7.3136\",\n // \"onlyOnePosition\": true,\n // \"updateTime\": 1721088016688\n // }\n //\n // standard position\n //\n // {\n // \"currentPrice\": \"82.91\",\n // \"symbol\": \"LTC/USDT\",\n // \"initialMargin\": \"5.00000000000000000000\",\n // \"unrealizedProfit\": \"-0.26464500\",\n // \"leverage\": \"20.000000000\",\n // \"isolated\": true,\n // \"entryPrice\": \"83.13\",\n // \"positionSide\": \"LONG\",\n // \"positionAmt\": \"1.20365912\",\n // }\n //\n // linear swap fetchPositionHistory\n //\n // {\n // \"positionId\": \"1861675561156571136\",\n // \"symbol\": \"LTC-USDT\",\n // \"isolated\": false,\n // \"positionSide\": \"LONG\",\n // \"openTime\": 1732693017000,\n // \"updateTime\": 1733310292000,\n // \"avgPrice\": \"95.18\",\n // \"avgClosePrice\": \"129.48\",\n // \"realisedProfit\": \"102.89\",\n // \"netProfit\": \"99.63\",\n // \"positionAmt\": \"30.0\",\n // \"closePositionAmt\": \"30.0\",\n // \"leverage\": 6,\n // \"closeAllPositions\": true,\n // \"positionCommission\": \"-0.33699650000000003\",\n // \"totalFunding\": \"-2.921461693902908\"\n // }\n //\n let marketId = this.safeString (position, 'symbol', '');\n marketId = marketId.replace ('/', '-'); // standard return different format\n const isolated = this.safeBool (position, 'isolated');\n let marginMode = undefined;\n if (isolated !== undefined) {\n marginMode = isolated ? 'isolated' : 'cross';\n }\n const timestamp = this.safeInteger (position, 'openTime');\n return this.safePosition ({\n 'info': position,\n 'id': this.safeString (position, 'positionId'),\n 'symbol': this.safeSymbol (marketId, market, '-', 'swap'),\n 'notional': this.safeNumber (position, 'positionValue'),\n 'marginMode': marginMode,\n 'liquidationPrice': undefined,\n 'entryPrice': this.safeNumber2 (position, 'avgPrice', 'entryPrice'),\n 'unrealizedPnl': this.safeNumber (position, 'unrealizedProfit'),\n 'realizedPnl': this.safeNumber (position, 'realisedProfit'),\n 'percentage': undefined,\n 'contracts': this.safeNumber (position, 'positionAmt'),\n 'contractSize': undefined,\n 'markPrice': this.safeNumber (position, 'markPrice'),\n 'lastPrice': undefined,\n 'side': this.safeStringLower (position, 'positionSide'),\n 'hedged': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastUpdateTimestamp': this.safeInteger (position, 'updateTime'),\n 'maintenanceMargin': undefined,\n 'maintenanceMarginPercentage': undefined,\n 'collateral': undefined,\n 'initialMargin': this.safeNumber (position, 'initialMargin'),\n 'initialMarginPercentage': undefined,\n 'leverage': this.safeNumber (position, 'leverage'),\n 'marginRatio': undefined,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"string\",\n \"lastFundingRate\": \"string\",\n \"markPrice\": \"string\",\n \"indexPrice\": \"string\",\n \"nextFundingTime\": \"int64\"\n }", "{\n \"symbol\": \"BTC-USDT\",\n \"openPrice\": \"26032.08\",\n \"highPrice\": \"26178.86\",\n \"lowPrice\": \"25968.18\",\n \"lastPrice\": \"26113.60\",\n \"volume\": \"1161.79\",\n \"quoteVolume\": \"30288466.44\",\n \"openTime\": \"1693081020762\",\n \"closeTime\": \"1693167420762\",\n added 2023-11-10:\n \"bidPrice\": 16726.0,\n \"bidQty\": 0.05,\n \"askPrice\": 16726.0,\n \"askQty\": 0.05,\n }", "{\n \"symbol\": \"BTC-USDT\",\n \"priceChange\": \"52.5\",\n \"priceChangePercent\": \"0.31%\", // they started to add the percent sign in value\n \"lastPrice\": \"16880.5\",\n \"lastQty\": \"2.2238\", // only present in swap!\n \"highPrice\": \"16897.5\",\n \"lowPrice\": \"16726.0\",\n \"volume\": \"245870.1692\",\n \"quoteVolume\": \"4151395117.73\",\n \"openPrice\": \"16832.0\",\n \"openTime\": 1672026667803,\n \"closeTime\": 1672026648425,\n added 2023-11-10:\n \"bidPrice\": 16726.0,\n \"bidQty\": 0.05,\n \"askPrice\": 16726.0,\n \"askQty\": 0.05,\n }" ], "line_end" => 2352, "line_start" => 2251, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "ts" }, %{ "comment" => nil, "key" => "datetime", "value" => "datetime" }, %{ "comment" => nil, "key" => "high", "value" => "high" }, %{ "comment" => nil, "key" => "low", "value" => "low" }, %{ "comment" => nil, "key" => "bid", "value" => "bid" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "bidVolume" }, %{ "comment" => nil, "key" => "ask", "value" => "ask" }, %{ "comment" => nil, "key" => "askVolume", "value" => "askVolume" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "open" }, %{ "comment" => nil, "key" => "close", "value" => "close" }, %{ "comment" => nil, "key" => "last", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousClose", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "change" }, %{ "comment" => nil, "key" => "percentage", "value" => "percentage" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "baseVolume" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "quoteVolume" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeString (ticker, 'markPrice')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeString (ticker, 'indexPrice')" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker", "source" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker {\n //\n // mark price\n // {\n // \"symbol\": \"string\",\n // \"lastFundingRate\": \"string\",\n // \"markPrice\": \"string\",\n // \"indexPrice\": \"string\",\n // \"nextFundingTime\": \"int64\"\n // }\n //\n // spot\n // {\n // \"symbol\": \"BTC-USDT\",\n // \"openPrice\": \"26032.08\",\n // \"highPrice\": \"26178.86\",\n // \"lowPrice\": \"25968.18\",\n // \"lastPrice\": \"26113.60\",\n // \"volume\": \"1161.79\",\n // \"quoteVolume\": \"30288466.44\",\n // \"openTime\": \"1693081020762\",\n // \"closeTime\": \"1693167420762\",\n // added 2023-11-10:\n // \"bidPrice\": 16726.0,\n // \"bidQty\": 0.05,\n // \"askPrice\": 16726.0,\n // \"askQty\": 0.05,\n // }\n // swap\n //\n // {\n // \"symbol\": \"BTC-USDT\",\n // \"priceChange\": \"52.5\",\n // \"priceChangePercent\": \"0.31%\", // they started to add the percent sign in value\n // \"lastPrice\": \"16880.5\",\n // \"lastQty\": \"2.2238\", // only present in swap!\n // \"highPrice\": \"16897.5\",\n // \"lowPrice\": \"16726.0\",\n // \"volume\": \"245870.1692\",\n // \"quoteVolume\": \"4151395117.73\",\n // \"openPrice\": \"16832.0\",\n // \"openTime\": 1672026667803,\n // \"closeTime\": 1672026648425,\n // added 2023-11-10:\n // \"bidPrice\": 16726.0,\n // \"bidQty\": 0.05,\n // \"askPrice\": 16726.0,\n // \"askQty\": 0.05,\n // }\n //\n const marketId = this.safeString (ticker, 'symbol');\n const lastQty = this.safeString (ticker, 'lastQty');\n // in spot markets, lastQty is not present\n // it's (bad, but) the only way we can check the tickers origin\n const type = (lastQty === undefined) ? 'spot' : 'swap';\n market = this.safeMarket (marketId, market, undefined, type);\n const symbol = market['symbol'];\n const open = this.safeString (ticker, 'openPrice');\n const high = this.safeString (ticker, 'highPrice');\n const low = this.safeString (ticker, 'lowPrice');\n const close = this.safeString (ticker, 'lastPrice');\n const quoteVolume = this.safeString (ticker, 'quoteVolume');\n const baseVolume = this.safeString (ticker, 'volume');\n let percentage = this.safeString (ticker, 'priceChangePercent');\n if (percentage !== undefined) {\n percentage = percentage.replace ('%', '');\n }\n const change = this.safeString (ticker, 'priceChange');\n let ts = this.safeInteger (ticker, 'closeTime');\n if (ts === 0) {\n ts = undefined;\n }\n const datetime = this.iso8601 (ts);\n const bid = this.safeString (ticker, 'bidPrice');\n const bidVolume = this.safeString (ticker, 'bidQty');\n const ask = this.safeString (ticker, 'askPrice');\n const askVolume = this.safeString (ticker, 'askQty');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': ts,\n 'datetime': datetime,\n 'high': high,\n 'low': low,\n 'bid': bid,\n 'bidVolume': bidVolume,\n 'ask': ask,\n 'askVolume': askVolume,\n 'vwap': undefined,\n 'open': open,\n 'close': close,\n 'last': undefined,\n 'previousClose': undefined,\n 'change': change,\n 'percentage': percentage,\n 'average': undefined,\n 'baseVolume': baseVolume,\n 'quoteVolume': quoteVolume,\n 'markPrice': this.safeString (ticker, 'markPrice'),\n 'indexPrice': this.safeString (ticker, 'indexPrice'),\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": 43148253,\n \"price\": 25714.71,\n \"qty\": 1.674571,\n \"time\": 1655085975589,\n \"buyerMaker\": false\n }", "{\n \"symbol\": \"LTC-USDT\",\n \"id\": 36237072,\n \"orderId\": 1674069326895775744,\n \"price\": \"85.891\",\n \"qty\": \"0.0582\",\n \"quoteQty\": \"4.9988562000000005\",\n \"commission\": -0.00005820000000000001,\n \"commissionAsset\": \"LTC\",\n \"time\": 1687964205000,\n \"isBuyer\": true,\n \"isMaker\": false\n }", "{\n \"time\": 1672025549368,\n \"isBuyerMaker\": true,\n \"price\": \"16885.0\",\n \"qty\": \"3.3002\",\n \"quoteQty\": \"55723.87\"\n }", "{\n \"volume\": \"0.1\",\n \"price\": \"106.75\",\n \"amount\": \"10.6750\",\n \"commission\": \"-0.0053\",\n \"currency\": \"USDT\",\n \"orderId\": \"1676213270274379776\",\n \"liquidatedPrice\": \"0.00\",\n \"liquidatedMarginRatio\": \"0.00\",\n \"filledTime\": \"2023-07-04T20:56:01.000+0800\"\n }", "{\n \"E\": 1690214529432,\n \"T\": 1690214529386,\n \"e\": \"trade\",\n \"m\": true,\n \"p\": \"29110.19\",\n \"q\": \"0.1868\",\n \"s\": \"BTC-USDT\",\n \"t\": \"57903921\"\n }" ], "line_end" => 1537, "line_start" => 1370, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeStringN (trade, [ 'id', 't' ])" }, %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "timestamp", "value" => "time" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (time)" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, '-')" }, %{ "comment" => nil, "key" => "order", "value" => "this.safeString2 (trade, 'orderId', 'i')" }, %{ "comment" => nil, "key" => "type", "value" => "this.safeStringLower (trade, 'o')" }, %{ "comment" => nil, "key" => "side", "value" => "this.parseOrderSide (side)" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takeOrMaker" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeStringN (trade, [ 'price', 'p', 'tradePrice' ])" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'cost': this.parseNumber (Precise.stringAbs (this.safeString2 (trade, 'commission', 'n'))),\n 'currency': currencyCode,\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "this.parseNumber (Precise.stringAbs (this.safeString2 (trade, 'commission', 'n')))" }, %{ "comment" => nil, "key" => "currency", "value" => "currencyCode" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // spot fetchTrades\n //\n // {\n // \"id\": 43148253,\n // \"price\": 25714.71,\n // \"qty\": 1.674571,\n // \"time\": 1655085975589,\n // \"buyerMaker\": false\n // }\n //\n // spot fetchMyTrades\n //\n // {\n // \"symbol\": \"LTC-USDT\",\n // \"id\": 36237072,\n // \"orderId\": 1674069326895775744,\n // \"price\": \"85.891\",\n // \"qty\": \"0.0582\",\n // \"quoteQty\": \"4.9988562000000005\",\n // \"commission\": -0.00005820000000000001,\n // \"commissionAsset\": \"LTC\",\n // \"time\": 1687964205000,\n // \"isBuyer\": true,\n // \"isMaker\": false\n // }\n //\n // swap fetchTrades\n //\n // {\n // \"time\": 1672025549368,\n // \"isBuyerMaker\": true,\n // \"price\": \"16885.0\",\n // \"qty\": \"3.3002\",\n // \"quoteQty\": \"55723.87\"\n // }\n //\n // swap fetchMyTrades\n //\n // {\n // \"volume\": \"0.1\",\n // \"price\": \"106.75\",\n // \"amount\": \"10.6750\",\n // \"commission\": \"-0.0053\",\n // \"currency\": \"USDT\",\n // \"orderId\": \"1676213270274379776\",\n // \"liquidatedPrice\": \"0.00\",\n // \"liquidatedMarginRatio\": \"0.00\",\n // \"filledTime\": \"2023-07-04T20:56:01.000+0800\"\n // }\n //\n // ws spot\n //\n // {\n // \"E\": 1690214529432,\n // \"T\": 1690214529386,\n // \"e\": \"trade\",\n // \"m\": true,\n // \"p\": \"29110.19\",\n // \"q\": \"0.1868\",\n // \"s\": \"BTC-USDT\",\n // \"t\": \"57903921\"\n // }\n //\n // ws linear swap\n //\n // {\n // \"q\": \"0.0421\",\n // \"p\": \"29023.5\",\n // \"T\": 1690221401344,\n // \"m\": false,\n // \"s\": \"BTC-USDT\"\n // }\n //\n // ws inverse swap\n //\n // {\n // \"e\": \"trade\",\n // \"E\": 1722920589665,\n // \"s\": \"BTC-USD\",\n // \"t\": \"39125001\",\n // \"p\": \"55360.0\",\n // \"q\": \"1\",\n // \"T\": 1722920589582,\n // \"m\": false\n // }\n //\n // inverse swap fetchMyTrades\n //\n // {\n // \"orderId\": \"1817441228670648320\",\n // \"symbol\": \"SOL-USD\",\n // \"type\": \"MARKET\",\n // \"side\": \"BUY\",\n // \"positionSide\": \"LONG\",\n // \"tradeId\": \"97244554\",\n // \"volume\": \"2\",\n // \"tradePrice\": \"182.652\",\n // \"amount\": \"20.00000000\",\n // \"realizedPnl\": \"0.00000000\",\n // \"commission\": \"-0.00005475\",\n // \"currency\": \"SOL\",\n // \"buyer\": true,\n // \"maker\": false,\n // \"tradeTime\": 1722146730000\n // }\n //\n let time = this.safeIntegerN (trade, [ 'time', 'filledTm', 'T', 'tradeTime' ]);\n const datetimeId = this.safeString (trade, 'filledTm');\n if (datetimeId !== undefined) {\n time = this.parse8601 (datetimeId);\n }\n if (time === 0) {\n time = undefined;\n }\n const cost = this.safeString (trade, 'quoteQty');\n // const type = (cost === undefined) ? 'spot' : 'swap'; this is not reliable\n const currencyId = this.safeStringN (trade, [ 'currency', 'N', 'commissionAsset' ]);\n const currencyCode = this.safeCurrencyCode (currencyId);\n const m = this.safeBool (trade, 'm');\n const marketId = this.safeString2 (trade, 's', 'symbol');\n const isBuyerMaker = this.safeBoolN (trade, [ 'buyerMaker', 'isBuyerMaker', 'maker' ]);\n let takeOrMaker = undefined;\n if ((isBuyerMaker !== undefined) || (m !== undefined)) {\n takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';\n }\n let side = this.safeStringLower2 (trade, 'side', 'S');\n if (side === undefined) {\n if ((isBuyerMaker !== undefined) || (m !== undefined)) {\n side = (isBuyerMaker || m) ? 'sell' : 'buy';\n takeOrMaker = 'taker';\n }\n }\n const isBuyer = this.safeBool (trade, 'isBuyer');\n if (isBuyer !== undefined) {\n side = isBuyer ? 'buy' : 'sell';\n }\n const isMaker = this.safeBool (trade, 'isMaker');\n if (isMaker !== undefined) {\n takeOrMaker = isMaker ? 'maker' : 'taker';\n }\n let amount = this.safeStringN (trade, [ 'qty', 'amount', 'q' ]);\n if ((market !== undefined) && market['swap'] && ('volume' in trade)) {\n // private trade returns num of contracts instead of base currency (as the order-related methods do)\n const contractSize = this.safeString (market['info'], 'tradeMinQuantity');\n const volume = this.safeString (trade, 'volume');\n amount = Precise.stringMul (volume, contractSize);\n }\n return this.safeTrade ({\n 'id': this.safeStringN (trade, [ 'id', 't' ]),\n 'info': trade,\n 'timestamp': time,\n 'datetime': this.iso8601 (time),\n 'symbol': this.safeSymbol (marketId, market, '-'),\n 'order': this.safeString2 (trade, 'orderId', 'i'),\n 'type': this.safeStringLower (trade, 'o'),\n 'side': this.parseOrderSide (side),\n 'takerOrMaker': takeOrMaker,\n 'price': this.safeStringN (trade, [ 'price', 'p', 'tradePrice' ]),\n 'amount': amount,\n 'cost': cost,\n 'fee': {\n 'cost': this.parseNumber (Precise.stringAbs (this.safeString2 (trade, 'commission', 'n'))),\n 'currency': currencyCode,\n },\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"takerCommissionRate\": 0.001,\n \"makerCommissionRate\": 0.001\n }" ], "line_end" => 6701, "line_start" => 6685, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (fee, 'makerCommissionRate')" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (fee, 'takerCommissionRate')" }, %{ "comment" => nil, "key" => "percentage", "value" => "false" }, %{ "comment" => nil, "key" => "tierBased", "value" => "false" } ], "name" => "parseTradingFee", "signature" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface", "source" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface {\n //\n // {\n // \"takerCommissionRate\": 0.001,\n // \"makerCommissionRate\": 0.001\n // }\n //\n const symbol = (market !== undefined) ? market['symbol'] : undefined;\n return {\n 'info': fee,\n 'symbol': symbol,\n 'maker': this.safeNumber (fee, 'makerCommissionRate'),\n 'taker': this.safeNumber (fee, 'takerCommissionRate'),\n 'percentage': false,\n 'tierBased': false,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amount\":\"0.00999800\",\n \"coin\":\"PAXG\",\n \"network\":\"ETH\",\n \"status\":1,\n \"address\":\"0x788cabe9236ce061e5a892e1a59395a81fc8d62c\",\n \"addressTag\":\"\",\n \"txId\":\"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3\",\n \"insertTime\":1599621997000,\n \"transferType\":0,\n \"unlockConfirm\":\"12/12\", // confirm times for unlocking\n \"confirmTimes\":\"12/12\"\n }", "{\n \"address\": \"0x94df8b352de7f46f64b01d3666bf6e936e44ce60\",\n \"amount\": \"8.91000000\",\n \"applyTime\": \"2019-10-12 11:12:02\",\n \"coin\": \"USDT\",\n \"id\": \"b6ae22b3aa844210a7041aee7589627c\",\n \"withdrawOrderId\": \"WITHDRAWtest123\",\n \"network\": \"ETH\",\n \"transferType\": 0\n \"status\": 6,\n \"transactionFee\": \"0.004\",\n \"confirmNo\":3,\n \"info\": \"The address is not valid. Please confirm with the recipient\",\n \"txId\": \"0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268\"\n }", "{\n \"code\":0,\n \"timestamp\":1705274263621,\n \"data\":{\n \"id\":\"1264246141278773252\"\n }\n }" ], "line_end" => 5502, "line_start" => 5407, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "txid", "value" => "this.safeString (transaction, 'txId')" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (network)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (transaction, 'amount')" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransactionStatus (this.safeString (transaction, 'status'))" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "datetime" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressTo", "value" => "address" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "tag" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "updated", "value" => "undefined" }, %{ "comment" => nil, "key" => "comment", "value" => "this.safeString (transaction, 'info')" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': code,\n 'cost': this.safeNumber (transaction, 'transactionFee'),\n 'rate': undefined,\n }" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeNumber (transaction, 'transactionFee')" }, %{ "comment" => nil, "key" => "rate", "value" => "undefined" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // fetchDeposits\n //\n // {\n // \"amount\":\"0.00999800\",\n // \"coin\":\"PAXG\",\n // \"network\":\"ETH\",\n // \"status\":1,\n // \"address\":\"0x788cabe9236ce061e5a892e1a59395a81fc8d62c\",\n // \"addressTag\":\"\",\n // \"txId\":\"0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3\",\n // \"insertTime\":1599621997000,\n // \"transferType\":0,\n // \"unlockConfirm\":\"12/12\", // confirm times for unlocking\n // \"confirmTimes\":\"12/12\"\n // }\n //\n // fetchWithdrawals\n //\n // {\n // \"address\": \"0x94df8b352de7f46f64b01d3666bf6e936e44ce60\",\n // \"amount\": \"8.91000000\",\n // \"applyTime\": \"2019-10-12 11:12:02\",\n // \"coin\": \"USDT\",\n // \"id\": \"b6ae22b3aa844210a7041aee7589627c\",\n // \"withdrawOrderId\": \"WITHDRAWtest123\",\n // \"network\": \"ETH\",\n // \"transferType\": 0\n // \"status\": 6,\n // \"transactionFee\": \"0.004\",\n // \"confirmNo\":3,\n // \"info\": \"The address is not valid. Please confirm with the recipient\",\n // \"txId\": \"0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268\"\n // }\n //\n // withdraw\n //\n // {\n // \"code\":0,\n // \"timestamp\":1705274263621,\n // \"data\":{\n // \"id\":\"1264246141278773252\"\n // }\n // }\n //\n // parse withdraw-type output first...\n //\n const data = this.safeValue (transaction, 'data');\n const dataId = (data === undefined) ? undefined : this.safeString (data, 'id');\n const id = this.safeString (transaction, 'id', dataId);\n const address = this.safeString (transaction, 'address');\n const tag = this.safeString (transaction, 'addressTag');\n let timestamp = this.safeInteger2 (transaction, 'insertTime', 'timestamp');\n let datetime = this.iso8601 (timestamp);\n if (timestamp === undefined) {\n datetime = this.safeString (transaction, 'applyTime');\n timestamp = this.parse8601 (datetime);\n }\n const network = this.safeString (transaction, 'network');\n const currencyId = this.safeString (transaction, 'coin');\n let code = this.safeCurrencyCode (currencyId, currency);\n if ((code !== undefined) && (code !== network) && code.indexOf (network) >= 0) {\n if (network !== undefined) {\n code = code.replace (network, '');\n }\n }\n const rawType = this.safeString (transaction, 'transferType');\n const type = (rawType === '0') ? 'deposit' : 'withdrawal';\n return {\n 'info': transaction,\n 'id': id,\n 'txid': this.safeString (transaction, 'txId'),\n 'type': type,\n 'currency': code,\n 'network': this.networkIdToCode (network),\n 'amount': this.safeNumber (transaction, 'amount'),\n 'status': this.parseTransactionStatus (this.safeString (transaction, 'status')),\n 'timestamp': timestamp,\n 'datetime': datetime,\n 'address': address,\n 'addressFrom': undefined,\n 'addressTo': address,\n 'tag': tag,\n 'tagFrom': tag,\n 'tagTo': undefined,\n 'updated': undefined,\n 'comment': this.safeString (transaction, 'info'),\n 'fee': {\n 'currency': code,\n 'cost': this.safeNumber (transaction, 'transactionFee'),\n 'rate': undefined,\n },\n 'internal': undefined,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5522, "line_start" => 5504, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: string)", "source" => "parseTransactionStatus (status: string) {\n const statuses: Dict = {\n '0': 'pending',\n '1': 'ok',\n '10': 'pending',\n '20': 'rejected',\n '30': 'ok',\n '40': 'rejected',\n '50': 'ok',\n '60': 'pending',\n '70': 'rejected',\n '2': 'pending',\n '3': 'rejected',\n '4': 'pending',\n '5': 'rejected',\n '6': 'ok',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5202, "line_start" => 5180, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transfer" }, %{ "comment" => nil, "key" => "id", "value" => "tranId" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "currency", "value" => "currencyCode" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (transfer, 'amount')" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "fromAccount" }, %{ "comment" => nil, "key" => "toAccount", "value" => "toAccount" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransferStatus (status)" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry", "source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n const tranId = this.safeString (transfer, 'transferId');\n const timestamp = this.safeInteger (transfer, 'timestamp');\n const currencyId = this.safeString (transfer, 'asset');\n const currencyCode = this.safeCurrencyCode (currencyId, currency);\n const status = this.safeString (transfer, 'status');\n const accountsById = this.safeDict (this.options, 'accountsById', {});\n const fromId = this.safeString (transfer, 'fromAccount');\n const toId = this.safeString (transfer, 'toAccount');\n const fromAccount = this.safeString (accountsById, fromId, fromId);\n const toAccount = this.safeString (accountsById, toId, toId);\n return {\n 'info': transfer,\n 'id': tranId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'currency': currencyCode,\n 'amount': this.safeNumber (transfer, 'amount'),\n 'fromAccount': fromAccount,\n 'toAccount': toAccount,\n 'status': this.parseTransferStatus (status),\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5209, "line_start" => 5204, "mappings" => [], "name" => "parseTransferStatus", "signature" => "parseTransferStatus (status: Str): string", "source" => "parseTransferStatus (status: Str): string {\n const statuses: Dict = {\n 'CONFIRMED': 'ok',\n };\n return this.safeString (statuses, status, status);\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: [], public: [] }, 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" ], type: :success_code }, signing: %{ api_key_header: "X-BX-APIKEY", confidence: :high, pattern: :hmac_sha256_query }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ precision_mode: 4, sample_limits: %{ "amount" => %{}, "cost" => %{ "max" => 300000, "min" => 1 }, "price" => %{} }, sample_precision: %{ "amount" => 1, "price" => 1.0e-7 }, spot: %{ base: "MEW", base_id: "MEW", case: :upper, contract: false, id: "MEW-USDT", limits: %{ "amount" => %{}, "cost" => %{ "max" => 300000, "min" => 1 }, "leverage" => %{}, "price" => %{} }, maker: 0.001, precision: %{ "amount" => 1, "price" => 1.0e-7 }, quote: "USDT", quote_id: "USDT", separator: "-", symbol: "MEW/USDT", taker: 0.001 }, swap: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 1, id: "BTC-USDT", inverse: false, limits: %{ "amount" => %{ "min" => 0.0001 }, "cost" => %{ "min" => 2 }, "leverage" => %{}, "price" => %{} }, linear: true, maker: 0.0002, precision: %{ "amount" => 0.0001, "price" => 0.1 }, quote: "USDT", quote_id: "USDT", separator: "-", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT", taker: 0.0005 } }, symbol_patterns: %{ spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :dash_upper, separator: "-", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, separator: "-", suffix: nil } }, timeframes: %{ "12h" => "12h", "15m" => "15m", "1M" => "1M", "1d" => "1d", "1h" => "1h", "1m" => "1m", "1w" => "1w", "2h" => "2h", "30m" => "30m", "3d" => "3d", "3m" => "3m", "4h" => "4h", "5m" => "5m", "6h" => "6h" }, url_strategy: %{ detected_from: "fallback", pattern: :no_prefix, prefix: nil }, urls: %{ api: "https://open-api.bingx.com/openApi", api_sections: %{ "account" => "https://open-api.bingx.com/openApi", "api" => "https://open-api.bingx.com/openApi", "contract" => "https://open-api.bingx.com/openApi", "copyTrading" => "https://open-api.bingx.com/openApi", "cswap" => "https://open-api.bingx.com/openApi", "fund" => "https://open-api.bingx.com/openApi", "spot" => "https://open-api.bingx.com/openApi", "subAccount" => "https://open-api.bingx.com/openApi", "swap" => "https://open-api.bingx.com/openApi", "user" => "https://open-api.bingx.com/openApi", "wallets" => "https://open-api.bingx.com/openApi" }, doc: "https://bingx-api.github.io/docs/", other: nil, sandbox: %{ "swap" => "https://open-api-vst.bingx.com/openApi" }, www: "https://bingx.com/" }, version: "v1", ws: %{ channel_templates: %{ watch_balance: %{ auth_required: true, market_id_format: :native, params: [], pattern: :reqtype_sub, separator: "@" }, watch_my_trades: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :reqtype_sub, separator: "@" }, watch_ohlcv: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :reqtype_sub, separator: "@" }, watch_order_book: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :reqtype_sub, separator: "@" }, watch_orders: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :reqtype_sub, separator: "@" }, watch_ticker: %{ market_id_format: :native, params: [], pattern: :reqtype_sub, separator: "@" }, watch_trades: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :reqtype_sub, separator: "@" } }, 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: false, watch_order_book: true, watch_order_book_for_symbols: false, watch_orders: true, watch_orders_for_symbols: nil, watch_position: nil, watch_positions: nil, watch_status: nil, watch_ticker: true, watch_tickers: false, watch_trades: true, watch_trades_for_symbols: false }, hostname: "bingx.com", message_patterns: [ %{ format: :custom, id_field: "id", keys: [ "dataType", "id" ], sources: [ :send, :watch ] }, %{ format: :custom, id_field: "id", keys: [ "dataType", "id", "reqType" ], sources: [ :send, :watch ] } ], options: %{ "watchBalance" => %{ "awaitBalanceSnapshot" => false, "fetchBalanceSnapshot" => true }, "watchOrderBook" => %{ "depth" => 100 }, "watchTrades" => %{ "ignoreDuplicates" => true }, "ws" => %{ "gunzip" => true } }, streaming: %{ keep_alive: 1800000 }, subscription_config: %{ args_field: "dataType", args_format: :string, market_id_format: :native, op_field: "reqType", separator: "@" }, subscription_pattern: :reqtype_sub, urls: %{ "inverse" => "wss://open-api-cswap-ws.bingx.com/market", "linear" => "wss://open-api-swap.bingx.com/swap-market", "spot" => "wss://open-api-ws.bingx.com/market" }, watch_methods: [ "watchBalance", "watchMyTrades", "watchOHLCV", "watchOrderBook", "watchOrders", "watchTicker", "watchTrades" ] } }