# Binance Exchange Specification # # Auto-generated by: mix ccxt.extract binance # 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: [], currencies: %{ "BNFCR" => %{ "code" => "BNFCR", "fees" => %{}, "id" => "BNFCR", "limits" => %{ "deposit" => %{}, "withdraw" => %{} }, "networks" => %{}, "precision" => 0.001 } }, currency_aliases: %{ "BCC" => "BCC", "BCHSV" => "BSV", "XBT" => "BTC", "YOYO" => "YOYOW" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 99, "coveragePercent" => 100, "enabledMethods" => 109, "excluded" => [ %{ "method" => "fetchCanceledAndClosedOrders", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchCanceledOrders", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchClosedOrders", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchDepositWithdrawFee", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchFundingInterval", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchIsolatedBorrowRate", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchLeverage", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchMarketLeverageTiers", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchTradingLimits", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchTransactionFee", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 10, "extractableMethods" => 99, "failures" => [] }, endpoints: [ %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 20.001, default_params: %{ "isIsolated" => "FALSE", "type" => "BORROW" }, market_type: :spot, method: :post, name: :borrow_cross_margin, param_mappings: %{ "code" => "asset" }, params: [ :code, :amount ], path: "/margin/borrow-repay", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 20.001, default_params: %{ "isIsolated" => "TRUE", "type" => "BORROW" }, market_type: :spot, method: :post, name: :borrow_isolated_margin, param_mappings: %{ "code" => "asset" }, params: [ :symbol, :code, :amount ], path: "/margin/borrow-repay", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, market_type: :spot, method: :delete, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/openOrders", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, market_type: :spot, method: :delete, name: :cancel_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/order", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, default_params: %{ "orderidlist" => [ "test-order-id" ], "symbol" => "BTCUSDT" }, market_type: :spot, method: :delete, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/batchOrders", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 3.3335, market_type: :spot, method: :post, name: :create_convert_trade, param_mappings: %{ "id" => "quoteId" }, params: [ :id, :fromCode, :toCode, :amount ], path: "/convert/acceptQuote", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "side" => "BUY", "timeInForce" => "GTC", "type" => "LIMIT" }, market_type: :spot, method: :post, name: :create_limit_buy_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :amount, :price ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC", "type" => "LIMIT" }, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "side" => "SELL", "timeInForce" => "GTC", "type" => "LIMIT" }, market_type: :spot, method: :post, name: :create_limit_sell_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :amount, :price ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "side" => "BUY", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_buy_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :amount ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "side" => "BUY", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{ "cost" => "quoteOrderQty" }, params: [ :symbol, :cost ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_order_with_cost, param_mappings: %{ "cost" => "quoteOrderQty" }, params: [ :symbol, :side, :cost ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "side" => "SELL", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_sell_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :amount ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "side" => "SELL", "type" => "MARKET" }, market_type: :spot, method: :post, name: :create_market_sell_order_with_cost, param_mappings: %{ "cost" => "quoteOrderQty" }, params: [ :symbol, :cost ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC" }, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/order", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 5, default_params: %{ "batchOrders" => [ %{ "newClientOrderId" => "", "newOrderRespType" => "RESULT", "price" => "50000", "quantity" => "0.001", "side" => "BUY", "symbol" => "BTCUSDT", "timeInForce" => "GTC", "type" => "LIMIT" } ] }, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/batchOrders", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "type" => "LIMIT_MAKER" }, market_type: :spot, method: :post, name: :create_post_only_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/order", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 4, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "RESULT", "reduceOnly" => true, "symbol" => "BTCUSDT", "timeInForce" => "GTC" }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC", "triggerDirection" => "below", "type" => "STOP_LOSS_LIMIT" }, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC", "triggerDirection" => "below", "type" => "STOP_LOSS_LIMIT" }, market_type: :swap, method: :post, name: :create_stop_loss_order, param_mappings: %{ "amount" => "quantity", "stopLossPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :stopLossPrice ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC", "triggerDirection" => "below", "type" => "STOP_LOSS_LIMIT" }, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC", "triggerDirection" => "above", "type" => "TAKE_PROFIT_LIMIT" }, market_type: :swap, method: :post, name: :create_take_profit_order, param_mappings: %{ "amount" => "quantity", "takeProfitPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfitPrice ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "trailingDelta" => "100", "type" => "STOP_LOSS" }, market_type: :swap, method: :post, name: :create_trailing_percent_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :type, :side, :amount, :price, :trailingPercent, :trailingTriggerPrice ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC", "triggerDirection" => "below", "type" => "STOP_LOSS_LIMIT" }, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "stopPrice" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/order", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.2, default_params: %{ "cancelReplaceMode" => "STOP_ON_FAILURE", "newClientOrderId" => "", "newOrderRespType" => "FULL", "timeInForce" => "GTC" }, market_type: :spot, method: :post, name: :edit_order, param_mappings: %{ "amount" => "quantity", "id" => "cancelOrderId" }, params: [ :id, :symbol, :type, :side, :amount, :price ], path: "/order/cancelReplace", response_transformer: {:extract_path, ["newOrderResponse"]}, source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 5, default_params: %{ "batchOrders" => [ %{ "orderId" => "test-order-id", "price" => "50000", "quantity" => "0.001", "side" => "BUY", "symbol" => "BTCUSDT" } ] }, market_type: :spot, method: :put, name: :edit_orders, param_mappings: %{}, params: [ :orders ], path: "/batchOrders", source: :intercepted }, %{ api_section: "eapiPublic", auth: false, cost: 5, market_type: :option, method: :get, name: :fetch_all_greeks, param_mappings: %{}, params: [ :symbols ], path: "/mark", source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/account", source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.4, default_params: %{ "symbols" => "[\"BTCUSDT\"]" }, market_type: :spot, method: :get, name: :fetch_bids_asks, param_mappings: %{}, params: [ :symbols ], path: "/ticker/bookTicker", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, market_type: :spot, method: :get, name: :fetch_borrow_interest, param_mappings: %{ "code" => "asset" }, params: [ :code, :symbol, :since, :limit ], path: "/margin/interestHistory", response_transformer: {:extract_path, ["rows"]}, source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, default_params: %{ "limit" => 93 }, market_type: :spot, method: :get, name: :fetch_borrow_rate_history, param_mappings: %{ "arg0" => "asset" }, params: [], path: "/margin/interestRateHistory", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 10, market_type: :spot, method: :get, name: :fetch_convert_currencies, param_mappings: %{}, params: [], path: "/convert/assetInfo", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 1.3334, market_type: :spot, method: :post, name: :fetch_convert_quote, param_mappings: %{ "amount" => "fromAmount", "fromCode" => "fromAsset", "toCode" => "toAsset" }, params: [ :fromCode, :toCode, :amount ], path: "/convert/getQuote", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.6667, market_type: :spot, method: :get, name: :fetch_convert_trade, param_mappings: %{ "id" => "orderId" }, params: [ :id, :code ], path: "/convert/orderStatus", response_transformer: {:extract_path, ["rows"]}, source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 20.001, default_params: %{ "endTime" => "" }, market_type: :spot, method: :get, name: :fetch_convert_trade_history, param_mappings: %{ "since" => "startTime" }, params: [ :code, :since, :limit ], path: "/convert/tradeFlow", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, market_type: :spot, method: :get, name: :fetch_cross_borrow_rate, param_mappings: %{ "code" => "asset" }, params: [ :code ], path: "/margin/interestRateHistory", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 1, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/capital/config/getall", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 1, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/capital/deposit/address", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 1, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fees, param_mappings: %{}, params: [ :codes ], path: "/capital/config/getall", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, market_type: :spot, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/capital/deposit/hisrec", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 30, default_params: %{ "incomeType" => "FUNDING_FEE", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/income", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_funding_intervals, param_mappings: %{}, params: [ :symbols ], path: "/fundingInfo", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/premiumIndex", source: :intercepted }, %{ api_section: "fapiPublic", 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: "/fundingRate", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/premiumIndex", source: :intercepted }, %{ api_section: "eapiPublic", auth: false, cost: 5, default_params: %{ "symbol" => "BTC-250103-100000-C" }, market_type: :option, method: :get, name: :fetch_greeks, param_mappings: %{}, params: [ :symbol ], path: "/mark", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, default_params: %{ "interval" => "1m", "limit" => 500, "pair" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_index_ohlcv, param_mappings: %{ "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/indexPriceKlines", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, default_params: %{ "0" => "B", "1" => "T", "2" => "C", "3" => "/", "4" => "U", "5" => "S", "6" => "D", "7" => "T" }, market_type: :spot, method: :get, name: :fetch_isolated_borrow_rates, param_mappings: %{}, params: [], path: "/margin/isolatedMarginData", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/depth", source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.4, market_type: :spot, method: :get, name: :fetch_last_prices, param_mappings: %{}, params: [ :symbols ], path: "/ticker/price", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 30, market_type: :spot, method: :get, name: :fetch_ledger, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/income", source: :intercepted }, %{ api_section: "eapiPrivate", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_ledger_entry, param_mappings: %{ "code" => "currency", "id" => "recordId" }, params: [ :id, :code ], path: "/bill", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_leverage_tiers, param_mappings: %{}, params: [ :symbols ], path: "/leverageBracket", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_leverages, param_mappings: %{}, params: [ :symbols ], path: "/leverageBracket", response_transformer: {:extract_path, ["positions"]}, source: :intercepted }, %{ api_section: "fapiData", auth: false, base_url: "https://fapi.binance.com/futures/data", cost: 1, default_params: %{ "period" => "1d", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_long_short_ratio_history, param_mappings: %{ "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/globalLongShortAccountRatio", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_margin_adjustment_history, param_mappings: %{}, params: [ :symbol, :type, :since, :limit ], path: "/positionMargin/history", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 5, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_margin_mode, param_mappings: %{}, params: [ :symbol ], path: "/symbolConfig", response_transformer: {:extract_path_unwrap, ["positions"]}, source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 5, market_type: :swap, method: :get, name: :fetch_margin_modes, param_mappings: %{}, params: [ :symbols ], path: "/symbolConfig", response_transformer: {:extract_path, ["positions"]}, source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, default_params: %{ "interval" => "1m", "limit" => 500, "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, param_mappings: %{ "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/markPriceKlines", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_mark_price, param_mappings: %{}, params: [ :symbol ], path: "/premiumIndex", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_mark_prices, param_mappings: %{}, params: [ :symbols ], path: "/premiumIndex", source: :intercepted }, %{ api_section: "public", auth: false, cost: 4, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/exchangeInfo", response_transformer: {:extract_path, ["symbols"]}, source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 20, default_params: %{ "autoCloseType" => "LIQUIDATION", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_my_liquidations, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/forceOrders", response_transformer: {:extract_path, ["rows"]}, source: :intercepted }, %{ api_section: "eapiPrivate", auth: true, cost: 5, default_params: %{ "symbol" => "BTC-250103-100000-C" }, market_type: :swap, method: :get, name: :fetch_my_settlement_history, param_mappings: %{}, params: [], path: "/exerciseRecord", source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, market_type: :spot, method: :get, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/myTrades", source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.4, market_type: :spot, method: :get, name: :fetch_ohlcv, param_mappings: %{ "since" => "startTime", "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/klines", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{}, params: [ :symbol ], path: "/openInterest", source: :intercepted }, %{ api_section: "fapiData", auth: false, base_url: "https://fapi.binance.com/futures/data", cost: 1, default_params: %{ "period" => "5m", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_open_interest_history, param_mappings: %{ "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/openInterestHist", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :spot, method: :get, name: :fetch_open_order, param_mappings: %{ "arg0" => "orderId" }, params: [], path: "/openOrder", source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.2, market_type: :spot, method: :get, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/openOrders", source: :intercepted }, %{ api_section: "eapiPublic", auth: false, cost: 5, default_params: %{ "symbol" => "BTC-250103-100000-C" }, market_type: :option, method: :get, name: :fetch_option, param_mappings: %{}, params: [ :symbol ], path: "/ticker", source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.8, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/order", source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/depth", source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, market_type: :spot, method: :get, name: :fetch_order_trades, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol, :since, :limit ], path: "/myTrades", source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, market_type: :spot, method: :get, name: :fetch_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/allOrders", source: :intercepted }, %{ api_section: "eapiPrivate", auth: true, cost: 5, default_params: %{ "symbol" => "BTC-250103-100000-C" }, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/position", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 30, market_type: :swap, method: :get, name: :fetch_position_mode, param_mappings: %{}, params: [ :symbol ], path: "/positionSide/dual", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/leverageBracket", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_positions_risk, param_mappings: %{}, params: [ :symbols ], path: "/leverageBracket", source: :intercepted }, %{ api_section: "fapiPublic", auth: false, cost: 1, default_params: %{ "interval" => "1m", "limit" => 500, "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_premium_index_ohlcv, param_mappings: %{ "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/premiumIndexKlines", source: :intercepted }, %{ api_section: "eapiPublic", auth: false, cost: 3, default_params: %{ "underlying" => "BTCUSD" }, market_type: :swap, method: :get, name: :fetch_settlement_history, param_mappings: %{}, params: [], path: "/exerciseHistory", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, market_type: :spot, method: :get, name: :fetch_status, param_mappings: %{}, params: [], path: "/system/status", source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.4, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/ticker/24hr", source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.4, default_params: %{ "symbols" => "[\"BTCUSDT\"]" }, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/ticker/24hr", source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.2, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/time", response_transformer: {:extract_path, ["serverTime"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.4, default_params: %{ "endTime" => "" }, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{ "since" => "startTime" }, params: [ :symbol, :since, :limit ], path: "/aggTrades", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{}, params: [ :symbol ], path: "/asset/tradeFee", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, market_type: :spot, method: :get, name: :fetch_trading_fees, param_mappings: %{}, params: [], path: "/asset/tradeFee", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 1, market_type: :spot, method: :get, name: :fetch_transaction_fees, param_mappings: %{}, params: [ :codes ], path: "/capital/config/getall", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 0.1, default_params: %{ "type" => "MAIN_UMFUTURE" }, market_type: :spot, method: :get, name: :fetch_transfers, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/asset/transfer", response_transformer: {:extract_path, ["rows"]}, source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 2, market_type: :spot, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/capital/withdraw/history", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 20.001, default_params: %{ "isIsolated" => "FALSE", "type" => "REPAY" }, market_type: :spot, method: :post, name: :repay_cross_margin, param_mappings: %{ "code" => "asset" }, params: [ :code, :amount ], path: "/margin/borrow-repay", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 20.001, default_params: %{ "isIsolated" => "TRUE", "type" => "REPAY" }, market_type: :spot, method: :post, name: :repay_isolated_margin, param_mappings: %{ "code" => "asset" }, params: [ :symbol, :code, :amount ], path: "/margin/borrow-repay", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/leverage", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_margin_mode, param_mappings: %{ "marginMode" => "marginType" }, params: [ :marginMode, :symbol ], path: "/marginType", source: :intercepted }, %{ api_section: "fapiPrivate", auth: true, cost: 1, default_params: %{ "dualSidePosition" => "true" }, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/positionSide/dual", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 6.0003, default_params: %{ "type" => "MAIN_UMFUTURE" }, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "code" => "asset" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/asset/transfer", source: :intercepted }, %{ api_section: "sapi", auth: true, base_url: "https://api.binance.com/sapi/v1", cost: 4.0002, market_type: :spot, method: :post, name: :withdraw, param_mappings: %{ "code" => "coin" }, params: [ :code, :amount, :address, :tag ], path: "/capital/withdraw/apply", source: :intercepted } ], error_code_details: %{ -1000 => %{ description: "An unknown error occured while processing the request.", type: :exchange_error }, -10001 => %{ description: "The system is under maintenance, please try again later.", type: :exchange_error }, -10002 => %{ description: "Invalid input parameters.", type: :invalid_parameters }, -10005 => %{ description: "No records found.", type: :exchange_error }, -10007 => %{ description: "This coin is not loanable", type: :invalid_parameters }, -10008 => %{ description: "This coin is not loanable", type: :invalid_parameters }, -10009 => %{ description: "This coin can not be used as collateral.", type: :invalid_parameters }, -1001 => %{ description: "Internal error; unable to process your request. Please try again.", type: :exchange_error }, -10010 => %{ description: "This coin can not be used as collateral.", type: :invalid_parameters }, -10011 => %{ description: "Insufficient spot assets.", type: :insufficient_balance }, -10012 => %{ description: "Invalid repayment amount.", type: :invalid_parameters }, -10013 => %{ description: "Insufficient collateral amount.", type: :insufficient_balance }, -10015 => %{ description: "Collateral deduction failed.", type: :exchange_error }, -10016 => %{ description: "Failed to provide loan.", type: :exchange_error }, -10017 => %{ description: "Repay amount should not be larger than liability.", type: :exchange_error }, -10018 => %{ description: "Invalid repayment amount.", type: :invalid_parameters }, -10019 => %{ description: "Configuration does not exists.", type: :invalid_parameters }, -1002 => %{ description: "You are not authorized to execute this request.", type: :invalid_credentials }, -10020 => %{ description: "User ID does not exist.", type: :invalid_parameters }, -10021 => %{ description: "Order does not exist.", type: :invalid_order }, -10022 => %{ description: "Invalid adjustment amount.", type: :invalid_parameters }, -10023 => %{ description: "Failed to adjust LTV.", type: :exchange_error }, -10024 => %{ description: "LTV adjustment not supported.", type: :invalid_parameters }, -10025 => %{ description: "Repayment failed.", type: :exchange_error }, -10026 => %{ description: "Invalid parameter.", type: :invalid_parameters }, -10028 => %{ description: "Invalid parameter.", type: :invalid_parameters }, -10029 => %{ description: "Loan amount is too small.", type: :exchange_error }, -1003 => %{ description: "Too many requests use the websocket for live updates to avoid polling the API.", type: :rate_limited }, -10030 => %{ description: "Loan amount is too much.", type: :exchange_error }, -10031 => %{ description: "Individual loan quota reached.", type: :exchange_error }, -10032 => %{ description: "Repayment is temporarily unavailable.", type: :exchange_error }, -10034 => %{ description: "Repay with collateral is not available currently, please try to repay with borrowed coin.", type: :exchange_error }, -10039 => %{ description: "Repayment amount is too small.", type: :exchange_error }, -1004 => %{ description: "Server is busy, please wait and try again", type: :exchange_error }, -10040 => %{ description: "Repayment amount is too large.", type: :exchange_error }, -10041 => %{ description: "Due to high demand, there are currently insufficient loanable assets for {0}. Please adjust your borrow amount or try again tomorrow.", type: :exchange_error }, -10042 => %{ description: "asset %s is not supported", type: :invalid_order }, -10043 => %{ description: "{0} borrowing is currently not supported.", type: :exchange_error }, -10044 => %{ description: "Collateral amount has reached the limit. Please reduce your collateral amount or try with other collaterals.", type: :exchange_error }, -10045 => %{ description: "The loan coin does not support collateral repayment. Please try again later.", type: :exchange_error }, -10046 => %{ description: "Collateral Adjustment exceeds the maximum limit. Please try again.", type: :exchange_error }, -10047 => %{ description: "This coin is currently not supported in your location due to local regulations.", type: :access_restricted }, -1005 => %{ description: "No such IP has been white listed", type: :access_restricted }, -1006 => %{ description: "An unexpected response was received from the message bus. Execution status unknown.", type: :exchange_error }, -1007 => %{ description: "Timeout waiting for response from backend server. Send status unknown, execution status unknown.", type: :network_error }, -1008 => %{ description: "undocumented, but mentioned: This is sent whenever the servers are overloaded with requests.", type: :exchange_error }, -1010 => %{ description: "ERROR_MSG_RECEIVED", type: :exchange_error }, -1011 => %{ description: "This IP cannot access this route.", type: :access_restricted }, -1013 => %{ description: "INVALID_MESSAGE.", type: :invalid_parameters }, -1014 => %{ description: "Unsupported order combination.", type: :invalid_order }, -1015 => %{ description: "Too many new orders.", type: :rate_limited }, -1016 => %{ description: "This service is no longer available.", type: :invalid_parameters }, -1020 => %{ description: "This operation is not supported.", type: :invalid_parameters }, -1021 => %{ description: "Timestamp for this request is outside of the recvWindow 1000ms ahead of the servers time.", type: :invalid_credentials }, -1022 => %{ description: "Signature for this request is not valid.", type: :invalid_credentials }, -1023 => %{ description: "Start time is greater than end time.", type: :invalid_parameters }, -1099 => %{ description: "Not found, authenticated, or authorized", type: :exchange_error }, -1100 => %{ description: "Illegal characters found in a parameter.", type: :invalid_parameters }, -11008 => %{ description: "undocumented: Exceeding the account’s maximum borrowable limit", type: :exchange_error }, -1101 => %{ description: "Too many parameters sent for this endpoint.", type: :invalid_parameters }, -1102 => %{ description: "A mandatory parameter was not sent, was empty/null, or malformed.", type: :invalid_parameters }, -1103 => %{ description: "An unknown parameter was sent.", type: :invalid_parameters }, -1104 => %{ description: "Not all sent parameters were read.", type: :invalid_parameters }, -1105 => %{ description: "A parameter was empty.", type: :invalid_parameters }, -1106 => %{ description: "A parameter was sent when not required.", type: :invalid_parameters }, -1108 => %{ description: "undocumented, but mentioned: This error will occur if a value to a parameter being sent was too large, potentially causing overflow", type: :invalid_order }, -1109 => %{ description: "Invalid account.", type: :invalid_parameters }, -1110 => %{ description: "Invalid symbolType.", type: :invalid_order }, -1111 => %{ description: "Precision is over the maximum defined for this asset.", type: :invalid_parameters }, -1112 => %{ description: "No orders on book for symbol.", type: :exchange_error }, -1113 => %{ description: "Withdrawal amount must be negative.", type: :invalid_parameters }, -1114 => %{ description: "TimeInForce parameter sent when not required.", type: :invalid_parameters }, -1115 => %{ description: "Invalid timeInForce.", type: :invalid_parameters }, -1116 => %{ description: "Invalid orderType.", type: :invalid_parameters }, -1117 => %{ description: "Invalid side.", type: :invalid_parameters }, -1118 => %{ description: "New client order ID was empty.", type: :invalid_parameters }, -1119 => %{ description: "Original client order ID was empty.", type: :invalid_parameters }, -1120 => %{ description: "Invalid interval.", type: :invalid_parameters }, -1121 => %{ description: "Invalid symbol.", type: :invalid_order }, -1122 => %{ description: "INVALID_SYMBOL_STATUS", type: :invalid_parameters }, -1125 => %{ description: "This listenKey does not exist.", type: :invalid_credentials }, -1126 => %{ description: "ASSET_NOT_SUPPORTED", type: :invalid_order }, -1127 => %{ description: "Lookup interval is too big.", type: :invalid_parameters }, -1128 => %{ description: "Combination of optional parameters invalid.", type: :invalid_parameters }, -1129 => %{ description: "BAD_CURRENCY", type: :invalid_order }, -1130 => %{ description: "Invalid data sent for a parameter.", type: :invalid_parameters }, -1131 => %{ description: "recvWindow must be less than 60000", type: :invalid_parameters }, -1134 => %{ description: "strategyType was less than 1000000.", type: :invalid_parameters }, -1135 => %{ description: "undocumented, but mentioned: This error code will occur if a parameter requiring a JSON object is invalid.", type: :invalid_parameters }, -1136 => %{ description: "Invalid newOrderRespType", type: :invalid_parameters }, -1145 => %{ description: "cancelRestrictions has to be either ONLY_NEW or ONLY_PARTIALLY_FILLED.", type: :invalid_parameters }, -1151 => %{ description: "Symbol is present multiple times in the list.", type: :invalid_parameters }, -12014 => %{ description: "More than 1 request in 2 seconds", type: :rate_limited }, -13000 => %{ description: "Redeption of the token is forbiden now", type: :exchange_error }, -13001 => %{ description: "Exceeds individual 24h redemption limit of the token", type: :exchange_error }, -13002 => %{ description: "Exceeds total 24h redemption limit of the token", type: :exchange_error }, -13003 => %{ description: "Subscription of the token is forbiden now", type: :access_restricted }, -13004 => %{ description: "Exceeds individual 24h subscription limit of the token", type: :exchange_error }, -13005 => %{ description: "Exceeds total 24h subscription limit of the token", type: :exchange_error }, -13006 => %{ description: "Subscription amount is too small", type: :exchange_error }, -13007 => %{ description: "The Agreement is not signed", type: :access_restricted }, -18002 => %{ description: "The total amount of codes you created has exceeded the 24-hour limit, please try again after UTC 0", type: :exchange_error }, -18003 => %{ description: "Too many codes created in 24 hours, please try again after UTC 0", type: :exchange_error }, -18004 => %{ description: "Too many invalid redeem attempts in 24 hours, please try again after UTC 0", type: :exchange_error }, -18005 => %{ description: "Too many invalid verify attempts, please try later", type: :access_restricted }, -18006 => %{ description: "The amount is too small, please re-enter", type: :exchange_error }, -18007 => %{ description: "This token is not currently supported, please re-enter", type: :exchange_error }, -2008 => %{ description: "undocumented, Invalid Api-Key ID", type: :invalid_credentials }, -2010 => %{ description: "NEW_ORDER_REJECTED", type: :invalid_order }, -2011 => %{ description: "CANCEL_REJECTED", type: :order_not_found }, -2012 => %{ description: "CANCEL_ALL_FAIL", type: :exchange_error }, -20121 => %{ description: "override commons", type: :invalid_order }, -20124 => %{ description: "override commons", type: :invalid_parameters }, -2013 => %{ description: "Order does not exist.", type: :order_not_found }, -20130 => %{ description: "override commons", type: :invalid_parameters }, -20132 => %{ description: "override commons", type: :invalid_parameters }, -2014 => %{ description: "API-key format invalid.", type: :invalid_credentials }, -2015 => %{ description: "Invalid API-key, IP, or permissions for action.", type: :invalid_credentials }, -2016 => %{ description: "No trading window could be found for the symbol. Try ticker/24hrs instead.", type: :exchange_error }, -2017 => %{ description: "API Keys are locked on this account.", type: :access_restricted }, -2018 => %{ description: "Balance is insufficient", type: :exchange_error }, -2019 => %{ description: "Margin is insufficient.", type: :exchange_error }, -20194 => %{ description: "override commons", type: :invalid_parameters }, -20195 => %{ description: "override commons", type: :invalid_parameters }, -20196 => %{ description: "override commons", type: :invalid_parameters }, -20198 => %{ description: "override commons", type: :exchange_error }, -2020 => %{ description: "Unable to fill.", type: :invalid_order }, -20204 => %{ description: "override commons", type: :invalid_parameters }, -2021 => %{ description: "This code is sent when either the cancellation of the order failed or the new order placement failed but not both.", type: :invalid_order }, -2022 => %{ description: "This code is sent when both the cancellation of the order failed and the new order placement failed.", type: :invalid_order }, -2023 => %{ description: "User in liquidation mode now.", type: :exchange_error }, -2024 => %{ description: "Position is not sufficient.", type: :exchange_error }, -2025 => %{ description: "Reach max open order limit.", type: :exchange_error }, -2026 => %{ description: "Order was canceled or expired with no executed qty over 90 days ago and has been archived.", type: :invalid_order }, -2027 => %{ description: "Exceeded the maximum allowable position at current leverage.", type: :exchange_error }, -2028 => %{ description: "Leverage is smaller than permitted: insufficient margin balance", type: :exchange_error }, -21001 => %{ description: "Request ID is not a Portfolio Margin Account.", type: :invalid_parameters }, -21002 => %{ description: "Portfolio Margin Account doesn't support transfer from margin to futures.", type: :invalid_parameters }, -21003 => %{ description: "Fail to retrieve margin assets.", type: :exchange_error }, -21004 => %{ description: "User doesn’t have portfolio margin bankruptcy loan", type: :exchange_error }, -21005 => %{ description: "User’s spot wallet doesn’t have enough BUSD to repay portfolio margin bankruptcy loan", type: :insufficient_balance }, -21006 => %{ description: "User had portfolio margin bankruptcy loan repayment in process", type: :exchange_error }, -21007 => %{ description: "User failed to repay portfolio margin bankruptcy loan since liquidation was in process", type: :exchange_error }, -3000 => %{ description: "Internal server error.", type: :exchange_error }, -3001 => %{ description: "Please enable 2FA first.", type: :invalid_credentials }, -3002 => %{ description: "We don't have this asset.", type: :invalid_order }, -3003 => %{ description: "Margin account does not exist.", type: :invalid_parameters }, -3004 => %{ description: "Trade not allowed.", type: :exchange_error }, -3005 => %{ description: "Transferring out not allowed. Transfer out amount exceeds max amount.", type: :invalid_parameters }, -3006 => %{ description: "Your borrow amount has exceed maximum borrow amount.", type: :invalid_parameters }, -3007 => %{ description: "You have pending transaction, please try again later..", type: :exchange_error }, -3008 => %{ description: "Borrow not allowed. Your borrow amount has exceed maximum borrow amount.", type: :invalid_parameters }, -3009 => %{ description: "This asset are not allowed to transfer into margin account currently.", type: :exchange_error }, -3010 => %{ description: "Repay not allowed. Repay amount exceeds borrow amount.", type: :invalid_parameters }, -3011 => %{ description: "Your input date is invalid.", type: :invalid_parameters }, -3012 => %{ description: "Borrow is banned for this asset.", type: :exchange_error }, -3013 => %{ description: "Borrow amount less than minimum borrow amount.", type: :invalid_parameters }, -3014 => %{ description: "Borrow is banned for this account.", type: :access_restricted }, -3015 => %{ description: "Repay amount exceeds borrow amount.", type: :invalid_parameters }, -3016 => %{ description: "Repay amount less than minimum repay amount.", type: :invalid_parameters }, -3017 => %{ description: "This asset are not allowed to transfer into margin account currently.", type: :exchange_error }, -3018 => %{ description: "Transferring in has been banned for this account.", type: :access_restricted }, -3019 => %{ description: "Transferring out has been banned for this account.", type: :access_restricted }, -3020 => %{ description: "Transfer out amount exceeds max amount.", type: :invalid_parameters }, -3021 => %{ description: "Margin account are not allowed to trade this trading pair.", type: :invalid_parameters }, -3022 => %{ description: "You account's trading is banned.", type: :access_restricted }, -3023 => %{ description: "You can't transfer out/place order under current margin level.", type: :exchange_error }, -3024 => %{ description: "The unpaid debt is too small after this repayment.", type: :exchange_error }, -3025 => %{ description: "Your input date is invalid.", type: :invalid_parameters }, -3026 => %{ description: "Your input param is invalid.", type: :invalid_parameters }, -3027 => %{ description: "Not a valid margin asset.", type: :invalid_order }, -3028 => %{ description: "Not a valid margin pair.", type: :invalid_order }, -3029 => %{ description: "Transfer failed.", type: :exchange_error }, -3036 => %{ description: "This account is not allowed to repay.", type: :access_restricted }, -3037 => %{ description: "PNL is clearing. Wait a second.", type: :exchange_error }, -3038 => %{ description: "Listen key not found.", type: :invalid_parameters }, -3041 => %{ description: "Balance is not enough", type: :insufficient_balance }, -3042 => %{ description: "PriceIndex not available for this margin pair.", type: :invalid_parameters }, -3043 => %{ description: "Transferring in not allowed.", type: :access_restricted }, -3044 => %{ description: "System busy.", type: :exchange_error }, -3045 => %{ description: "The system doesn't have enough asset now.", type: :exchange_error }, -32603 => %{ description: "undocumented, Filter failure: LOT_SIZE & precision", type: :invalid_parameters }, -3999 => %{ description: "This function is only available for invited users.", type: :access_restricted }, -4000 => %{ description: "override commons", type: :invalid_order }, -4001 => %{ description: "Invalid operation.", type: :invalid_parameters }, -4002 => %{ description: "Invalid get.", type: :invalid_parameters }, -4003 => %{ description: "Your input email is invalid.", type: :invalid_parameters }, -4004 => %{ description: "You don't login or auth.", type: :invalid_parameters }, -4005 => %{ description: "Too many new requests.", type: :invalid_parameters }, -4006 => %{ description: "Support main account only.", type: :invalid_parameters }, -4007 => %{ description: "Address validation is not passed.", type: :invalid_parameters }, -4008 => %{ description: "Address tag validation is not passed.", type: :invalid_parameters }, -4009 => %{ description: "undocumented", type: :invalid_parameters }, -4010 => %{ description: "{\"code\":-4010 ,\"msg\":\"White list mail has been confirmed.\"} // [TODO] possible bug: it should probably be \"has not been confirmed\"", type: :invalid_parameters }, -4011 => %{ description: "White list mail is invalid.", type: :invalid_parameters }, -4012 => %{ description: "White list is not opened.", type: :invalid_parameters }, -4013 => %{ description: "2FA is not opened.", type: :invalid_parameters }, -4014 => %{ description: "Withdraw is not allowed within 2 min login.", type: :invalid_parameters }, -4015 => %{ description: "Withdraw is limited.", type: :invalid_parameters }, -4016 => %{ description: "Within 24 hours after password modification, withdrawal is prohibited.", type: :invalid_parameters }, -4017 => %{ description: "Within 24 hours after the release of 2FA, withdrawal is prohibited.", type: :invalid_parameters }, -4018 => %{ description: "We don't have this asset.", type: :invalid_parameters }, -4019 => %{ description: "Current asset is not open for withdrawal.", type: :exchange_error }, -4020 => %{ description: "override commons", type: :invalid_parameters }, -4021 => %{ description: "Asset withdrawal must be an %s multiple of %s.", type: :invalid_parameters }, -4022 => %{ description: "Not less than the minimum pick-up quantity %s.", type: :invalid_parameters }, -4023 => %{ description: "Within 24 hours, the withdrawal exceeds the maximum amount.", type: :invalid_parameters }, -4024 => %{ description: "You don't have this asset.", type: :invalid_parameters }, -4025 => %{ description: "The number of hold asset is less than zero.", type: :invalid_parameters }, -4026 => %{ description: "You have insufficient balance.", type: :invalid_parameters }, -4027 => %{ description: "Failed to obtain tranId.", type: :invalid_parameters }, -4028 => %{ description: "The amount of withdrawal must be greater than the Commission.", type: :invalid_parameters }, -4029 => %{ description: "The withdrawal record does not exist.", type: :invalid_parameters }, -4030 => %{ description: "Confirmation of successful asset withdrawal. [TODO] possible bug in docs", type: :invalid_parameters }, -4031 => %{ description: "Cancellation failed.", type: :invalid_parameters }, -4032 => %{ description: "Withdraw verification exception.", type: :exchange_error }, -4033 => %{ description: "Illegal address.", type: :invalid_parameters }, -4034 => %{ description: "The address is suspected of fake.", type: :exchange_error }, -4035 => %{ description: "This address is not on the whitelist. Please join and try again.", type: :exchange_error }, -4036 => %{ description: "The new address needs to be withdrawn in {0} hours.", type: :exchange_error }, -4037 => %{ description: "Re-sending Mail failed.", type: :exchange_error }, -4038 => %{ description: "Please try again in 5 minutes.", type: :exchange_error }, -4039 => %{ description: "The user does not exist.", type: :exchange_error }, -4040 => %{ description: "This address not charged.", type: :exchange_error }, -4041 => %{ description: "Please try again in one minute.", type: :exchange_error }, -4042 => %{ description: "This asset cannot get deposit address again.", type: :exchange_error }, -4043 => %{ description: "More than 100 recharge addresses were used in 24 hours.", type: :exchange_error }, -4044 => %{ description: "This is a blacklist country.", type: :invalid_parameters }, -4045 => %{ description: "Failure to acquire assets.", type: :exchange_error }, -4046 => %{ description: "Agreement not confirmed.", type: :exchange_error }, -4047 => %{ description: "Time interval must be within 0-90 days", type: :exchange_error }, -4048 => %{ description: "override commons", type: :exchange_error }, -4049 => %{ description: "override commons", type: :invalid_parameters }, -4050 => %{ description: "override commons", type: :insufficient_balance }, -4051 => %{ description: "override commons", type: :insufficient_balance }, -4052 => %{ description: "override commons", type: :exchange_error }, -4053 => %{ description: "override commons", type: :invalid_parameters }, -4054 => %{ description: "override commons", type: :exchange_error }, -4055 => %{ description: "override commons", type: :invalid_parameters }, -4056 => %{ description: "override commons", type: :invalid_credentials }, -4057 => %{ description: "override commons", type: :invalid_credentials }, -4058 => %{ description: "override commons", type: :invalid_parameters }, -4059 => %{ description: "override commons", type: :exchange_error }, -4060 => %{ description: "As your deposit has not reached the required block confirmations, we have temporarily locked {0} asset", type: :invalid_parameters }, -4061 => %{ description: "override commons", type: :exchange_error }, -4062 => %{ description: "override commons", type: :invalid_parameters }, -4063 => %{ description: "override commons", type: :invalid_parameters }, -4064 => %{ description: "override commons", type: :invalid_parameters }, -4065 => %{ description: "override commons", type: :invalid_parameters }, -4066 => %{ description: "override commons", type: :invalid_parameters }, -4067 => %{ description: "override commons", type: :exchange_error }, -4068 => %{ description: "override commons", type: :exchange_error }, -4069 => %{ description: "override commons", type: :invalid_parameters }, -4070 => %{ description: "override commons", type: :invalid_parameters }, -4071 => %{ description: "override commons", type: :invalid_parameters }, -4072 => %{ description: "override commons", type: :exchange_error }, -4073 => %{ description: "override commons", type: :invalid_parameters }, -4074 => %{ description: "override commons", type: :invalid_parameters }, -4075 => %{ description: "override commons", type: :invalid_parameters }, -4076 => %{ description: "override commons", type: :exchange_error }, -4077 => %{ description: "override commons", type: :exchange_error }, -4078 => %{ description: "override commons", type: :exchange_error }, -4079 => %{ description: "override commons", type: :invalid_parameters }, -4080 => %{ description: "override commons", type: :access_restricted }, -4081 => %{ description: "override commons", type: :invalid_parameters }, -4082 => %{ description: "override commons", type: :invalid_parameters }, -4083 => %{ description: "override commons", type: :exchange_error }, -4084 => %{ description: "override commons", type: :invalid_parameters }, -4085 => %{ description: "override commons", type: :invalid_parameters }, -4086 => %{ description: "override commons", type: :invalid_parameters }, -4087 => %{ description: "override commons", type: :access_restricted }, -4088 => %{ description: "override commons", type: :access_restricted }, -4089 => %{ description: "override commons", type: :exchange_error }, -4090 => %{ description: "User can not place order currently.", type: :access_restricted }, -4091 => %{ description: "override commons", type: :exchange_error }, -4092 => %{ description: "override commons", type: :exchange_error }, -4093 => %{ description: "override commons", type: :exchange_error }, -4094 => %{ description: "override commons", type: :exchange_error }, -4095 => %{ description: "override commons", type: :exchange_error }, -4096 => %{ description: "override commons", type: :exchange_error }, -4097 => %{ description: "override commons", type: :exchange_error }, -4098 => %{ description: "override commons", type: :exchange_error }, -4099 => %{ description: "override commons", type: :exchange_error }, -4101 => %{ description: "override commons", type: :exchange_error }, -4102 => %{ description: "override commons", type: :exchange_error }, -4103 => %{ description: "override commons", type: :exchange_error }, -4104 => %{ description: "override commons", type: :invalid_parameters }, -4105 => %{ description: "override commons", type: :exchange_error }, -4106 => %{ description: "override commons", type: :exchange_error }, -4107 => %{ description: "override commons", type: :exchange_error }, -4108 => %{ description: "override commons", type: :exchange_error }, -4109 => %{ description: "override commons", type: :exchange_error }, -4110 => %{ description: "override commons", type: :exchange_error }, -4111 => %{ description: "clientTranId is duplicated.", type: :invalid_parameters }, -4112 => %{ description: "override commons", type: :exchange_error }, -4113 => %{ description: "override commons", type: :exchange_error }, -4114 => %{ description: "override commons", type: :invalid_parameters }, -4115 => %{ description: "override commons", type: :invalid_parameters }, -4116 => %{ description: "override commons", type: :exchange_error }, -4117 => %{ description: "override commons", type: :exchange_error }, -4118 => %{ description: "override commons", type: :exchange_error }, -4119 => %{ description: "override commons", type: :exchange_error }, -4120 => %{ description: "override commons", type: :exchange_error }, -4121 => %{ description: "override commons", type: :exchange_error }, -4122 => %{ description: "override commons", type: :exchange_error }, -4123 => %{ description: "override commons", type: :exchange_error }, -4124 => %{ description: "override commons", type: :exchange_error }, -4125 => %{ description: "override commons", type: :exchange_error }, -4126 => %{ description: "override commons", type: :exchange_error }, -4127 => %{ description: "override commons", type: :exchange_error }, -4128 => %{ description: "override commons", type: :exchange_error }, -4129 => %{ description: "override commons", type: :exchange_error }, -4130 => %{ description: "override commons", type: :exchange_error }, -4131 => %{ description: "override commons", type: :exchange_error }, -4132 => %{ description: "override commons", type: :exchange_error }, -4133 => %{ description: "override commons", type: :exchange_error }, -4134 => %{ description: "override commons", type: :exchange_error }, -4135 => %{ description: "override commons", type: :invalid_parameters }, -4136 => %{ description: "override commons", type: :exchange_error }, -4137 => %{ description: "override commons", type: :invalid_parameters }, -4138 => %{ description: "override commons", type: :invalid_parameters }, -4139 => %{ description: "override commons", type: :invalid_parameters }, -4140 => %{ description: "Invalid symbol status for opening position", type: :invalid_order }, -4141 => %{ description: "override commons", type: :invalid_parameters }, -4142 => %{ description: "override commons", type: :invalid_order }, -4143 => %{ description: "override commons", type: :exchange_error }, -4144 => %{ description: "override commons", type: :invalid_order }, -4145 => %{ description: "override commons", type: :exchange_error }, -4146 => %{ description: "override commons", type: :exchange_error }, -4147 => %{ description: "override commons", type: :exchange_error }, -4148 => %{ description: "override commons", type: :exchange_error }, -4149 => %{ description: "override commons", type: :exchange_error }, -4150 => %{ description: "override commons", type: :exchange_error }, -4151 => %{ description: "Price is higher than stop price multiplier cap.", type: :invalid_parameters }, -4152 => %{ description: "Price is lower than stop price multiplier floor.", type: :invalid_parameters }, -4154 => %{ description: "Stop price is higher than price multiplier cap.", type: :invalid_parameters }, -4155 => %{ description: "Stop price is lower than price multiplier floor", type: :invalid_parameters }, -4161 => %{ description: "Leverage reduction is not supported in Isolated Margin Mode with open positions", type: :exchange_error }, -4164 => %{ description: "{\"code\":-4164,\"msg\":\"Order's notional must be no smaller than 20 (unless you choose reduce only).\"},", type: :invalid_order }, -4165 => %{ description: "Invalid time interval", type: :invalid_parameters }, -4167 => %{ description: "Unable to adjust to Multi-Assets mode with symbols of USDⓈ-M Futures under isolated-margin mode.", type: :invalid_parameters }, -4168 => %{ description: "Unable to adjust to isolated-margin mode under the Multi-Assets mode.", type: :invalid_parameters }, -4169 => %{ description: "Unable to adjust Multi-Assets Mode with insufficient margin balance in USDⓈ-M Futures", type: :exchange_error }, -4170 => %{ description: "Unable to adjust Multi-Assets Mode with open orders in USDⓈ-M Futures", type: :exchange_error }, -4171 => %{ description: "Adjusted asset mode is currently set and does not need to be adjusted repeatedly", type: :exchange_error }, -4172 => %{ description: "Unable to adjust Multi-Assets Mode with a negative wallet balance of margin available asset in USDⓈ-M Futures account.", type: :exchange_error }, -4178 => %{ description: "Order's notional must be no smaller than one (unless you choose reduce only)", type: :invalid_parameters }, -4183 => %{ description: "Price is higher than stop price multiplier cap.", type: :invalid_order }, -4184 => %{ description: "Price is lower than stop price multiplier floor.", type: :invalid_order }, -4188 => %{ description: "Timestamp for this request is outside of the ME recvWindow.", type: :invalid_parameters }, -4192 => %{ description: "Trade forbidden due to Cooling-off Period.", type: :access_restricted }, -4194 => %{ description: "Intermediate Personal Verification is required for adjusting leverage over 20x.", type: :access_restricted }, -4195 => %{ description: "More than 20x leverage is available one month after account registration.", type: :access_restricted }, -4196 => %{ description: "Only limit order is supported.", type: :invalid_parameters }, -4197 => %{ description: "No need to modify the order.", type: :exchange_error }, -4198 => %{ description: "Exceed maximum modify order limit.", type: :exchange_error }, -4199 => %{ description: "Symbol is not in trading status. Order amendment is not permitted.", type: :invalid_parameters }, -4200 => %{ description: "More than 20x leverage is available %s days after Futures account registration.", type: :access_restricted }, -4201 => %{ description: "Users in your location/country can only access a maximum leverage of %s", type: :access_restricted }, -4202 => %{ description: "Intermediate Personal Verification is required for adjusting leverage over 20x", type: :exchange_error }, -4203 => %{ description: "More than 20x leverage is available one month after account registration.", type: :access_restricted }, -4205 => %{ description: "More than 20x leverage is available %s days after Futures account registration.", type: :access_restricted }, -4206 => %{ description: "Users in this country has limited adjust leverage.", type: :access_restricted }, -4208 => %{ description: "Current symbol leverage cannot exceed 20 when using position limit adjustment service.", type: :exchange_error }, -4209 => %{ description: "Leverage adjustment failed. Current symbol max leverage limit is %sx", type: :exchange_error }, -4210 => %{ description: "Stop price is higher than price multiplier cap", type: :invalid_parameters }, -4211 => %{ description: "Stop price is lower than price multiplier floor", type: :invalid_parameters }, -4400 => %{ description: "Futures Trading Quantitative Rules violated, only reduceOnly order is allowed, please try again later.", type: :access_restricted }, -4401 => %{ description: "Compliance restricted account permission: can only place reduceOnly order.", type: :access_restricted }, -4402 => %{ description: "Dear user, as per our Terms of Use and compliance with local regulations, this feature is currently not available in your region.", type: :access_restricted }, -4403 => %{ description: "Dear user, as per our Terms of Use and compliance with local regulations, the leverage can only up to %sx in your region", type: :access_restricted }, -4408 => %{ description: "This symbol is in reduce only mode due to regulation requirements. Please upgrade to Binance Credits Trading Mode.", type: :invalid_order }, -5001 => %{ description: "Don't allow transfer to micro assets.", type: :invalid_parameters }, -5002 => %{ description: "You have insufficient balance.", type: :insufficient_balance }, -5003 => %{ description: "You don't have this asset.", type: :insufficient_balance }, -5004 => %{ description: "The residual balances of %s have exceeded 0.001BTC, Please re-choose.", type: :exchange_error }, -5005 => %{ description: "The residual balances of %s is too low, Please re-choose.", type: :exchange_error }, -5006 => %{ description: "Only transfer once in 24 hours.", type: :exchange_error }, -5007 => %{ description: "Quantity must be greater than zero.", type: :invalid_parameters }, -5008 => %{ description: "Insufficient amount of returnable assets.", type: :exchange_error }, -5009 => %{ description: "Product does not exist.", type: :invalid_order }, -5010 => %{ description: "Asset transfer fail.", type: :exchange_error }, -5011 => %{ description: "future account not exists.", type: :invalid_parameters }, -5012 => %{ description: "Asset transfer is in pending.", type: :exchange_error }, -5013 => %{ description: "{\"code\":-5013,\"msg\":\"Asset transfer failed: insufficient balance\"\"} // undocumented", type: :insufficient_balance }, -5021 => %{ description: "This parent sub have no relation", type: :invalid_order }, -5022 => %{ description: "future account or sub relation not exists.", type: :invalid_order }, -5024 => %{ description: "Symbol is not in trading status. Order amendment is not permitted.", type: :exchange_error }, -5025 => %{ description: "Only limit order is supported.", type: :exchange_error }, -5026 => %{ description: "Exceed maximum modify order limit.", type: :exchange_error }, -5027 => %{ description: "No need to modify the order.", type: :exchange_error }, -5028 => %{ description: "Timestamp for this request is outside of the ME recvWindow.", type: :exchange_error }, -5037 => %{ description: "Invalid price match", type: :invalid_parameters }, -5038 => %{ description: "Price match only supports order type: LIMIT, STOP AND TAKE_PROFIT", type: :invalid_parameters }, -5039 => %{ description: "Invalid self trade prevention mode", type: :invalid_parameters }, -5040 => %{ description: "The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000", type: :invalid_parameters }, -5041 => %{ description: "No depth matches this BBO order", type: :rate_limited }, -6001 => %{ description: "Daily product not exists.", type: :invalid_order }, -6003 => %{ description: "Product not exist or you don't have permission", type: :access_restricted }, -6004 => %{ description: "Product not in purchase status", type: :invalid_parameters }, -6005 => %{ description: "Smaller than min purchase limit", type: :invalid_parameters }, -6006 => %{ description: "Redeem amount error", type: :invalid_parameters }, -6007 => %{ description: "Not in redeem time", type: :exchange_error }, -6008 => %{ description: "Product not in redeem status", type: :exchange_error }, -6009 => %{ description: "Request frequency too high", type: :rate_limited }, -6011 => %{ description: "Exceeding the maximum num allowed to purchase per user", type: :exchange_error }, -6012 => %{ description: "Balance not enough", type: :insufficient_balance }, -6013 => %{ description: "Purchasing failed", type: :exchange_error }, -6014 => %{ description: "Exceed up-limit allowed to purchased", type: :exchange_error }, -6015 => %{ description: "Empty request body", type: :invalid_parameters }, -6016 => %{ description: "Parameter err", type: :invalid_parameters }, -6017 => %{ description: "Not in whitelist", type: :access_restricted }, -6018 => %{ description: "Asset not enough", type: :insufficient_balance }, -6019 => %{ description: "Need confirm", type: :exchange_error }, -6020 => %{ description: "Project not exists", type: :invalid_parameters }, -7001 => %{ description: "Date range is not supported.", type: :invalid_parameters }, -7002 => %{ description: "Data request type is not supported.", type: :invalid_parameters }, 100001003 => %{ description: "undocumented, {\"code\":100001003,\"msg\":\"Verification failed\"}", type: :invalid_credentials }, 200003903 => %{ description: "undocumented, {\"code\":200003903,\"msg\":\"Your identity verification has been rejected. Please complete identity verification again.\"}", type: :invalid_credentials }, 400002 => %{ description: "undocumented, { “status”: “FAIL”, “code”: “400002”, “errorMessage”: “Signature for this request is not valid.” }", type: :invalid_parameters }, "API key does not exist" => %{ description: nil, type: :invalid_credentials }, "Account has insufficient balance for requested action." => %{ description: nil, type: :insufficient_balance }, "Limit orders require GTC for this phase." => %{ description: nil, type: :invalid_parameters }, "MAX_POSITION" => %{ description: "Filter failure: MAX_POSITION", type: :invalid_parameters }, "Market is closed." => %{ description: "Market is closed.", type: :market_closed }, "Order would immediately match and take." => %{ description: "Order would immediately match and take.", type: :invalid_order }, "Order would trigger immediately." => %{ description: nil, type: :invalid_order }, "PERCENT_PRICE_BY_SIDE" => %{ description: "Filter failure: PERCENT_PRICE_BY_SIDE", type: :invalid_order }, "Rest API trading is not enabled." => %{ description: nil, type: :access_restricted }, "Stop price would trigger immediately." => %{ description: "Stop price would trigger immediately.", type: :invalid_order }, "System abnormality" => %{ description: "System abnormality", type: :exchange_error }, "System is under maintenance." => %{ description: "System is under maintenance.", type: :network_error }, "This account may not place or cancel orders." => %{ description: nil, type: :access_restricted }, "This action is disabled on this account." => %{ description: "This action is disabled on this account.", type: :access_restricted }, "This order type is not possible in this trading phase." => %{ description: nil, type: :invalid_parameters }, "This symbol is not permitted for this account." => %{ description: "This symbol is not permitted for this account.", type: :access_restricted }, "This symbol is restricted for this account." => %{ description: nil, type: :access_restricted }, "This type of sub-account exceeds the maximum number limit" => %{ description: "This type of sub-account exceeds the maximum number limit", type: :exchange_error }, "Too many requests. Please try again later." => %{ description: "Too many requests. Please try again later.", type: :rate_limited }, "You are not authorized to execute this request." => %{ description: "You are not authorized to execute this request.", type: :access_restricted }, "You don't have permission." => %{ description: "You don't have permission.", type: :access_restricted }, "has no operation privilege" => %{ description: nil, type: :access_restricted } }, error_codes: %{ -1000 => :exchange_error, -10001 => :exchange_error, -10002 => :invalid_parameters, -10005 => :exchange_error, -10007 => :invalid_parameters, -10008 => :invalid_parameters, -10009 => :invalid_parameters, -1001 => :exchange_error, -10010 => :invalid_parameters, -10011 => :insufficient_balance, -10012 => :invalid_parameters, -10013 => :insufficient_balance, -10015 => :exchange_error, -10016 => :exchange_error, -10017 => :exchange_error, -10018 => :invalid_parameters, -10019 => :invalid_parameters, -1002 => :invalid_credentials, -10020 => :invalid_parameters, -10021 => :invalid_order, -10022 => :invalid_parameters, -10023 => :exchange_error, -10024 => :invalid_parameters, -10025 => :exchange_error, -10026 => :invalid_parameters, -10028 => :invalid_parameters, -10029 => :exchange_error, -1003 => :rate_limited, -10030 => :exchange_error, -10031 => :exchange_error, -10032 => :exchange_error, -10034 => :exchange_error, -10039 => :exchange_error, -1004 => :exchange_error, -10040 => :exchange_error, -10041 => :exchange_error, -10042 => :invalid_order, -10043 => :exchange_error, -10044 => :exchange_error, -10045 => :exchange_error, -10046 => :exchange_error, -10047 => :access_restricted, -1005 => :access_restricted, -1006 => :exchange_error, -1007 => :network_error, -1008 => :exchange_error, -1010 => :exchange_error, -1011 => :access_restricted, -1013 => :invalid_parameters, -1014 => :invalid_order, -1015 => :rate_limited, -1016 => :invalid_parameters, -1020 => :invalid_parameters, -1021 => :invalid_credentials, -1022 => :invalid_credentials, -1023 => :invalid_parameters, -1099 => :exchange_error, -1100 => :invalid_parameters, -11008 => :exchange_error, -1101 => :invalid_parameters, -1102 => :invalid_parameters, -1103 => :invalid_parameters, -1104 => :invalid_parameters, -1105 => :invalid_parameters, -1106 => :invalid_parameters, -1108 => :invalid_order, -1109 => :invalid_parameters, -1110 => :invalid_order, -1111 => :invalid_parameters, -1112 => :exchange_error, -1113 => :invalid_parameters, -1114 => :invalid_parameters, -1115 => :invalid_parameters, -1116 => :invalid_parameters, -1117 => :invalid_parameters, -1118 => :invalid_parameters, -1119 => :invalid_parameters, -1120 => :invalid_parameters, -1121 => :invalid_order, -1122 => :invalid_parameters, -1125 => :invalid_credentials, -1126 => :invalid_order, -1127 => :invalid_parameters, -1128 => :invalid_parameters, -1129 => :invalid_order, -1130 => :invalid_parameters, -1131 => :invalid_parameters, -1134 => :invalid_parameters, -1135 => :invalid_parameters, -1136 => :invalid_parameters, -1145 => :invalid_parameters, -1151 => :invalid_parameters, -12014 => :rate_limited, -13000 => :exchange_error, -13001 => :exchange_error, -13002 => :exchange_error, -13003 => :access_restricted, -13004 => :exchange_error, -13005 => :exchange_error, -13006 => :exchange_error, -13007 => :access_restricted, -18002 => :exchange_error, -18003 => :exchange_error, -18004 => :exchange_error, -18005 => :access_restricted, -18006 => :exchange_error, -18007 => :exchange_error, -2008 => :invalid_credentials, -2010 => :invalid_order, -2011 => :order_not_found, -2012 => :exchange_error, -20121 => :invalid_order, -20124 => :invalid_parameters, -2013 => :order_not_found, -20130 => :invalid_parameters, -20132 => :invalid_parameters, -2014 => :invalid_credentials, -2015 => :invalid_credentials, -2016 => :exchange_error, -2017 => :access_restricted, -2018 => :exchange_error, -2019 => :exchange_error, -20194 => :invalid_parameters, -20195 => :invalid_parameters, -20196 => :invalid_parameters, -20198 => :exchange_error, -2020 => :invalid_order, -20204 => :invalid_parameters, -2021 => :invalid_order, -2022 => :invalid_order, -2023 => :exchange_error, -2024 => :exchange_error, -2025 => :exchange_error, -2026 => :invalid_order, -2027 => :exchange_error, -2028 => :exchange_error, -21001 => :invalid_parameters, -21002 => :invalid_parameters, -21003 => :exchange_error, -21004 => :exchange_error, -21005 => :insufficient_balance, -21006 => :exchange_error, -21007 => :exchange_error, -3000 => :exchange_error, -3001 => :invalid_credentials, -3002 => :invalid_order, -3003 => :invalid_parameters, -3004 => :exchange_error, -3005 => :invalid_parameters, -3006 => :invalid_parameters, -3007 => :exchange_error, -3008 => :invalid_parameters, -3009 => :exchange_error, -3010 => :invalid_parameters, -3011 => :invalid_parameters, -3012 => :exchange_error, -3013 => :invalid_parameters, -3014 => :access_restricted, -3015 => :invalid_parameters, -3016 => :invalid_parameters, -3017 => :exchange_error, -3018 => :access_restricted, -3019 => :access_restricted, -3020 => :invalid_parameters, -3021 => :invalid_parameters, -3022 => :access_restricted, -3023 => :exchange_error, -3024 => :exchange_error, -3025 => :invalid_parameters, -3026 => :invalid_parameters, -3027 => :invalid_order, -3028 => :invalid_order, -3029 => :exchange_error, -3036 => :access_restricted, -3037 => :exchange_error, -3038 => :invalid_parameters, -3041 => :insufficient_balance, -3042 => :invalid_parameters, -3043 => :access_restricted, -3044 => :exchange_error, -3045 => :exchange_error, -32603 => :invalid_parameters, -3999 => :access_restricted, -4000 => :invalid_order, -4001 => :invalid_parameters, -4002 => :invalid_parameters, -4003 => :invalid_parameters, -4004 => :invalid_parameters, -4005 => :invalid_parameters, -4006 => :invalid_parameters, -4007 => :invalid_parameters, -4008 => :invalid_parameters, -4009 => :invalid_parameters, -4010 => :invalid_parameters, -4011 => :invalid_parameters, -4012 => :invalid_parameters, -4013 => :invalid_parameters, -4014 => :invalid_parameters, -4015 => :invalid_parameters, -4016 => :invalid_parameters, -4017 => :invalid_parameters, -4018 => :invalid_parameters, -4019 => :exchange_error, -4020 => :invalid_parameters, -4021 => :invalid_parameters, -4022 => :invalid_parameters, -4023 => :invalid_parameters, -4024 => :invalid_parameters, -4025 => :invalid_parameters, -4026 => :invalid_parameters, -4027 => :invalid_parameters, -4028 => :invalid_parameters, -4029 => :invalid_parameters, -4030 => :invalid_parameters, -4031 => :invalid_parameters, -4032 => :exchange_error, -4033 => :invalid_parameters, -4034 => :exchange_error, -4035 => :exchange_error, -4036 => :exchange_error, -4037 => :exchange_error, -4038 => :exchange_error, -4039 => :exchange_error, -4040 => :exchange_error, -4041 => :exchange_error, -4042 => :exchange_error, -4043 => :exchange_error, -4044 => :invalid_parameters, -4045 => :exchange_error, -4046 => :exchange_error, -4047 => :exchange_error, -4048 => :exchange_error, -4049 => :invalid_parameters, -4050 => :insufficient_balance, -4051 => :insufficient_balance, -4052 => :exchange_error, -4053 => :invalid_parameters, -4054 => :exchange_error, -4055 => :invalid_parameters, -4056 => :invalid_credentials, -4057 => :invalid_credentials, -4058 => :invalid_parameters, -4059 => :exchange_error, -4060 => :invalid_parameters, -4061 => :exchange_error, -4062 => :invalid_parameters, -4063 => :invalid_parameters, -4064 => :invalid_parameters, -4065 => :invalid_parameters, -4066 => :invalid_parameters, -4067 => :exchange_error, -4068 => :exchange_error, -4069 => :invalid_parameters, -4070 => :invalid_parameters, -4071 => :invalid_parameters, -4072 => :exchange_error, -4073 => :invalid_parameters, -4074 => :invalid_parameters, -4075 => :invalid_parameters, -4076 => :exchange_error, -4077 => :exchange_error, -4078 => :exchange_error, -4079 => :invalid_parameters, -4080 => :access_restricted, -4081 => :invalid_parameters, -4082 => :invalid_parameters, -4083 => :exchange_error, -4084 => :invalid_parameters, -4085 => :invalid_parameters, -4086 => :invalid_parameters, -4087 => :access_restricted, -4088 => :access_restricted, -4089 => :exchange_error, -4090 => :access_restricted, -4091 => :exchange_error, -4092 => :exchange_error, -4093 => :exchange_error, -4094 => :exchange_error, -4095 => :exchange_error, -4096 => :exchange_error, -4097 => :exchange_error, -4098 => :exchange_error, -4099 => :exchange_error, -4101 => :exchange_error, -4102 => :exchange_error, -4103 => :exchange_error, -4104 => :invalid_parameters, -4105 => :exchange_error, -4106 => :exchange_error, -4107 => :exchange_error, -4108 => :exchange_error, -4109 => :exchange_error, -4110 => :exchange_error, -4111 => :invalid_parameters, -4112 => :exchange_error, -4113 => :exchange_error, -4114 => :invalid_parameters, -4115 => :invalid_parameters, -4116 => :exchange_error, -4117 => :exchange_error, -4118 => :exchange_error, -4119 => :exchange_error, -4120 => :exchange_error, -4121 => :exchange_error, -4122 => :exchange_error, -4123 => :exchange_error, -4124 => :exchange_error, -4125 => :exchange_error, -4126 => :exchange_error, -4127 => :exchange_error, -4128 => :exchange_error, -4129 => :exchange_error, -4130 => :exchange_error, -4131 => :exchange_error, -4132 => :exchange_error, -4133 => :exchange_error, -4134 => :exchange_error, -4135 => :invalid_parameters, -4136 => :exchange_error, -4137 => :invalid_parameters, -4138 => :invalid_parameters, -4139 => :invalid_parameters, -4140 => :invalid_order, -4141 => :invalid_parameters, -4142 => :invalid_order, -4143 => :exchange_error, -4144 => :invalid_order, -4145 => :exchange_error, -4146 => :exchange_error, -4147 => :exchange_error, -4148 => :exchange_error, -4149 => :exchange_error, -4150 => :exchange_error, -4151 => :invalid_parameters, -4152 => :invalid_parameters, -4154 => :invalid_parameters, -4155 => :invalid_parameters, -4161 => :exchange_error, -4164 => :invalid_order, -4165 => :invalid_parameters, -4167 => :invalid_parameters, -4168 => :invalid_parameters, -4169 => :exchange_error, -4170 => :exchange_error, -4171 => :exchange_error, -4172 => :exchange_error, -4178 => :invalid_parameters, -4183 => :invalid_order, -4184 => :invalid_order, -4188 => :invalid_parameters, -4192 => :access_restricted, -4194 => :access_restricted, -4195 => :access_restricted, -4196 => :invalid_parameters, -4197 => :exchange_error, -4198 => :exchange_error, -4199 => :invalid_parameters, -4200 => :access_restricted, -4201 => :access_restricted, -4202 => :exchange_error, -4203 => :access_restricted, -4205 => :access_restricted, -4206 => :access_restricted, -4208 => :exchange_error, -4209 => :exchange_error, -4210 => :invalid_parameters, -4211 => :invalid_parameters, -4400 => :access_restricted, -4401 => :access_restricted, -4402 => :access_restricted, -4403 => :access_restricted, -4408 => :invalid_order, -5001 => :invalid_parameters, -5002 => :insufficient_balance, -5003 => :insufficient_balance, -5004 => :exchange_error, -5005 => :exchange_error, -5006 => :exchange_error, -5007 => :invalid_parameters, -5008 => :exchange_error, -5009 => :invalid_order, -5010 => :exchange_error, -5011 => :invalid_parameters, -5012 => :exchange_error, -5013 => :insufficient_balance, -5021 => :invalid_order, -5022 => :invalid_order, -5024 => :exchange_error, -5025 => :exchange_error, -5026 => :exchange_error, -5027 => :exchange_error, -5028 => :exchange_error, -5037 => :invalid_parameters, -5038 => :invalid_parameters, -5039 => :invalid_parameters, -5040 => :invalid_parameters, -5041 => :rate_limited, -6001 => :invalid_order, -6003 => :access_restricted, -6004 => :invalid_parameters, -6005 => :invalid_parameters, -6006 => :invalid_parameters, -6007 => :exchange_error, -6008 => :exchange_error, -6009 => :rate_limited, -6011 => :exchange_error, -6012 => :insufficient_balance, -6013 => :exchange_error, -6014 => :exchange_error, -6015 => :invalid_parameters, -6016 => :invalid_parameters, -6017 => :access_restricted, -6018 => :insufficient_balance, -6019 => :exchange_error, -6020 => :invalid_parameters, -7001 => :invalid_parameters, -7002 => :invalid_parameters, 100001003 => :invalid_credentials, 200003903 => :invalid_credentials, 400002 => :invalid_parameters, "API key does not exist" => :invalid_credentials, "Account has insufficient balance for requested action." => :insufficient_balance, "Limit orders require GTC for this phase." => :invalid_parameters, "MAX_POSITION" => :invalid_parameters, "Market is closed." => :market_closed, "Order would immediately match and take." => :invalid_order, "Order would trigger immediately." => :invalid_order, "PERCENT_PRICE_BY_SIDE" => :invalid_order, "Rest API trading is not enabled." => :access_restricted, "Stop price would trigger immediately." => :invalid_order, "System abnormality" => :exchange_error, "System is under maintenance." => :network_error, "This account may not place or cancel orders." => :access_restricted, "This action is disabled on this account." => :access_restricted, "This order type is not possible in this trading phase." => :invalid_parameters, "This symbol is not permitted for this account." => :access_restricted, "This symbol is restricted for this account." => :access_restricted, "This type of sub-account exceeds the maximum number limit" => :exchange_error, "Too many requests. Please try again later." => :rate_limited, "You are not authorized to execute this request." => :access_restricted, "You don't have permission." => :access_restricted, "has no operation privilege" => :access_restricted }, exceptions: %{ broad: %{ "MAX_POSITION" => :bad_request, "PERCENT_PRICE_BY_SIDE" => :invalid_order, "has no operation privilege" => :permission_denied }, exact: %{ "-1000" => :operation_failed, "-1001" => :operation_failed, "-1002" => :authentication_error, "-1003" => :rate_limit_exceeded, "-1004" => :operation_rejected, "-1006" => :operation_failed, "-1007" => :request_timeout, "-1010" => :operation_failed, "-1013" => :bad_request, "-1014" => :invalid_order, "-1015" => :rate_limit_exceeded, "-1016" => :bad_request, "-1020" => :bad_request, "-1021" => :invalid_nonce, "-1022" => :authentication_error, "-1100" => :bad_request, "-1101" => :bad_request, "-1102" => :bad_request, "-1103" => :bad_request, "-1104" => :bad_request, "-1105" => :bad_request, "-1106" => :bad_request, "-1108" => :bad_symbol, "-1111" => :bad_request, "-1112" => :operation_failed, "-1114" => :bad_request, "-1115" => :bad_request, "-1116" => :bad_request, "-1117" => :bad_request, "-1118" => :bad_request, "-1119" => :bad_request, "-1120" => :bad_request, "-1121" => :bad_symbol, "-1125" => :authentication_error, "-1127" => :bad_request, "-1128" => :bad_request, "-1130" => :bad_request, "-2010" => :invalid_order, "-2011" => :order_not_found, "-20121" => :bad_symbol, "-20124" => :bad_request, "-2013" => :order_not_found, "-20130" => :bad_request, "-20132" => :bad_request, "-2014" => :authentication_error, "-2015" => :authentication_error, "-20194" => :bad_request, "-20195" => :bad_request, "-20196" => :bad_request, "-20198" => :operation_rejected, "-20204" => :bad_request, "-4000" => :invalid_order, "-4001" => :bad_request, "-4002" => :bad_request, "-4003" => :bad_request, "-4004" => :bad_request, "-4005" => :bad_request, "-4006" => :bad_request, "-4007" => :bad_request, "-4008" => :bad_request, "-4009" => :bad_request, "-4010" => :bad_request, "-4011" => :bad_request, "-4012" => :bad_request, "-4013" => :bad_request, "-4014" => :bad_request, "-4015" => :bad_request, "-4016" => :bad_request, "-4017" => :bad_request, "-4018" => :bad_request, "-4019" => :operation_rejected, "-4020" => :bad_request, "-4021" => :bad_request, "-4022" => :bad_request, "-4023" => :bad_request, "-4024" => :bad_request, "-4025" => :bad_request, "-4026" => :bad_request, "-4027" => :bad_request, "-4028" => :bad_request, "-4029" => :bad_request, "-4030" => :bad_request, "-4031" => :bad_request, "-4032" => :operation_rejected, "-4033" => :bad_request, "-4044" => :bad_request, "-4045" => :operation_rejected, "-4046" => :operation_rejected, "-4047" => :operation_rejected, "-4048" => :operation_rejected, "-4049" => :bad_request, "-4050" => :insufficient_funds, "-4051" => :insufficient_funds, "-4052" => :operation_rejected, "-4053" => :bad_request, "-4054" => :operation_rejected, "-4055" => :bad_request, "-4056" => :authentication_error, "-4057" => :authentication_error, "-4058" => :bad_request, "-4059" => :operation_rejected, "-4060" => :bad_request, "-4061" => :operation_rejected, "-4062" => :bad_request, "-4067" => :operation_rejected, "-4068" => :operation_rejected, "-4082" => :bad_request, "-4083" => :operation_rejected, "-4084" => :bad_request, "-4086" => :bad_request, "-4104" => :bad_request, "-4135" => :bad_request, "-4137" => :bad_request, "-4138" => :bad_request, "-4139" => :bad_request, "-4142" => :order_immediately_fillable, "API key does not exist" => :authentication_error, "Account has insufficient balance for requested action." => :insufficient_funds, "Limit orders require GTC for this phase." => :bad_request, "Market is closed." => :market_closed, "Order would immediately match and take." => :order_immediately_fillable, "Order would trigger immediately." => :order_immediately_fillable, "Rest API trading is not enabled." => :permission_denied, "Stop price would trigger immediately." => :order_immediately_fillable, "System abnormality" => :operation_failed, "System is under maintenance." => :on_maintenance, "This account may not place or cancel orders." => :permission_denied, "This action is disabled on this account." => :account_suspended, "This order type is not possible in this trading phase." => :bad_request, "This symbol is not permitted for this account." => :permission_denied, "This symbol is restricted for this account." => :permission_denied, "This type of sub-account exceeds the maximum number limit" => :operation_rejected, "Too many requests. Please try again later." => :rate_limit_exceeded, "You are not authorized to execute this request." => :permission_denied, "You don't have permission." => :permission_denied } }, exchange_options: %{ "accountsById" => %{ "CMFUTURE" => "inverse", "FUNDING" => "funding", "MAIN" => "spot", "MARGIN" => "margin", "OPTION" => "option", "UMFUTURE" => "linear" }, "accountsByType" => %{ "cross" => "MARGIN", "delivery" => "CMFUTURE", "funding" => "FUNDING", "future" => "UMFUTURE", "inverse" => "CMFUTURE", "linear" => "UMFUTURE", "main" => "MAIN", "margin" => "MARGIN", "option" => "OPTION", "spot" => "MAIN", "swap" => "UMFUTURE" }, "adjustForTimeDifference" => false, "broker" => %{ "delivery" => "x-xcKtGhcu", "future" => "x-cvBPrNm9", "inverse" => "x-xcKtGhcu", "margin" => "x-TKT5PX2F", "option" => "x-xcKtGhcu", "spot" => "x-TKT5PX2F", "swap" => "x-cvBPrNm9" }, "currencyToPrecisionRoundingMode" => 0, "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "defaultSubType" => nil, "defaultTimeInForce" => "GTC", "defaultType" => "spot", "defaultWithdrawPrecision" => 1.0e-8, "fetchCurrencies" => true, "fetchMargins" => true, "fetchMarkets" => %{ "types" => [ "spot", "linear", "inverse" ] }, "fetchPositions" => "positionRisk", "hasAlreadyAuthenticatedSuccessfully" => false, "impliedNetworks" => %{ "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "legalMoney" => %{ "AED" => true, "ARS" => true, "AUD" => true, "BRL" => true, "CAD" => true, "CHF" => true, "CZK" => true, "DKK" => true, "EUR" => true, "GBP" => true, "GHS" => true, "HKD" => true, "HUF" => true, "INR" => true, "JPY" => true, "KES" => true, "KZT" => true, "MXN" => true, "NGN" => true, "NOK" => true, "NZD" => true, "PEN" => true, "PHP" => true, "PLN" => true, "RUB" => true, "SEK" => true, "TRY" => true, "UAH" => true, "UGX" => true, "USD" => true, "VND" => true, "ZAR" => true }, "legalMoneyCurrenciesById" => %{ "BUSD" => "USD" }, "loadAllOptions" => false, "networks" => %{ "BEP2" => "BNB", "BEP20" => "BSC", "EOS" => "EOS", "ERC20" => "ETH", "OMNI" => "OMNI", "SOL" => "SOL", "SPL" => "SOL", "TRC20" => "TRX" }, "networksById" => %{ "BNB" => "BEP2", "BSC" => "BEP20", "EOS" => "EOS", "ETH" => "ERC20", "OMNI" => "OMNI", "SOL" => "SOL", "TRX" => "TRC20" }, "newOrderRespType" => %{ "limit" => "FULL", "market" => "FULL" }, "quoteOrderQty" => true, "recvWindow" => 10000, "sandboxMode" => false, "throwMarginModeAlreadySet" => false, "timeDifference" => 0, "warnOnFetchOpenOrdersWithoutSymbol" => true }, extended_metadata: %{ fees_url: "https://www.binance.com/en/fee/schedule", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/e9419b93-ccb0-46aa-9bff-c883f096274b", referral_discount: 0.1, referral_url: "https://accounts.binance.com/register?ref=CCXTCOM" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ for_derivatives: %{ create_order: %{ hedged: true, iceberg: false, leverage: false, margin_mode: false, market_buy_by_cost: true, market_buy_requires_price: false, self_trade_prevention: true, stop_loss_price: true, take_profit_price: true, time_in_force: %{ fok: true, gtd: true, ioc: true, po: true }, trailing: true, trigger_price: true, trigger_price_type: %{ index: false, last: true, mark: true } }, create_orders: %{ max: 5 }, fetch_closed_orders: %{ days_back: 90, days_back_canceled: 3, limit: 1000, margin_mode: true, symbol_required: true, trailing: false, trigger: false, until_days: 7 }, fetch_my_trades: %{ limit: 1000, margin_mode: false, symbol_required: true, until_days: 7 }, fetch_ohlcv: %{ limit: 1500 }, fetch_open_orders: %{ limit: 500, margin_mode: true, symbol_required: false, trailing: false, trigger: false }, fetch_order: %{ margin_mode: false, symbol_required: true, trailing: false, trigger: false }, fetch_orders: %{ days_back: 90, limit: 1000, margin_mode: true, symbol_required: true, trailing: false, trigger: false, until_days: 7 }, sandbox: true }, future: %{ inverse: %{ extends: "forDerivatives" }, linear: %{ extends: "forDerivatives" } }, spot: %{ create_order: %{ hedged: true, iceberg_amount: true, leverage: false, margin_mode: true, market_buy_by_cost: true, market_buy_requires_price: false, self_trade_prevention: %{ e_x_p_i_r_e__b_o_t_h: true, e_x_p_i_r_e__m_a_k_e_r: true, e_x_p_i_r_e__t_a_k_e_r: true, n_o_n_e: true }, stop_loss_price: true, take_profit_price: true, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: false, trigger_direction: false, trigger_price: true }, fetch_closed_orders: %{ limit: 1000, margin_mode: true, symbol_required: true, trailing: false, trigger: false, until_days: 10000 }, fetch_currencies: %{ private: true }, fetch_my_trades: %{ limit: 1000, margin_mode: false, symbol_required: true, until_days: 1 }, fetch_ohlcv: %{ limit: 1000 }, fetch_open_orders: %{ margin_mode: true, symbol_required: false, trailing: false, trigger: false }, fetch_order: %{ margin_mode: true, symbol_required: true, trailing: false, trigger: false }, fetch_orders: %{ limit: 1000, margin_mode: true, symbol_required: true, trailing: false, trigger: false, until_days: 10000 }, sandbox: true }, swap: %{ inverse: %{ extends: "forDerivatives" }, linear: %{ extends: "forDerivatives" } } }, fees: %{ inverse: %{ trading: %{ fee_side: "base", maker: 0.0001, percentage: true, taker: 0.0005, tier_based: true, tiers: %{ maker: [ %{ fee: 0.0001, volume: 0 }, %{ fee: 8.0e-5, volume: 250 }, %{ fee: 5.0e-5, volume: 2500 }, %{ fee: 3.0e-6, volume: 7500 }, %{ fee: 0, volume: 22500 }, %{ fee: -5.0e-5, volume: 50000 }, %{ fee: -6.0e-5, volume: 100000 }, %{ fee: -7.0e-5, volume: 200000 }, %{ fee: -8.0e-5, volume: 400000 }, %{ fee: -9.0e-5, volume: 750000 } ], taker: [ %{ fee: 0.0005, volume: 0 }, %{ fee: 4.5e-4, volume: 250 }, %{ fee: 0.0004, volume: 2500 }, %{ fee: 0.0003, volume: 7500 }, %{ fee: 2.5e-4, volume: 22500 }, %{ fee: 2.4e-4, volume: 50000 }, %{ fee: 2.4e-4, volume: 100000 }, %{ fee: 2.4e-4, volume: 200000 }, %{ fee: 2.4e-4, volume: 400000 }, %{ fee: 2.4e-4, volume: 750000 } ] } } }, linear: %{ trading: %{ fee_side: "quote", maker: 0.0002, percentage: true, taker: 0.0005, tier_based: true, tiers: %{ maker: [ %{ fee: 0.0002, volume: 0 }, %{ fee: 1.6e-4, volume: 250 }, %{ fee: 1.4e-4, volume: 2500 }, %{ fee: 1.2e-4, volume: 7500 }, %{ fee: 0.0001, volume: 22500 }, %{ fee: 8.0e-5, volume: 50000 }, %{ fee: 6.0e-5, volume: 100000 }, %{ fee: 4.0e-5, volume: 200000 }, %{ fee: 2.0e-5, volume: 400000 }, %{ fee: 0, volume: 750000 } ], taker: [ %{ fee: 0.0004, volume: 0 }, %{ fee: 0.0004, volume: 250 }, %{ fee: 3.5e-4, volume: 2500 }, %{ fee: 3.2e-4, volume: 7500 }, %{ fee: 0.0003, volume: 22500 }, %{ fee: 2.7e-4, volume: 50000 }, %{ fee: 2.5e-4, volume: 100000 }, %{ fee: 2.2e-4, volume: 200000 }, %{ fee: 0.0002, volume: 400000 }, %{ fee: 1.7e-4, volume: 750000 } ] } } }, trading: %{ fee_side: "get", maker: 0.001, percentage: true, taker: 0.001, tier_based: false } }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if ((code === 418) || (code === 429)) {\n throw new errors.DDoSProtection(this.id + ' ' + code.toString() + ' ' + reason + ' ' + body);\n }\n // error response in a form: { \"code\": -1013, \"msg\": \"Invalid quantity.\" }\n // following block cointains legacy checks against message patterns in \"msg\" property\n // will switch \"code\" checks eventually, when we know all of them\n if (code >= 400) {\n if (body.indexOf('Price * QTY is zero or less') >= 0) {\n throw new errors.InvalidOrder(this.id + ' order cost = amount * price is zero or less ' + body);\n }\n if (body.indexOf('LOT_SIZE') >= 0) {\n throw new errors.InvalidOrder(this.id + ' order amount should be evenly divisible by lot size ' + body);\n }\n if (body.indexOf('PRICE_FILTER') >= 0) {\n throw new errors.InvalidOrder(this.id + ' order price is invalid, i.e. exceeds allowed price precision, exceeds min price or max price limits or is invalid value in general, use this.priceToPrecision (symbol, amount) ' + body);\n }\n }\n if (response === undefined) {\n return undefined; // fallback to default error handler\n }\n // response in format {'msg': 'The coin does not exist.', 'success': true/false}\n const success = this.safeBool(response, 'success', true);\n if (!success) {\n const messageNew = this.safeString(response, 'msg');\n let parsedMessage = undefined;\n if (messageNew !== undefined) {\n try {\n parsedMessage = JSON.parse(messageNew);\n }\n catch (e) {\n // do nothing\n parsedMessage = undefined;\n }\n if (parsedMessage !== undefined) {\n response = parsedMessage;\n }\n }\n }\n const message = this.safeString(response, 'msg');\n if (message !== undefined) {\n this.throwExactlyMatchedException(this.getExceptionsByUrl(url, 'exact'), message, this.id + ' ' + message);\n this.throwExactlyMatchedException(this.exceptions['exact'], message, this.id + ' ' + message);\n this.throwBroadlyMatchedException(this.getExceptionsByUrl(url, 'broad'), message, this.id + ' ' + message);\n this.throwBroadlyMatchedException(this.exceptions['broad'], message, this.id + ' ' + message);\n }\n // checks against error codes\n const error = this.safeString(response, 'code');\n if (error !== undefined) {\n // https://github.com/ccxt/ccxt/issues/6501\n // https://github.com/ccxt/ccxt/issues/7742\n if ((error === '200') || Precise[\"default\"].stringEquals(error, '0')) {\n return undefined;\n }\n // a workaround for {\"code\":-2015,\"msg\":\"Invalid API-key, IP, or permissions for action.\"}\n // despite that their message is very confusing, it is raised by Binance\n // on a temporary ban, the API key is valid, but disabled for a while\n if ((error === '-2015') && this.options['hasAlreadyAuthenticatedSuccessfully']) {\n throw new errors.DDoSProtection(this.id + ' ' + body);\n }\n const feedback = this.id + ' ' + body;\n if (message === 'No need to change margin type.') {\n // not an error\n // https://github.com/ccxt/ccxt/issues/11268\n // https://github.com/ccxt/ccxt/pull/11624\n // POST https://fapi.binance.com/fapi/v1/marginType 400 Bad Request\n // binanceusdm {\"code\":-4046,\"msg\":\"No need to change margin type.\"}\n throw new errors.MarginModeAlreadySet(feedback);\n }\n this.throwExactlyMatchedException(this.getExceptionsByUrl(url, 'exact'), error, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], error, feedback);\n throw new errors.ExchangeError(feedback);\n }\n if (!success) {\n throw new errors.ExchangeError(this.id + ' ' + body);\n }\n if (Array.isArray(response)) {\n // cancelOrders returns an array like this: [{\"code\":-2011,\"msg\":\"Unknown order sent.\"}]\n const arrayLength = response.length;\n if (arrayLength === 1) { // when there's a single error we can throw, otherwise we have a partial success\n const element = response[0];\n const errorCode = this.safeString(element, 'code');\n if (errorCode !== undefined) {\n this.throwExactlyMatchedException(this.getExceptionsByUrl(url, 'exact'), errorCode, this.id + ' ' + body);\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, this.id + ' ' + body);\n }\n }\n }\n return undefined;\n }", has: %{ add_margin: true, borrow_cross_margin: true, borrow_isolated_margin: true, borrow_margin: false, c_o_r_s: false, cancel_all_orders: 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: false, close_position: false, create_convert_trade: true, create_deposit_address: false, create_limit_buy_order: true, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: true, create_limit_sell_order_ws: false, create_market_buy_order: true, 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: true, 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: false, create_order_with_take_profit_and_stop_loss_ws: false, create_order_ws: false, create_orders: true, create_post_only_order: true, create_post_only_order_ws: false, create_reduce_only_order: true, create_reduce_only_order_ws: false, create_stop_limit_order: true, create_stop_limit_order_ws: false, create_stop_loss_order: 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: false, 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: true, fetch_accounts: false, fetch_all_greeks: true, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: true, fetch_borrow_interest: true, fetch_borrow_rate: false, fetch_borrow_rate_histories: false, fetch_borrow_rate_history: true, fetch_borrow_rates: false, fetch_borrow_rates_per_symbol: false, fetch_canceled_and_closed_orders: true, fetch_canceled_orders: true, fetch_closed_order: false, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: true, fetch_convert_quote: true, fetch_convert_trade: true, fetch_convert_trade_history: true, fetch_cross_borrow_rate: true, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: false, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: false, fetch_deposit_withdraw_fee: true, fetch_deposit_withdraw_fees: true, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: true, fetch_funding_interval: true, fetch_funding_intervals: true, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: true, fetch_greeks: true, fetch_index_ohlcv: true, fetch_isolated_borrow_rate: true, fetch_isolated_borrow_rates: true, fetch_isolated_positions: false, fetch_l2_order_book: true, fetch_l3_order_book: false, fetch_last_prices: true, fetch_ledger: true, fetch_ledger_entry: true, fetch_leverage: true, fetch_leverage_tiers: true, fetch_leverages: true, fetch_liquidations: false, fetch_long_short_ratio: false, fetch_long_short_ratio_history: true, fetch_margin_adjustment_history: true, fetch_margin_mode: true, fetch_margin_modes: true, 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: true, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: true, fetch_open_interest_history: true, fetch_open_interests: false, fetch_open_order: true, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: true, fetch_option_chain: false, fetch_order: true, fetch_order_book: true, fetch_order_book_ws: false, fetch_order_books: false, fetch_order_trades: true, 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: false, fetch_positions_risk: true, fetch_positions_ws: false, fetch_premium_index_ohlcv: true, fetch_settlement_history: true, fetch_status: true, fetch_ticker: true, fetch_ticker_ws: false, fetch_tickers: true, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: true, fetch_trading_fees: true, fetch_trading_fees_ws: false, fetch_trading_limits: true, fetch_transaction_fee: true, fetch_transaction_fees: true, 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: true, margin: true, option: true, private_api: true, public_api: true, reduce_margin: true, repay_cross_margin: true, repay_isolated_margin: true, sandbox: true, set_leverage: true, set_margin: false, 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: true, watch_liquidations: true, watch_liquidations_for_symbols: true, watch_mark_price: true, watch_mark_prices: true, watch_my_liquidations: true, watch_my_liquidations_for_symbols: true, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: true, watch_order_book: true, watch_order_book_for_symbols: true, watch_orders: true, watch_orders_for_symbols: true, watch_position: false, watch_positions: true, watch_status: false, watch_ticker: true, watch_tickers: true, watch_trades: true, watch_trades_for_symbols: true, withdraw: true, ws: false }, http_config: nil, id: "binance", markets: nil, name: "Binance", ohlcv_timestamp_resolution: :milliseconds, options: %{ accounts_by_id: %{ "CMFUTURE" => "inverse", "FUNDING" => "funding", "MAIN" => "spot", "MARGIN" => "margin", "OPTION" => "option", "UMFUTURE" => "linear" }, accounts_by_type: %{ "cross" => "MARGIN", "delivery" => "CMFUTURE", "funding" => "FUNDING", "future" => "UMFUTURE", "inverse" => "CMFUTURE", "linear" => "UMFUTURE", "main" => "MAIN", "margin" => "MARGIN", "option" => "OPTION", "spot" => "MAIN", "swap" => "UMFUTURE" }, adjust_for_time_difference: false, broker: %{ "delivery" => "x-xcKtGhcu", "future" => "x-cvBPrNm9", "inverse" => "x-xcKtGhcu", "margin" => "x-TKT5PX2F", "option" => "x-xcKtGhcu", "spot" => "x-TKT5PX2F", "swap" => "x-cvBPrNm9" }, currency_to_precision_rounding_mode: 0, default_account_type: "spot", default_sub_type: nil, default_time_in_force: "GTC", default_type: "spot", default_withdraw_precision: 1.0e-8, fetch_currencies: true, fetch_margins: true, fetch_markets: %{ "types" => [ "spot", "linear", "inverse" ] }, fetch_positions: "positionRisk", has_already_authenticated_successfully: false, implied_networks: %{ "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, legal_money: %{ "AED" => true, "ARS" => true, "AUD" => true, "BRL" => true, "CAD" => true, "CHF" => true, "CZK" => true, "DKK" => true, "EUR" => true, "GBP" => true, "GHS" => true, "HKD" => true, "HUF" => true, "INR" => true, "JPY" => true, "KES" => true, "KZT" => true, "MXN" => true, "NGN" => true, "NOK" => true, "NZD" => true, "PEN" => true, "PHP" => true, "PLN" => true, "RUB" => true, "SEK" => true, "TRY" => true, "UAH" => true, "UGX" => true, "USD" => true, "VND" => true, "ZAR" => true }, legal_money_currencies_by_id: %{ "BUSD" => "USD" }, load_all_options: false, networks: %{ "BEP2" => "BNB", "BEP20" => "BSC", "EOS" => "EOS", "ERC20" => "ETH", "OMNI" => "OMNI", "SOL" => "SOL", "SPL" => "SOL", "TRC20" => "TRX" }, networks_by_id: %{ "SOL" => "SOL" }, new_order_resp_type: %{ "limit" => "FULL", "market" => "FULL" }, quote_order_qty: true, recv_window: 10000, sandbox_mode: false, throw_margin_mode_already_set: false, time_difference: 0, warn_on_fetch_open_orders_without_symbol: true }, order_mappings: %{ side_format: :uppercase, side_key: "side", type_format: :uppercase, type_key: "type" }, param_mappings: %{ "amount" => "fromAmount", "arg0" => "orderId", "code" => "coin", "cost" => "quoteOrderQty", "fromCode" => "fromAsset", "id" => "orderId", "marginMode" => "marginType", "since" => "startTime", "stopLossPrice" => "stopPrice", "takeProfitPrice" => "stopPrice", "timeframe" => "interval", "toCode" => "toAsset", "triggerPrice" => "stopPrice" }, parse_methods: [ %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"WLDUSDT\",\n \"positionSide\": \"BOTH\",\n \"positionAmt\": \"-849\",\n \"unrealizedProfit\": \"11.17920750\",\n \"notional\": \"-1992.46079250\",\n \"isolatedMargin\": \"0\",\n \"isolatedWallet\": \"0\",\n \"initialMargin\": \"99.62303962\",\n \"maintMargin\": \"11.95476475\",\n \"updateTime\": \"1721995760449\"\n \"leverage\": \"50\", // in v2\n \"entryPrice\": \"2.34\", // in v2\n \"positionInitialMargin\": \"118.82116614\", // in v2\n \"openOrderInitialMargin\": \"0\", // in v2\n \"isolated\": false, // in v2\n \"breakEvenPrice\": \"2.3395788\", // in v2\n \"maxNotional\": \"25000\", // in v2\n \"bidNotional\": \"0\", // in v2\n \"askNotional\": \"0\" // in v2\n }", "{\n \"symbol\": \"BTCUSD_210625\",\n \"initialMargin\": \"0.00024393\",\n \"maintMargin\": \"0.00002439\",\n \"unrealizedProfit\": \"-0.00000163\",\n \"positionInitialMargin\": \"0.00024393\",\n \"openOrderInitialMargin\": \"0\",\n \"leverage\": \"10\",\n \"isolated\": false,\n \"positionSide\": \"BOTH\",\n \"entryPrice\": \"41021.20000069\",\n \"maxQty\": \"100\",\n \"notionalValue\": \"0.00243939\",\n \"isolatedWallet\": \"0\",\n \"crossMargin\": \"0.314\"\n \"crossWalletBalance\": \"34\",\n }", "{\n \"symbol\": \"CTSIUSDT\",\n \"initialMargin\": \"0\",\n \"maintMargin\": \"0\",\n \"unrealizedProfit\": \"0.00000000\",\n \"positionInitialMargin\": \"0\",\n \"openOrderInitialMargin\": \"0\",\n \"leverage\": \"20\",\n \"entryPrice\": \"0.0\",\n \"maxNotional\": \"25000\",\n \"bidNotional\": \"0\",\n \"askNotional\": \"0\",\n \"positionSide\": \"SHORT\",\n \"positionAmt\": \"0\",\n \"updateTime\": 0,\n \"notional\": \"0\",\n \"breakEvenPrice\": \"0.0\"\n }", "{\n \"symbol\": \"TRXUSD_PERP\",\n \"initialMargin\": \"0\",\n \"maintMargin\": \"0\",\n \"unrealizedProfit\": \"0.00000000\",\n \"positionInitialMargin\": \"0\",\n \"openOrderInitialMargin\": \"0\",\n \"leverage\": \"20\",\n \"entryPrice\": \"0.00000000\",\n \"positionSide\": \"SHORT\",\n \"positionAmt\": \"0\",\n \"maxQty\": \"5000000\",\n \"updateTime\": 0,\n \"notionalValue\": \"0\",\n \"breakEvenPrice\": \"0.00000000\"\n }" ], "line_end" => 10326, "line_start" => 10078, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "initialMargin" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "this.parseNumber (initialMarginPercentageString)" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "maintenanceMargin" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "maintenanceMarginPercentage" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "entryPrice" }, %{ "comment" => nil, "key" => "notional", "value" => "notional" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.parseNumber (leverageString)" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "unrealizedPnl" }, %{ "comment" => nil, "key" => "contracts", "value" => "contracts" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contractSize" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "marginRatio" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "liquidationPrice" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "collateral", "value" => "collateral" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "hedged", "value" => "hedged" }, %{ "comment" => nil, "key" => "percentage", "value" => "percentage" } ], "name" => "parseAccountPosition", "signature" => "parseAccountPosition (position, market: Market = undefined)", "source" => "parseAccountPosition (position, market: Market = undefined) {\n //\n // usdm\n //\n // v3 (similar for cross & isolated)\n //\n // {\n // \"symbol\": \"WLDUSDT\",\n // \"positionSide\": \"BOTH\",\n // \"positionAmt\": \"-849\",\n // \"unrealizedProfit\": \"11.17920750\",\n // \"notional\": \"-1992.46079250\",\n // \"isolatedMargin\": \"0\",\n // \"isolatedWallet\": \"0\",\n // \"initialMargin\": \"99.62303962\",\n // \"maintMargin\": \"11.95476475\",\n // \"updateTime\": \"1721995760449\"\n // \"leverage\": \"50\", // in v2\n // \"entryPrice\": \"2.34\", // in v2\n // \"positionInitialMargin\": \"118.82116614\", // in v2\n // \"openOrderInitialMargin\": \"0\", // in v2\n // \"isolated\": false, // in v2\n // \"breakEvenPrice\": \"2.3395788\", // in v2\n // \"maxNotional\": \"25000\", // in v2\n // \"bidNotional\": \"0\", // in v2\n // \"askNotional\": \"0\" // in v2\n // }\n //\n // coinm\n //\n // {\n // \"symbol\": \"BTCUSD_210625\",\n // \"initialMargin\": \"0.00024393\",\n // \"maintMargin\": \"0.00002439\",\n // \"unrealizedProfit\": \"-0.00000163\",\n // \"positionInitialMargin\": \"0.00024393\",\n // \"openOrderInitialMargin\": \"0\",\n // \"leverage\": \"10\",\n // \"isolated\": false,\n // \"positionSide\": \"BOTH\",\n // \"entryPrice\": \"41021.20000069\",\n // \"maxQty\": \"100\",\n // \"notionalValue\": \"0.00243939\",\n // \"isolatedWallet\": \"0\",\n // \"crossMargin\": \"0.314\"\n // \"crossWalletBalance\": \"34\",\n // }\n //\n // linear portfolio margin\n //\n // {\n // \"symbol\": \"CTSIUSDT\",\n // \"initialMargin\": \"0\",\n // \"maintMargin\": \"0\",\n // \"unrealizedProfit\": \"0.00000000\",\n // \"positionInitialMargin\": \"0\",\n // \"openOrderInitialMargin\": \"0\",\n // \"leverage\": \"20\",\n // \"entryPrice\": \"0.0\",\n // \"maxNotional\": \"25000\",\n // \"bidNotional\": \"0\",\n // \"askNotional\": \"0\",\n // \"positionSide\": \"SHORT\",\n // \"positionAmt\": \"0\",\n // \"updateTime\": 0,\n // \"notional\": \"0\",\n // \"breakEvenPrice\": \"0.0\"\n // }\n //\n // inverse portoflio margin\n //\n // {\n // \"symbol\": \"TRXUSD_PERP\",\n // \"initialMargin\": \"0\",\n // \"maintMargin\": \"0\",\n // \"unrealizedProfit\": \"0.00000000\",\n // \"positionInitialMargin\": \"0\",\n // \"openOrderInitialMargin\": \"0\",\n // \"leverage\": \"20\",\n // \"entryPrice\": \"0.00000000\",\n // \"positionSide\": \"SHORT\",\n // \"positionAmt\": \"0\",\n // \"maxQty\": \"5000000\",\n // \"updateTime\": 0,\n // \"notionalValue\": \"0\",\n // \"breakEvenPrice\": \"0.00000000\"\n // }\n //\n const marketId = this.safeString (position, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'contract');\n const symbol = this.safeString (market, 'symbol');\n const leverageString = this.safeString (position, 'leverage');\n const leverage = (leverageString !== undefined) ? parseInt (leverageString) : undefined;\n const initialMarginString = this.safeString (position, 'initialMargin');\n const initialMargin = this.parseNumber (initialMarginString);\n let initialMarginPercentageString = undefined;\n if (leverageString !== undefined) {\n initialMarginPercentageString = Precise.stringDiv ('1', leverageString, 8);\n const rational = this.isRoundNumber (1000 % leverage);\n if (!rational) {\n initialMarginPercentageString = Precise.stringDiv (Precise.stringAdd (initialMarginPercentageString, '1e-8'), '1', 8);\n }\n }\n // as oppose to notionalValue\n const usdm = ('notional' in position);\n const maintenanceMarginString = this.safeString (position, 'maintMargin');\n const maintenanceMargin = this.parseNumber (maintenanceMarginString);\n const entryPriceString = this.safeString (position, 'entryPrice');\n let entryPrice = this.parseNumber (entryPriceString);\n const notionalString = this.safeString2 (position, 'notional', 'notionalValue');\n const notionalStringAbs = Precise.stringAbs (notionalString);\n const notional = this.parseNumber (notionalStringAbs);\n let contractsString = this.safeString (position, 'positionAmt');\n let contractsStringAbs = Precise.stringAbs (contractsString);\n if (contractsString === undefined) {\n const entryNotional = Precise.stringMul (Precise.stringMul (leverageString, initialMarginString), entryPriceString);\n const contractSizeNew = this.safeString (market, 'contractSize');\n contractsString = Precise.stringDiv (entryNotional, contractSizeNew);\n contractsStringAbs = Precise.stringDiv (Precise.stringAdd (contractsString, '0.5'), '1', 0);\n }\n const contracts = this.parseNumber (contractsStringAbs);\n const leverageBrackets = this.safeDict (this.options, 'leverageBrackets', {});\n const leverageBracket = this.safeList (leverageBrackets, symbol, []);\n let maintenanceMarginPercentageString = undefined;\n for (let i = 0; i < leverageBracket.length; i++) {\n const bracket = leverageBracket[i];\n if (Precise.stringLt (notionalStringAbs, bracket[0])) {\n break;\n }\n maintenanceMarginPercentageString = bracket[1];\n }\n const maintenanceMarginPercentage = this.parseNumber (maintenanceMarginPercentageString);\n const unrealizedPnlString = this.safeString (position, 'unrealizedProfit');\n const unrealizedPnl = this.parseNumber (unrealizedPnlString);\n let timestamp = this.safeInteger (position, 'updateTime');\n if (timestamp === 0) {\n timestamp = undefined;\n }\n let isolated = this.safeBool (position, 'isolated');\n if (isolated === undefined) {\n const isolatedMarginRaw = this.safeString (position, 'isolatedMargin');\n isolated = !Precise.stringEq (isolatedMarginRaw, '0');\n }\n let marginMode = undefined;\n let collateralString = undefined;\n let walletBalance = undefined;\n if (isolated) {\n marginMode = 'isolated';\n walletBalance = this.safeString (position, 'isolatedWallet');\n collateralString = Precise.stringAdd (walletBalance, unrealizedPnlString);\n } else {\n marginMode = 'cross';\n walletBalance = this.safeString (position, 'crossWalletBalance');\n collateralString = this.safeString (position, 'crossMargin');\n }\n const collateral = this.parseNumber (collateralString);\n let marginRatio = undefined;\n let side = undefined;\n let percentage = undefined;\n let liquidationPriceStringRaw = undefined;\n let liquidationPrice = undefined;\n const contractSize = this.safeValue (market, 'contractSize');\n const contractSizeString = this.numberToString (contractSize);\n if (Precise.stringEquals (notionalString, '0')) {\n entryPrice = undefined;\n } else {\n side = Precise.stringLt (notionalString, '0') ? 'short' : 'long';\n marginRatio = this.parseNumber (Precise.stringDiv (Precise.stringAdd (Precise.stringDiv (maintenanceMarginString, collateralString), '5e-5'), '1', 4));\n percentage = this.parseNumber (Precise.stringMul (Precise.stringDiv (unrealizedPnlString, initialMarginString, 4), '100'));\n if (usdm) {\n // calculate liquidation price\n //\n // liquidationPrice = (walletBalance / (contracts * (±1 + mmp))) + (±entryPrice / (±1 + mmp))\n //\n // mmp = maintenanceMarginPercentage\n // where ± is negative for long and positive for short\n // TODO: calculate liquidation price for coinm contracts\n let onePlusMaintenanceMarginPercentageString = undefined;\n let entryPriceSignString = entryPriceString;\n if (side === 'short') {\n onePlusMaintenanceMarginPercentageString = Precise.stringAdd ('1', maintenanceMarginPercentageString);\n } else {\n onePlusMaintenanceMarginPercentageString = Precise.stringAdd ('-1', maintenanceMarginPercentageString);\n entryPriceSignString = Precise.stringMul ('-1', entryPriceSignString);\n }\n const leftSide = Precise.stringDiv (walletBalance, Precise.stringMul (contractsStringAbs, onePlusMaintenanceMarginPercentageString));\n const rightSide = Precise.stringDiv (entryPriceSignString, onePlusMaintenanceMarginPercentageString);\n liquidationPriceStringRaw = Precise.stringAdd (leftSide, rightSide);\n } else {\n // calculate liquidation price\n //\n // liquidationPrice = (contracts * contractSize(±1 - mmp)) / (±1/entryPrice * contracts * contractSize - walletBalance)\n //\n let onePlusMaintenanceMarginPercentageString = undefined;\n let entryPriceSignString = entryPriceString;\n if (side === 'short') {\n onePlusMaintenanceMarginPercentageString = Precise.stringSub ('1', maintenanceMarginPercentageString);\n } else {\n onePlusMaintenanceMarginPercentageString = Precise.stringSub ('-1', maintenanceMarginPercentageString);\n entryPriceSignString = Precise.stringMul ('-1', entryPriceSignString);\n }\n const size = Precise.stringMul (contractsStringAbs, contractSizeString);\n const leftSide = Precise.stringMul (size, onePlusMaintenanceMarginPercentageString);\n const rightSide = Precise.stringSub (Precise.stringMul (Precise.stringDiv ('1', entryPriceSignString), size), walletBalance);\n liquidationPriceStringRaw = Precise.stringDiv (leftSide, rightSide);\n }\n const pricePrecision = this.precisionFromString (this.safeString (market['precision'], 'price'));\n const pricePrecisionPlusOne = pricePrecision + 1;\n const pricePrecisionPlusOneString = pricePrecisionPlusOne.toString ();\n // round half up\n const rounder = new Precise ('5e-' + pricePrecisionPlusOneString);\n const rounderString = rounder.toString ();\n const liquidationPriceRoundedString = Precise.stringAdd (rounderString, liquidationPriceStringRaw);\n let truncatedLiquidationPrice = Precise.stringDiv (liquidationPriceRoundedString, '1', pricePrecision);\n if (truncatedLiquidationPrice[0] === '-') {\n // user cannot be liquidated\n // since he has more collateral than the size of the position\n truncatedLiquidationPrice = undefined;\n }\n liquidationPrice = this.parseNumber (truncatedLiquidationPrice);\n }\n const positionSide = this.safeString (position, 'positionSide');\n const hedged = positionSide !== 'BOTH';\n return {\n 'info': position,\n 'id': undefined,\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'initialMargin': initialMargin,\n 'initialMarginPercentage': this.parseNumber (initialMarginPercentageString),\n 'maintenanceMargin': maintenanceMargin,\n 'maintenanceMarginPercentage': maintenanceMarginPercentage,\n 'entryPrice': entryPrice,\n 'notional': notional,\n 'leverage': this.parseNumber (leverageString),\n 'unrealizedPnl': unrealizedPnl,\n 'contracts': contracts,\n 'contractSize': contractSize,\n 'marginRatio': marginRatio,\n 'liquidationPrice': liquidationPrice,\n 'markPrice': undefined,\n 'collateral': collateral,\n 'marginMode': marginMode,\n 'side': side,\n 'hedged': hedged,\n 'percentage': percentage,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 10076, "line_start" => 10040, "mappings" => [ %{ "comment" => nil, "key" => "crossMargin", "value" => "balances[code]['crossMargin']" }, %{ "comment" => nil, "key" => "crossWalletBalance", "value" => "balances[code]['crossWalletBalance']" }, %{ "comment" => nil, "key" => "crossMargin", "value" => "Precise.stringAdd (crossWalletBalance, crossUnPnl)" }, %{ "comment" => nil, "key" => "crossWalletBalance", "value" => "crossWalletBalance" } ], "name" => "parseAccountPositions", "signature" => "parseAccountPositions (account, filterClosed = false)", "source" => "parseAccountPositions (account, filterClosed = false) {\n const positions = this.safeList (account, 'positions');\n const assets = this.safeList (account, 'assets', []);\n const balances: Dict = {};\n for (let i = 0; i < assets.length; i++) {\n const entry = assets[i];\n const currencyId = this.safeString (entry, 'asset');\n const code = this.safeCurrencyCode (currencyId);\n const crossWalletBalance = this.safeString (entry, 'crossWalletBalance');\n const crossUnPnl = this.safeString (entry, 'crossUnPnl');\n balances[code] = {\n 'crossMargin': Precise.stringAdd (crossWalletBalance, crossUnPnl),\n 'crossWalletBalance': crossWalletBalance,\n };\n }\n const result = [];\n for (let i = 0; i < positions.length; i++) {\n const position = positions[i];\n const marketId = this.safeString (position, 'symbol');\n const market = this.safeMarket (marketId, undefined, undefined, 'contract');\n const code = market['linear'] ? market['quote'] : market['base'];\n const maintenanceMargin = this.safeString (position, 'maintMargin');\n // check for maintenance margin so empty positions are not returned\n const isPositionOpen = (maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000');\n if (!filterClosed || isPositionOpen) {\n // sometimes not all the codes are correctly returned...\n if (code in balances) {\n const parsed = this.parseAccountPosition (this.extend (position, {\n 'crossMargin': balances[code]['crossMargin'],\n 'crossWalletBalance': balances[code]['crossWalletBalance'],\n }), market);\n result.push (parsed);\n }\n }\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3714, "line_start" => 3603, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "response" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseBalanceCustom", "signature" => "parseBalanceCustom (response, type = undefined, marginMode = undefined, isPortfolioMargin = false): Balances", "source" => "parseBalanceCustom (response, type = undefined, marginMode = undefined, isPortfolioMargin = false): Balances {\n const result = {\n 'info': response,\n };\n let timestamp = undefined;\n const isolated = marginMode === 'isolated';\n const cross = (type === 'margin') || (marginMode === 'cross');\n if (isPortfolioMargin) {\n for (let i = 0; i < response.length; i++) {\n const entry = response[i];\n const account = this.account ();\n const currencyId = this.safeString (entry, 'asset');\n const code = this.safeCurrencyCode (currencyId);\n if (type === 'linear') {\n account['free'] = this.safeString (entry, 'umWalletBalance');\n account['used'] = this.safeString (entry, 'umUnrealizedPNL');\n } else if (type === 'inverse') {\n account['free'] = this.safeString (entry, 'cmWalletBalance');\n account['used'] = this.safeString (entry, 'cmUnrealizedPNL');\n } else if (cross) {\n const borrowed = this.safeString (entry, 'crossMarginBorrowed');\n const interest = this.safeString (entry, 'crossMarginInterest');\n account['debt'] = Precise.stringAdd (borrowed, interest);\n account['free'] = this.safeString (entry, 'crossMarginFree');\n account['used'] = this.safeString (entry, 'crossMarginLocked');\n account['total'] = this.safeString (entry, 'crossMarginAsset');\n } else {\n const usedLinear = this.safeString (entry, 'umUnrealizedPNL');\n const usedInverse = this.safeString (entry, 'cmUnrealizedPNL');\n const totalUsed = Precise.stringAdd (usedLinear, usedInverse);\n const totalWalletBalance = this.safeString (entry, 'totalWalletBalance');\n account['total'] = Precise.stringAdd (totalUsed, totalWalletBalance);\n }\n result[code] = account;\n }\n } else if (!isolated && ((type === 'spot') || cross)) {\n timestamp = this.safeInteger (response, 'updateTime');\n const balances = this.safeList2 (response, 'balances', 'userAssets', []);\n for (let i = 0; i < balances.length; i++) {\n const balance = balances[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 if (cross) {\n const debt = this.safeString (balance, 'borrowed');\n const interest = this.safeString (balance, 'interest');\n account['debt'] = Precise.stringAdd (debt, interest);\n }\n result[code] = account;\n }\n } else if (isolated) {\n const assets = this.safeList (response, 'assets');\n for (let i = 0; i < assets.length; i++) {\n const asset = assets[i];\n const marketId = this.safeString (asset, 'symbol');\n const symbol = this.safeSymbol (marketId, undefined, undefined, 'spot');\n const base = this.safeDict (asset, 'baseAsset', {});\n const quote = this.safeDict (asset, 'quoteAsset', {});\n const baseCode = this.safeCurrencyCode (this.safeString (base, 'asset'));\n const quoteCode = this.safeCurrencyCode (this.safeString (quote, 'asset'));\n const subResult: Dict = {};\n subResult[baseCode] = this.parseBalanceHelper (base);\n subResult[quoteCode] = this.parseBalanceHelper (quote);\n result[symbol] = this.safeBalance (subResult);\n }\n } else if (type === 'savings') {\n const positionAmountVos = this.safeList (response, 'positionAmountVos', []);\n for (let i = 0; i < positionAmountVos.length; i++) {\n const entry = positionAmountVos[i];\n const currencyId = this.safeString (entry, 'asset');\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n const usedAndTotal = this.safeString (entry, 'amount');\n account['total'] = usedAndTotal;\n account['used'] = usedAndTotal;\n result[code] = account;\n }\n } else if (type === 'funding') {\n for (let i = 0; i < response.length; i++) {\n const entry = response[i];\n const account = this.account ();\n const currencyId = this.safeString (entry, 'asset');\n const code = this.safeCurrencyCode (currencyId);\n account['free'] = this.safeString (entry, 'free');\n const frozen = this.safeString (entry, 'freeze');\n const withdrawing = this.safeString (entry, 'withdrawing');\n const locked = this.safeString (entry, 'locked');\n account['used'] = Precise.stringAdd (frozen, Precise.stringAdd (locked, withdrawing));\n result[code] = account;\n }\n } else {\n let balances = response;\n if (!Array.isArray (response)) {\n balances = this.safeList (response, 'assets', []);\n }\n for (let i = 0; i < balances.length; i++) {\n const balance = balances[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, 'availableBalance');\n account['used'] = this.safeString (balance, 'initialMargin');\n account['total'] = this.safeString2 (balance, 'marginBalance', 'balance');\n result[code] = account;\n }\n }\n result['timestamp'] = timestamp;\n result['datetime'] = this.iso8601 (timestamp);\n return isolated ? result : this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3601, "line_start" => 3593, "mappings" => [], "name" => "parseBalanceHelper", "signature" => "parseBalanceHelper (entry)", "source" => "parseBalanceHelper (entry) {\n const account = this.account ();\n account['used'] = this.safeString (entry, 'locked');\n account['free'] = this.safeString (entry, 'free');\n const interest = this.safeString (entry, 'interest');\n const debt = this.safeString (entry, 'borrowed');\n account['debt'] = Precise.stringAdd (debt, interest);\n return account;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 12784, "line_start" => 12769, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (this.safeString (info, 'asset'))" }, %{ "comment" => nil, "key" => "interest", "value" => "this.safeNumber (info, 'interest')" }, %{ "comment" => nil, "key" => "interestRate", "value" => "this.safeNumber (info, 'interestRate')" }, %{ "comment" => nil, "key" => "amountBorrowed", "value" => "this.safeNumber (info, 'principal')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseBorrowInterest", "signature" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest", "source" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest {\n const symbol = this.safeString (info, 'isolatedSymbol');\n const timestamp = this.safeInteger (info, 'interestAccuredTime');\n const marginMode = (symbol === undefined) ? 'cross' : 'isolated';\n return {\n 'info': info,\n 'symbol': symbol,\n 'currency': this.safeCurrencyCode (this.safeString (info, 'asset')),\n 'interest': this.safeNumber (info, 'interest'),\n 'interestRate': this.safeNumber (info, 'interestRate'),\n 'amountBorrowed': this.safeNumber (info, 'principal'),\n 'marginMode': marginMode,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n } as BorrowInterest;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"asset\": \"USDT\",\n \"timestamp\": 1638230400000,\n \"dailyInterestRate\": \"0.0006\",\n \"vipLevel\": 0\n }" ], "line_end" => 12555, "line_start" => 12536, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "rate", "value" => "this.safeNumber (info, 'dailyInterestRate')" }, %{ "comment" => nil, "key" => "period", "value" => "86400000" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseBorrowRate", "signature" => "parseBorrowRate (info, currency: Currency = undefined)", "source" => "parseBorrowRate (info, currency: Currency = undefined) {\n //\n // {\n // \"asset\": \"USDT\",\n // \"timestamp\": 1638230400000,\n // \"dailyInterestRate\": \"0.0006\",\n // \"vipLevel\": 0\n // }\n //\n const timestamp = this.safeInteger (info, 'timestamp');\n const currencyId = this.safeString (info, 'asset');\n return {\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'rate': this.safeNumber (info, 'dailyInterestRate'),\n 'period': 86400000,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"quoteId\":\"12415572564\",\n \"ratio\":\"38163.7\",\n \"inverseRatio\":\"0.0000262\",\n \"validTimestamp\":1623319461670,\n \"toAmount\":\"3816.37\",\n \"fromAmount\":\"0.1\"\n }", "{\n \"orderId\":\"933256278426274426\",\n \"createTime\":1623381330472,\n \"orderStatus\":\"PROCESS\"\n }", "{\n \"tranId\": 118263407119,\n \"status\": \"S\"\n }", "{\n \"tranId\": 118263615991,\n \"type\": 244,\n \"time\": 1664442078000,\n \"deductedAsset\": \"BUSD\",\n \"deductedAmount\": \"1\",\n \"targetAsset\": \"USDC\",\n \"targetAmount\": \"1\",\n \"status\": \"S\",\n \"accountType\": \"MAIN\"\n }", "{\n \"orderId\":933256278426274426,\n \"orderStatus\":\"SUCCESS\",\n \"fromAsset\":\"BTC\",\n \"fromAmount\":\"0.00054414\",\n \"toAsset\":\"USDT\",\n \"toAmount\":\"20\",\n \"ratio\":\"36755\",\n \"inverseRatio\":\"0.00002721\",\n \"createTime\":1623381330472\n }" ], "line_end" => 14281, "line_start" => 14193, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "conversion" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeStringN (conversion, [ 'tranId', 'orderId', 'quoteId' ])" }, %{ "comment" => nil, "key" => "fromCurrency", "value" => "fromCode" }, %{ "comment" => nil, "key" => "fromAmount", "value" => "this.safeNumber2 (conversion, 'deductedAmount', 'fromAmount')" }, %{ "comment" => nil, "key" => "toCurrency", "value" => "toCode" }, %{ "comment" => nil, "key" => "toAmount", "value" => "this.safeNumber2 (conversion, 'targetAmount', 'toAmount')" }, %{ "comment" => nil, "key" => "price", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" } ], "name" => "parseConversion", "signature" => "parseConversion (conversion: Dict, fromCurrency: Currency = undefined, toCurrency: Currency = undefined): Conversion", "source" => "parseConversion (conversion: Dict, fromCurrency: Currency = undefined, toCurrency: Currency = undefined): Conversion {\n //\n // fetchConvertQuote\n //\n // {\n // \"quoteId\":\"12415572564\",\n // \"ratio\":\"38163.7\",\n // \"inverseRatio\":\"0.0000262\",\n // \"validTimestamp\":1623319461670,\n // \"toAmount\":\"3816.37\",\n // \"fromAmount\":\"0.1\"\n // }\n //\n // createConvertTrade\n //\n // {\n // \"orderId\":\"933256278426274426\",\n // \"createTime\":1623381330472,\n // \"orderStatus\":\"PROCESS\"\n // }\n //\n // createConvertTrade BUSD\n //\n // {\n // \"tranId\": 118263407119,\n // \"status\": \"S\"\n // }\n //\n // fetchConvertTrade, fetchConvertTradeHistory BUSD\n //\n // {\n // \"tranId\": 118263615991,\n // \"type\": 244,\n // \"time\": 1664442078000,\n // \"deductedAsset\": \"BUSD\",\n // \"deductedAmount\": \"1\",\n // \"targetAsset\": \"USDC\",\n // \"targetAmount\": \"1\",\n // \"status\": \"S\",\n // \"accountType\": \"MAIN\"\n // }\n //\n // fetchConvertTrade\n //\n // {\n // \"orderId\":933256278426274426,\n // \"orderStatus\":\"SUCCESS\",\n // \"fromAsset\":\"BTC\",\n // \"fromAmount\":\"0.00054414\",\n // \"toAsset\":\"USDT\",\n // \"toAmount\":\"20\",\n // \"ratio\":\"36755\",\n // \"inverseRatio\":\"0.00002721\",\n // \"createTime\":1623381330472\n // }\n //\n // fetchConvertTradeHistory\n //\n // {\n // \"quoteId\": \"f3b91c525b2644c7bc1e1cd31b6e1aa6\",\n // \"orderId\": 940708407462087195,\n // \"orderStatus\": \"SUCCESS\",\n // \"fromAsset\": \"USDT\",\n // \"fromAmount\": \"20\",\n // \"toAsset\": \"BNB\",\n // \"toAmount\": \"0.06154036\",\n // \"ratio\": \"0.00307702\",\n // \"inverseRatio\": \"324.99\",\n // \"createTime\": 1624248872184\n // }\n //\n const timestamp = this.safeIntegerN (conversion, [ 'time', 'validTimestamp', 'createTime' ]);\n const fromCur = this.safeString2 (conversion, 'deductedAsset', 'fromAsset');\n const fromCode = this.safeCurrencyCode (fromCur, fromCurrency);\n const to = this.safeString2 (conversion, 'targetAsset', 'toAsset');\n const toCode = this.safeCurrencyCode (to, toCurrency);\n return {\n 'info': conversion,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': this.safeStringN (conversion, [ 'tranId', 'orderId', 'quoteId' ]),\n 'fromCurrency': fromCode,\n 'fromAmount': this.safeNumber2 (conversion, 'deductedAmount', 'fromAmount'),\n 'toCurrency': toCode,\n 'toAmount': this.safeNumber2 (conversion, 'targetAmount', 'toAmount'),\n 'price': undefined,\n 'fee': undefined,\n } as Conversion;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"XRP\",\n \"address\": \"rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh\",\n \"tag\": \"108618262\",\n \"url\": \"https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh\"\n }" ], "line_end" => 9231, "line_start" => 9203, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "response" }, %{ "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 (response, currency: Currency = undefined): DepositAddress", "source" => "parseDepositAddress (response, currency: Currency = undefined): DepositAddress {\n //\n // {\n // \"coin\": \"XRP\",\n // \"address\": \"rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh\",\n // \"tag\": \"108618262\",\n // \"url\": \"https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh\"\n // }\n //\n const url = this.safeString (response, 'url');\n const address = this.safeString (response, 'address');\n const currencyId = this.safeString (response, 'currency');\n const code = this.safeCurrencyCode (currencyId, currency);\n // deposit-address endpoint provides only network url (not network ID/CODE)\n // so we should map the url to network (their data is inside currencies)\n const networkCode = this.getNetworkCodeByNetworkUrl (code, url);\n let tag = this.safeString (response, 'tag', '');\n if (tag.length === 0) {\n tag = undefined;\n }\n this.checkAddress (address);\n return {\n 'info': response,\n 'currency': code,\n 'network': networkCode,\n 'address': address,\n 'tag': tag,\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"BAT\",\n \"depositAllEnable\": true,\n \"withdrawAllEnable\": true,\n \"name\": \"Basic Attention Token\",\n \"free\": \"0\",\n \"locked\": \"0\",\n \"freeze\": \"0\",\n \"withdrawing\": \"0\",\n \"ipoing\": \"0\",\n \"ipoable\": \"0\",\n \"storage\": \"0\",\n \"isLegalMoney\": false,\n \"trading\": true,\n \"networkList\": [\n {\n \"network\": \"BNB\",\n \"coin\": \"BAT\",\n \"withdrawIntegerMultiple\": \"0.00000001\",\n \"isDefault\": false,\n \"depositEnable\": true,\n \"withdrawEnable\": true,\n \"depositDesc\": '',\n \"withdrawDesc\": '',\n \"specialTips\": \"The name of this asset is Basic Attention Token (BAT). Both a MEMO and an Address are required to successfully deposit your BEP2 tokens to Binance.\",\n \"name\": \"BEP2\",\n \"resetAddressStatus\": false,\n \"addressRegex\": \"^(bnb1)[0-9a-z]{38}$\",\n \"memoRegex\": \"^[0-9A-Za-z\\\\-_]{1,120}$\",\n \"withdrawFee\": \"0.27\",\n \"withdrawMin\": \"0.54\",\n \"withdrawMax\": \"10000000000\",\n \"minConfirm\": \"1\",\n \"unLockConfirm\": \"0\"\n },\n ...\n ]\n }" ], "line_end" => 9473, "line_start" => 9406, "mappings" => [], "name" => "parseDepositWithdrawFee", "signature" => "parseDepositWithdrawFee (fee, currency: Currency = undefined)", "source" => "parseDepositWithdrawFee (fee, currency: Currency = undefined) {\n //\n // {\n // \"coin\": \"BAT\",\n // \"depositAllEnable\": true,\n // \"withdrawAllEnable\": true,\n // \"name\": \"Basic Attention Token\",\n // \"free\": \"0\",\n // \"locked\": \"0\",\n // \"freeze\": \"0\",\n // \"withdrawing\": \"0\",\n // \"ipoing\": \"0\",\n // \"ipoable\": \"0\",\n // \"storage\": \"0\",\n // \"isLegalMoney\": false,\n // \"trading\": true,\n // \"networkList\": [\n // {\n // \"network\": \"BNB\",\n // \"coin\": \"BAT\",\n // \"withdrawIntegerMultiple\": \"0.00000001\",\n // \"isDefault\": false,\n // \"depositEnable\": true,\n // \"withdrawEnable\": true,\n // \"depositDesc\": '',\n // \"withdrawDesc\": '',\n // \"specialTips\": \"The name of this asset is Basic Attention Token (BAT). Both a MEMO and an Address are required to successfully deposit your BEP2 tokens to Binance.\",\n // \"name\": \"BEP2\",\n // \"resetAddressStatus\": false,\n // \"addressRegex\": \"^(bnb1)[0-9a-z]{38}$\",\n // \"memoRegex\": \"^[0-9A-Za-z\\\\-_]{1,120}$\",\n // \"withdrawFee\": \"0.27\",\n // \"withdrawMin\": \"0.54\",\n // \"withdrawMax\": \"10000000000\",\n // \"minConfirm\": \"1\",\n // \"unLockConfirm\": \"0\"\n // },\n // ...\n // ]\n // }\n //\n const networkList = this.safeList (fee, 'networkList', []);\n const result = this.depositWithdrawFee (fee);\n for (let j = 0; j < networkList.length; j++) {\n const networkEntry = networkList[j];\n const networkId = this.safeString (networkEntry, 'network');\n const networkCode = this.networkIdToCode (networkId);\n const withdrawFee = this.safeNumber (networkEntry, 'withdrawFee');\n const isDefault = this.safeBool (networkEntry, 'isDefault');\n if (isDefault === true) {\n result['withdraw'] = {\n 'fee': withdrawFee,\n 'percentage': undefined,\n };\n }\n result['networks'][networkCode] = {\n 'withdraw': {\n 'fee': withdrawFee,\n 'percentage': undefined,\n },\n 'deposit': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n };\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"fromAsset\": \"USDT\",\n \"amount\": \"0.009669\",\n \"transferedAmount\": \"0.00002992\",\n \"serviceChargeAmount\": \"0.00000059\",\n \"operateTime\": \"1628076010000\",\n \"transId\": \"71416578712\",\n \"isDustTrade\": true\n }" ], "line_end" => 8357, "line_start" => 8287, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "order", "value" => "orderId" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "currency", "value" => "earnedCurrency" }, %{ "comment" => nil, "key" => "cost", "value" => "this.parseNumber (feeCostString)" } ], "name" => "parseDustTrade", "signature" => "parseDustTrade (trade, market: Market = undefined)", "source" => "parseDustTrade (trade, market: Market = undefined) {\n //\n // {\n // \"fromAsset\": \"USDT\",\n // \"amount\": \"0.009669\",\n // \"transferedAmount\": \"0.00002992\",\n // \"serviceChargeAmount\": \"0.00000059\",\n // \"operateTime\": \"1628076010000\",\n // \"transId\": \"71416578712\",\n // \"isDustTrade\": true\n // }\n //\n const orderId = this.safeString (trade, 'transId');\n const timestamp = this.safeInteger (trade, 'operateTime');\n const currencyId = this.safeString (trade, 'fromAsset');\n const tradedCurrency = this.safeCurrencyCode (currencyId);\n const bnb = this.currency ('BNB');\n const earnedCurrency = bnb['code'];\n const applicantSymbol = earnedCurrency + '/' + tradedCurrency;\n let tradedCurrencyIsQuote = false;\n if (applicantSymbol in this.markets) {\n tradedCurrencyIsQuote = true;\n }\n const feeCostString = this.safeString (trade, 'serviceChargeAmount');\n const fee = {\n 'currency': earnedCurrency,\n 'cost': this.parseNumber (feeCostString),\n };\n let symbol = undefined;\n let amountString = undefined;\n let costString = undefined;\n let side = undefined;\n if (tradedCurrencyIsQuote) {\n symbol = applicantSymbol;\n amountString = this.safeString (trade, 'transferedAmount');\n costString = this.safeString (trade, 'amount');\n side = 'buy';\n } else {\n symbol = tradedCurrency + '/' + earnedCurrency;\n amountString = this.safeString (trade, 'amount');\n costString = this.safeString (trade, 'transferedAmount');\n side = 'sell';\n }\n let priceString = undefined;\n if (costString !== undefined) {\n if (amountString) {\n priceString = Precise.stringDiv (costString, amountString);\n }\n }\n const id = undefined;\n const amount = this.parseNumber (amountString);\n const price = this.parseNumber (priceString);\n const cost = this.parseNumber (costString);\n const type = undefined;\n const takerOrMaker = undefined;\n return {\n 'id': id,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'order': orderId,\n 'type': type,\n 'takerOrMaker': takerOrMaker,\n 'side': side,\n 'amount': amount,\n 'price': price,\n 'cost': cost,\n 'fee': fee,\n 'info': trade,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"markPrice\": \"45802.81129892\",\n \"indexPrice\": \"45745.47701915\",\n \"estimatedSettlePrice\": \"45133.91753671\",\n \"lastFundingRate\": \"0.00063521\",\n \"interestRate\": \"0.00010000\",\n \"nextFundingTime\": \"1621267200000\",\n \"time\": \"1621252344001\"\n }", "{\n \"symbol\": \"BLZUSDT\",\n \"adjustedFundingRateCap\": \"0.03000000\",\n \"adjustedFundingRateFloor\": \"-0.03000000\",\n \"fundingIntervalHours\": 4,\n \"disclaimer\": false\n }" ], "line_end" => 10038, "line_start" => 9978, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "markPrice", "value" => "markPrice" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "indexPrice" }, %{ "comment" => nil, "key" => "interestRate", "value" => "interestRate" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "estimatedSettlePrice" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "fundingRate" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "fundingTime" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "this.iso8601 (fundingTime)" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "interval", "value" => "intervalString" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n // ensure it matches with https://www.binance.com/en/futures/funding-history/0\n //\n // fetchFundingRate, fetchFundingRates\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"markPrice\": \"45802.81129892\",\n // \"indexPrice\": \"45745.47701915\",\n // \"estimatedSettlePrice\": \"45133.91753671\",\n // \"lastFundingRate\": \"0.00063521\",\n // \"interestRate\": \"0.00010000\",\n // \"nextFundingTime\": \"1621267200000\",\n // \"time\": \"1621252344001\"\n // }\n //\n // fetchFundingInterval, fetchFundingIntervals\n //\n // {\n // \"symbol\": \"BLZUSDT\",\n // \"adjustedFundingRateCap\": \"0.03000000\",\n // \"adjustedFundingRateFloor\": \"-0.03000000\",\n // \"fundingIntervalHours\": 4,\n // \"disclaimer\": false\n // }\n //\n const timestamp = this.safeInteger (contract, 'time');\n const marketId = this.safeString (contract, 'symbol');\n const symbol = this.safeSymbol (marketId, market, undefined, 'contract');\n const markPrice = this.safeNumber (contract, 'markPrice');\n const indexPrice = this.safeNumber (contract, 'indexPrice');\n const interestRate = this.safeNumber (contract, 'interestRate');\n const estimatedSettlePrice = this.safeNumber (contract, 'estimatedSettlePrice');\n const fundingRate = this.safeNumber (contract, 'lastFundingRate');\n const fundingTime = this.safeInteger (contract, 'nextFundingTime');\n const interval = this.safeString (contract, 'fundingIntervalHours');\n let intervalString = undefined;\n if (interval !== undefined) {\n intervalString = interval + 'h';\n }\n return {\n 'info': contract,\n 'symbol': symbol,\n 'markPrice': markPrice,\n 'indexPrice': indexPrice,\n 'interestRate': interestRate,\n 'estimatedSettlePrice': estimatedSettlePrice,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fundingRate': fundingRate,\n 'fundingTimestamp': fundingTime,\n 'fundingDatetime': this.iso8601 (fundingTime),\n 'nextFundingRate': undefined,\n 'nextFundingTimestamp': undefined,\n 'nextFundingDatetime': undefined,\n 'previousFundingRate': undefined,\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n 'interval': intervalString,\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"fundingRate\": \"0.00063521\",\n \"fundingTime\": \"1621267200000\",\n }" ], "line_end" => 9946, "line_start" => 9930, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (this.safeString (contract, 'symbol'), undefined, undefined, '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\": \"BTCUSDT\",\n // \"fundingRate\": \"0.00063521\",\n // \"fundingTime\": \"1621267200000\",\n // }\n //\n const timestamp = this.safeInteger (contract, 'fundingTime');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (this.safeString (contract, 'symbol'), undefined, undefined, 'swap'),\n 'fundingRate': this.safeNumber (contract, 'fundingRate'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC-231229-40000-C\",\n \"markPrice\": \"2012\",\n \"bidIV\": \"0.60236275\",\n \"askIV\": \"0.62267244\",\n \"markIV\": \"0.6125176\",\n \"delta\": \"0.39111646\",\n \"theta\": \"-32.13948531\",\n \"gamma\": \"0.00004656\",\n \"vega\": \"51.70062218\",\n \"highPriceLimit\": \"6474\",\n \"lowPriceLimit\": \"5\"\n }" ], "line_end" => 13511, "line_start" => 13472, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "delta", "value" => "this.safeNumber (greeks, 'delta')" }, %{ "comment" => nil, "key" => "gamma", "value" => "this.safeNumber (greeks, 'gamma')" }, %{ "comment" => nil, "key" => "theta", "value" => "this.safeNumber (greeks, 'theta')" }, %{ "comment" => nil, "key" => "vega", "value" => "this.safeNumber (greeks, 'vega')" }, %{ "comment" => nil, "key" => "rho", "value" => "undefined" }, %{ "comment" => nil, "key" => "bidSize", "value" => "undefined" }, %{ "comment" => nil, "key" => "askSize", "value" => "undefined" }, %{ "comment" => nil, "key" => "bidImpliedVolatility", "value" => "this.safeNumber (greeks, 'bidIV')" }, %{ "comment" => nil, "key" => "askImpliedVolatility", "value" => "this.safeNumber (greeks, 'askIV')" }, %{ "comment" => nil, "key" => "markImpliedVolatility", "value" => "this.safeNumber (greeks, 'markIV')" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "askPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (greeks, 'markPrice')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "underlyingPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "greeks" } ], "name" => "parseGreeks", "signature" => "parseGreeks (greeks: Dict, market: Market = undefined): Greeks", "source" => "parseGreeks (greeks: Dict, market: Market = undefined): Greeks {\n //\n // {\n // \"symbol\": \"BTC-231229-40000-C\",\n // \"markPrice\": \"2012\",\n // \"bidIV\": \"0.60236275\",\n // \"askIV\": \"0.62267244\",\n // \"markIV\": \"0.6125176\",\n // \"delta\": \"0.39111646\",\n // \"theta\": \"-32.13948531\",\n // \"gamma\": \"0.00004656\",\n // \"vega\": \"51.70062218\",\n // \"highPriceLimit\": \"6474\",\n // \"lowPriceLimit\": \"5\"\n // }\n //\n const marketId = this.safeString (greeks, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n return {\n 'symbol': symbol,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'delta': this.safeNumber (greeks, 'delta'),\n 'gamma': this.safeNumber (greeks, 'gamma'),\n 'theta': this.safeNumber (greeks, 'theta'),\n 'vega': this.safeNumber (greeks, 'vega'),\n 'rho': undefined,\n 'bidSize': undefined,\n 'askSize': undefined,\n 'bidImpliedVolatility': this.safeNumber (greeks, 'bidIV'),\n 'askImpliedVolatility': this.safeNumber (greeks, 'askIV'),\n 'markImpliedVolatility': this.safeNumber (greeks, 'markIV'),\n 'bidPrice': undefined,\n 'askPrice': undefined,\n 'markPrice': this.safeNumber (greeks, 'markPrice'),\n 'lastPrice': undefined,\n 'underlyingPrice': undefined,\n 'info': greeks,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ETHUSDT\",\n \"incomeType\": \"FUNDING_FEE\",\n \"income\": \"0.00134317\",\n \"asset\": \"USDT\",\n \"time\": \"1621584000000\",\n \"info\": \"FUNDING_FEE\",\n \"tranId\": \"4480321991774044580\",\n \"tradeId\": \"\"\n }" ], "line_end" => 8912, "line_start" => 8887, "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')" } ], "name" => "parseIncome", "signature" => "parseIncome (income, market: Market = undefined)", "source" => "parseIncome (income, market: Market = undefined) {\n //\n // {\n // \"symbol\": \"ETHUSDT\",\n // \"incomeType\": \"FUNDING_FEE\",\n // \"income\": \"0.00134317\",\n // \"asset\": \"USDT\",\n // \"time\": \"1621584000000\",\n // \"info\": \"FUNDING_FEE\",\n // \"tranId\": \"4480321991774044580\",\n // \"tradeId\": \"\"\n // }\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 };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"vipLevel\": 0,\n \"symbol\": \"BTCUSDT\",\n \"leverage\": \"10\",\n \"data\": [\n {\n \"coin\": \"BTC\",\n \"dailyInterest\": \"0.00026125\",\n \"borrowLimit\": \"270\"\n },\n {\n \"coin\": \"USDT\",\n \"dailyInterest\": \"0.000475\",\n \"borrowLimit\": \"2100000\"\n }\n ]\n }" ], "line_end" => 12593, "line_start" => 12557, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeString (market, 'symbol')" }, %{ "comment" => nil, "key" => "base", "value" => "this.safeString (baseInfo, 'coin')" }, %{ "comment" => nil, "key" => "baseRate", "value" => "this.safeNumber (baseInfo, 'dailyInterest')" }, %{ "comment" => nil, "key" => "quote", "value" => "this.safeString (quoteInfo, 'coin')" }, %{ "comment" => nil, "key" => "quoteRate", "value" => "this.safeNumber (quoteInfo, 'dailyInterest')" }, %{ "comment" => nil, "key" => "period", "value" => "86400000" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" } ], "name" => "parseIsolatedBorrowRate", "signature" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate", "source" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate {\n //\n // {\n // \"vipLevel\": 0,\n // \"symbol\": \"BTCUSDT\",\n // \"leverage\": \"10\",\n // \"data\": [\n // {\n // \"coin\": \"BTC\",\n // \"dailyInterest\": \"0.00026125\",\n // \"borrowLimit\": \"270\"\n // },\n // {\n // \"coin\": \"USDT\",\n // \"dailyInterest\": \"0.000475\",\n // \"borrowLimit\": \"2100000\"\n // }\n // ]\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'spot');\n const data = this.safeList (info, 'data');\n const baseInfo = this.safeDict (data, 0);\n const quoteInfo = this.safeDict (data, 1);\n return {\n 'info': info,\n 'symbol': this.safeString (market, 'symbol'),\n 'base': this.safeString (baseInfo, 'coin'),\n 'baseRate': this.safeNumber (baseInfo, 'dailyInterest'),\n 'quote': this.safeString (quoteInfo, 'coin'),\n 'quoteRate': this.safeNumber (quoteInfo, 'dailyInterest'),\n 'period': 86400000,\n 'timestamp': undefined,\n 'datetime': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"LTCBTC\",\n \"price\": \"4.00000200\"\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"price\": \"6000.01\",\n \"time\": 1589437530011 // Transaction time\n }", "{\n \"symbol\": \"BTCUSD_200626\", // symbol (\"BTCUSD_200626\", \"BTCUSD_PERP\", etc..)\n \"ps\": \"BTCUSD\", // pair\n \"price\": \"9647.8\",\n \"time\": 1591257246176\n }" ], "line_end" => 4460, "line_start" => 4421, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumberOmitZero (entry, 'price')" }, %{ "comment" => nil, "key" => "side", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "entry" } ], "name" => "parseLastPrice", "signature" => "parseLastPrice (entry, market: Market = undefined)", "source" => "parseLastPrice (entry, market: Market = undefined) {\n //\n // spot\n //\n // {\n // \"symbol\": \"LTCBTC\",\n // \"price\": \"4.00000200\"\n // }\n //\n // usdm (swap/future)\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"price\": \"6000.01\",\n // \"time\": 1589437530011 // Transaction time\n // }\n //\n //\n // coinm (swap/future)\n //\n // {\n // \"symbol\": \"BTCUSD_200626\", // symbol (\"BTCUSD_200626\", \"BTCUSD_PERP\", etc..)\n // \"ps\": \"BTCUSD\", // pair\n // \"price\": \"9647.8\",\n // \"time\": 1591257246176\n // }\n //\n const timestamp = this.safeInteger (entry, 'time');\n const type = (timestamp === undefined) ? 'spot' : 'swap';\n const marketId = this.safeString (entry, 'symbol');\n market = this.safeMarket (marketId, market, undefined, type);\n return {\n 'symbol': market['symbol'],\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'price': this.safeNumberOmitZero (entry, 'price'),\n 'side': undefined,\n 'info': entry,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": \"1125899906845701870\",\n \"asset\": \"USDT\",\n \"amount\": \"-0.16518203\",\n \"type\": \"FEE\",\n \"createDate\": 167662104241\n }", "{\n \"symbol\": \"\",\n \"incomeType\": \"TRANSFER\",\n \"income\": \"10.00000000\",\n \"asset\": \"USDT\",\n \"time\": 1677645250000,\n \"info\": \"TRANSFER\",\n \"tranId\": 131001573082,\n \"tradeId\": \"\"\n }" ], "line_end" => 11936, "line_start" => 11881, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (item, 'id', 'tranId')" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "account", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceId", "value" => "this.safeString (item, 'tradeId')" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseLedgerEntryType (type)" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amount)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // options (eapi)\n //\n // {\n // \"id\": \"1125899906845701870\",\n // \"asset\": \"USDT\",\n // \"amount\": \"-0.16518203\",\n // \"type\": \"FEE\",\n // \"createDate\": 167662104241\n // }\n //\n // futures (fapi, dapi, papi)\n //\n // {\n // \"symbol\": \"\",\n // \"incomeType\": \"TRANSFER\",\n // \"income\": \"10.00000000\",\n // \"asset\": \"USDT\",\n // \"time\": 1677645250000,\n // \"info\": \"TRANSFER\",\n // \"tranId\": 131001573082,\n // \"tradeId\": \"\"\n // }\n //\n let amount = this.safeString2 (item, 'amount', 'income');\n let direction = undefined;\n if (Precise.stringLe (amount, '0')) {\n direction = 'out';\n amount = Precise.stringMul ('-1', amount);\n } else {\n direction = 'in';\n }\n const currencyId = this.safeString (item, 'asset');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const timestamp = this.safeInteger2 (item, 'createDate', 'time');\n const type = this.safeString2 (item, 'type', 'incomeType');\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': this.safeString2 (item, 'id', 'tranId'),\n 'direction': direction,\n 'account': undefined,\n 'referenceAccount': undefined,\n 'referenceId': this.safeString (item, 'tradeId'),\n 'type': this.parseLedgerEntryType (type),\n 'currency': code,\n 'amount': this.parseNumber (amount),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'before': undefined,\n 'after': undefined,\n 'status': undefined,\n 'fee': undefined,\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 11961, "line_start" => 11938, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const ledgerType: Dict = {\n 'FEE': 'fee',\n 'FUNDING_FEE': 'fee',\n 'OPTIONS_PREMIUM_FEE': 'fee',\n 'POSITION_LIMIT_INCREASE_FEE': 'fee',\n 'CONTRACT': 'trade',\n 'REALIZED_PNL': 'trade',\n 'TRANSFER': 'transfer',\n 'CROSS_COLLATERAL_TRANSFER': 'transfer',\n 'INTERNAL_TRANSFER': 'transfer',\n 'COIN_SWAP_DEPOSIT': 'deposit',\n 'COIN_SWAP_WITHDRAW': 'withdrawal',\n 'OPTIONS_SETTLE_PROFIT': 'settlement',\n 'DELIVERED_SETTELMENT': 'settlement',\n 'WELCOME_BONUS': 'cashback',\n 'CONTEST_REWARD': 'cashback',\n 'COMMISSION_REBATE': 'rebate',\n 'API_REBATE': 'rebate',\n 'REFERRAL_KICKBACK': 'referral',\n 'COMMISSION': 'commission',\n };\n return this.safeString (ledgerType, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 11554, "line_start" => 11524, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "longLeverage" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "shortLeverage" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage", "source" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage {\n const marketId = this.safeString (leverage, 'symbol');\n const marginModeRaw = this.safeBool (leverage, 'isolated');\n let marginMode = undefined;\n if (marginModeRaw !== undefined) {\n marginMode = marginModeRaw ? 'isolated' : 'cross';\n }\n const marginTypeRaw = this.safeStringLower (leverage, 'marginType');\n if (marginTypeRaw !== undefined) {\n marginMode = (marginTypeRaw === 'crossed') ? 'cross' : 'isolated';\n }\n const side = this.safeStringLower (leverage, 'positionSide');\n let longLeverage = undefined;\n let shortLeverage = undefined;\n const leverageValue = this.safeInteger (leverage, 'leverage');\n if ((side === undefined) || (side === 'both')) {\n longLeverage = leverageValue;\n shortLeverage = leverageValue;\n } else if (side === 'long') {\n longLeverage = leverageValue;\n } else if (side === 'short') {\n shortLeverage = leverageValue;\n }\n return {\n 'info': leverage,\n 'symbol': this.safeSymbol (marketId, market),\n 'marginMode': marginMode,\n 'longLeverage': longLeverage,\n 'shortLeverage': shortLeverage,\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"avgPrice\": \"0.00388359\",\n \"executedQty\": \"31.39000000\",\n \"orderId\": 180015097,\n \"price\": \"0.00388110\",\n \"qty\": \"31.39000000\",\n \"side\": \"SELL\",\n \"symbol\": \"BNBBTC\",\n \"timeInForce\": \"GTC\",\n \"isIsolated\": true,\n \"updatedTime\": 1558941374745\n }", "{\n \"orderId\": 6071832819,\n \"symbol\": \"BTCUSDT\",\n \"status\": \"FILLED\",\n \"clientOrderId\": \"autoclose-1596107620040000020\",\n \"price\": \"10871.09\",\n \"avgPrice\": \"10913.21000\",\n \"origQty\": \"0.001\",\n \"executedQty\": \"0.002\",\n \"cumQuote\": \"10.91321\",\n \"timeInForce\": \"IOC\",\n \"type\": \"LIMIT\",\n \"reduceOnly\": false,\n \"closePosition\": false,\n \"side\": \"SELL\",\n \"positionSide\": \"BOTH\",\n \"stopPrice\": \"0\",\n \"workingType\": \"CONTRACT_PRICE\",\n \"origType\": \"LIMIT\",\n \"time\": 1596107620044,\n \"updateTime\": 1596107620087\n }", "{\n \"orderId\": 165123080,\n \"symbol\": \"BTCUSD_200925\",\n \"pair\": \"BTCUSD\",\n \"status\": \"FILLED\",\n \"clientOrderId\": \"autoclose-1596542005017000006\",\n \"price\": \"11326.9\",\n \"avgPrice\": \"11326.9\",\n \"origQty\": \"1\",\n \"executedQty\": \"1\",\n \"cumBase\": \"0.00882854\",\n \"timeInForce\": \"IOC\",\n \"type\": \"LIMIT\",\n \"reduceOnly\": false,\n \"closePosition\": false,\n \"side\": \"SELL\",\n \"positionSide\": \"BOTH\",\n \"stopPrice\": \"0\",\n \"workingType\": \"CONTRACT_PRICE\",\n \"priceProtect\": false,\n \"origType\": \"LIMIT\",\n \"time\": 1596542005019,\n \"updateTime\": 1596542005050\n }" ], "line_end" => 13392, "line_start" => 13309, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "liquidation" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.safeNumber (liquidation, 'executedQty')" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.safeNumber (market, 'contractSize')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (liquidation, 'avgPrice')" }, %{ "comment" => nil, "key" => "side", "value" => "this.safeStringLower (liquidation, 'side')" }, %{ "comment" => nil, "key" => "baseValue", "value" => "this.safeNumber (liquidation, 'cumBase')" }, %{ "comment" => nil, "key" => "quoteValue", "value" => "this.safeNumber (liquidation, 'cumQuote')" }, %{ "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 // margin\n //\n // {\n // \"avgPrice\": \"0.00388359\",\n // \"executedQty\": \"31.39000000\",\n // \"orderId\": 180015097,\n // \"price\": \"0.00388110\",\n // \"qty\": \"31.39000000\",\n // \"side\": \"SELL\",\n // \"symbol\": \"BNBBTC\",\n // \"timeInForce\": \"GTC\",\n // \"isIsolated\": true,\n // \"updatedTime\": 1558941374745\n // }\n //\n // linear\n //\n // {\n // \"orderId\": 6071832819,\n // \"symbol\": \"BTCUSDT\",\n // \"status\": \"FILLED\",\n // \"clientOrderId\": \"autoclose-1596107620040000020\",\n // \"price\": \"10871.09\",\n // \"avgPrice\": \"10913.21000\",\n // \"origQty\": \"0.001\",\n // \"executedQty\": \"0.002\",\n // \"cumQuote\": \"10.91321\",\n // \"timeInForce\": \"IOC\",\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"closePosition\": false,\n // \"side\": \"SELL\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"0\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"origType\": \"LIMIT\",\n // \"time\": 1596107620044,\n // \"updateTime\": 1596107620087\n // }\n //\n // inverse\n //\n // {\n // \"orderId\": 165123080,\n // \"symbol\": \"BTCUSD_200925\",\n // \"pair\": \"BTCUSD\",\n // \"status\": \"FILLED\",\n // \"clientOrderId\": \"autoclose-1596542005017000006\",\n // \"price\": \"11326.9\",\n // \"avgPrice\": \"11326.9\",\n // \"origQty\": \"1\",\n // \"executedQty\": \"1\",\n // \"cumBase\": \"0.00882854\",\n // \"timeInForce\": \"IOC\",\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"closePosition\": false,\n // \"side\": \"SELL\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"0\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"origType\": \"LIMIT\",\n // \"time\": 1596542005019,\n // \"updateTime\": 1596542005050\n // }\n //\n const marketId = this.safeString (liquidation, 'symbol');\n const timestamp = this.safeInteger2 (liquidation, 'updatedTime', 'updateTime');\n return this.safeLiquidation ({\n 'info': liquidation,\n 'symbol': this.safeSymbol (marketId, market),\n 'contracts': this.safeNumber (liquidation, 'executedQty'),\n 'contractSize': this.safeNumber (market, 'contractSize'),\n 'price': this.safeNumber (liquidation, 'avgPrice'),\n 'side': this.safeStringLower (liquidation, 'side'),\n 'baseValue': this.safeNumber (liquidation, 'cumBase'),\n 'quoteValue': this.safeNumber (liquidation, 'cumQuote'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"longAccount\": \"0.4558\",\n \"longShortRatio\": \"0.8376\",\n \"shortAccount\": \"0.5442\",\n \"timestamp\": 1726790400000\n }", "{\n \"longAccount\": \"0.7262\",\n \"longShortRatio\": \"2.6523\",\n \"shortAccount\": \"0.2738\",\n \"pair\": \"BTCUSD\",\n \"timestamp\": 1726790400000\n }" ], "line_end" => 14425, "line_start" => 14393, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'contract')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "timeframe", "value" => "undefined" }, %{ "comment" => nil, "key" => "longShortRatio", "value" => "this.safeNumber (info, 'longShortRatio')" } ], "name" => "parseLongShortRatio", "signature" => "parseLongShortRatio (info: Dict, market: Market = undefined): LongShortRatio", "source" => "parseLongShortRatio (info: Dict, market: Market = undefined): LongShortRatio {\n //\n // linear\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"longAccount\": \"0.4558\",\n // \"longShortRatio\": \"0.8376\",\n // \"shortAccount\": \"0.5442\",\n // \"timestamp\": 1726790400000\n // }\n //\n // inverse\n //\n // {\n // \"longAccount\": \"0.7262\",\n // \"longShortRatio\": \"2.6523\",\n // \"shortAccount\": \"0.2738\",\n // \"pair\": \"BTCUSD\",\n // \"timestamp\": 1726790400000\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n const timestamp = this.safeIntegerOmitZero (info, 'timestamp');\n return {\n 'info': info,\n 'symbol': this.safeSymbol (marketId, market, undefined, 'contract'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'timeframe': undefined,\n 'longShortRatio': this.safeNumber (info, 'longShortRatio'),\n } as LongShortRatio;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"tranId\": 108988250265,\n \"clientTag\":\"\"\n }", "{\n \"asset\": \"USDC\",\n \"amount\": 10,\n \"specifyRepayAssets\": null,\n \"updateTime\": 1727170761267,\n \"success\": true\n }" ], "line_end" => 12978, "line_start" => 12950, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeInteger (info, 'tranId')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (info, 'amount')" }, %{ "comment" => nil, "key" => "symbol", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseMarginLoan", "signature" => "parseMarginLoan (info, currency: Currency = undefined)", "source" => "parseMarginLoan (info, currency: Currency = undefined) {\n //\n // {\n // \"tranId\": 108988250265,\n // \"clientTag\":\"\"\n // }\n //\n // repayCrossMargin alternative endpoint\n //\n // {\n // \"asset\": \"USDC\",\n // \"amount\": 10,\n // \"specifyRepayAssets\": null,\n // \"updateTime\": 1727170761267,\n // \"success\": true\n // }\n //\n const currencyId = this.safeString (info, 'asset');\n const timestamp = this.safeInteger (info, 'updateTime');\n return {\n 'id': this.safeInteger (info, 'tranId'),\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'amount': this.safeNumber (info, 'amount'),\n 'symbol': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 13719, "line_start" => 13702, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "marginMode" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "marginMode", "value" => "reMarginMode" } ], "name" => "parseMarginMode", "signature" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode", "source" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode {\n const marketId = this.safeString (marginMode, 'symbol');\n market = this.safeMarket (marketId, market);\n const marginModeRaw = this.safeBool (marginMode, 'isolated');\n let reMarginMode = undefined;\n if (marginModeRaw !== undefined) {\n reMarginMode = marginModeRaw ? 'isolated' : 'cross';\n }\n const marginTypeRaw = this.safeStringLower (marginMode, 'marginType');\n if (marginTypeRaw !== undefined) {\n reMarginMode = (marginTypeRaw === 'crossed') ? 'cross' : 'isolated';\n }\n return {\n 'info': marginMode,\n 'symbol': market['symbol'],\n 'marginMode': reMarginMode,\n } as MarginMode;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"code\": 200,\n \"msg\": \"Successfully modify position margin.\",\n \"amount\": 0.001,\n \"type\": 1\n }", "{\n symbol: \"XRPUSDT\",\n type: \"1\",\n deltaType: \"TRADE\",\n amount: \"2.57148240\",\n asset: \"USDT\",\n time: \"1711046271555\",\n positionSide: \"BOTH\",\n clientTranId: \"\"\n }" ], "line_end" => 12363, "line_start" => 12320, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "data" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "(rawType === 1) ? 'add' : 'reduce'" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'isolated'" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (data, 'amount')" }, %{ "comment" => nil, "key" => "code", "value" => "this.safeString (data, 'asset')" }, %{ "comment" => nil, "key" => "total", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "(success || noErrorCode) ? 'ok' : 'failed'" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseMarginModification", "signature" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification", "source" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification {\n //\n // add/reduce margin\n //\n // {\n // \"code\": 200,\n // \"msg\": \"Successfully modify position margin.\",\n // \"amount\": 0.001,\n // \"type\": 1\n // }\n //\n // fetchMarginAdjustmentHistory\n //\n // {\n // symbol: \"XRPUSDT\",\n // type: \"1\",\n // deltaType: \"TRADE\",\n // amount: \"2.57148240\",\n // asset: \"USDT\",\n // time: \"1711046271555\",\n // positionSide: \"BOTH\",\n // clientTranId: \"\"\n // }\n //\n const rawType = this.safeInteger (data, 'type');\n const errorCode = this.safeString (data, 'code');\n const marketId = this.safeString (data, 'symbol');\n const timestamp = this.safeInteger (data, 'time');\n market = this.safeMarket (marketId, market, undefined, 'swap');\n const noErrorCode = errorCode === undefined;\n const success = errorCode === '200';\n return {\n 'info': data,\n 'symbol': market['symbol'],\n 'type': (rawType === 1) ? 'add' : 'reduce',\n 'marginMode': 'isolated',\n 'amount': this.safeNumber (data, 'amount'),\n 'code': this.safeString (data, 'asset'),\n 'total': undefined,\n 'status': (success || noErrorCode) ? 'ok' : 'failed',\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }" }, %{ "comment" => nil, "examples" => [ "therefore limits['price']['max'] doesn't have any meaningful value except undefined" ], "line_end" => 3591, "line_start" => 3410, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "lowercaseId", "value" => "lowercaseId" }, %{ "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" => "settleId" }, %{ "comment" => nil, "key" => "type", "value" => "unifiedType" }, %{ "comment" => nil, "key" => "spot", "value" => "spot" }, %{ "comment" => nil, "key" => "margin", "value" => "spot && isMarginTradingAllowed" }, %{ "comment" => nil, "key" => "marginModes", "value" => "marginModes" }, %{ "comment" => nil, "key" => "swap", "value" => "swap" }, %{ "comment" => nil, "key" => "future", "value" => "future" }, %{ "comment" => nil, "key" => "option", "value" => "option" }, %{ "comment" => nil, "key" => "active", "value" => "active" }, %{ "comment" => nil, "key" => "contract", "value" => "contract" }, %{ "comment" => nil, "key" => "linear", "value" => "linear" }, %{ "comment" => nil, "key" => "inverse", "value" => "inverse" }, %{ "comment" => nil, "key" => "taker", "value" => "fees['trading']['taker']" }, %{ "comment" => nil, "key" => "maker", "value" => "fees['trading']['maker']" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contractSize" }, %{ "comment" => nil, "key" => "expiry", "value" => "expiry" }, %{ "comment" => nil, "key" => "expiryDatetime", "value" => "this.iso8601 (expiry)" }, %{ "comment" => nil, "key" => "strike", "value" => "parsedStrike" }, %{ "comment" => nil, "key" => "optionType", "value" => "this.safeStringLower (market, 'side')" }, %{ "comment" => nil, "key" => "precision", "value" => "{\n 'amount': this.parseNumber (this.parsePrecision (this.safeString2 (market, 'quantityPrecision', 'quantityScale'))),\n 'price': this.parseNumber (this.parsePrecision (this.safeString2 (market, 'pricePrecision', 'priceScale'))),\n 'base': this.parseNumber (this.parsePrecision (this.safeString (market, 'baseAssetPrecision'))),\n 'quote': this.parseNumber (this.parsePrecision (this.safeString (market, 'quotePrecision'))),\n }" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': this.safeNumber (market, 'minQty'),\n 'max': this.safeNumber (market, 'maxQty'),\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': undefined,\n },\n }" }, %{ "comment" => nil, "key" => "info", "value" => "market" }, %{ "comment" => nil, "key" => "created", "value" => "this.safeInteger (market, 'onboardDate')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (this.parsePrecision (this.safeString2 (market, 'quantityPrecision', 'quantityScale')))" }, %{ "comment" => nil, "key" => "price", "value" => "this.parseNumber (this.parsePrecision (this.safeString2 (market, 'pricePrecision', 'priceScale')))" }, %{ "comment" => nil, "key" => "base", "value" => "this.parseNumber (this.parsePrecision (this.safeString (market, 'baseAssetPrecision')))" }, %{ "comment" => nil, "key" => "quote", "value" => "this.parseNumber (this.parsePrecision (this.safeString (market, 'quotePrecision')))" }, %{ "comment" => nil, "key" => "leverage", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "amount", "value" => "{\n 'min': this.safeNumber (market, 'minQty'),\n 'max': this.safeNumber (market, 'maxQty'),\n }" }, %{ "comment" => nil, "key" => "price", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "min", "value" => "undefined" }, %{ "comment" => nil, "key" => "max", "value" => "undefined" }, %{ "comment" => nil, "key" => "min", "value" => "this.safeNumber (filter, 'minQty')" }, %{ "comment" => nil, "key" => "max", "value" => "this.safeNumber (filter, 'maxQty')" } ], "name" => "parseMarket", "signature" => "parseMarket (market: Dict): Market", "source" => "parseMarket (market: Dict): Market {\n let swap = false;\n let future = false;\n let option = false;\n const underlying = this.safeString (market, 'underlying');\n const id = this.safeString (market, 'symbol');\n const optionParts = id.split ('-');\n const optionBase = this.safeString (optionParts, 0);\n const lowercaseId = this.safeStringLower (market, 'symbol');\n const baseId = this.safeString (market, 'baseAsset', optionBase);\n const quoteId = this.safeString (market, 'quoteAsset');\n const base = this.safeCurrencyCode (baseId);\n const quote = this.safeCurrencyCode (quoteId);\n const contractType = this.safeString (market, 'contractType');\n let contract = ('contractType' in market);\n let expiry = this.safeInteger2 (market, 'deliveryDate', 'expiryDate');\n let settleId = this.safeString (market, 'marginAsset');\n if ((contractType === 'PERPETUAL') || (expiry === 4133404800000)) { // some swap markets do not have contract type, eg: BTCST\n expiry = undefined;\n swap = true;\n } else if (underlying !== undefined) {\n contract = true;\n option = true;\n settleId = (settleId === undefined) ? 'USDT' : settleId;\n } else if (expiry !== undefined) {\n future = true;\n }\n const settle = this.safeCurrencyCode (settleId);\n const spot = !contract;\n const filters = this.safeList (market, 'filters', []);\n const filtersByType = this.indexBy (filters, 'filterType');\n const status = this.safeString2 (market, 'status', 'contractStatus');\n let contractSize = undefined;\n let fees = this.fees;\n let linear = undefined;\n let inverse = undefined;\n let symbol = base + '/' + quote;\n let strike = undefined;\n if (contract) {\n if (swap) {\n symbol = symbol + ':' + settle;\n } else if (future) {\n symbol = symbol + ':' + settle + '-' + this.yymmdd (expiry);\n } else if (option) {\n strike = this.numberToString (this.parseToNumeric (this.safeString (market, 'strikePrice')));\n symbol = symbol + ':' + settle + '-' + this.yymmdd (expiry) + '-' + strike + '-' + this.safeString (optionParts, 3);\n }\n contractSize = this.safeNumber2 (market, 'contractSize', 'unit', this.parseNumber ('1'));\n linear = settle === quote;\n inverse = settle === base;\n const feesType = linear ? 'linear' : 'inverse';\n fees = this.safeDict (this.fees, feesType, {}) as any;\n }\n let active = (status === 'TRADING');\n if (spot) {\n const permissions = this.safeList (market, 'permissions', []);\n for (let j = 0; j < permissions.length; j++) {\n if (permissions[j] === 'TRD_GRP_003') {\n active = false;\n break;\n }\n }\n }\n const isMarginTradingAllowed = this.safeBool (market, 'isMarginTradingAllowed', false);\n let marginModes = undefined;\n if (spot) {\n const hasCrossMargin = this.inArray (id, this.options['crossMarginPairsData']);\n const hasIsolatedMargin = this.inArray (id, this.options['isolatedMarginPairsData']);\n marginModes = {\n 'cross': hasCrossMargin,\n 'isolated': hasIsolatedMargin,\n };\n } else if (linear || inverse) {\n marginModes = {\n 'cross': true,\n 'isolated': true,\n };\n }\n let unifiedType = undefined;\n if (spot) {\n unifiedType = 'spot';\n } else if (swap) {\n unifiedType = 'swap';\n } else if (future) {\n unifiedType = 'future';\n } else if (option) {\n unifiedType = 'option';\n active = undefined;\n }\n let parsedStrike = undefined;\n if (strike !== undefined) {\n parsedStrike = this.parseToNumeric (strike);\n }\n const entry = {\n 'id': id,\n 'lowercaseId': lowercaseId,\n 'symbol': symbol,\n 'base': base,\n 'quote': quote,\n 'settle': settle,\n 'baseId': baseId,\n 'quoteId': quoteId,\n 'settleId': settleId,\n 'type': unifiedType,\n 'spot': spot,\n 'margin': spot && isMarginTradingAllowed,\n 'marginModes': marginModes,\n 'swap': swap,\n 'future': future,\n 'option': option,\n 'active': active,\n 'contract': contract,\n 'linear': linear,\n 'inverse': inverse,\n 'taker': fees['trading']['taker'],\n 'maker': fees['trading']['maker'],\n 'contractSize': contractSize,\n 'expiry': expiry,\n 'expiryDatetime': this.iso8601 (expiry),\n 'strike': parsedStrike,\n 'optionType': this.safeStringLower (market, 'side'),\n 'precision': {\n 'amount': this.parseNumber (this.parsePrecision (this.safeString2 (market, 'quantityPrecision', 'quantityScale'))),\n 'price': this.parseNumber (this.parsePrecision (this.safeString2 (market, 'pricePrecision', 'priceScale'))),\n 'base': this.parseNumber (this.parsePrecision (this.safeString (market, 'baseAssetPrecision'))),\n 'quote': this.parseNumber (this.parsePrecision (this.safeString (market, 'quotePrecision'))),\n },\n 'limits': {\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': this.safeNumber (market, 'minQty'),\n 'max': this.safeNumber (market, 'maxQty'),\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': undefined,\n },\n },\n 'info': market,\n 'created': this.safeInteger (market, 'onboardDate'), // present in inverse & linear apis\n };\n if ('PRICE_FILTER' in filtersByType) {\n const filter = this.safeDict (filtersByType, 'PRICE_FILTER', {});\n // PRICE_FILTER reports zero values for maxPrice\n // since they updated filter types in November 2018\n // https://github.com/ccxt/ccxt/issues/4286\n // therefore limits['price']['max'] doesn't have any meaningful value except undefined\n entry['limits']['price'] = {\n 'min': this.safeNumber (filter, 'minPrice'),\n 'max': this.safeNumber (filter, 'maxPrice'),\n };\n entry['precision']['price'] = this.safeNumber (filter, 'tickSize');\n }\n if ('LOT_SIZE' in filtersByType) {\n const filter = this.safeDict (filtersByType, 'LOT_SIZE', {});\n entry['precision']['amount'] = this.safeNumber (filter, 'stepSize');\n entry['limits']['amount'] = {\n 'min': this.safeNumber (filter, 'minQty'),\n 'max': this.safeNumber (filter, 'maxQty'),\n };\n }\n if ('MARKET_LOT_SIZE' in filtersByType) {\n const filter = this.safeDict (filtersByType, 'MARKET_LOT_SIZE', {});\n entry['limits']['market'] = {\n 'min': this.safeNumber (filter, 'minQty'),\n 'max': this.safeNumber (filter, 'maxQty'),\n };\n }\n if (('MIN_NOTIONAL' in filtersByType) || ('NOTIONAL' in filtersByType)) { // notional added in 12/04/23 to spot testnet\n const filter = this.safeDict2 (filtersByType, 'MIN_NOTIONAL', 'NOTIONAL', {});\n entry['limits']['cost']['min'] = this.safeNumber2 (filter, 'minNotional', 'notional');\n entry['limits']['cost']['max'] = this.safeNumber (filter, 'maxNotional');\n }\n return entry;\n }" }, %{ "comment" => nil, "examples" => [ "@param {object} info Exchange response for 1 market", "@param {object} market CCXT market", "{\n \"symbol\": \"SUSHIUSDT\",\n \"brackets\": [\n {\n \"bracket\": 1,\n \"initialLeverage\": 50,\n \"notionalCap\": 50000,\n \"notionalFloor\": 0,\n \"maintMarginRatio\": 0.01,\n \"cum\": 0.0\n },\n ...\n ]\n }" ], "line_end" => 10735, "line_start" => 10694, "mappings" => [], "name" => "parseMarketLeverageTiers", "signature" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[]", "source" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[] {\n /**\n * @ignore\n * @method\n * @param {object} info Exchange response for 1 market\n * @param {object} market CCXT market\n */\n //\n // {\n // \"symbol\": \"SUSHIUSDT\",\n // \"brackets\": [\n // {\n // \"bracket\": 1,\n // \"initialLeverage\": 50,\n // \"notionalCap\": 50000,\n // \"notionalFloor\": 0,\n // \"maintMarginRatio\": 0.01,\n // \"cum\": 0.0\n // },\n // ...\n // ]\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'contract');\n const brackets = this.safeList (info, 'brackets', []);\n const tiers = [];\n for (let j = 0; j < brackets.length; j++) {\n const bracket = brackets[j];\n tiers.push ({\n 'tier': this.safeNumber (bracket, 'bracket'),\n 'symbol': this.safeSymbol (marketId, market),\n 'currency': market['quote'],\n 'minNotional': this.safeNumber2 (bracket, 'notionalFloor', 'qtyFloor'),\n 'maxNotional': this.safeNumber2 (bracket, 'notionalCap', 'qtyCap'),\n 'maintenanceMarginRate': this.safeNumber (bracket, 'maintMarginRatio'),\n 'maxLeverage': this.safeNumber (bracket, 'initialLeverage'),\n 'info': bracket,\n });\n }\n return tiers as LeverageTier[];\n }" }, %{ "comment" => nil, "examples" => [ "[\n 1591478520000, // open time\n \"0.02501300\", // open\n \"0.02501800\", // high\n \"0.02500000\", // low\n \"0.02500000\", // close\n \"22.19000000\", // volume\n 1591478579999, // close time\n \"0.55490906\", // quote asset volume, base asset volume for dapi\n 40, // number of trades\n \"10.92900000\", // taker buy base asset volume\n \"0.27336462\", // taker buy quote asset volume\n \"0\" // ignore\n ]", "[\n [\n 1591256460000, // Open time\n \"9653.29201333\", // Open\n \"9654.56401333\", // High\n \"9653.07367333\", // Low\n \"9653.07367333\", // Close (or latest price)\n \"0\", // Ignore\n 1591256519999, // Close time\n \"0\", // Ignore\n 60, // Number of bisic data\n \"0\", // Ignore\n \"0\", // Ignore\n \"0\" // Ignore\n ]\n ]", "{\n \"open\": \"32.2\",\n \"high\": \"32.2\",\n \"low\": \"32.2\",\n \"close\": \"32.2\",\n \"volume\": \"0\",\n \"interval\": \"5m\",\n \"tradeCount\": 0,\n \"takerVolume\": \"0\",\n \"takerAmount\": \"0\",\n \"amount\": \"0\",\n \"openTime\": 1677096900000,\n \"closeTime\": 1677097200000\n }" ], "line_end" => 4654, "line_start" => 4592, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n // when api method = publicGetKlines || fapiPublicGetKlines || dapiPublicGetKlines\n // [\n // 1591478520000, // open time\n // \"0.02501300\", // open\n // \"0.02501800\", // high\n // \"0.02500000\", // low\n // \"0.02500000\", // close\n // \"22.19000000\", // volume\n // 1591478579999, // close time\n // \"0.55490906\", // quote asset volume, base asset volume for dapi\n // 40, // number of trades\n // \"10.92900000\", // taker buy base asset volume\n // \"0.27336462\", // taker buy quote asset volume\n // \"0\" // ignore\n // ]\n //\n // when api method = fapiPublicGetMarkPriceKlines || fapiPublicGetIndexPriceKlines\n // [\n // [\n // 1591256460000, // Open time\n // \"9653.29201333\", // Open\n // \"9654.56401333\", // High\n // \"9653.07367333\", // Low\n // \"9653.07367333\", // Close (or latest price)\n // \"0\", // Ignore\n // 1591256519999, // Close time\n // \"0\", // Ignore\n // 60, // Number of bisic data\n // \"0\", // Ignore\n // \"0\", // Ignore\n // \"0\" // Ignore\n // ]\n // ]\n //\n // options\n //\n // {\n // \"open\": \"32.2\",\n // \"high\": \"32.2\",\n // \"low\": \"32.2\",\n // \"close\": \"32.2\",\n // \"volume\": \"0\",\n // \"interval\": \"5m\",\n // \"tradeCount\": 0,\n // \"takerVolume\": \"0\",\n // \"takerAmount\": \"0\",\n // \"amount\": \"0\",\n // \"openTime\": 1677096900000,\n // \"closeTime\": 1677097200000\n // }\n //\n const inverse = this.safeBool (market, 'inverse');\n const volumeIndex = inverse ? 7 : 5;\n return [\n this.safeInteger2 (ohlcv, 0, 'openTime'),\n this.safeNumber2 (ohlcv, 1, 'open'),\n this.safeNumber2 (ohlcv, 2, 'high'),\n this.safeNumber2 (ohlcv, 3, 'low'),\n this.safeNumber2 (ohlcv, 4, 'close'),\n this.safeNumber2 (ohlcv, volumeIndex, 'volume'),\n ];\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 13146, "line_start" => 13129, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (id, market, undefined, 'contract')" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "market['inverse'] ? undefined : amount" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "value" }, %{ "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 const timestamp = this.safeInteger2 (interest, 'timestamp', 'time');\n const id = this.safeString (interest, 'symbol');\n const amount = this.safeNumber2 (interest, 'sumOpenInterest', 'openInterest');\n const value = this.safeNumber2 (interest, 'sumOpenInterestValue', 'sumOpenInterestUsd');\n // Inverse returns the number of contracts different from the base or quote volume in this case\n // compared with https://www.binance.com/en/futures/funding-history/quarterly/4\n return this.safeOpenInterest ({\n 'symbol': this.safeSymbol (id, market, undefined, 'contract'),\n 'baseVolume': market['inverse'] ? undefined : amount, // deprecated\n 'quoteVolume': value, // deprecated\n 'openInterestAmount': amount,\n 'openInterestValue': value,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC-241227-80000-C\",\n \"priceChange\": \"0\",\n \"priceChangePercent\": \"0\",\n \"lastPrice\": \"2750\",\n \"lastQty\": \"0\",\n \"open\": \"2750\",\n \"high\": \"2750\",\n \"low\": \"2750\",\n \"volume\": \"0\",\n \"amount\": \"0\",\n \"bidPrice\": \"4880\",\n \"askPrice\": \"0\",\n \"openTime\": 0,\n \"closeTime\": 0,\n \"firstTradeId\": 0,\n \"tradeCount\": 0,\n \"strikePrice\": \"80000\",\n \"exercisePrice\": \"63944.09893617\"\n }" ], "line_end" => 13809, "line_start" => 13765, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "chain" }, %{ "comment" => nil, "key" => "currency", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "impliedVolatility", "value" => "undefined" }, %{ "comment" => nil, "key" => "openInterest", "value" => "undefined" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "this.safeNumber (chain, 'bidPrice')" }, %{ "comment" => nil, "key" => "askPrice", "value" => "this.safeNumber (chain, 'askPrice')" }, %{ "comment" => nil, "key" => "midPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber (chain, 'lastPrice')" }, %{ "comment" => nil, "key" => "underlyingPrice", "value" => "this.safeNumber (chain, 'exercisePrice')" }, %{ "comment" => nil, "key" => "change", "value" => "this.safeNumber (chain, 'priceChange')" }, %{ "comment" => nil, "key" => "percentage", "value" => "this.safeNumber (chain, 'priceChangePercent')" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeNumber (chain, 'volume')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "undefined" } ], "name" => "parseOption", "signature" => "parseOption (chain: Dict, currency: Currency = undefined, market: Market = undefined): Option", "source" => "parseOption (chain: Dict, currency: Currency = undefined, market: Market = undefined): Option {\n //\n // {\n // \"symbol\": \"BTC-241227-80000-C\",\n // \"priceChange\": \"0\",\n // \"priceChangePercent\": \"0\",\n // \"lastPrice\": \"2750\",\n // \"lastQty\": \"0\",\n // \"open\": \"2750\",\n // \"high\": \"2750\",\n // \"low\": \"2750\",\n // \"volume\": \"0\",\n // \"amount\": \"0\",\n // \"bidPrice\": \"4880\",\n // \"askPrice\": \"0\",\n // \"openTime\": 0,\n // \"closeTime\": 0,\n // \"firstTradeId\": 0,\n // \"tradeCount\": 0,\n // \"strikePrice\": \"80000\",\n // \"exercisePrice\": \"63944.09893617\"\n // }\n //\n const marketId = this.safeString (chain, 'symbol');\n market = this.safeMarket (marketId, market);\n return {\n 'info': chain,\n 'currency': undefined,\n 'symbol': market['symbol'],\n 'timestamp': undefined,\n 'datetime': undefined,\n 'impliedVolatility': undefined,\n 'openInterest': undefined,\n 'bidPrice': this.safeNumber (chain, 'bidPrice'),\n 'askPrice': this.safeNumber (chain, 'askPrice'),\n 'midPrice': undefined,\n 'markPrice': undefined,\n 'lastPrice': this.safeNumber (chain, 'lastPrice'),\n 'underlyingPrice': this.safeNumber (chain, 'exercisePrice'),\n 'change': this.safeNumber (chain, 'priceChange'),\n 'percentage': this.safeNumber (chain, 'priceChangePercent'),\n 'baseVolume': this.safeNumber (chain, 'volume'),\n 'quoteVolume': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"entryPrice\": \"27.70000000\",\n \"symbol\": \"ETH-230426-1850-C\",\n \"side\": \"LONG\",\n \"quantity\": \"0.50000000\",\n \"reducibleQty\": \"0.50000000\",\n \"markValue\": \"10.250000000\",\n \"ror\": \"-0.2599\",\n \"unrealizedPNL\": \"-3.600000000\",\n \"markPrice\": \"20.5\",\n \"strikePrice\": \"1850.00000000\",\n \"positionCost\": \"13.85000000\",\n \"expiryDate\": 1682496000000,\n \"priceScale\": 1,\n \"quantityScale\": 2,\n \"optionSide\": \"CALL\",\n \"quoteAsset\": \"USDT\",\n \"time\": 1682492427106\n }" ], "line_end" => 10897, "line_start" => 10841, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.safeNumber (position, 'entryPrice')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (position, 'markPrice')" }, %{ "comment" => nil, "key" => "notional", "value" => "this.safeNumber (position, 'markValue')" }, %{ "comment" => nil, "key" => "collateral", "value" => "this.safeNumber (position, 'positionCost')" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.safeNumber (position, 'unrealizedPNL')" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (quantity)" }, %{ "comment" => nil, "key" => "contractSize", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "hedged", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "leverage", "value" => "undefined" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginMode", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" } ], "name" => "parseOptionPosition", "signature" => "parseOptionPosition (position: Dict, market: Market = undefined)", "source" => "parseOptionPosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"entryPrice\": \"27.70000000\",\n // \"symbol\": \"ETH-230426-1850-C\",\n // \"side\": \"LONG\",\n // \"quantity\": \"0.50000000\",\n // \"reducibleQty\": \"0.50000000\",\n // \"markValue\": \"10.250000000\",\n // \"ror\": \"-0.2599\",\n // \"unrealizedPNL\": \"-3.600000000\",\n // \"markPrice\": \"20.5\",\n // \"strikePrice\": \"1850.00000000\",\n // \"positionCost\": \"13.85000000\",\n // \"expiryDate\": 1682496000000,\n // \"priceScale\": 1,\n // \"quantityScale\": 2,\n // \"optionSide\": \"CALL\",\n // \"quoteAsset\": \"USDT\",\n // \"time\": 1682492427106\n // }\n //\n const marketId = this.safeString (position, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'swap');\n const symbol = market['symbol'];\n const side = this.safeStringLower (position, 'side');\n let quantity = this.safeString (position, 'quantity');\n if (side !== 'long') {\n quantity = Precise.stringMul ('-1', quantity);\n }\n const timestamp = this.safeInteger (position, 'time');\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': symbol,\n 'entryPrice': this.safeNumber (position, 'entryPrice'),\n 'markPrice': this.safeNumber (position, 'markPrice'),\n 'notional': this.safeNumber (position, 'markValue'),\n 'collateral': this.safeNumber (position, 'positionCost'),\n 'unrealizedPnl': this.safeNumber (position, 'unrealizedPNL'),\n 'side': side,\n 'contracts': this.parseNumber (quantity),\n 'contractSize': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'hedged': undefined,\n 'maintenanceMargin': undefined,\n 'maintenanceMarginPercentage': undefined,\n 'initialMargin': undefined,\n 'initialMarginPercentage': undefined,\n 'leverage': undefined,\n 'liquidationPrice': undefined,\n 'marginRatio': undefined,\n 'marginMode': undefined,\n 'percentage': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"LTCBTC\",\n \"orderId\": 1,\n \"clientOrderId\": \"myOrder1\",\n \"price\": \"0.1\",\n \"origQty\": \"1.0\",\n \"executedQty\": \"0.0\",\n \"cummulativeQuoteQty\": \"0.0\",\n \"status\": \"NEW\",\n \"timeInForce\": \"GTC\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY\",\n \"stopPrice\": \"0.0\",\n \"icebergQty\": \"0.0\",\n \"time\": 1499827319559,\n \"updateTime\": 1499827319559,\n \"isWorking\": true\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"orderId\": 16383176297,\n \"orderListId\": -1,\n \"clientOrderId\": \"x-TKT5PX2F22ecb58eb9074fb1be018c\",\n \"transactTime\": 1670891847932,\n \"price\": \"13500.00000000\",\n \"origQty\": \"0.00085000\",\n \"executedQty\": \"0.00000000\",\n \"cummulativeQuoteQty\": \"0.00000000\",\n \"status\": \"NEW\",\n \"timeInForce\": \"GTC\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY\",\n \"fills\": []\n }", "{\n \"orderId\": 151007482392,\n \"symbol\": \"BTCUSDT\",\n \"status\": \"NEW\",\n \"clientOrderId\": \"web_pCCGp9AIHjziKLlpGpXI\",\n \"price\": \"25000\",\n \"avgPrice\": \"0.00000\",\n \"origQty\": \"0.001\",\n \"executedQty\": \"0\",\n \"cumQty\": \"0\",\n \"cumQuote\": \"0\",\n \"timeInForce\": \"GTC\",\n \"type\": \"LIMIT\",\n \"reduceOnly\": false,\n \"closePosition\": false,\n \"side\": \"BUY\",\n \"positionSide\": \"BOTH\",\n \"stopPrice\": \"0\",\n \"workingType\": \"CONTRACT_PRICE\",\n \"priceProtect\": false,\n \"origType\": \"LIMIT\",\n \"updateTime\": 1684300587845\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"orderId\": 1,\n \"clientOrderId\": \"myOrder1\",\n \"price\": \"0.1\",\n \"origQty\": \"1.0\",\n \"executedQty\": \"1.0\",\n \"cumQuote\": \"10.0\",\n \"status\": \"NEW\",\n \"timeInForce\": \"GTC\",\n \"type\": \"LIMIT\",\n \"side\": \"BUY\",\n \"stopPrice\": \"0.0\",\n \"updateTime\": 1499827319559\n }", "createOrder with { \"newOrderRespType\": \"FULL\" }" ], "line_end" => 6233, "line_start" => 5633, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "status", "value" => "'rejected'" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeStringN (order, [ 'strategyId', 'orderId', 'algoId' ])" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeStringN (order, [ 'clientOrderId', 'newClientStrategyId', 'clientAlgoId' ])" }, %{ "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" => "lastUpdateTimestamp" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseOrderType (type)" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "timeInForce" }, %{ "comment" => nil, "key" => "postOnly", "value" => "postOnly" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "this.safeBool (order, 'reduceOnly')" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "triggerPrice" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "filled", "value" => "filled" }, %{ "comment" => nil, "key" => "remaining", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "trades", "value" => "fills" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // spot\n //\n // {\n // \"symbol\": \"LTCBTC\",\n // \"orderId\": 1,\n // \"clientOrderId\": \"myOrder1\",\n // \"price\": \"0.1\",\n // \"origQty\": \"1.0\",\n // \"executedQty\": \"0.0\",\n // \"cummulativeQuoteQty\": \"0.0\",\n // \"status\": \"NEW\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY\",\n // \"stopPrice\": \"0.0\",\n // \"icebergQty\": \"0.0\",\n // \"time\": 1499827319559,\n // \"updateTime\": 1499827319559,\n // \"isWorking\": true\n // }\n //\n // spot: editOrder\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"orderId\": 16383176297,\n // \"orderListId\": -1,\n // \"clientOrderId\": \"x-TKT5PX2F22ecb58eb9074fb1be018c\",\n // \"transactTime\": 1670891847932,\n // \"price\": \"13500.00000000\",\n // \"origQty\": \"0.00085000\",\n // \"executedQty\": \"0.00000000\",\n // \"cummulativeQuoteQty\": \"0.00000000\",\n // \"status\": \"NEW\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY\",\n // \"fills\": []\n // }\n //\n // swap and future: editOrder\n //\n // {\n // \"orderId\": 151007482392,\n // \"symbol\": \"BTCUSDT\",\n // \"status\": \"NEW\",\n // \"clientOrderId\": \"web_pCCGp9AIHjziKLlpGpXI\",\n // \"price\": \"25000\",\n // \"avgPrice\": \"0.00000\",\n // \"origQty\": \"0.001\",\n // \"executedQty\": \"0\",\n // \"cumQty\": \"0\",\n // \"cumQuote\": \"0\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"closePosition\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"0\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"origType\": \"LIMIT\",\n // \"updateTime\": 1684300587845\n // }\n //\n // futures\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"orderId\": 1,\n // \"clientOrderId\": \"myOrder1\",\n // \"price\": \"0.1\",\n // \"origQty\": \"1.0\",\n // \"executedQty\": \"1.0\",\n // \"cumQuote\": \"10.0\",\n // \"status\": \"NEW\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY\",\n // \"stopPrice\": \"0.0\",\n // \"updateTime\": 1499827319559\n // }\n //\n // createOrder with { \"newOrderRespType\": \"FULL\" }\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"orderId\": 5403233939,\n // \"orderListId\": -1,\n // \"clientOrderId\": \"x-TKT5PX2F5e669e75b6c14f69a2c43e\",\n // \"transactTime\": 1617151923742,\n // \"price\": \"0.00000000\",\n // \"origQty\": \"0.00050000\",\n // \"executedQty\": \"0.00050000\",\n // \"cummulativeQuoteQty\": \"29.47081500\",\n // \"status\": \"FILLED\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"MARKET\",\n // \"side\": \"BUY\",\n // \"fills\": [\n // {\n // \"price\": \"58941.63000000\",\n // \"qty\": \"0.00050000\",\n // \"commission\": \"0.00007050\",\n // \"commissionAsset\": \"BNB\",\n // \"tradeId\": 737466631\n // }\n // ]\n // }\n //\n // delivery\n //\n // {\n // \"orderId\": \"18742727411\",\n // \"symbol\": \"ETHUSD_PERP\",\n // \"pair\": \"ETHUSD\",\n // \"status\": \"FILLED\",\n // \"clientOrderId\": \"x-xcKtGhcu3e2d1503fdd543b3b02419\",\n // \"price\": \"0\",\n // \"avgPrice\": \"4522.14\",\n // \"origQty\": \"1\",\n // \"executedQty\": \"1\",\n // \"cumBase\": \"0.00221134\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"MARKET\",\n // \"reduceOnly\": false,\n // \"closePosition\": false,\n // \"side\": \"SELL\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"0\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"origType\": \"MARKET\",\n // \"time\": \"1636061952660\",\n // \"updateTime\": \"1636061952660\"\n // }\n //\n // option: createOrder, fetchOrder, fetchOpenOrders, fetchOrders\n //\n // {\n // \"orderId\": 4728833085436977152,\n // \"symbol\": \"ETH-230211-1500-C\",\n // \"price\": \"10.0\",\n // \"quantity\": \"1.00\",\n // \"executedQty\": \"0.00\",\n // \"fee\": \"0\",\n // \"side\": \"BUY\",\n // \"type\": \"LIMIT\",\n // \"timeInForce\": \"GTC\",\n // \"reduceOnly\": false,\n // \"postOnly\": false,\n // \"createTime\": 1676083034462,\n // \"updateTime\": 1676083034462,\n // \"status\": \"ACCEPTED\",\n // \"avgPrice\": \"0\",\n // \"source\": \"API\",\n // \"clientOrderId\": \"\",\n // \"priceScale\": 1,\n // \"quantityScale\": 2,\n // \"optionSide\": \"CALL\",\n // \"quoteAsset\": \"USDT\",\n // \"lastTrade\": {\"id\":\"69\",\"time\":\"1676084430567\",\"price\":\"24.9\",\"qty\":\"1.00\"},\n // \"mmp\": false\n // }\n //\n // cancelOrders/createOrders\n //\n // {\n // \"code\": -4005,\n // \"msg\": \"Quantity greater than max quantity.\"\n // }\n //\n // createOrder, fetchOpenOrders, fetchOrder, cancelOrder, fetchOrders: portfolio margin linear swap and future\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"side\": \"BUY\",\n // \"executedQty\": \"0.000\",\n // \"orderId\": 258649539704,\n // \"goodTillDate\": 0,\n // \"avgPrice\": \"0\",\n // \"origQty\": \"0.010\",\n // \"clientOrderId\": \"x-xcKtGhcu02573c6f15e544e990057b\",\n // \"positionSide\": \"BOTH\",\n // \"cumQty\": \"0.000\",\n // \"updateTime\": 1707110415436,\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"price\": \"35000.00\",\n // \"cumQuote\": \"0.00000\",\n // \"selfTradePreventionMode\": \"NONE\",\n // \"timeInForce\": \"GTC\",\n // \"status\": \"NEW\"\n // }\n //\n // createOrder, fetchOpenOrders, fetchOrder, cancelOrder, fetchOrders: portfolio margin inverse swap and future\n //\n // {\n // \"symbol\": \"ETHUSD_PERP\",\n // \"side\": \"BUY\",\n // \"cumBase\": \"0\",\n // \"executedQty\": \"0\",\n // \"orderId\": 71275227732,\n // \"avgPrice\": \"0.00\",\n // \"origQty\": \"1\",\n // \"clientOrderId\": \"x-xcKtGhcuca5af3acfb5044198c5398\",\n // \"positionSide\": \"BOTH\",\n // \"cumQty\": \"0\",\n // \"updateTime\": 1707110994334,\n // \"type\": \"LIMIT\",\n // \"pair\": \"ETHUSD\",\n // \"reduceOnly\": false,\n // \"price\": \"2000\",\n // \"timeInForce\": \"GTC\",\n // \"status\": \"NEW\"\n // }\n //\n // createOrder, fetchOpenOrders, fetchOpenOrder: portfolio margin linear swap and future conditional\n //\n // {\n // \"newClientStrategyId\": \"x-xcKtGhcu27f109953d6e4dc0974006\",\n // \"strategyId\": 3645916,\n // \"strategyStatus\": \"NEW\",\n // \"strategyType\": \"STOP\",\n // \"origQty\": \"0.010\",\n // \"price\": \"35000.00\",\n // \"reduceOnly\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"45000.00\",\n // \"symbol\": \"BTCUSDT\",\n // \"timeInForce\": \"GTC\",\n // \"bookTime\": 1707112625879,\n // \"updateTime\": 1707112625879,\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"goodTillDate\": 0,\n // \"selfTradePreventionMode\": \"NONE\"\n // }\n //\n // createOrder, fetchOpenOrders: portfolio margin inverse swap and future conditional\n //\n // {\n // \"newClientStrategyId\": \"x-xcKtGhcuc6b86f053bb34933850739\",\n // \"strategyId\": 1423462,\n // \"strategyStatus\": \"NEW\",\n // \"strategyType\": \"STOP\",\n // \"origQty\": \"1\",\n // \"price\": \"2000\",\n // \"reduceOnly\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"3000\",\n // \"symbol\": \"ETHUSD_PERP\",\n // \"timeInForce\": \"GTC\",\n // \"bookTime\": 1707113098840,\n // \"updateTime\": 1707113098840,\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false\n // }\n //\n // createOrder, cancelAllOrders, cancelOrder: portfolio margin spot margin\n //\n // {\n // \"clientOrderId\": \"x-TKT5PX2Fe9ef29d8346440f0b28b86\",\n // \"cummulativeQuoteQty\": \"0.00000000\",\n // \"executedQty\": \"0.00000000\",\n // \"fills\": [],\n // \"orderId\": 24684460474,\n // \"origQty\": \"0.00100000\",\n // \"price\": \"35000.00000000\",\n // \"selfTradePreventionMode\": \"EXPIRE_MAKER\",\n // \"side\": \"BUY\",\n // \"status\": \"NEW\",\n // \"symbol\": \"BTCUSDT\",\n // \"timeInForce\": \"GTC\",\n // \"transactTime\": 1707113538870,\n // \"type\": \"LIMIT\"\n // }\n //\n // fetchOpenOrders, fetchOrder, fetchOrders: portfolio margin spot margin\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"orderId\": 24700763749,\n // \"clientOrderId\": \"x-TKT5PX2F6f724c2a4af6425f98c7b6\",\n // \"price\": \"35000.00000000\",\n // \"origQty\": \"0.00100000\",\n // \"executedQty\": \"0.00000000\",\n // \"cummulativeQuoteQty\": \"0.00000000\",\n // \"status\": \"NEW\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"side\": \"BUY\",\n // \"stopPrice\": \"0.00000000\",\n // \"icebergQty\": \"0.00000000\",\n // \"time\": 1707199187679,\n // \"updateTime\": 1707199187679,\n // \"isWorking\": true,\n // \"accountId\": 200180970,\n // \"selfTradePreventionMode\": \"EXPIRE_MAKER\",\n // \"preventedMatchId\": null,\n // \"preventedQuantity\": null\n // }\n //\n // cancelOrder: portfolio margin linear and inverse swap conditional\n //\n // {\n // \"strategyId\": 3733211,\n // \"newClientStrategyId\": \"x-xcKtGhcuaf166172ed504cd1bc0396\",\n // \"strategyType\": \"STOP\",\n // \"strategyStatus\": \"CANCELED\",\n // \"origQty\": \"0.010\",\n // \"price\": \"35000.00\",\n // \"reduceOnly\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"50000.00\", // ignored with trailing orders\n // \"symbol\": \"BTCUSDT\",\n // \"timeInForce\": \"GTC\",\n // \"activatePrice\": null, // only return with trailing orders\n // \"priceRate\": null, // only return with trailing orders\n // \"bookTime\": 1707270098774,\n // \"updateTime\": 1707270119261,\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"goodTillDate\": 0,\n // \"selfTradePreventionMode\": \"NONE\"\n // }\n //\n // fetchOrders: portfolio margin linear and inverse swap conditional\n //\n // {\n // \"newClientStrategyId\": \"x-xcKtGhcuaf166172ed504cd1bc0396\",\n // \"strategyId\": 3733211,\n // \"strategyStatus\": \"CANCELLED\",\n // \"strategyType\": \"STOP\",\n // \"origQty\": \"0.010\",\n // \"price\": \"35000\",\n // \"orderId\": 0,\n // \"reduceOnly\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"50000\",\n // \"symbol\": \"BTCUSDT\",\n // \"type\": \"LIMIT\",\n // \"bookTime\": 1707270098774,\n // \"updateTime\": 1707270119261,\n // \"timeInForce\": \"GTC\",\n // \"triggerTime\": 0,\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"goodTillDate\": 0,\n // \"selfTradePreventionMode\": \"NONE\"\n // }\n //\n // fetchOpenOrder: linear swap\n //\n // {\n // \"orderId\": 3697213934,\n // \"symbol\": \"BTCUSDT\",\n // \"status\": \"NEW\",\n // \"clientOrderId\": \"x-xcKtGhcufb20c5a7761a4aa09aa156\",\n // \"price\": \"33000.00\",\n // \"avgPrice\": \"0.00000\",\n // \"origQty\": \"0.010\",\n // \"executedQty\": \"0.000\",\n // \"cumQuote\": \"0.00000\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"closePosition\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"0.00\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"origType\": \"LIMIT\",\n // \"priceMatch\": \"NONE\",\n // \"selfTradePreventionMode\": \"NONE\",\n // \"goodTillDate\": 0,\n // \"time\": 1707892893502,\n // \"updateTime\": 1707892893515\n // }\n //\n // fetchOpenOrder: inverse swap\n //\n // {\n // \"orderId\": 597368542,\n // \"symbol\": \"BTCUSD_PERP\",\n // \"pair\": \"BTCUSD\",\n // \"status\": \"NEW\",\n // \"clientOrderId\": \"x-xcKtGhcubbde7ba93b1a4ab881eff3\",\n // \"price\": \"35000\",\n // \"avgPrice\": \"0\",\n // \"origQty\": \"1\",\n // \"executedQty\": \"0\",\n // \"cumBase\": \"0\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"closePosition\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"stopPrice\": \"0\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false,\n // \"origType\": \"LIMIT\",\n // \"time\": 1707893453199,\n // \"updateTime\": 1707893453199\n // }\n //\n // fetchOpenOrder: linear portfolio margin\n //\n // {\n // \"orderId\": 264895013409,\n // \"symbol\": \"BTCUSDT\",\n // \"status\": \"NEW\",\n // \"clientOrderId\": \"x-xcKtGhcu6278f1adbdf14f74ab432e\",\n // \"price\": \"35000\",\n // \"avgPrice\": \"0\",\n // \"origQty\": \"0.010\",\n // \"executedQty\": \"0\",\n // \"cumQuote\": \"0\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"LONG\",\n // \"origType\": \"LIMIT\",\n // \"time\": 1707893839364,\n // \"updateTime\": 1707893839364,\n // \"goodTillDate\": 0,\n // \"selfTradePreventionMode\": \"NONE\"\n // }\n //\n // fetchOpenOrder: inverse portfolio margin\n //\n // {\n // \"orderId\": 71790316950,\n // \"symbol\": \"ETHUSD_PERP\",\n // \"pair\": \"ETHUSD\",\n // \"status\": \"NEW\",\n // \"clientOrderId\": \"x-xcKtGhcuec11030474204ab08ba2c2\",\n // \"price\": \"2500\",\n // \"avgPrice\": \"0\",\n // \"origQty\": \"1\",\n // \"executedQty\": \"0\",\n // \"cumBase\": \"0\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"LIMIT\",\n // \"reduceOnly\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"LONG\",\n // \"origType\": \"LIMIT\",\n // \"time\": 1707894181694,\n // \"updateTime\": 1707894181694\n // }\n //\n // fetchOpenOrder: inverse portfolio margin conditional\n //\n // {\n // \"newClientStrategyId\": \"x-xcKtGhcu2da9c765294b433994ffce\",\n // \"strategyId\": 1423501,\n // \"strategyStatus\": \"NEW\",\n // \"strategyType\": \"STOP\",\n // \"origQty\": \"1\",\n // \"price\": \"2500\",\n // \"reduceOnly\": false,\n // \"side\": \"BUY\",\n // \"positionSide\": \"LONG\",\n // \"stopPrice\": \"4000\",\n // \"symbol\": \"ETHUSD_PERP\",\n // \"bookTime\": 1707894782679,\n // \"updateTime\": 1707894782679,\n // \"timeInForce\": \"GTC\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceProtect\": false\n // }\n //\n // createOrder, fetchOrder, fetchOpenOrders, fetchOrders, cancelOrderWs, createOrderWs: linear swap conditional order\n //\n // {\n // \"algoId\": 3358,\n // \"clientAlgoId\": \"yT58zmV3DSzMBQxc5tAJXU\",\n // \"algoType\": \"CONDITIONAL\",\n // \"orderType\": \"STOP\",\n // \"symbol\": \"BTCUSDT\",\n // \"side\": \"BUY\",\n // \"positionSide\": \"BOTH\",\n // \"timeInForce\": \"GTC\",\n // \"quantity\": \"0.002\",\n // \"algoStatus\": \"NEW\",\n // \"triggerPrice\": \"100000.00\",\n // \"price\": \"102000.00\",\n // \"icebergQuantity\": null,\n // \"selfTradePreventionMode\": \"EXPIRE_MAKER\",\n // \"workingType\": \"CONTRACT_PRICE\",\n // \"priceMatch\": \"NONE\",\n // \"closePosition\": false,\n // \"priceProtect\": false,\n // \"reduceOnly\": false,\n // \"createTime\": 1763458576201,\n // \"updateTime\": 1763458576201,\n // \"triggerTime\": 0,\n // \"goodTillDate\": 0\n // }\n //\n // cancelOrder: linear swap conditional\n //\n // {\n // \"algoId\": 3358,\n // \"clientAlgoId\": \"yT58zmV3DSzMBQxc5tAJXU\",\n // \"code\": \"200\",\n // \"msg\": \"success\"\n // }\n //\n const code = this.safeString (order, 'code');\n if (code !== undefined) {\n // cancelOrders/createOrders might have a partial success\n const msg = this.safeString (order, 'msg');\n if ((code !== '200') && !((msg === 'success') || (msg === 'The operation of cancel all open order is done.'))) {\n return this.safeOrder ({ 'info': order, 'status': 'rejected' }, market);\n }\n }\n const status = this.parseOrderStatus (this.safeStringN (order, [ 'status', 'strategyStatus', 'algoStatus' ]));\n const marketId = this.safeString (order, 'symbol');\n const isContract = ('positionSide' in order) || ('cumQuote' in order);\n const marketType = isContract ? 'contract' : 'spot';\n const symbol = this.safeSymbol (marketId, market, undefined, marketType);\n const filled = this.safeString (order, 'executedQty', '0');\n const timestamp = this.safeIntegerN (order, [ 'time', 'createTime', 'workingTime', 'transactTime', 'updateTime' ]); // order of the keys matters here\n let lastTradeTimestamp = undefined;\n if (('transactTime' in order) || ('updateTime' in order)) {\n const timestampValue = this.safeInteger2 (order, 'updateTime', 'transactTime');\n if (status === 'open') {\n if (Precise.stringGt (filled, '0')) {\n lastTradeTimestamp = timestampValue;\n }\n } else if (status === 'closed') {\n lastTradeTimestamp = timestampValue;\n }\n }\n const lastUpdateTimestamp = this.safeInteger2 (order, 'transactTime', 'updateTime');\n const average = this.safeString (order, 'avgPrice');\n const price = this.safeString (order, 'price');\n const amount = this.safeString2 (order, 'origQty', 'quantity');\n // - Spot/Margin market: cummulativeQuoteQty\n // - Futures market: cumQuote.\n // Note this is not the actual cost, since Binance futures uses leverage to calculate margins.\n let cost = this.safeString2 (order, 'cummulativeQuoteQty', 'cumQuote');\n cost = this.safeString (order, 'cumBase', cost);\n const type = this.safeStringLower2 (order, 'type', 'orderType');\n const side = this.safeStringLower (order, 'side');\n const fills = this.safeList (order, 'fills', []);\n let timeInForce = this.safeString (order, 'timeInForce');\n if (timeInForce === 'GTX') {\n // GTX means \"Good Till Crossing\" and is an equivalent way of saying Post Only\n timeInForce = 'PO';\n }\n const postOnly = (type === 'limit_maker') || (timeInForce === 'PO');\n const stopPriceString = this.safeString2 (order, 'stopPrice', 'triggerPrice');\n const triggerPrice = this.parseNumber (this.omitZero (stopPriceString));\n const feeCost = this.safeNumber (order, 'fee');\n let fee = undefined;\n if (feeCost !== undefined) {\n fee = {\n 'currency': this.safeString (order, 'quoteAsset'),\n 'cost': feeCost,\n 'rate': undefined,\n };\n }\n return this.safeOrder ({\n 'info': order,\n 'id': this.safeStringN (order, [ 'strategyId', 'orderId', 'algoId' ]),\n 'clientOrderId': this.safeStringN (order, [ 'clientOrderId', 'newClientStrategyId', 'clientAlgoId' ]),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': lastTradeTimestamp,\n 'lastUpdateTimestamp': lastUpdateTimestamp,\n 'symbol': symbol,\n 'type': this.parseOrderType (type),\n 'timeInForce': timeInForce,\n 'postOnly': postOnly,\n 'reduceOnly': this.safeBool (order, 'reduceOnly'),\n 'side': side,\n 'price': price,\n 'triggerPrice': triggerPrice,\n 'amount': amount,\n 'cost': cost,\n 'average': average,\n 'filled': filled,\n 'remaining': undefined,\n 'status': status,\n 'fee': fee,\n 'trades': fills,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5619, "line_start" => 5602, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n 'NEW': 'open',\n 'PARTIALLY_FILLED': 'open',\n 'ACCEPTED': 'open',\n 'TRIGGERING': 'open',\n 'FILLED': 'closed',\n 'TRIGGERED': 'closed',\n 'FINISHED': 'closed',\n 'CANCELED': 'canceled',\n 'CANCELLED': 'canceled',\n 'PENDING_CANCEL': 'canceling', // currently unused\n 'REJECTED': 'rejected',\n 'EXPIRED': 'expired',\n 'EXPIRED_IN_MATCH': 'expired',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5631, "line_start" => 5621, "mappings" => [ %{ "comment" => nil, "key" => "limit_maker", "value" => "'limit'" }, %{ "comment" => nil, "key" => "stop", "value" => "'limit'" }, %{ "comment" => nil, "key" => "stop_market", "value" => "'market'" }, %{ "comment" => nil, "key" => "take_profit", "value" => "'limit'" }, %{ "comment" => nil, "key" => "take_profit_market", "value" => "'market'" }, %{ "comment" => nil, "key" => "trailing_stop_market", "value" => "'market'" } ], "name" => "parseOrderType", "signature" => "parseOrderType (type: Str)", "source" => "parseOrderType (type: Str) {\n const types = {\n 'limit_maker': 'limit',\n 'stop': 'limit',\n 'stop_market': 'market',\n 'take_profit': 'limit',\n 'take_profit_market': 'market',\n 'trailing_stop_market': 'market',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 10565, "line_start" => 10328, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "contracts", "value" => "contracts" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contractSize" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "unrealizedPnl" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.parseNumber (leverageString)" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "liquidationPrice" }, %{ "comment" => nil, "key" => "collateral", "value" => "collateral" }, %{ "comment" => nil, "key" => "notional", "value" => "notional" }, %{ "comment" => nil, "key" => "markPrice", "value" => "markPrice" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "entryPrice" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "this.parseNumber (initialMarginString)" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "this.parseNumber (initialMarginPercentageString)" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "maintenanceMargin" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "maintenanceMarginPercentage" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "marginRatio" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "marginType", "value" => "marginMode" }, %{ "comment" => nil, "key" => "hedged", "value" => "hedged" }, %{ "comment" => nil, "key" => "percentage", "value" => "percentage" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePositionRisk", "signature" => "parsePositionRisk (position, market: Market = undefined)", "source" => "parsePositionRisk (position, market: Market = undefined) {\n //\n // usdm\n //\n // {\n // symbol: \"WLDUSDT\",\n // positionSide: \"BOTH\",\n // positionAmt: \"5\",\n // entryPrice: \"2.3483\",\n // breakEvenPrice: \"2.349356735\",\n // markPrice: \"2.39560000\",\n // unRealizedProfit: \"0.23650000\",\n // liquidationPrice: \"0\",\n // isolatedMargin: \"0\",\n // notional: \"11.97800000\",\n // isolatedWallet: \"0\",\n // updateTime: \"1722062678998\",\n // initialMargin: \"2.39560000\", // not in v2\n // maintMargin: \"0.07186800\", // not in v2\n // positionInitialMargin: \"2.39560000\", // not in v2\n // openOrderInitialMargin: \"0\", // not in v2\n // adl: \"2\", // not in v2\n // bidNotional: \"0\", // not in v2\n // askNotional: \"0\", // not in v2\n // marginAsset: \"USDT\", // not in v2\n // // the below fields are only in v2\n // leverage: \"5\",\n // maxNotionalValue: \"6000000\",\n // marginType: \"cross\",\n // isAutoAddMargin: \"false\",\n // isolated: false,\n // adlQuantile: \"2\",\n //\n // coinm\n //\n // {\n // \"symbol\": \"BTCUSD_PERP\",\n // \"positionAmt\": \"2\",\n // \"entryPrice\": \"37643.10000021\",\n // \"markPrice\": \"38103.05510455\",\n // \"unRealizedProfit\": \"0.00006413\",\n // \"liquidationPrice\": \"25119.97445760\",\n // \"leverage\": \"2\",\n // \"maxQty\": \"1500\",\n // \"marginType\": \"isolated\",\n // \"isolatedMargin\": \"0.00274471\",\n // \"isAutoAddMargin\": \"false\",\n // \"positionSide\": \"BOTH\",\n // \"notionalValue\": \"0.00524892\",\n // \"isolatedWallet\": \"0.00268058\"\n // }\n //\n // inverse portfolio margin\n //\n // {\n // \"symbol\": \"ETHUSD_PERP\",\n // \"positionAmt\": \"1\",\n // \"entryPrice\": \"2422.400000007\",\n // \"markPrice\": \"2424.51267823\",\n // \"unRealizedProfit\": \"0.0000036\",\n // \"liquidationPrice\": \"293.57678898\",\n // \"leverage\": \"100\",\n // \"positionSide\": \"LONG\",\n // \"updateTime\": 1707371941861,\n // \"maxQty\": \"15\",\n // \"notionalValue\": \"0.00412454\",\n // \"breakEvenPrice\": \"2423.368960034\"\n // }\n //\n // linear portfolio margin\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"positionAmt\": \"0.01\",\n // \"entryPrice\": \"44525.0\",\n // \"markPrice\": \"45464.1735922\",\n // \"unRealizedProfit\": \"9.39173592\",\n // \"liquidationPrice\": \"38007.16308568\",\n // \"leverage\": \"100\",\n // \"positionSide\": \"LONG\",\n // \"updateTime\": 1707371879042,\n // \"maxNotionalValue\": \"500000.0\",\n // \"notional\": \"454.64173592\",\n // \"breakEvenPrice\": \"44542.81\"\n // }\n //\n const marketId = this.safeString (position, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'contract');\n const symbol = this.safeString (market, 'symbol');\n const isolatedMarginString = this.safeString (position, 'isolatedMargin');\n const leverageBrackets = this.safeDict (this.options, 'leverageBrackets', {});\n const leverageBracket = this.safeList (leverageBrackets, symbol, []);\n const notionalString = this.safeString2 (position, 'notional', 'notionalValue');\n const notionalStringAbs = Precise.stringAbs (notionalString);\n let maintenanceMarginPercentageString = undefined;\n for (let i = 0; i < leverageBracket.length; i++) {\n const bracket = leverageBracket[i];\n if (Precise.stringLt (notionalStringAbs, bracket[0])) {\n break;\n }\n maintenanceMarginPercentageString = bracket[1];\n }\n const notional = this.parseNumber (notionalStringAbs);\n const contractsAbs = Precise.stringAbs (this.safeString (position, 'positionAmt'));\n const contracts = this.parseNumber (contractsAbs);\n const unrealizedPnlString = this.safeString (position, 'unRealizedProfit');\n const unrealizedPnl = this.parseNumber (unrealizedPnlString);\n const liquidationPriceString = this.omitZero (this.safeString (position, 'liquidationPrice'));\n const liquidationPrice = this.parseNumber (liquidationPriceString);\n let collateralString = undefined;\n let marginMode = this.safeString (position, 'marginType');\n if (marginMode === undefined && isolatedMarginString !== undefined) {\n marginMode = Precise.stringEq (isolatedMarginString, '0') ? 'cross' : 'isolated';\n }\n let side = undefined;\n if (Precise.stringGt (notionalString, '0')) {\n side = 'long';\n } else if (Precise.stringLt (notionalString, '0')) {\n side = 'short';\n }\n const entryPriceString = this.safeString (position, 'entryPrice');\n const entryPrice = this.parseNumber (entryPriceString);\n const contractSize = this.safeValue (market, 'contractSize');\n const contractSizeString = this.numberToString (contractSize);\n // as oppose to notionalValue\n const linear = ('notional' in position);\n if (marginMode === 'cross') {\n // calculate collateral\n const precision = this.safeDict (market, 'precision', {});\n const basePrecisionValue = this.safeString (precision, 'base');\n const quotePrecisionValue = this.safeString2 (precision, 'quote', 'price');\n const precisionIsUndefined = (basePrecisionValue === undefined) && (quotePrecisionValue === undefined);\n if (!precisionIsUndefined) {\n if (linear) {\n // walletBalance = (liquidationPrice * (±1 + mmp) ± entryPrice) * contracts\n let onePlusMaintenanceMarginPercentageString = undefined;\n let entryPriceSignString = entryPriceString;\n if (side === 'short') {\n onePlusMaintenanceMarginPercentageString = Precise.stringAdd ('1', maintenanceMarginPercentageString);\n entryPriceSignString = Precise.stringMul ('-1', entryPriceSignString);\n } else {\n onePlusMaintenanceMarginPercentageString = Precise.stringAdd ('-1', maintenanceMarginPercentageString);\n }\n const inner = Precise.stringMul (liquidationPriceString, onePlusMaintenanceMarginPercentageString);\n const leftSide = Precise.stringAdd (inner, entryPriceSignString);\n const quotePrecision = this.precisionFromString (this.safeString2 (precision, 'quote', 'price'));\n if (quotePrecision !== undefined) {\n collateralString = Precise.stringDiv (Precise.stringMul (leftSide, contractsAbs), '1', quotePrecision);\n }\n } else {\n // walletBalance = (contracts * contractSize) * (±1/entryPrice - (±1 - mmp) / liquidationPrice)\n let onePlusMaintenanceMarginPercentageString = undefined;\n let entryPriceSignString = entryPriceString;\n if (side === 'short') {\n onePlusMaintenanceMarginPercentageString = Precise.stringSub ('1', maintenanceMarginPercentageString);\n } else {\n onePlusMaintenanceMarginPercentageString = Precise.stringSub ('-1', maintenanceMarginPercentageString);\n entryPriceSignString = Precise.stringMul ('-1', entryPriceSignString);\n }\n const leftSide = Precise.stringMul (contractsAbs, contractSizeString);\n const rightSide = Precise.stringSub (Precise.stringDiv ('1', entryPriceSignString), Precise.stringDiv (onePlusMaintenanceMarginPercentageString, liquidationPriceString));\n const basePrecision = this.precisionFromString (this.safeString (precision, 'base'));\n if (basePrecision !== undefined) {\n collateralString = Precise.stringDiv (Precise.stringMul (leftSide, rightSide), '1', basePrecision);\n }\n }\n }\n } else {\n collateralString = this.safeString (position, 'isolatedMargin');\n }\n collateralString = (collateralString === undefined) ? '0' : collateralString;\n const collateral = this.parseNumber (collateralString);\n const markPrice = this.parseNumber (this.omitZero (this.safeString (position, 'markPrice')));\n let timestamp = this.safeInteger (position, 'updateTime');\n if (timestamp === 0) {\n timestamp = undefined;\n }\n const maintenanceMarginPercentage = this.parseNumber (maintenanceMarginPercentageString);\n let maintenanceMarginString = Precise.stringMul (maintenanceMarginPercentageString, notionalStringAbs);\n if (maintenanceMarginString === undefined) {\n // for a while, this new value was a backup to the existing calculations, but in future we might prioritize this\n maintenanceMarginString = this.safeString (position, 'maintMargin');\n }\n const maintenanceMargin = this.parseNumber (maintenanceMarginString);\n let initialMarginString = undefined;\n let initialMarginPercentageString = undefined;\n const leverageString = this.safeString (position, 'leverage');\n if (leverageString !== undefined) {\n const leverage = parseInt (leverageString);\n const rational = this.isRoundNumber (1000 % leverage);\n initialMarginPercentageString = Precise.stringDiv ('1', leverageString, 8);\n if (!rational) {\n initialMarginPercentageString = Precise.stringAdd (initialMarginPercentageString, '1e-8');\n }\n const unrounded = Precise.stringMul (notionalStringAbs, initialMarginPercentageString);\n initialMarginString = Precise.stringDiv (unrounded, '1', 8);\n } else {\n initialMarginString = this.safeString (position, 'initialMargin');\n const unrounded = Precise.stringMul (initialMarginString, '1');\n initialMarginPercentageString = Precise.stringDiv (unrounded, notionalStringAbs, 8);\n }\n let marginRatio = undefined;\n let percentage = undefined;\n if (!Precise.stringEquals (collateralString, '0')) {\n marginRatio = this.parseNumber (Precise.stringDiv (Precise.stringAdd (Precise.stringDiv (maintenanceMarginString, collateralString), '5e-5'), '1', 4));\n percentage = this.parseNumber (Precise.stringMul (Precise.stringDiv (unrealizedPnlString, initialMarginString, 4), '100'));\n }\n const positionSide = this.safeString (position, 'positionSide');\n const hedged = positionSide !== 'BOTH';\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': symbol,\n 'contracts': contracts,\n 'contractSize': contractSize,\n 'unrealizedPnl': unrealizedPnl,\n 'leverage': this.parseNumber (leverageString),\n 'liquidationPrice': liquidationPrice,\n 'collateral': collateral,\n 'notional': notional,\n 'markPrice': markPrice,\n 'entryPrice': entryPrice,\n 'timestamp': timestamp,\n 'initialMargin': this.parseNumber (initialMarginString),\n 'initialMarginPercentage': this.parseNumber (initialMarginPercentageString),\n 'maintenanceMargin': maintenanceMargin,\n 'maintenanceMarginPercentage': maintenanceMarginPercentage,\n 'marginRatio': marginRatio,\n 'datetime': this.iso8601 (timestamp),\n 'marginMode': marginMode,\n 'marginType': marginMode, // deprecated\n 'side': side,\n 'hedged': hedged,\n 'percentage': percentage,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ETH-230223-1900-P\",\n \"strikePrice\": \"1900\",\n \"realStrikePrice\": \"1665.5897334\",\n \"expiryDate\": 1677139200000,\n \"strikeResult\": \"REALISTIC_VALUE_STRICKEN\"\n }", "{\n \"id\": \"1125899906842897036\",\n \"currency\": \"USDT\",\n \"symbol\": \"BTC-230728-30000-C\",\n \"exercisePrice\": \"30000.00000000\",\n \"markPrice\": \"29160.71284993\",\n \"quantity\": \"1.00000000\",\n \"amount\": \"0.00000000\",\n \"fee\": \"0.00000000\",\n \"createDate\": 1690531200000,\n \"priceScale\": 0,\n \"quantityScale\": 2,\n \"optionSide\": \"CALL\",\n \"positionSide\": \"LONG\",\n \"quoteAsset\": \"USDT\"\n }" ], "line_end" => 11699, "line_start" => 11659, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "settlement" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber2 (settlement, 'realStrikePrice', 'exercisePrice')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseSettlement", "signature" => "parseSettlement (settlement, market)", "source" => "parseSettlement (settlement, market) {\n //\n // fetchSettlementHistory\n //\n // {\n // \"symbol\": \"ETH-230223-1900-P\",\n // \"strikePrice\": \"1900\",\n // \"realStrikePrice\": \"1665.5897334\",\n // \"expiryDate\": 1677139200000,\n // \"strikeResult\": \"REALISTIC_VALUE_STRICKEN\"\n // }\n //\n // fetchMySettlementHistory\n //\n // {\n // \"id\": \"1125899906842897036\",\n // \"currency\": \"USDT\",\n // \"symbol\": \"BTC-230728-30000-C\",\n // \"exercisePrice\": \"30000.00000000\",\n // \"markPrice\": \"29160.71284993\",\n // \"quantity\": \"1.00000000\",\n // \"amount\": \"0.00000000\",\n // \"fee\": \"0.00000000\",\n // \"createDate\": 1690531200000,\n // \"priceScale\": 0,\n // \"quantityScale\": 2,\n // \"optionSide\": \"CALL\",\n // \"positionSide\": \"LONG\",\n // \"quoteAsset\": \"USDT\"\n // }\n //\n const timestamp = this.safeInteger2 (settlement, 'expiryDate', 'createDate');\n const marketId = this.safeString (settlement, 'symbol');\n return {\n 'info': settlement,\n 'symbol': this.safeSymbol (marketId, market),\n 'price': this.safeNumber2 (settlement, 'realStrikePrice', 'exercisePrice'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"symbol\": \"ETH-230223-1900-P\",\n \"strikePrice\": \"1900\",\n \"realStrikePrice\": \"1665.5897334\",\n \"expiryDate\": 1677139200000,\n \"strikeResult\": \"EXTRINSIC_VALUE_EXPIRED\"\n }\n ]", "[\n {\n \"id\": \"1125899906842897036\",\n \"currency\": \"USDT\",\n \"symbol\": \"BTC-230728-30000-C\",\n \"exercisePrice\": \"30000.00000000\",\n \"markPrice\": \"29160.71284993\",\n \"quantity\": \"1.00000000\",\n \"amount\": \"0.00000000\",\n \"fee\": \"0.00000000\",\n \"createDate\": 1690531200000,\n \"priceScale\": 0,\n \"quantityScale\": 2,\n \"optionSide\": \"CALL\",\n \"positionSide\": \"LONG\",\n \"quoteAsset\": \"USDT\"\n }\n ]" ], "line_end" => 11741, "line_start" => 11701, "mappings" => [], "name" => "parseSettlements", "signature" => "parseSettlements (settlements, market)", "source" => "parseSettlements (settlements, market) {\n //\n // fetchSettlementHistory\n //\n // [\n // {\n // \"symbol\": \"ETH-230223-1900-P\",\n // \"strikePrice\": \"1900\",\n // \"realStrikePrice\": \"1665.5897334\",\n // \"expiryDate\": 1677139200000,\n // \"strikeResult\": \"EXTRINSIC_VALUE_EXPIRED\"\n // }\n // ]\n //\n // fetchMySettlementHistory\n //\n // [\n // {\n // \"id\": \"1125899906842897036\",\n // \"currency\": \"USDT\",\n // \"symbol\": \"BTC-230728-30000-C\",\n // \"exercisePrice\": \"30000.00000000\",\n // \"markPrice\": \"29160.71284993\",\n // \"quantity\": \"1.00000000\",\n // \"amount\": \"0.00000000\",\n // \"fee\": \"0.00000000\",\n // \"createDate\": 1690531200000,\n // \"priceScale\": 0,\n // \"quantityScale\": 2,\n // \"optionSide\": \"CALL\",\n // \"positionSide\": \"LONG\",\n // \"quoteAsset\": \"USDT\"\n // }\n // ]\n //\n const result = [];\n for (let i = 0; i < settlements.length; i++) {\n result.push (this.parseSettlement (settlements[i], market));\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"markPrice\": \"11793.63104562\", // mark price\n \"indexPrice\": \"11781.80495970\", // index price\n \"estimatedSettlePrice\": \"11781.16138815\", // Estimated Settle Price, only useful in the last hour before the settlement starts\n \"lastFundingRate\": \"0.00038246\", // This is the lastest estimated funding rate\n \"nextFundingTime\": 1597392000000,\n \"interestRate\": \"0.00010000\",\n \"time\": 1597370495002\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"priceChange\": \"-188.18000000\",\n \"priceChangePercent\": \"-0.159\",\n \"weightedAvgPrice\": \"118356.64734074\",\n \"lastPrice\": \"118449.03000000\",\n \"prevClosePrice\": \"118637.22000000\", // field absent in rolling ticker\n \"lastQty\": \"0.00731000\", // field absent in rolling ticker\n \"bidPrice\": \"118449.02000000\", // field absent in rolling ticker\n \"bidQty\": \"7.15931000\", // field absent in rolling ticker\n \"askPrice\": \"118449.03000000\", // field absent in rolling ticker\n \"askQty\": \"0.09592000\", // field absent in rolling ticker\n \"openPrice\": \"118637.21000000\",\n \"highPrice\": \"119273.36000000\",\n \"lowPrice\": \"117427.50000000\",\n \"volume\": \"14741.41491000\",\n \"quoteVolume\": \"1744744445.80640740\",\n \"openTime\": \"1753701474013\",\n \"closeTime\": \"1753787874013\",\n \"firstId\": \"5116031635\",\n \"lastId\": \"5117964946\",\n \"count\": \"1933312\"\n }", "{\n \"symbol\": \"SUSDT\",\n \"priceChange\": \"-0.0229000\",\n \"priceChangePercent\": \"-6.777\",\n \"weightedAvgPrice\": \"0.3210035\",\n \"lastPrice\": \"0.3150000\",\n \"lastQty\": \"16\",\n \"openPrice\": \"0.3379000\",\n \"highPrice\": \"0.3411000\",\n \"lowPrice\": \"0.3071000\",\n \"volume\": \"120588225\",\n \"quoteVolume\": \"38709237.2289000\",\n \"openTime\": \"1753701720000\",\n \"closeTime\": \"1753788172414\",\n \"firstId\": \"72234973\",\n \"lastId\": \"72423677\",\n \"count\": \"188700\"\n }", "{\n \"baseVolume\": \"214549.95171161\",\n \"closeTime\": \"1621965286847\",\n \"count\": \"1283779\",\n \"firstId\": \"152560106\",\n \"highPrice\": \"39938.3\",\n \"lastId\": \"153843955\",\n \"lastPrice\": \"37993.4\",\n \"lastQty\": \"1\",\n \"lowPrice\": \"36457.2\",\n \"openPrice\": \"37783.4\",\n \"openTime\": \"1621878840000\",\n \"pair\": \"BTCUSD\",\n \"priceChange\": \"210.0\",\n \"priceChangePercent\": \"0.556\",\n \"symbol\": \"BTCUSD_PERP\",\n \"volume\": \"81990451\",\n \"weightedAvgPrice\": \"38215.08713747\"\n }", "{\n \"symbol\": \"ETH-230510-1825-C\",\n \"priceChange\": \"-5.1\",\n \"priceChangePercent\": \"-0.1854\",\n \"lastPrice\": \"22.4\",\n \"lastQty\": \"0\",\n \"open\": \"27.5\",\n \"high\": \"34.1\",\n \"low\": \"22.4\",\n \"volume\": \"6.83\",\n \"amount\": \"201.44\",\n \"bidPrice\": \"21.9\",\n \"askPrice\": \"22.4\",\n \"openTime\": 1683614771898,\n \"closeTime\": 1683695017784,\n \"firstTradeId\": 12,\n \"tradeCount\": 22,\n \"strikePrice\": \"1825\",\n \"exercisePrice\": \"1845.95341176\"\n }" ], "line_end" => 4251, "line_start" => 4065, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "this.safeString2 (ticker, 'highPrice', 'high')" }, %{ "comment" => nil, "key" => "low", "value" => "this.safeString2 (ticker, 'lowPrice', 'low')" }, %{ "comment" => nil, "key" => "bid", "value" => "this.safeString (ticker, 'bidPrice')" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "this.safeString (ticker, 'bidQty')" }, %{ "comment" => nil, "key" => "ask", "value" => "this.safeString (ticker, 'askPrice')" }, %{ "comment" => nil, "key" => "askVolume", "value" => "this.safeString (ticker, 'askQty')" }, %{ "comment" => nil, "key" => "vwap", "value" => "wAvg" }, %{ "comment" => nil, "key" => "open", "value" => "this.safeString2 (ticker, 'openPrice', 'open')" }, %{ "comment" => nil, "key" => "close", "value" => "last" }, %{ "comment" => nil, "key" => "last", "value" => "last" }, %{ "comment" => nil, "key" => "previousClose", "value" => "this.safeString (ticker, 'prevClosePrice')" }, %{ "comment" => nil, "key" => "percentage", "value" => "this.safeString (ticker, 'priceChangePercent')" }, %{ "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 // markPrices\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"markPrice\": \"11793.63104562\", // mark price\n // \"indexPrice\": \"11781.80495970\", // index price\n // \"estimatedSettlePrice\": \"11781.16138815\", // Estimated Settle Price, only useful in the last hour before the settlement starts\n // \"lastFundingRate\": \"0.00038246\", // This is the lastest estimated funding rate\n // \"nextFundingTime\": 1597392000000,\n // \"interestRate\": \"0.00010000\",\n // \"time\": 1597370495002\n // }\n //\n // spot - ticker\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"priceChange\": \"-188.18000000\",\n // \"priceChangePercent\": \"-0.159\",\n // \"weightedAvgPrice\": \"118356.64734074\",\n // \"lastPrice\": \"118449.03000000\",\n // \"prevClosePrice\": \"118637.22000000\", // field absent in rolling ticker\n // \"lastQty\": \"0.00731000\", // field absent in rolling ticker\n // \"bidPrice\": \"118449.02000000\", // field absent in rolling ticker\n // \"bidQty\": \"7.15931000\", // field absent in rolling ticker\n // \"askPrice\": \"118449.03000000\", // field absent in rolling ticker\n // \"askQty\": \"0.09592000\", // field absent in rolling ticker\n // \"openPrice\": \"118637.21000000\",\n // \"highPrice\": \"119273.36000000\",\n // \"lowPrice\": \"117427.50000000\",\n // \"volume\": \"14741.41491000\",\n // \"quoteVolume\": \"1744744445.80640740\",\n // \"openTime\": \"1753701474013\",\n // \"closeTime\": \"1753787874013\",\n // \"firstId\": \"5116031635\",\n // \"lastId\": \"5117964946\",\n // \"count\": \"1933312\"\n // }\n //\n // usdm tickers\n //\n // {\n // \"symbol\": \"SUSDT\",\n // \"priceChange\": \"-0.0229000\",\n // \"priceChangePercent\": \"-6.777\",\n // \"weightedAvgPrice\": \"0.3210035\",\n // \"lastPrice\": \"0.3150000\",\n // \"lastQty\": \"16\",\n // \"openPrice\": \"0.3379000\",\n // \"highPrice\": \"0.3411000\",\n // \"lowPrice\": \"0.3071000\",\n // \"volume\": \"120588225\",\n // \"quoteVolume\": \"38709237.2289000\",\n // \"openTime\": \"1753701720000\",\n // \"closeTime\": \"1753788172414\",\n // \"firstId\": \"72234973\",\n // \"lastId\": \"72423677\",\n // \"count\": \"188700\"\n // }\n //\n // coinm\n //\n // {\n // \"baseVolume\": \"214549.95171161\",\n // \"closeTime\": \"1621965286847\",\n // \"count\": \"1283779\",\n // \"firstId\": \"152560106\",\n // \"highPrice\": \"39938.3\",\n // \"lastId\": \"153843955\",\n // \"lastPrice\": \"37993.4\",\n // \"lastQty\": \"1\",\n // \"lowPrice\": \"36457.2\",\n // \"openPrice\": \"37783.4\",\n // \"openTime\": \"1621878840000\",\n // \"pair\": \"BTCUSD\",\n // \"priceChange\": \"210.0\",\n // \"priceChangePercent\": \"0.556\",\n // \"symbol\": \"BTCUSD_PERP\",\n // \"volume\": \"81990451\",\n // \"weightedAvgPrice\": \"38215.08713747\"\n // }\n //\n // eapi: fetchTicker, fetchTickers\n //\n // {\n // \"symbol\": \"ETH-230510-1825-C\",\n // \"priceChange\": \"-5.1\",\n // \"priceChangePercent\": \"-0.1854\",\n // \"lastPrice\": \"22.4\",\n // \"lastQty\": \"0\",\n // \"open\": \"27.5\",\n // \"high\": \"34.1\",\n // \"low\": \"22.4\",\n // \"volume\": \"6.83\",\n // \"amount\": \"201.44\",\n // \"bidPrice\": \"21.9\",\n // \"askPrice\": \"22.4\",\n // \"openTime\": 1683614771898,\n // \"closeTime\": 1683695017784,\n // \"firstTradeId\": 12,\n // \"tradeCount\": 22,\n // \"strikePrice\": \"1825\",\n // \"exercisePrice\": \"1845.95341176\"\n // }\n //\n // spot bidsAsks\n //\n // {\n // \"symbol\":\"ETHBTC\",\n // \"bidPrice\":\"0.07466800\",\n // \"bidQty\":\"5.31990000\",\n // \"askPrice\":\"0.07466900\",\n // \"askQty\":\"10.93540000\"\n // }\n //\n // usdm bidsAsks\n //\n // {\n // \"symbol\":\"BTCUSDT\",\n // \"bidPrice\":\"21321.90\",\n // \"bidQty\":\"33.592\",\n // \"askPrice\":\"21322.00\",\n // \"askQty\":\"1.427\",\n // \"time\":\"1673899207538\"\n // }\n //\n // coinm bidsAsks\n //\n // {\n // \"symbol\":\"BTCUSD_PERP\",\n // \"pair\":\"BTCUSD\",\n // \"bidPrice\":\"21301.2\",\n // \"bidQty\":\"188\",\n // \"askPrice\":\"21301.3\",\n // \"askQty\":\"10302\",\n // \"time\":\"1673899278514\"\n // }\n //\n const timestamp = this.safeInteger2 (ticker, 'closeTime', 'time');\n let marketType = undefined;\n if (('time' in ticker)) {\n marketType = 'contract';\n }\n if (marketType === undefined) {\n marketType = ('bidQty' in ticker) ? 'spot' : 'contract';\n }\n const marketId = this.safeString (ticker, 'symbol');\n const symbol = this.safeSymbol (marketId, market, undefined, marketType);\n const last = this.safeString (ticker, 'lastPrice');\n const wAvg = this.safeString (ticker, 'weightedAvgPrice');\n const isCoinm = ('baseVolume' in ticker);\n let baseVolume = undefined;\n let quoteVolume = undefined;\n if (isCoinm) {\n baseVolume = this.safeString (ticker, 'baseVolume');\n // 'volume' field in inverse markets is not quoteVolume, but traded amount (per contracts)\n quoteVolume = Precise.stringMul (baseVolume, wAvg);\n } else {\n baseVolume = this.safeString (ticker, 'volume');\n quoteVolume = this.safeString2 (ticker, 'quoteVolume', 'amount');\n }\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': this.safeString2 (ticker, 'highPrice', 'high'),\n 'low': this.safeString2 (ticker, 'lowPrice', 'low'),\n 'bid': this.safeString (ticker, 'bidPrice'),\n 'bidVolume': this.safeString (ticker, 'bidQty'),\n 'ask': this.safeString (ticker, 'askPrice'),\n 'askVolume': this.safeString (ticker, 'askQty'),\n 'vwap': wAvg,\n 'open': this.safeString2 (ticker, 'openPrice', 'open'),\n 'close': last,\n 'last': last,\n 'previousClose': this.safeString (ticker, 'prevClosePrice'), // previous day close\n 'change': this.safeString (ticker, 'priceChange'),\n 'percentage': this.safeString (ticker, 'priceChangePercent'),\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" => [], "line_end" => 4525, "line_start" => 4515, "mappings" => [], "name" => "parseTickersForRolling", "signature" => "parseTickersForRolling (response, symbols)", "source" => "parseTickersForRolling (response, symbols) {\n const results = [];\n for (let i = 0; i < response.length; i++) {\n const marketId = this.safeString (response[i], 'symbol');\n const tickerMarket = this.safeMarket (marketId, undefined, undefined, 'spot');\n const parsedTicker = this.parseTicker (response[i]);\n parsedTicker['symbol'] = tickerMarket['symbol'];\n results.push (parsedTicker);\n }\n return this.filterByArray (results, 'symbol', symbols);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"a\": 26129, // Aggregate tradeId\n \"p\": \"0.01633102\", // Price\n \"q\": \"4.70443515\", // Quantity\n \"f\": 27781, // First tradeId\n \"l\": 27781, // Last tradeId\n \"T\": 1498793709153, // Timestamp\n \"m\": true, // Was the buyer the maker?\n \"M\": true // Was the trade the best price match?\n }", "{\n \"a\": \"269772814\",\n \"p\": \"25864.1\",\n \"q\": \"3\",\n \"f\": \"662149354\",\n \"l\": \"662149355\",\n \"T\": \"1694209776022\",\n \"m\": false,\n }", "{\n \"id\": 28457,\n \"price\": \"4.00000100\",\n \"qty\": \"12.00000000\",\n \"time\": 1499865549590,\n \"isBuyerMaker\": true,\n \"isBestMatch\": true\n }", "{\n \"symbol\": \"BNBBTC\",\n \"id\": 28457,\n \"orderId\": 100234,\n \"price\": \"4.00000100\",\n \"qty\": \"12.00000000\",\n \"commission\": \"10.10000000\",\n \"commissionAsset\": \"BNB\",\n \"time\": 1499865549590,\n \"isBuyer\": true,\n \"isMaker\": false,\n \"isBestMatch\": true\n }", "{\n \"accountId\": 20,\n \"buyer\": False,\n \"commission\": \"-0.07819010\",\n \"commissionAsset\": \"USDT\",\n \"counterPartyId\": 653,\n \"id\": 698759,\n \"maker\": False,\n \"orderId\": 25851813,\n \"price\": \"7819.01\",\n \"qty\": \"0.002\",\n \"quoteQty\": \"0.01563\",\n \"realizedPnl\": \"-0.91539999\",\n \"side\": \"SELL\",\n \"symbol\": \"BTCUSDT\",\n \"time\": 1569514978020\n }" ], "line_end" => 5054, "line_start" => 4788, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeStringN (trade, [ 't', 'a', 'tradeId', 'id' ])" }, %{ "comment" => nil, "key" => "order", "value" => "this.safeString (trade, 'orderId')" }, %{ "comment" => nil, "key" => "type", "value" => "this.safeStringLower (trade, 'type')" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeString2 (trade, 'p', 'price')" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeString2 (trade, 'quoteQty', 'baseQty')" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n if ('isDustTrade' in trade) {\n return this.parseDustTrade (trade, market);\n }\n //\n // aggregate trades\n // https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#compressedaggregate-trades-list\n //\n // {\n // \"a\": 26129, // Aggregate tradeId\n // \"p\": \"0.01633102\", // Price\n // \"q\": \"4.70443515\", // Quantity\n // \"f\": 27781, // First tradeId\n // \"l\": 27781, // Last tradeId\n // \"T\": 1498793709153, // Timestamp\n // \"m\": true, // Was the buyer the maker?\n // \"M\": true // Was the trade the best price match?\n // }\n //\n // REST: aggregate trades for swap & future (both linear and inverse)\n //\n // {\n // \"a\": \"269772814\",\n // \"p\": \"25864.1\",\n // \"q\": \"3\",\n // \"f\": \"662149354\",\n // \"l\": \"662149355\",\n // \"T\": \"1694209776022\",\n // \"m\": false,\n // }\n //\n // recent public trades and old public trades\n // https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#recent-trades-list\n // https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#old-trade-lookup-market_data\n //\n // {\n // \"id\": 28457,\n // \"price\": \"4.00000100\",\n // \"qty\": \"12.00000000\",\n // \"time\": 1499865549590,\n // \"isBuyerMaker\": true,\n // \"isBestMatch\": true\n // }\n //\n // private trades\n // https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#account-trade-list-user_data\n //\n // {\n // \"symbol\": \"BNBBTC\",\n // \"id\": 28457,\n // \"orderId\": 100234,\n // \"price\": \"4.00000100\",\n // \"qty\": \"12.00000000\",\n // \"commission\": \"10.10000000\",\n // \"commissionAsset\": \"BNB\",\n // \"time\": 1499865549590,\n // \"isBuyer\": true,\n // \"isMaker\": false,\n // \"isBestMatch\": true\n // }\n //\n // futures trades\n //\n // {\n // \"accountId\": 20,\n // \"buyer\": False,\n // \"commission\": \"-0.07819010\",\n // \"commissionAsset\": \"USDT\",\n // \"counterPartyId\": 653,\n // \"id\": 698759,\n // \"maker\": False,\n // \"orderId\": 25851813,\n // \"price\": \"7819.01\",\n // \"qty\": \"0.002\",\n // \"quoteQty\": \"0.01563\",\n // \"realizedPnl\": \"-0.91539999\",\n // \"side\": \"SELL\",\n // \"symbol\": \"BTCUSDT\",\n // \"time\": 1569514978020\n // }\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"id\": 477128891,\n // \"orderId\": 13809777875,\n // \"side\": \"SELL\",\n // \"price\": \"38479.55\",\n // \"qty\": \"0.001\",\n // \"realizedPnl\": \"-0.00009534\",\n // \"marginAsset\": \"USDT\",\n // \"quoteQty\": \"38.47955\",\n // \"commission\": \"-0.00076959\",\n // \"commissionAsset\": \"USDT\",\n // \"time\": 1612733566708,\n // \"positionSide\": \"BOTH\",\n // \"maker\": true,\n // \"buyer\": false\n // }\n //\n // { respType: FULL }\n //\n // {\n // \"price\": \"4000.00000000\",\n // \"qty\": \"1.00000000\",\n // \"commission\": \"4.00000000\",\n // \"commissionAsset\": \"USDT\",\n // \"tradeId\": \"1234\",\n // }\n //\n // options: fetchMyTrades\n //\n // {\n // \"id\": 1125899906844226012,\n // \"tradeId\": 73,\n // \"orderId\": 4638761100843040768,\n // \"symbol\": \"ETH-230211-1500-C\",\n // \"price\": \"18.70000000\",\n // \"quantity\": \"-0.57000000\",\n // \"fee\": \"0.17305890\",\n // \"realizedProfit\": \"-3.53400000\",\n // \"side\": \"SELL\",\n // \"type\": \"LIMIT\",\n // \"volatility\": \"0.30000000\",\n // \"liquidity\": \"MAKER\",\n // \"time\": 1676085216845,\n // \"priceScale\": 1,\n // \"quantityScale\": 2,\n // \"optionSide\": \"CALL\",\n // \"quoteAsset\": \"USDT\"\n // }\n //\n // options: fetchTrades\n //\n // {\n // \"id\": 1,\n // \"symbol\": \"ETH-230216-1500-C\",\n // \"price\": \"35.5\",\n // \"qty\": \"0.03\",\n // \"quoteQty\": \"1.065\",\n // \"side\": 1,\n // \"time\": 1676366446072\n // }\n //\n // fetchMyTrades: linear portfolio margin\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"id\": 4575108247,\n // \"orderId\": 261942655610,\n // \"side\": \"SELL\",\n // \"price\": \"47263.40\",\n // \"qty\": \"0.010\",\n // \"realizedPnl\": \"27.38400000\",\n // \"marginAsset\": \"USDT\",\n // \"quoteQty\": \"472.63\",\n // \"commission\": \"0.18905360\",\n // \"commissionAsset\": \"USDT\",\n // \"time\": 1707530039409,\n // \"buyer\": false,\n // \"maker\": false,\n // \"positionSide\": \"LONG\"\n // }\n //\n // fetchMyTrades: inverse portfolio margin\n //\n // {\n // \"symbol\": \"ETHUSD_PERP\",\n // \"id\": 701907838,\n // \"orderId\": 71548909034,\n // \"pair\": \"ETHUSD\",\n // \"side\": \"SELL\",\n // \"price\": \"2498.15\",\n // \"qty\": \"1\",\n // \"realizedPnl\": \"0.00012517\",\n // \"marginAsset\": \"ETH\",\n // \"baseQty\": \"0.00400296\",\n // \"commission\": \"0.00000160\",\n // \"commissionAsset\": \"ETH\",\n // \"time\": 1707530317519,\n // \"positionSide\": \"LONG\",\n // \"buyer\": false,\n // \"maker\": false\n // }\n //\n // fetchMyTrades: spot margin portfolio margin\n //\n // {\n // \"symbol\": \"ADAUSDT\",\n // \"id\": 470227543,\n // \"orderId\": 4421170947,\n // \"price\": \"0.53880000\",\n // \"qty\": \"10.00000000\",\n // \"quoteQty\": \"5.38800000\",\n // \"commission\": \"0.00538800\",\n // \"commissionAsset\": \"USDT\",\n // \"time\": 1707545780522,\n // \"isBuyer\": false,\n // \"isMaker\": false,\n // \"isBestMatch\": true\n // }\n //\n const timestamp = this.safeInteger2 (trade, 'T', 'time');\n let amount = this.safeString2 (trade, 'q', 'qty');\n amount = this.safeString (trade, 'quantity', amount);\n const marketId = this.safeString (trade, 'symbol');\n const isSpotTrade = ('isIsolated' in trade) || ('M' in trade) || ('orderListId' in trade) || ('isMaker' in trade);\n const marketType = isSpotTrade ? 'spot' : 'contract';\n market = this.safeMarket (marketId, market, undefined, marketType);\n const symbol = market['symbol'];\n let side = undefined;\n const buyerMaker = this.safeBool2 (trade, 'm', 'isBuyerMaker');\n let takerOrMaker = undefined;\n if (buyerMaker !== undefined) {\n side = buyerMaker ? 'sell' : 'buy'; // this is reversed intentionally\n } else if ('side' in trade) {\n side = this.safeStringLower (trade, 'side');\n } else {\n if ('isBuyer' in trade) {\n side = trade['isBuyer'] ? 'buy' : 'sell'; // this is a true side\n }\n }\n let fee = undefined;\n if ('commission' in trade) {\n fee = {\n 'cost': this.safeString (trade, 'commission'),\n 'currency': this.safeCurrencyCode (this.safeString (trade, 'commissionAsset')),\n };\n }\n if ('isMaker' in trade) {\n takerOrMaker = trade['isMaker'] ? 'maker' : 'taker';\n }\n if ('maker' in trade) {\n takerOrMaker = trade['maker'] ? 'maker' : 'taker';\n }\n if (('optionSide' in trade) || market['option']) {\n const settle = this.safeCurrencyCode (this.safeString (trade, 'quoteAsset', 'USDT'));\n takerOrMaker = this.safeStringLower (trade, 'liquidity');\n if ('fee' in trade) {\n fee = {\n 'cost': this.safeString (trade, 'fee'),\n 'currency': settle,\n };\n }\n if ((side !== 'buy') && (side !== 'sell')) {\n side = (side === '1') ? 'buy' : 'sell';\n }\n if ('optionSide' in trade) {\n if (side !== 'buy') {\n amount = Precise.stringMul ('-1', amount);\n }\n }\n }\n return this.safeTrade ({\n 'info': trade,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'id': this.safeStringN (trade, [ 't', 'a', 'tradeId', 'id' ]),\n 'order': this.safeString (trade, 'orderId'),\n 'type': this.safeStringLower (trade, 'type'),\n 'side': side,\n 'takerOrMaker': takerOrMaker,\n 'price': this.safeString2 (trade, 'p', 'price'),\n 'amount': amount,\n 'cost': this.safeString2 (trade, 'quoteQty', 'baseQty'),\n 'fee': fee,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"symbol\": \"BTCUSDT\",\n \"makerCommission\": \"0.001\",\n \"takerCommission\": \"0.001\"\n }\n ]", "{\n \"symbol\": \"BTCUSD_PERP\",\n \"makerCommissionRate\": \"0.00015\", // 0.015%\n \"takerCommissionRate\": \"0.00040\" // 0.040%\n }" ], "line_end" => 9542, "line_start" => 9514, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber2 (fee, 'makerCommission', 'makerCommissionRate')" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber2 (fee, 'takerCommission', 'takerCommissionRate')" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "tierBased", "value" => "undefined" } ], "name" => "parseTradingFee", "signature" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface", "source" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface {\n //\n // spot\n // [\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"makerCommission\": \"0.001\",\n // \"takerCommission\": \"0.001\"\n // }\n // ]\n //\n // swap\n // {\n // \"symbol\": \"BTCUSD_PERP\",\n // \"makerCommissionRate\": \"0.00015\", // 0.015%\n // \"takerCommissionRate\": \"0.00040\" // 0.040%\n // }\n //\n const marketId = this.safeString (fee, 'symbol');\n const symbol = this.safeSymbol (marketId, market, undefined, 'spot');\n return {\n 'info': fee,\n 'symbol': symbol,\n 'maker': this.safeNumber2 (fee, 'makerCommission', 'makerCommissionRate'),\n 'taker': this.safeNumber2 (fee, 'takerCommission', 'takerCommissionRate'),\n 'percentage': undefined,\n 'tierBased': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amount\": \"4500\",\n \"coin\": \"USDT\",\n \"network\": \"BSC\",\n \"status\": 1,\n \"address\": \"0xc9c923c87347ca0f3451d6d308ce84f691b9f501\",\n \"addressTag\": \"\",\n \"txId\": \"Internal transfer 51376627901\",\n \"insertTime\": 1618394381000,\n \"transferType\": 1,\n \"confirmTimes\": \"1/15\"\n }", "{\n \"id\": \"69e53ad305124b96b43668ceab158a18\",\n \"amount\": \"28.75\",\n \"transactionFee\": \"0.25\",\n \"coin\": \"XRP\",\n \"status\": 6,\n \"address\": \"r3T75fuLjX51mmfb5Sk1kMNuhBgBPJsjza\",\n \"addressTag\": \"101286922\",\n \"txId\": \"19A5B24ED0B697E4F0E9CD09FCB007170A605BC93C9280B9E6379C5E6EF0F65A\",\n \"applyTime\": \"2021-04-15 12:09:16\",\n \"network\": \"XRP\",\n \"transferType\": 0\n }", "{\n \"orderNo\": \"CJW684897551397171200\",\n \"fiatCurrency\": \"GBP\",\n \"indicatedAmount\": \"29.99\",\n \"amount\": \"28.49\",\n \"totalFee\": \"1.50\",\n \"method\": \"bank transfer\",\n \"status\": \"Successful\",\n \"createTime\": 1614898701000,\n \"updateTime\": 1614898820000\n }", "{\n \"orderNo\": \"25ced37075c1470ba8939d0df2316e23\",\n \"fiatCurrency\": \"EUR\",\n \"transactionType\": 0,\n \"indicatedAmount\": \"15.00\",\n \"amount\": \"15.00\",\n \"totalFee\": \"0.00\",\n \"method\": \"card\",\n \"status\": \"Failed\",\n \"createTime\": \"1627501026000\",\n \"updateTime\": \"1627501027000\"\n }", "{ id: \"9a67628b16ba4988ae20d329333f16bc\" }" ], "line_end" => 8774, "line_start" => 8645, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "txid", "value" => "txid" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "network", "value" => "network" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "addressTo", "value" => "address" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" }, %{ "comment" => nil, "key" => "tagTo", "value" => "tag" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "updated", "value" => "updated" }, %{ "comment" => nil, "key" => "internal", "value" => "internal" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "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\": \"4500\",\n // \"coin\": \"USDT\",\n // \"network\": \"BSC\",\n // \"status\": 1,\n // \"address\": \"0xc9c923c87347ca0f3451d6d308ce84f691b9f501\",\n // \"addressTag\": \"\",\n // \"txId\": \"Internal transfer 51376627901\",\n // \"insertTime\": 1618394381000,\n // \"transferType\": 1,\n // \"confirmTimes\": \"1/15\"\n // }\n //\n // fetchWithdrawals\n //\n // {\n // \"id\": \"69e53ad305124b96b43668ceab158a18\",\n // \"amount\": \"28.75\",\n // \"transactionFee\": \"0.25\",\n // \"coin\": \"XRP\",\n // \"status\": 6,\n // \"address\": \"r3T75fuLjX51mmfb5Sk1kMNuhBgBPJsjza\",\n // \"addressTag\": \"101286922\",\n // \"txId\": \"19A5B24ED0B697E4F0E9CD09FCB007170A605BC93C9280B9E6379C5E6EF0F65A\",\n // \"applyTime\": \"2021-04-15 12:09:16\",\n // \"network\": \"XRP\",\n // \"transferType\": 0\n // }\n //\n // fiat transaction\n // withdraw\n // {\n // \"orderNo\": \"CJW684897551397171200\",\n // \"fiatCurrency\": \"GBP\",\n // \"indicatedAmount\": \"29.99\",\n // \"amount\": \"28.49\",\n // \"totalFee\": \"1.50\",\n // \"method\": \"bank transfer\",\n // \"status\": \"Successful\",\n // \"createTime\": 1614898701000,\n // \"updateTime\": 1614898820000\n // }\n //\n // deposit\n // {\n // \"orderNo\": \"25ced37075c1470ba8939d0df2316e23\",\n // \"fiatCurrency\": \"EUR\",\n // \"transactionType\": 0,\n // \"indicatedAmount\": \"15.00\",\n // \"amount\": \"15.00\",\n // \"totalFee\": \"0.00\",\n // \"method\": \"card\",\n // \"status\": \"Failed\",\n // \"createTime\": \"1627501026000\",\n // \"updateTime\": \"1627501027000\"\n // }\n //\n // withdraw\n //\n // { id: \"9a67628b16ba4988ae20d329333f16bc\" }\n //\n const id = this.safeString2 (transaction, 'id', 'orderNo');\n const address = this.safeString (transaction, 'address');\n let tag = this.safeString (transaction, 'addressTag'); // set but unused\n if (tag !== undefined) {\n if (tag.length < 1) {\n tag = undefined;\n }\n }\n let txid = this.safeString (transaction, 'txId');\n if ((txid !== undefined) && (txid.indexOf ('Internal transfer ') >= 0)) {\n txid = txid.slice (18);\n }\n const currencyId = this.safeString2 (transaction, 'coin', 'fiatCurrency');\n let code = this.safeCurrencyCode (currencyId, currency);\n let timestamp = undefined;\n timestamp = this.safeInteger2 (transaction, 'insertTime', 'createTime');\n if (timestamp === undefined) {\n timestamp = this.parse8601 (this.safeString (transaction, 'applyTime'));\n }\n const updated = this.safeInteger2 (transaction, 'successTime', 'updateTime');\n let type = this.safeString (transaction, 'type');\n if (type === undefined) {\n const txType = this.safeString (transaction, 'transactionType');\n if (txType !== undefined) {\n type = (txType === '0') ? 'deposit' : 'withdrawal';\n }\n const legalMoneyCurrenciesById = this.safeDict (this.options, 'legalMoneyCurrenciesById');\n code = this.safeString (legalMoneyCurrenciesById, code, code);\n }\n const status = this.parseTransactionStatusByType (this.safeString (transaction, 'status'), type);\n const amount = this.safeNumber (transaction, 'amount');\n const feeCost = this.safeNumber2 (transaction, 'transactionFee', 'totalFee');\n let fee = undefined;\n if (feeCost !== undefined) {\n fee = { 'currency': code, 'cost': feeCost };\n }\n const internalInteger = this.safeInteger (transaction, 'transferType');\n let internal = undefined;\n if (internalInteger !== undefined) {\n internal = (internalInteger !== 0) ? true : false;\n }\n const network = this.safeString (transaction, 'network');\n return {\n 'info': transaction,\n 'id': id,\n 'txid': txid,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'network': network,\n 'address': address,\n 'addressTo': address,\n 'addressFrom': undefined,\n 'tag': tag,\n 'tagTo': tag,\n 'tagFrom': undefined,\n 'type': type,\n 'amount': amount,\n 'currency': code,\n 'status': status,\n 'updated': updated,\n 'internal': internal,\n 'comment': undefined,\n 'fee': fee,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 8643, "line_start" => 8605, "mappings" => [], "name" => "parseTransactionStatusByType", "signature" => "parseTransactionStatusByType (status, type = undefined)", "source" => "parseTransactionStatusByType (status, type = undefined) {\n if (type === undefined) {\n return status;\n }\n const statusesByType: Dict = {\n 'deposit': {\n '0': 'pending',\n '1': 'ok',\n '6': 'ok',\n // Fiat\n // Processing, Failed, Successful, Finished, Refunding, Refunded, Refund Failed, Order Partial credit Stopped\n 'Processing': 'pending',\n 'Failed': 'failed',\n 'Successful': 'ok',\n 'Refunding': 'canceled',\n 'Refunded': 'canceled',\n 'Refund Failed': 'failed',\n },\n 'withdrawal': {\n '0': 'pending', // Email Sent\n '1': 'canceled', // Cancelled (different from 1 = ok in deposits)\n '2': 'pending', // Awaiting Approval\n '3': 'failed', // Rejected\n '4': 'pending', // Processing\n '5': 'failed', // Failure\n '6': 'ok', // Completed\n // Fiat\n // Processing, Failed, Successful, Finished, Refunding, Refunded, Refund Failed, Order Partial credit Stopped\n 'Processing': 'pending',\n 'Failed': 'failed',\n 'Successful': 'ok',\n 'Refunding': 'canceled',\n 'Refunded': 'canceled',\n 'Refund Failed': 'failed',\n },\n };\n const statuses = this.safeDict (statusesByType, type, {});\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"tranId\":13526853623\n }", "{\n \"timestamp\": 1614640878000,\n \"asset\": \"USDT\",\n \"amount\": \"25\",\n \"type\": \"MAIN_UMFUTURE\",\n \"status\": \"CONFIRMED\",\n \"tranId\": 43000126248\n }", "{\n \"orderType\": \"C2C\", // Enum:PAY(C2B Merchant Acquiring Payment), PAY_REFUND(C2B Merchant Acquiring Payment,refund), C2C(C2C Transfer Payment),CRYPTO_BOX(Crypto box), CRYPTO_BOX_RF(Crypto Box, refund), C2C_HOLDING(Transfer to new Binance user), C2C_HOLDING_RF(Transfer to new Binance user,refund), PAYOUT(B2C Disbursement Payment), REMITTANCE(Send cash)\n \"transactionId\": \"M_P_71505104267788288\",\n \"transactionTime\": 1610090460133, //trade timestamp\n \"amount\": \"23.72469206\", //order amount(up to 8 decimal places), positive is income, negative is expenditure\n \"currency\": \"BNB\",\n \"walletType\": 1, //main wallet type, 1 for funding wallet, 2 for spot wallet, 3 for fiat wallet, 4 or 6 for card payment, 5 for earn wallet\n \"walletTypes\": [1,2], //array format,there are multiple values when using combination payment\n \"fundsDetail\": [ // details\n {\n \"currency\": \"USDT\", //asset\n \"amount\": \"1.2\",\n \"walletAssetCost\":[ //details of asset cost per wallet\n {\"1\":\"0.6\"},\n {\"2\":\"0.6\"}\n ]\n },\n {\n \"currency\": \"ETH\",\n \"amount\": \"0.0001\",\n \"walletAssetCost\":[\n {\"1\":\"0.00005\"},\n {\"2\":\"0.00005\"}\n ]\n }\n ],\n \"payerInfo\":{\n \"name\":\"Jack\", //nickname or merchant name\n \"type\":\"USER\", //account type,USER for personal,MERCHANT for merchant\n \"binanceId\":\"12345678\", //binance uid\n \"accountId\":\"67736251\" //binance pay id\n },\n \"receiverInfo\":{\n \"name\":\"Alan\", //nickname or merchant name\n \"type\":\"MERCHANT\", //account type,USER for personal,MERCHANT for merchant\n \"email\":\"alan@binance.com\", //email\n \"binanceId\":\"34355667\", //binance uid\n \"accountId\":\"21326891\", //binance pay id\n \"countryCode\":\"1\", //International area code\n \"phoneNumber\":\"8057651210\",\n \"mobileCode\":\"US\", //country code\n \"extend\":[ //extension field\n \"institutionName\": \"\",\n \"cardNumber\": \"\",\n \"digitalWalletId\": \"\"\n ]\n }\n }" ], "line_end" => 8885, "line_start" => 8783, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transfer" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "fromAccount" }, %{ "comment" => nil, "key" => "toAccount", "value" => "toAccount" }, %{ "comment" => nil, "key" => "status", "value" => "status" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry", "source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n //\n // transfer\n //\n // {\n // \"tranId\":13526853623\n // }\n //\n // fetchTransfers\n //\n // {\n // \"timestamp\": 1614640878000,\n // \"asset\": \"USDT\",\n // \"amount\": \"25\",\n // \"type\": \"MAIN_UMFUTURE\",\n // \"status\": \"CONFIRMED\",\n // \"tranId\": 43000126248\n // }\n //\n // {\n // \"orderType\": \"C2C\", // Enum:PAY(C2B Merchant Acquiring Payment), PAY_REFUND(C2B Merchant Acquiring Payment,refund), C2C(C2C Transfer Payment),CRYPTO_BOX(Crypto box), CRYPTO_BOX_RF(Crypto Box, refund), C2C_HOLDING(Transfer to new Binance user), C2C_HOLDING_RF(Transfer to new Binance user,refund), PAYOUT(B2C Disbursement Payment), REMITTANCE(Send cash)\n // \"transactionId\": \"M_P_71505104267788288\",\n // \"transactionTime\": 1610090460133, //trade timestamp\n // \"amount\": \"23.72469206\", //order amount(up to 8 decimal places), positive is income, negative is expenditure\n // \"currency\": \"BNB\",\n // \"walletType\": 1, //main wallet type, 1 for funding wallet, 2 for spot wallet, 3 for fiat wallet, 4 or 6 for card payment, 5 for earn wallet\n // \"walletTypes\": [1,2], //array format,there are multiple values when using combination payment\n // \"fundsDetail\": [ // details\n // {\n // \"currency\": \"USDT\", //asset\n // \"amount\": \"1.2\",\n // \"walletAssetCost\":[ //details of asset cost per wallet\n // {\"1\":\"0.6\"},\n // {\"2\":\"0.6\"}\n // ]\n // },\n // {\n // \"currency\": \"ETH\",\n // \"amount\": \"0.0001\",\n // \"walletAssetCost\":[\n // {\"1\":\"0.00005\"},\n // {\"2\":\"0.00005\"}\n // ]\n // }\n // ],\n // \"payerInfo\":{\n // \"name\":\"Jack\", //nickname or merchant name\n // \"type\":\"USER\", //account type,USER for personal,MERCHANT for merchant\n // \"binanceId\":\"12345678\", //binance uid\n // \"accountId\":\"67736251\" //binance pay id\n // },\n // \"receiverInfo\":{\n // \"name\":\"Alan\", //nickname or merchant name\n // \"type\":\"MERCHANT\", //account type,USER for personal,MERCHANT for merchant\n // \"email\":\"alan@binance.com\", //email\n // \"binanceId\":\"34355667\", //binance uid\n // \"accountId\":\"21326891\", //binance pay id\n // \"countryCode\":\"1\", //International area code\n // \"phoneNumber\":\"8057651210\",\n // \"mobileCode\":\"US\", //country code\n // \"extend\":[ //extension field\n // \"institutionName\": \"\",\n // \"cardNumber\": \"\",\n // \"digitalWalletId\": \"\"\n // ]\n // }\n // }\n const id = this.safeString2 (transfer, 'tranId', 'transactionId');\n const currencyId = this.safeString2 (transfer, 'asset', 'currency');\n const code = this.safeCurrencyCode (currencyId, currency);\n const amount = this.safeNumber (transfer, 'amount');\n const type = this.safeString (transfer, 'type');\n let fromAccount = undefined;\n let toAccount = undefined;\n const accountsById = this.safeDict (this.options, 'accountsById', {});\n if (type !== undefined) {\n const parts = type.split ('_');\n fromAccount = this.safeValue (parts, 0);\n toAccount = this.safeValue (parts, 1);\n fromAccount = this.safeString (accountsById, fromAccount, fromAccount);\n toAccount = this.safeString (accountsById, toAccount, toAccount);\n }\n const walletType = this.safeInteger (transfer, 'walletType');\n if (walletType !== undefined) {\n const payer = this.safeDict (transfer, 'payerInfo', {});\n const receiver = this.safeDict (transfer, 'receiverInfo', {});\n fromAccount = this.safeString (payer, 'accountId');\n toAccount = this.safeString (receiver, 'accountId');\n }\n const timestamp = this.safeInteger2 (transfer, 'timestamp', 'transactionTime');\n const status = this.parseTransferStatus (this.safeString (transfer, 'status'));\n return {\n 'info': transfer,\n 'id': id,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'currency': code,\n 'amount': amount,\n 'fromAccount': fromAccount,\n 'toAccount': toAccount,\n 'status': status,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 8781, "line_start" => 8776, "mappings" => [], "name" => "parseTransferStatus", "signature" => "parseTransferStatus (status: Str): Str", "source" => "parseTransferStatus (status: Str): Str {\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: 50, period: 1000, requests: 20, rolling_window_size: 60000 }, raw_endpoints: %{ private: [ %{ auth: false, cost: 4, method: :get, path: "/account" }, %{ auth: false, cost: 4, method: :get, path: "/account/commission" }, %{ auth: false, cost: 4, method: :get, path: "/allOrderList" }, %{ auth: false, cost: 4, method: :get, path: "/allOrders" }, %{ auth: false, cost: 4, method: :get, path: "/myAllocations" }, %{ auth: false, cost: 4, method: :get, path: "/myPreventedMatches" }, %{ auth: false, cost: 4, method: :get, path: "/myTrades" }, %{ auth: false, cost: 1.2, method: :get, path: "/openOrderList" }, %{ auth: false, cost: 1, method: :get, path: "/openOrders" }, %{ auth: false, cost: 0.8, method: :get, path: "/order" }, %{ auth: false, cost: 0.8, method: :get, path: "/orderList" }, %{ auth: false, cost: 8, method: :get, path: "/rateLimit/order" }, %{ auth: false, cost: 0.2, method: :post, path: "/order" }, %{ auth: false, cost: 0.2, method: :post, path: "/order/cancelReplace" }, %{ auth: false, cost: 0.2, method: :post, path: "/order/oco" }, %{ auth: false, cost: 0.2, method: :post, path: "/order/test" }, %{ auth: false, cost: 0.2, method: :post, path: "/orderList/oco" }, %{ auth: false, cost: 0.2, method: :post, path: "/orderList/opo" }, %{ auth: false, cost: 0.2, method: :post, path: "/orderList/opoco" }, %{ auth: false, cost: 0.2, method: :post, path: "/orderList/oto" }, %{ auth: false, cost: 0.2, method: :post, path: "/orderList/otoco" }, %{ auth: false, cost: 0.2, method: :post, path: "/sor/order" }, %{ auth: false, cost: 0.2, method: :post, path: "/sor/order/test" }, %{ auth: false, cost: 0.2, method: :delete, path: "/openOrders" }, %{ auth: false, cost: 0.2, method: :delete, path: "/order" }, %{ auth: false, cost: 0.2, method: :delete, path: "/orderList" } ], public: [ %{ auth: false, cost: 0.4, method: :get, path: "/aggTrades" }, %{ auth: false, cost: 0.4, method: :get, path: "/avgPrice" }, %{ auth: false, cost: 1, method: :get, path: "/depth" }, %{ auth: false, cost: 4, method: :get, path: "/exchangeInfo" }, %{ auth: false, cost: 2, method: :get, path: "/historicalTrades" }, %{ auth: false, cost: 0.4, method: :get, path: "/klines" }, %{ auth: false, cost: 0.2, method: :get, path: "/ping" }, %{ auth: false, cost: 1, method: :get, path: "/ticker" }, %{ auth: false, cost: 1, method: :get, path: "/ticker/24hr" }, %{ auth: false, cost: 1, method: :get, path: "/ticker/bookTicker" }, %{ auth: false, cost: 1, method: :get, path: "/ticker/price" }, %{ auth: false, cost: 0.8, method: :get, path: "/ticker/tradingDay" }, %{ auth: false, cost: 0.2, method: :get, path: "/time" }, %{ auth: false, cost: 2, method: :get, path: "/trades" }, %{ auth: false, cost: 0.4, method: :get, path: "/uiKlines" }, %{ auth: false, cost: 0.4, method: :post, path: "/userDataStream" }, %{ auth: false, cost: 0.4, method: :put, path: "/userDataStream" }, %{ auth: false, cost: 0.4, method: :delete, path: "/userDataStream" } ] }, 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: [ "200", "0" ], type: :error_field_present }, signing: %{ api_key_header: "X-MBX-APIKEY", confidence: :high, pattern: :hmac_sha256_query, recv_window: 5000, recv_window_key: "recvWindow", uses_recv_window: true }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ future: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 1, expiry: 1774598400000, expiry_datetime: "2026-03-27T08:00:00.000Z", id: "BTCUSDT_260327", inverse: false, limits: %{ "amount" => %{ "max" => 500, "min" => 0.001 }, "cost" => %{ "min" => 5 }, "leverage" => %{}, "market" => %{ "max" => 1, "min" => 0.001 }, "price" => %{ "max" => 1000000, "min" => 576.3 } }, linear: true, maker: 0.0002, precision: %{ "amount" => 0.001, "base" => 1.0e-8, "price" => 0.1, "quote" => 1.0e-8 }, quote: "USDT", quote_id: "USDT", separator: "_", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT-260327", taker: 0.0005 }, precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 100000, "min" => 0.0001 }, "cost" => %{ "max" => 9000000, "min" => 0.0001 }, "price" => %{ "max" => 922327, "min" => 1.0e-5 } }, sample_precision: %{ "amount" => 0.0001, "base" => 1.0e-8, "price" => 1.0e-5, "quote" => 1.0e-8 }, spot: %{ base: "ETH", base_id: "ETH", case: :upper, contract: false, id: "ETHBTC", limits: %{ "amount" => %{ "max" => 100000, "min" => 0.0001 }, "cost" => %{ "max" => 9000000, "min" => 0.0001 }, "leverage" => %{}, "market" => %{ "max" => 1887.09733208, "min" => 0 }, "price" => %{ "max" => 922327, "min" => 1.0e-5 } }, maker: 0.001, precision: %{ "amount" => 0.0001, "base" => 1.0e-8, "price" => 1.0e-5, "quote" => 1.0e-8 }, quote: "BTC", quote_id: "BTC", separator: "", symbol: "ETH/BTC", taker: 0.001 }, swap: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 1, id: "BTCUSDT", inverse: false, limits: %{ "amount" => %{ "max" => 1000, "min" => 0.001 }, "cost" => %{ "min" => 100 }, "leverage" => %{}, "market" => %{ "max" => 120, "min" => 0.001 }, "price" => %{ "max" => 4529764, "min" => 556.8 } }, linear: true, maker: 0.0002, precision: %{ "amount" => 0.001, "base" => 1.0e-8, "price" => 0.1, "quote" => 1.0e-8 }, quote: "USDT", quote_id: "USDT", separator: "", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT", taker: 0.0005 } }, symbol_patterns: %{ future: %{ case: :upper, component_order: [ :base, :quote, :date ], date_format: :yymmdd, pattern: :future_yymmdd, separator: "_", suffix: nil }, spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :no_separator_upper, separator: "", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, separator: "", suffix: nil } }, timeframes: %{ "12h" => "12h", "15m" => "15m", "1M" => "1M", "1d" => "1d", "1h" => "1h", "1m" => "1m", "1s" => "1s", "1w" => "1w", "2h" => "2h", "30m" => "30m", "3d" => "3d", "3m" => "3m", "4h" => "4h", "5m" => "5m", "6h" => "6h", "8h" => "8h" }, url_strategy: %{ detected_from: "fallback", pattern: :no_prefix, prefix: nil }, urls: %{ api: "https://api.binance.com/api/v3", api_sections: %{ "dapiData" => "https://dapi.binance.com/futures/data", "dapiPrivate" => "https://dapi.binance.com/dapi/v1", "dapiPrivateV2" => "https://dapi.binance.com/dapi/v2", "dapiPublic" => "https://dapi.binance.com/dapi/v1", "eapiPrivate" => "https://eapi.binance.com/eapi/v1", "eapiPublic" => "https://eapi.binance.com/eapi/v1", "fapiData" => "https://fapi.binance.com/futures/data", "fapiPrivate" => "https://fapi.binance.com/fapi/v1", "fapiPrivateV2" => "https://fapi.binance.com/fapi/v2", "fapiPrivateV3" => "https://fapi.binance.com/fapi/v3", "fapiPublic" => "https://fapi.binance.com/fapi/v1", "fapiPublicV2" => "https://fapi.binance.com/fapi/v2", "fapiPublicV3" => "https://fapi.binance.com/fapi/v3", "papi" => "https://papi.binance.com/papi/v1", "papiV2" => "https://papi.binance.com/papi/v2", "private" => "https://api.binance.com/api/v3", "public" => "https://api.binance.com/api/v3", "sapi" => "https://api.binance.com/sapi/v1", "sapiV2" => "https://api.binance.com/sapi/v2", "sapiV3" => "https://api.binance.com/sapi/v3", "sapiV4" => "https://api.binance.com/sapi/v4", "v1" => "https://api.binance.com/api/v1" }, doc: [ "https://developers.binance.com/en" ], other: %{ "api_management" => "https://www.binance.com/en/usercenter/settings/api-management" }, sandbox: %{ "dapiPrivate" => "https://testnet.binancefuture.com/dapi/v1", "dapiPrivateV2" => "https://testnet.binancefuture.com/dapi/v2", "dapiPublic" => "https://testnet.binancefuture.com/dapi/v1", "fapiPrivate" => "https://testnet.binancefuture.com/fapi/v1", "fapiPrivateV2" => "https://testnet.binancefuture.com/fapi/v2", "fapiPrivateV3" => "https://testnet.binancefuture.com/fapi/v3", "fapiPublic" => "https://testnet.binancefuture.com/fapi/v1", "fapiPublicV2" => "https://testnet.binancefuture.com/fapi/v2", "fapiPublicV3" => "https://testnet.binancefuture.com/fapi/v3", "private" => "https://testnet.binance.vision/api/v3", "public" => "https://testnet.binance.vision/api/v3", "v1" => "https://testnet.binance.vision/api/v1" }, www: "https://www.binance.com" }, version: nil, ws: %{ auth: %{ market_specific: false, pattern: :listen_key, pre_auth: %{ endpoints: [ %{ api_section: "fapiPrivate", endpoint: "fapiPrivatePostListenKey", method: "POST", path: "/listenKey", type: :linear }, %{ api_section: "dapiPrivate", endpoint: "dapiPrivatePostListenKey", method: "POST", path: "/listenKey", type: :inverse }, %{ api_section: "public", endpoint: "publicPostUserDataStream", method: "POST", path: "/userDataStream", type: :spot }, %{ api_section: "papi", endpoint: "papiPostListenKey", method: "POST", path: "/listenKey", type: :portfolio_margin } ], type: :listen_key }, requires_passphrase: false }, channel_templates: %{ watch_balance: %{ auth_required: true, market_id_format: :lowercase, params: [], pattern: :stream_based, separator: "@" }, watch_bids_asks: %{ channel_name: "bookTicker", market_id_format: :lowercase, params: [], pattern: :stream_based, separator: "@" }, watch_liquidations: %{ channel_name: "forceOrder", market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_liquidations_for_symbols: %{ channel_name: "forceOrder", market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_mark_price: %{ channel_name: "markPrice", market_id_format: :lowercase, params: [ %{ "default" => "markPrice", "name" => "name" } ], pattern: :stream_based, separator: "@" }, watch_mark_prices: %{ channel_name: "markPrice", market_id_format: :lowercase, params: [ %{ "default" => "markPrice", "name" => "name" } ], pattern: :stream_based, separator: "@" }, watch_my_liquidations: %{ market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_my_liquidations_for_symbols: %{ auth_required: true, market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_my_trades: %{ auth_required: true, market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_ohlcv: %{ channel_name: "kline", market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" }, %{ "default" => nil, "name" => "interval" } ], pattern: :stream_based, separator: "@" }, watch_ohlcv_for_symbols: %{ channel_name: "kline", market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "interval" }, %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_order_book: %{ channel_name: "depth", market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" }, %{ "default" => "100", "name" => "watchOrderBookRate" } ], pattern: :stream_based, separator: "@" }, watch_order_book_for_symbols: %{ channel_name: "depth", market_id_format: :lowercase, params: [ %{ "default" => "100", "name" => "watchOrderBookRate" }, %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_orders: %{ auth_required: true, market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_positions: %{ auth_required: true, market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" }, watch_ticker: %{ channel_name: "ticker", market_id_format: :lowercase, params: [ %{ "default" => "ticker", "name" => "name" } ], pattern: :stream_based, separator: "@" }, watch_tickers: %{ channel_name: "ticker", market_id_format: :lowercase, params: [ %{ "default" => "ticker", "name" => "name" } ], pattern: :stream_based, separator: "@" }, watch_trades: %{ channel_name: "trade", market_id_format: :lowercase, params: [ %{ "default" => nil, "name" => "limit" }, %{ "default" => "trade", "name" => "name" } ], pattern: :stream_based, separator: "@" }, watch_trades_for_symbols: %{ channel_name: "trade", market_id_format: :lowercase, params: [ %{ "default" => "trade", "name" => "name" }, %{ "default" => nil, "name" => "limit" } ], pattern: :stream_based, separator: "@" } }, has: %{ watch_balance: true, watch_bids_asks: true, watch_liquidations: true, watch_liquidations_for_symbols: true, watch_mark_price: true, watch_mark_prices: true, watch_my_liquidations: true, watch_my_liquidations_for_symbols: true, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: true, watch_order_book: true, watch_order_book_for_symbols: true, watch_orders: true, watch_orders_for_symbols: true, watch_position: nil, watch_positions: true, watch_status: nil, watch_ticker: true, watch_tickers: true, watch_trades: true, watch_trades_for_symbols: true }, message_patterns: [ %{ args_field: "params", format: :method, id_field: "id", keys: [ "id", "method", "params" ], kind_field: "method", kind_value: "SUBSCRIBE", sources: [ :send, :watch_multiple ] }, %{ args_field: "params", format: :method, id_field: "id", keys: [ "id", "method", "params" ], kind_field: "method", kind_value: "UNSUBSCRIBE", sources: [ :send, :watch_multiple ] }, %{ args_field: "params", format: :method, id_field: "id", keys: [ "id", "method", "params" ], kind_field: "method", kind_value: "userDataStream.subscribe.signature", sources: [ :send, :watch ] } ], options: %{ "streamBySubscriptionsHash" => %{}, "streamIndex" => -1, "streamLimits" => %{ "delivery" => 50, "future" => 50, "margin" => 50, "spot" => 50 }, "subscriptionLimitByStream" => %{ "delivery" => 200, "future" => 200, "margin" => 200, "spot" => 200 }, "tickerChannelsMap" => %{ "1dTicker" => "ticker_1d", "1hTicker" => "ticker_1h", "24hrMiniTicker" => "miniTicker", "24hrTicker" => "ticker", "4hTicker" => "ticker_4h", "bookTicker" => "bookTicker", "markPriceUpdate" => "markPrice" }, "watchBalance" => %{ "awaitBalanceSnapshot" => true, "fetchBalanceSnapshot" => false }, "watchLiquidationsForSymbols" => %{ "defaultType" => "swap" }, "watchOHLCV" => %{ "name" => "kline" }, "watchOrderBook" => %{ "checksum" => true, "maxRetries" => 3 }, "watchOrderBookLimit" => 1000, "watchOrderBookRate" => 100, "watchPositions" => %{ "awaitPositionsSnapshot" => true, "fetchPositionsSnapshot" => true }, "watchTicker" => %{ "name" => "ticker" }, "watchTickers" => %{ "name" => "ticker" }, "watchTrades" => %{ "name" => "trade" }, "ws" => %{ "cost" => 5 } }, streaming: %{ keep_alive: 180000 }, subscription_config: %{ args_field: "params", args_format: :string_list, market_id_format: :lowercase, op_field: "method", separator: "@" }, subscription_pattern: :method_subscribe, test_urls: %{ "delivery" => "wss://dstream.binancefuture.com/ws", "future" => "wss://fstream.binancefuture.com/ws", "margin" => "wss://stream.testnet.binance.vision/ws", "spot" => "wss://stream.testnet.binance.vision/ws", "ws-api" => %{ "delivery" => "wss://testnet.binancefuture.com/ws-dapi/v1", "future" => "wss://testnet.binancefuture.com/ws-fapi/v1", "spot" => "wss://ws-api.testnet.binance.vision/ws-api/v3" } }, urls: %{ "delivery" => "wss://dstream.binance.com/ws", "future" => "wss://fstream.binance.com/ws", "margin" => "wss://stream.binance.com:9443/ws", "papi" => "wss://fstream.binance.com/pm/ws", "spot" => "wss://stream.binance.com:9443/ws", "ws-api" => %{ "delivery" => "wss://ws-dapi.binance.com/ws-dapi/v1", "future" => "wss://ws-fapi.binance.com/ws-fapi/v1", "spot" => "wss://ws-api.binance.com:443/ws-api/v3" } }, watch_methods: [ "watchBalance", "watchBidsAsks", "watchLiquidations", "watchLiquidationsForSymbols", "watchMarkPrice", "watchMarkPrices", "watchMyLiquidations", "watchMyLiquidationsForSymbols", "watchMyTrades", "watchOHLCV", "watchOHLCVForSymbols", "watchOrderBook", "watchOrderBookForSymbols", "watchOrders", "watchPositions", "watchTicker", "watchTickers", "watchTrades", "watchTradesForSymbols" ] } }