# OKX (US) Exchange Specification # # Auto-generated by: mix ccxt.extract okxus # CCXT version: 4.5.42 # Spec format version: 2 # # 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: false, classification: :pro, comment: nil, countries: [ "CN", "US" ], currencies: %{ "AED" => %{ "code" => "AED", "fees" => %{}, "id" => "AED", "limits" => %{ "deposit" => %{}, "withdraw" => %{} }, "networks" => %{}, "precision" => 0.0001 }, "AUD" => %{ "code" => "AUD", "fees" => %{}, "id" => "AUD", "limits" => %{ "deposit" => %{}, "withdraw" => %{} }, "networks" => %{}, "precision" => 0.0001 }, "EUR" => %{ "code" => "EUR", "fees" => %{}, "id" => "EUR", "limits" => %{ "deposit" => %{}, "withdraw" => %{} }, "networks" => %{}, "precision" => 0.0001 }, "GBP" => %{ "code" => "GBP", "fees" => %{}, "id" => "GBP", "limits" => %{ "deposit" => %{}, "withdraw" => %{} }, "networks" => %{}, "precision" => 0.0001 }, "USD" => %{ "code" => "USD", "fees" => %{}, "id" => "USD", "limits" => %{ "deposit" => %{}, "withdraw" => %{} }, "networks" => %{}, "precision" => 0.0001 } }, currency_aliases: %{ "AE" => "AET", "BCHSV" => "BSV", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 86, "coveragePercent" => 100, "enabledMethods" => 94, "excluded" => [ %{ "method" => "fetchMarketLeverageTiers", "reason" => "okxus fetchMarketLeverageTiers() cannot fetch leverage tiers for BTC/USDT:USDT" }, %{ "method" => "fetchDepositWithdrawFee", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchPositionHistory", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 3, "extractableMethods" => 91, "failures" => [ %{ "error" => "okxus fetchMarginAdjustmentHistory () requires a type argument", "method" => "fetchMarginAdjustmentHistory" }, %{ "error" => "okxus fetchSettlementHistory() supports futures and options markets only", "method" => "fetchSettlementHistory" }, %{ "error" => "okxus repayCrossMargin() requires an id parameter", "method" => "repayCrossMargin" }, %{ "error" => "okxus setMarginMode() params[\"lever\"] should be between 1 and 125", "method" => "setMarginMode" }, %{ "error" => "okxus fetchAllGreeks() requires either a uly or instFamily parameter", "method" => "fetchAllGreeks" } ] }, endpoints: [ %{ api_section: "private", auth: true, cost: 10, default_params: %{ "timeOut" => 1 }, expects: :list, market_type: :spot, method: :post, name: :cancel_all_orders_after, param_mappings: %{}, params: [ :timeout ], path: "/trade/cancel-all-after", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.3333333333333333, expects: :single, market_type: :spot, method: :post, name: :cancel_order, param_mappings: %{ "id" => "ordId", "symbol" => "instId" }, params: [ :id, :symbol ], path: "/trade/cancel-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :list, market_type: :spot, method: :post, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/trade/cancel-batch-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :list, market_type: :spot, method: :post, name: :cancel_orders_for_symbols, param_mappings: %{}, params: [ :orders ], path: "/trade/cancel-batch-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "side" => "sell" }, expects: :single, market_type: :spot, method: :post, name: :create_convert_trade, param_mappings: %{ "id" => "quoteId", "toCode" => "quoteCcy" }, params: [ :id, :fromCode, :toCode, :amount ], path: "/asset/convert/trade", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :single, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{}, params: [ :symbol, :side, :amount, :price ], path: "/trade/batch-orders", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :single, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{}, params: [ :symbol, :cost ], path: "/trade/batch-orders", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :single, market_type: :spot, method: :post, name: :create_market_order, param_mappings: %{}, params: [ :symbol, :side, :amount, :price ], path: "/trade/batch-orders", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :single, market_type: :spot, method: :post, name: :create_market_sell_order_with_cost, param_mappings: %{}, params: [ :symbol, :cost ], path: "/trade/batch-orders", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :single, market_type: :spot, method: :post, name: :create_order, param_mappings: %{}, params: [ :symbol, :type, :side, :amount, :price ], path: "/trade/batch-orders", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :list, market_type: :swap, method: :post, name: :create_order_with_take_profit_and_stop_loss, param_mappings: %{}, params: [ :symbol, :type, :side, :amount, :price, :takeProfit, :stopLoss ], path: "/trade/batch-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :list, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/trade/batch-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :single, market_type: :spot, method: :post, name: :create_post_only_order, param_mappings: %{}, params: [ :symbol, :type, :side, :amount, :price ], path: "/trade/batch-orders", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.06666666666666667, expects: :single, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{}, params: [ :symbol, :type, :side, :amount, :price ], path: "/trade/batch-orders", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clOrdId" => "", "ordType" => "trigger", "tag" => "6b9ad766b55dBCDE", "tdMode" => "cross", "triggerDirection" => "below" }, expects: :single, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "sz", "price" => "orderPx", "symbol" => "instId", "triggerPrice" => "triggerPx" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/trade/order-algo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clOrdId" => "", "ordType" => "conditional", "slTriggerPxType" => "last", "tag" => "6b9ad766b55dBCDE", "tdMode" => "cross", "triggerDirection" => "below" }, expects: :single, market_type: :swap, method: :post, name: :create_stop_loss_order, param_mappings: %{ "amount" => "sz", "price" => "slOrdPx", "stopLossPrice" => "slTriggerPx", "symbol" => "instId" }, params: [ :symbol, :type, :side, :amount, :price, :stopLossPrice ], path: "/trade/order-algo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clOrdId" => "", "ordType" => "trigger", "orderPx" => "-1", "tag" => "6b9ad766b55dBCDE", "tdMode" => "cross", "triggerDirection" => "below" }, expects: :single, market_type: :swap, method: :post, name: :create_stop_market_order, param_mappings: %{ "amount" => "sz", "symbol" => "instId", "triggerPrice" => "triggerPx" }, params: [ :symbol, :side, :amount, :triggerPrice ], path: "/trade/order-algo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clOrdId" => "", "ordType" => "trigger", "tag" => "6b9ad766b55dBCDE", "tdMode" => "cross", "triggerDirection" => "below" }, expects: :single, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "sz", "price" => "orderPx", "symbol" => "instId", "triggerPrice" => "triggerPx" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/trade/order-algo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clOrdId" => "", "ordType" => "conditional", "tag" => "6b9ad766b55dBCDE", "tdMode" => "cross", "tpTriggerPxType" => "last", "triggerDirection" => "above" }, expects: :single, market_type: :swap, method: :post, name: :create_take_profit_order, param_mappings: %{ "amount" => "sz", "price" => "tpOrdPx", "symbol" => "instId", "takeProfitPrice" => "tpTriggerPx" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfitPrice ], path: "/trade/order-algo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "callbackRatio" => "0.01", "clOrdId" => "", "ordType" => "move_order_stop", "tag" => "6b9ad766b55dBCDE", "tdMode" => "cross" }, expects: :single, market_type: :swap, method: :post, name: :create_trailing_percent_order, param_mappings: %{ "amount" => "sz", "price" => "px", "symbol" => "instId" }, params: [ :symbol, :type, :side, :amount, :price, :trailingPercent, :trailingTriggerPrice ], path: "/trade/order-algo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "clOrdId" => "", "ordType" => "trigger", "tag" => "6b9ad766b55dBCDE", "tdMode" => "cross", "triggerDirection" => "below" }, expects: :single, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "sz", "price" => "orderPx", "symbol" => "instId", "triggerPrice" => "triggerPx" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/trade/order-algo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.3333333333333333, expects: :single, market_type: :spot, method: :post, name: :edit_order, param_mappings: %{ "amount" => "newSz", "id" => "ordId", "price" => "newPx", "symbol" => "instId" }, params: [ :id, :symbol, :type, :side, :amount, :price ], path: "/trade/amend-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, expects: :list, market_type: :spot, method: :get, name: :fetch_accounts, param_mappings: %{}, params: [], path: "/account/config", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, expects: :single, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/account/balance", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "mgnMode" => "cross" }, expects: :list, market_type: :spot, method: :get, name: :fetch_borrow_interest, param_mappings: %{ "code" => "ccy" }, params: [ :code, :symbol, :since, :limit ], path: "/account/interest-accrued", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_borrow_rate_histories, param_mappings: %{}, params: [], path: "/finance/savings/lending-rate-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_borrow_rate_history, param_mappings: %{ "code" => "ccy" }, params: [ :code, :since, :limit ], path: "/finance/savings/lending-rate-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.5, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT", "state" => "canceled" }, swap: %{ "instType" => "SWAP", "state" => "canceled" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_canceled_orders, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :since, :limit ], path: "/trade/orders-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.5, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT", "state" => "filled" }, swap: %{ "instType" => "SWAP", "state" => "filled" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_closed_orders, pagination: %{ style: :dynamic }, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :since, :limit ], path: "/trade/orders-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_convert_currencies, param_mappings: %{}, params: [], path: "/asset/convert/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 50, default_params: %{ "side" => "sell" }, expects: :single, market_type: :spot, method: :post, name: :fetch_convert_quote, param_mappings: %{ "amount" => "rfqSz", "toCode" => "quoteCcy" }, params: [ :fromCode, :toCode, :amount ], path: "/asset/convert/estimate-quote", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :single, market_type: :spot, method: :get, name: :fetch_convert_trade, param_mappings: %{ "id" => "clTReqId" }, params: [ :id, :code ], path: "/asset/convert/history", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_convert_trade_history, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/asset/convert/history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, expects: :single, market_type: :spot, method: :get, name: :fetch_cross_borrow_rate, param_mappings: %{ "code" => "ccy" }, params: [ :code ], path: "/account/interest-rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, expects: :list, market_type: :spot, method: :get, name: :fetch_cross_borrow_rates, param_mappings: %{}, params: [], path: "/account/interest-rate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/asset/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :single, market_type: :spot, method: :get, name: :fetch_deposit, param_mappings: %{ "id" => "depId" }, params: [ :id, :code ], path: "/asset/deposit-history", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :single, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "ccy" }, params: [ :code ], path: "/asset/deposit-address", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_deposit_addresses_by_network, param_mappings: %{ "code" => "ccy" }, params: [ :code ], path: "/asset/deposit-address", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, default_params: %{ "ccy" => "B,T,C" }, expects: :list, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fees, param_mappings: %{}, params: [ :codes ], path: "/asset/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_deposits, pagination: %{ style: :dynamic }, param_mappings: %{ "code" => "ccy" }, params: [ :code, :since, :limit ], path: "/asset/deposit-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "ccy" => "USDT", "ctType" => "linear", "instType" => "SWAP", "type" => "8" }, expects: :list, market_type: :swap, method: :get, name: :fetch_funding_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/account/bills-archive", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, expects: :single, market_type: :swap, method: :get, name: :fetch_funding_interval, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/public/funding-rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, expects: :single, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/public/funding-rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, expects: :list, market_type: :swap, method: :get, name: :fetch_funding_rate_history, pagination: %{ style: :time_window }, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :since, :limit ], path: "/public/funding-rate-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, default_params: %{ "instId" => "ANY" }, expects: :list, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/public/funding-rate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "expTime" => "100000" }, expects: :list, market_type: :option, method: :get, name: :fetch_greeks, param_mappings: %{}, params: [ :symbol ], path: "/public/opt-summary", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "bar" => "1m", "limit" => 100 }, expects: :list, market_type: :swap, method: :get, name: :fetch_index_ohlcv, pagination: %{ style: :time_window }, param_mappings: %{ "timeframe" => "bar" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/market/index-candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.5, default_params: %{ "sz" => 100 }, expects: :single, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :limit ], path: "/market/books", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT" }, swap: %{ "instType" => "SWAP" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_ledger, pagination: %{ style: :dynamic }, param_mappings: %{ "code" => "ccy" }, params: [ :code, :since, :limit ], path: "/account/bills", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "mgnMode" => "cross" }, expects: :single, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/account/leverage-info", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 4, expects: :list, market_type: :swap, method: :get, name: :fetch_long_short_ratio_history, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/rubik/stat/contracts/long-short-account-ratio-contract", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "bar" => "1m", "limit" => 100 }, expects: :list, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, pagination: %{ style: :time_window }, param_mappings: %{ "symbol" => "instId", "timeframe" => "bar" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/market/mark-price-candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, expects: :single, market_type: :swap, method: :get, name: :fetch_mark_price, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/public/mark-price", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT" }, swap: %{ "instType" => "SWAP" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_mark_prices, param_mappings: %{}, params: [ :symbols ], path: "/public/mark-price", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT" }, swap: %{ "instType" => "SPOT", "type" => "swap" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/public/instruments", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT" }, swap: %{ "instType" => "SWAP" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_my_trades, pagination: %{ style: :dynamic }, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :since, :limit ], path: "/trade/fills-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "after" => "", "before" => "", "limit" => 300 }, expects: :list, market_type: :spot, method: :get, name: :fetch_ohlcv, pagination: %{ style: :time_window }, param_mappings: %{ "symbol" => "instId", "timeframe" => "bar" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/market/history-candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "instType" => "SWAP" }, expects: :single, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/public/open-interest", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 4, default_params: %{ "ccy" => "BTC", "period" => "1D" }, expects: :list, market_type: :swap, method: :get, name: :fetch_open_interest_history, param_mappings: %{ "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/rubik/stat/contracts/open-interest-volume", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "instType" => "SWAP" }, expects: :list, market_type: :spot, method: :get, name: :fetch_open_interests, param_mappings: %{}, params: [ :symbols ], path: "/public/open-interest", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.3333333333333333, expects: :list, market_type: :spot, method: :get, name: :fetch_open_orders, pagination: %{ style: :dynamic }, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :since, :limit ], path: "/trade/orders-pending", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, expects: :single, market_type: :option, method: :get, name: :fetch_option, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/market/ticker", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "instType" => "OPTION", "uly" => "BTC-USD" }, expects: :list, market_type: :option, method: :get, name: :fetch_option_chain, param_mappings: %{}, params: [ :code ], path: "/market/tickers", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.3333333333333333, expects: :single, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "ordId", "symbol" => "instId" }, params: [ :id, :symbol ], path: "/trade/order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.5, expects: :single, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{ "limit" => "sz", "symbol" => "instId" }, params: [ :symbol, :limit ], path: "/market/books", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT" }, swap: %{ "instType" => "SWAP" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_order_trades, pagination: %{ style: :dynamic }, param_mappings: %{ "id" => "ordId", "symbol" => "instId" }, params: [ :id, :symbol, :since, :limit ], path: "/trade/fills-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "instType" => "SWAP" }, expects: :single, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/account/positions", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "instId" => "BTCUSDT" }, expects: :list, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/account/positions", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, expects: :list, market_type: :swap, method: :get, name: :fetch_positions_for_symbol, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/account/positions", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "instId" => "BTCUSDT", "limit" => 100 }, expects: :list, market_type: :swap, method: :get, name: :fetch_positions_history, param_mappings: %{}, params: [ :symbols, :since, :limit ], path: "/account/positions-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 50, expects: :single, market_type: :spot, method: :get, name: :fetch_status, param_mappings: %{}, params: [], path: "/system/status", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, expects: :single, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/market/ticker", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT" }, swap: %{ "instType" => "SWAP" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/market/tickers", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, expects: :single, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/public/time", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 0.2, expects: :list, market_type: :spot, method: :get, name: :fetch_trades, pagination: %{ cursor_received: "tradeId", cursor_sent: "after", style: :cursor }, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol, :since, :limit ], path: "/market/trades", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ _by_market_type: %{ spot: %{ "instType" => "SPOT" }, swap: %{ "instType" => "SWAP", "uly" => "BTC-USDT" } } }, expects: :single, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{ "symbol" => "instId" }, params: [ :symbol ], path: "/account/trade-fee", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, expects: :single, market_type: :spot, method: :get, name: :fetch_transfer, param_mappings: %{ "id" => "transId" }, params: [ :id, :code ], path: "/asset/transfer-state", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "type" => "1" }, expects: :list, market_type: :spot, method: :get, name: :fetch_transfers, param_mappings: %{ "code" => "ccy" }, params: [ :code, :since, :limit ], path: "/account/bills-archive", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ _by_market_type: %{ spot: %{ "0" => "BTC/USDT", "instType" => "OPTION" }, swap: %{ "0" => "BTC/USDT", "instType" => "SWAP" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_underlying_assets, param_mappings: %{}, params: [], path: "/public/underlying", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :single, market_type: :spot, method: :get, name: :fetch_withdrawal, param_mappings: %{ "id" => "wdId" }, params: [ :id, :code ], path: "/asset/withdrawal-history", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :list, market_type: :spot, method: :get, name: :fetch_withdrawals, pagination: %{ style: :dynamic }, param_mappings: %{ "code" => "ccy" }, params: [ :code, :since, :limit ], path: "/asset/withdrawal-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "mgnMode" => "cross" }, expects: :single, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{ "leverage" => "lever", "symbol" => "instId" }, params: [ :leverage, :symbol ], path: "/account/set-leverage", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "posMode" => "long_short_mode" }, expects: :single, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/account/set-position-mode", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "type" => "0" }, expects: :single, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "amount" => "amt", "code" => "ccy", "fromAccount" => "from", "toAccount" => "to" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/asset/transfer", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1.6666666666666667, expects: :single, market_type: :spot, method: :get, name: :withdraw, param_mappings: %{}, params: [ :code, :amount, :address, :tag ], path: "/asset/currencies", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted } ], error_code_details: %{ 1 => %{ description: nil, type: :exchange_error }, 1009 => %{ description: nil, type: :invalid_parameters }, 2 => %{ description: nil, type: :exchange_error }, 4001 => %{ description: nil, type: :invalid_credentials }, 4002 => %{ description: nil, type: :invalid_parameters }, 4003 => %{ description: nil, type: :rate_limited }, 4004 => %{ description: nil, type: :network_error }, 4005 => %{ description: nil, type: :network_error }, 4006 => %{ description: nil, type: :invalid_parameters }, 4007 => %{ description: nil, type: :invalid_credentials }, 4008 => %{ description: nil, type: :rate_limited }, 4088 => %{ description: nil, type: :exchange_error }, 50000 => %{ description: nil, type: :invalid_parameters }, 50001 => %{ description: nil, type: :network_error }, 50002 => %{ description: nil, type: :invalid_parameters }, 50004 => %{ description: nil, type: :network_error }, 50005 => %{ description: nil, type: :network_error }, 50006 => %{ description: nil, type: :invalid_parameters }, 50007 => %{ description: nil, type: :access_restricted }, 50008 => %{ description: nil, type: :invalid_credentials }, 50009 => %{ description: nil, type: :access_restricted }, 50010 => %{ description: nil, type: :exchange_error }, 50011 => %{ description: nil, type: :rate_limited }, 50012 => %{ description: nil, type: :exchange_error }, 50013 => %{ description: nil, type: :network_error }, 50014 => %{ description: nil, type: :invalid_parameters }, 50015 => %{ description: nil, type: :exchange_error }, 50016 => %{ description: nil, type: :exchange_error }, 50017 => %{ description: nil, type: :exchange_error }, 50018 => %{ description: nil, type: :exchange_error }, 50019 => %{ description: nil, type: :exchange_error }, 50020 => %{ description: nil, type: :exchange_error }, 50021 => %{ description: nil, type: :exchange_error }, 50022 => %{ description: nil, type: :exchange_error }, 50023 => %{ description: nil, type: :exchange_error }, 50024 => %{ description: nil, type: :invalid_parameters }, 50025 => %{ description: nil, type: :exchange_error }, 50026 => %{ description: nil, type: :network_error }, 50027 => %{ description: nil, type: :access_restricted }, 50028 => %{ description: nil, type: :exchange_error }, 50044 => %{ description: nil, type: :invalid_parameters }, 50061 => %{ description: nil, type: :exchange_error }, 50062 => %{ description: nil, type: :exchange_error }, 50100 => %{ description: nil, type: :exchange_error }, 50101 => %{ description: nil, type: :invalid_credentials }, 50102 => %{ description: nil, type: :invalid_credentials }, 50103 => %{ description: nil, type: :invalid_credentials }, 50104 => %{ description: nil, type: :invalid_credentials }, 50105 => %{ description: nil, type: :invalid_credentials }, 50106 => %{ description: nil, type: :invalid_credentials }, 50107 => %{ description: nil, type: :invalid_credentials }, 50108 => %{ description: nil, type: :exchange_error }, 50109 => %{ description: nil, type: :exchange_error }, 50110 => %{ description: nil, type: :access_restricted }, 50111 => %{ description: nil, type: :invalid_credentials }, 50112 => %{ description: nil, type: :invalid_credentials }, 50113 => %{ description: nil, type: :invalid_credentials }, 50114 => %{ description: nil, type: :invalid_credentials }, 50115 => %{ description: nil, type: :invalid_parameters }, 51000 => %{ description: nil, type: :invalid_parameters }, 51001 => %{ description: nil, type: :invalid_order }, 51002 => %{ description: nil, type: :invalid_order }, 51003 => %{ description: nil, type: :invalid_parameters }, 51004 => %{ description: nil, type: :invalid_order }, 51005 => %{ description: nil, type: :invalid_order }, 51006 => %{ description: nil, type: :invalid_order }, 51007 => %{ description: nil, type: :invalid_order }, 51008 => %{ description: nil, type: :insufficient_balance }, 51009 => %{ description: nil, type: :access_restricted }, 51010 => %{ description: nil, type: :access_restricted }, 51011 => %{ description: nil, type: :invalid_order }, 51012 => %{ description: nil, type: :invalid_order }, 51014 => %{ description: nil, type: :invalid_order }, 51015 => %{ description: nil, type: :invalid_order }, 51016 => %{ description: nil, type: :invalid_order }, 51017 => %{ description: nil, type: :exchange_error }, 51018 => %{ description: nil, type: :exchange_error }, 51019 => %{ description: nil, type: :exchange_error }, 51020 => %{ description: nil, type: :invalid_order }, 51021 => %{ description: nil, type: :market_closed }, 51022 => %{ description: nil, type: :market_closed }, 51023 => %{ description: nil, type: :exchange_error }, 51024 => %{ description: nil, type: :access_restricted }, 51025 => %{ description: nil, type: :exchange_error }, 51026 => %{ description: nil, type: :invalid_order }, 51027 => %{ description: nil, type: :market_closed }, 51028 => %{ description: nil, type: :market_closed }, 51029 => %{ description: nil, type: :market_closed }, 51030 => %{ description: nil, type: :market_closed }, 51031 => %{ description: nil, type: :invalid_order }, 51046 => %{ description: nil, type: :invalid_order }, 51047 => %{ description: nil, type: :invalid_order }, 51051 => %{ description: nil, type: :invalid_order }, 51072 => %{ description: nil, type: :invalid_order }, 51073 => %{ description: nil, type: :invalid_order }, 51074 => %{ description: nil, type: :invalid_order }, 51090 => %{ description: nil, type: :invalid_order }, 51091 => %{ description: nil, type: :invalid_order }, 51092 => %{ description: nil, type: :invalid_order }, 51093 => %{ description: nil, type: :invalid_order }, 51094 => %{ description: nil, type: :invalid_order }, 51095 => %{ description: nil, type: :invalid_order }, 51096 => %{ description: nil, type: :invalid_order }, 51098 => %{ description: nil, type: :invalid_order }, 51099 => %{ description: nil, type: :invalid_order }, 51100 => %{ description: nil, type: :invalid_order }, 51101 => %{ description: nil, type: :invalid_order }, 51102 => %{ description: nil, type: :invalid_order }, 51103 => %{ description: nil, type: :invalid_order }, 51104 => %{ description: nil, type: :invalid_order }, 51105 => %{ description: nil, type: :invalid_order }, 51106 => %{ description: nil, type: :invalid_order }, 51107 => %{ description: nil, type: :invalid_order }, 51108 => %{ description: nil, type: :invalid_order }, 51109 => %{ description: nil, type: :invalid_order }, 51110 => %{ description: nil, type: :invalid_order }, 51111 => %{ description: nil, type: :invalid_parameters }, 51112 => %{ description: nil, type: :invalid_order }, 51113 => %{ description: nil, type: :rate_limited }, 51115 => %{ description: nil, type: :invalid_order }, 51116 => %{ description: nil, type: :invalid_order }, 51117 => %{ description: nil, type: :invalid_order }, 51118 => %{ description: nil, type: :invalid_order }, 51119 => %{ description: nil, type: :insufficient_balance }, 51120 => %{ description: nil, type: :invalid_order }, 51121 => %{ description: nil, type: :invalid_order }, 51122 => %{ description: nil, type: :invalid_order }, 51124 => %{ description: nil, type: :invalid_order }, 51125 => %{ description: nil, type: :invalid_order }, 51126 => %{ description: nil, type: :invalid_order }, 51127 => %{ description: nil, type: :insufficient_balance }, 51128 => %{ description: nil, type: :invalid_order }, 51129 => %{ description: nil, type: :invalid_order }, 51130 => %{ description: nil, type: :invalid_order }, 51131 => %{ description: nil, type: :insufficient_balance }, 51132 => %{ description: nil, type: :invalid_order }, 51133 => %{ description: nil, type: :invalid_order }, 51134 => %{ description: nil, type: :invalid_order }, 51135 => %{ description: nil, type: :invalid_order }, 51136 => %{ description: nil, type: :invalid_order }, 51137 => %{ description: nil, type: :invalid_order }, 51138 => %{ description: nil, type: :invalid_order }, 51139 => %{ description: nil, type: :invalid_order }, 51155 => %{ description: nil, type: :access_restricted }, 51156 => %{ description: nil, type: :invalid_parameters }, 51159 => %{ description: nil, type: :invalid_parameters }, 51162 => %{ description: nil, type: :invalid_order }, 51163 => %{ description: nil, type: :invalid_order }, 51166 => %{ description: nil, type: :invalid_order }, 51174 => %{ description: nil, type: :invalid_order }, 51185 => %{ description: nil, type: :invalid_order }, 51201 => %{ description: nil, type: :invalid_order }, 51202 => %{ description: nil, type: :invalid_order }, 51203 => %{ description: nil, type: :invalid_order }, 51204 => %{ description: nil, type: :invalid_order }, 51205 => %{ description: nil, type: :invalid_order }, 51250 => %{ description: nil, type: :invalid_order }, 51251 => %{ description: nil, type: :invalid_order }, 51252 => %{ description: nil, type: :invalid_order }, 51253 => %{ description: nil, type: :invalid_order }, 51254 => %{ description: nil, type: :invalid_order }, 51255 => %{ description: nil, type: :invalid_order }, 51256 => %{ description: nil, type: :invalid_order }, 51257 => %{ description: nil, type: :invalid_order }, 51258 => %{ description: nil, type: :invalid_order }, 51259 => %{ description: nil, type: :invalid_order }, 51260 => %{ description: nil, type: :invalid_order }, 51261 => %{ description: nil, type: :invalid_order }, 51262 => %{ description: nil, type: :invalid_order }, 51263 => %{ description: nil, type: :invalid_order }, 51264 => %{ description: nil, type: :invalid_order }, 51265 => %{ description: nil, type: :invalid_order }, 51267 => %{ description: nil, type: :invalid_order }, 51268 => %{ description: nil, type: :invalid_order }, 51269 => %{ description: nil, type: :invalid_order }, 51270 => %{ description: nil, type: :invalid_order }, 51271 => %{ description: nil, type: :invalid_order }, 51272 => %{ description: nil, type: :invalid_order }, 51273 => %{ description: nil, type: :invalid_order }, 51274 => %{ description: nil, type: :invalid_order }, 51275 => %{ description: nil, type: :invalid_order }, 51276 => %{ description: nil, type: :invalid_order }, 51277 => %{ description: nil, type: :invalid_order }, 51278 => %{ description: nil, type: :invalid_order }, 51279 => %{ description: nil, type: :invalid_order }, 51280 => %{ description: nil, type: :invalid_order }, 51321 => %{ description: nil, type: :invalid_order }, 51322 => %{ description: nil, type: :invalid_order }, 51323 => %{ description: nil, type: :invalid_parameters }, 51324 => %{ description: nil, type: :invalid_parameters }, 51325 => %{ description: nil, type: :invalid_order }, 51327 => %{ description: nil, type: :invalid_order }, 51328 => %{ description: nil, type: :invalid_order }, 51329 => %{ description: nil, type: :invalid_order }, 51330 => %{ description: nil, type: :invalid_order }, 51400 => %{ description: nil, type: :order_not_found }, 51401 => %{ description: nil, type: :order_not_found }, 51402 => %{ description: nil, type: :order_not_found }, 51403 => %{ description: nil, type: :invalid_order }, 51404 => %{ description: nil, type: :invalid_order }, 51405 => %{ description: nil, type: :exchange_error }, 51406 => %{ description: nil, type: :exchange_error }, 51407 => %{ description: nil, type: :invalid_parameters }, 51408 => %{ description: nil, type: :exchange_error }, 51409 => %{ description: nil, type: :exchange_error }, 51410 => %{ description: nil, type: :exchange_error }, 51500 => %{ description: nil, type: :exchange_error }, 51501 => %{ description: nil, type: :exchange_error }, 51502 => %{ description: nil, type: :insufficient_balance }, 51503 => %{ description: nil, type: :exchange_error }, 51506 => %{ description: nil, type: :exchange_error }, 51508 => %{ description: nil, type: :exchange_error }, 51509 => %{ description: nil, type: :exchange_error }, 51510 => %{ description: nil, type: :exchange_error }, 51511 => %{ description: nil, type: :exchange_error }, 51600 => %{ description: nil, type: :exchange_error }, 51601 => %{ description: nil, type: :exchange_error }, 51602 => %{ description: nil, type: :exchange_error }, 51603 => %{ description: nil, type: :order_not_found }, 51732 => %{ description: nil, type: :invalid_credentials }, 51733 => %{ description: nil, type: :invalid_credentials }, 51734 => %{ description: nil, type: :invalid_credentials }, 51735 => %{ description: nil, type: :exchange_error }, 51736 => %{ description: nil, type: :insufficient_balance }, 52000 => %{ description: nil, type: :exchange_error }, 54000 => %{ description: nil, type: :exchange_error }, 54001 => %{ description: nil, type: :exchange_error }, 54008 => %{ description: nil, type: :invalid_order }, 54009 => %{ description: nil, type: :invalid_order }, 54011 => %{ description: nil, type: :invalid_order }, 54072 => %{ description: nil, type: :exchange_error }, 54073 => %{ description: nil, type: :invalid_parameters }, 54074 => %{ description: nil, type: :exchange_error }, 55100 => %{ description: nil, type: :invalid_order }, 55101 => %{ description: nil, type: :invalid_order }, 55102 => %{ description: nil, type: :invalid_order }, 55103 => %{ description: nil, type: :invalid_order }, 55104 => %{ description: nil, type: :invalid_order }, 55111 => %{ description: nil, type: :invalid_order }, 55112 => %{ description: nil, type: :invalid_order }, 55113 => %{ description: nil, type: :invalid_order }, 58000 => %{ description: nil, type: :exchange_error }, 58001 => %{ description: nil, type: :invalid_credentials }, 58002 => %{ description: nil, type: :access_restricted }, 58003 => %{ description: nil, type: :exchange_error }, 58004 => %{ description: nil, type: :access_restricted }, 58005 => %{ description: nil, type: :exchange_error }, 58006 => %{ description: nil, type: :exchange_error }, 58007 => %{ description: nil, type: :exchange_error }, 58100 => %{ description: nil, type: :exchange_error }, 58101 => %{ description: nil, type: :access_restricted }, 58102 => %{ description: nil, type: :rate_limited }, 58103 => %{ description: nil, type: :exchange_error }, 58104 => %{ description: nil, type: :exchange_error }, 58105 => %{ description: nil, type: :exchange_error }, 58106 => %{ description: nil, type: :exchange_error }, 58107 => %{ description: nil, type: :exchange_error }, 58108 => %{ description: nil, type: :exchange_error }, 58109 => %{ description: nil, type: :exchange_error }, 58110 => %{ description: nil, type: :exchange_error }, 58111 => %{ description: nil, type: :exchange_error }, 58112 => %{ description: nil, type: :exchange_error }, 58114 => %{ description: nil, type: :exchange_error }, 58115 => %{ description: nil, type: :exchange_error }, 58116 => %{ description: nil, type: :exchange_error }, 58117 => %{ description: nil, type: :exchange_error }, 58125 => %{ description: nil, type: :invalid_parameters }, 58126 => %{ description: nil, type: :invalid_parameters }, 58127 => %{ description: nil, type: :invalid_parameters }, 58128 => %{ description: nil, type: :invalid_parameters }, 58200 => %{ description: nil, type: :exchange_error }, 58201 => %{ description: nil, type: :exchange_error }, 58202 => %{ description: nil, type: :exchange_error }, 58203 => %{ description: nil, type: :invalid_parameters }, 58204 => %{ description: nil, type: :access_restricted }, 58205 => %{ description: nil, type: :exchange_error }, 58206 => %{ description: nil, type: :exchange_error }, 58207 => %{ description: nil, type: :invalid_parameters }, 58208 => %{ description: nil, type: :exchange_error }, 58209 => %{ description: nil, type: :exchange_error }, 58210 => %{ description: nil, type: :exchange_error }, 58211 => %{ description: nil, type: :exchange_error }, 58212 => %{ description: nil, type: :exchange_error }, 58213 => %{ description: nil, type: :invalid_credentials }, 58221 => %{ description: nil, type: :invalid_parameters }, 58222 => %{ description: nil, type: :invalid_parameters }, 58224 => %{ description: nil, type: :invalid_parameters }, 58227 => %{ description: nil, type: :invalid_parameters }, 58228 => %{ description: nil, type: :invalid_parameters }, 58229 => %{ description: nil, type: :insufficient_balance }, 58300 => %{ description: nil, type: :exchange_error }, 58350 => %{ description: nil, type: :insufficient_balance }, 59000 => %{ description: nil, type: :exchange_error }, 59001 => %{ description: nil, type: :exchange_error }, 59100 => %{ description: nil, type: :exchange_error }, 59101 => %{ description: nil, type: :exchange_error }, 59102 => %{ description: nil, type: :exchange_error }, 59103 => %{ description: nil, type: :insufficient_balance }, 59104 => %{ description: nil, type: :exchange_error }, 59105 => %{ description: nil, type: :exchange_error }, 59106 => %{ description: nil, type: :exchange_error }, 59107 => %{ description: nil, type: :exchange_error }, 59108 => %{ description: nil, type: :insufficient_balance }, 59109 => %{ description: nil, type: :exchange_error }, 59128 => %{ description: nil, type: :invalid_order }, 59200 => %{ description: nil, type: :insufficient_balance }, 59201 => %{ description: nil, type: :insufficient_balance }, 59216 => %{ description: nil, type: :invalid_parameters }, 59260 => %{ description: nil, type: :access_restricted }, 59262 => %{ description: nil, type: :access_restricted }, 59300 => %{ description: nil, type: :exchange_error }, 59301 => %{ description: nil, type: :exchange_error }, 59313 => %{ description: nil, type: :exchange_error }, 59401 => %{ description: nil, type: :exchange_error }, 59410 => %{ description: nil, type: :exchange_error }, 59411 => %{ description: nil, type: :insufficient_balance }, 59412 => %{ description: nil, type: :exchange_error }, 59413 => %{ description: nil, type: :exchange_error }, 59414 => %{ description: nil, type: :invalid_parameters }, 59500 => %{ description: nil, type: :exchange_error }, 59501 => %{ description: nil, type: :exchange_error }, 59502 => %{ description: nil, type: :exchange_error }, 59503 => %{ description: nil, type: :exchange_error }, 59504 => %{ description: nil, type: :exchange_error }, 59505 => %{ description: nil, type: :exchange_error }, 59506 => %{ description: nil, type: :exchange_error }, 59507 => %{ description: nil, type: :exchange_error }, 59508 => %{ description: nil, type: :access_restricted }, 59515 => %{ description: nil, type: :exchange_error }, 59516 => %{ description: nil, type: :exchange_error }, 59517 => %{ description: nil, type: :exchange_error }, 59518 => %{ description: nil, type: :exchange_error }, 59519 => %{ description: nil, type: :exchange_error }, 59642 => %{ description: nil, type: :invalid_parameters }, 59643 => %{ description: nil, type: :exchange_error }, 59683 => %{ description: nil, type: :exchange_error }, 59684 => %{ description: nil, type: :invalid_parameters }, 59686 => %{ description: nil, type: :invalid_parameters }, 60001 => %{ description: nil, type: :invalid_credentials }, 60002 => %{ description: nil, type: :invalid_credentials }, 60003 => %{ description: nil, type: :invalid_credentials }, 60004 => %{ description: nil, type: :invalid_credentials }, 60005 => %{ description: nil, type: :invalid_credentials }, 60006 => %{ description: nil, type: :invalid_credentials }, 60007 => %{ description: nil, type: :invalid_credentials }, 60008 => %{ description: nil, type: :invalid_credentials }, 60009 => %{ description: nil, type: :invalid_credentials }, 60010 => %{ description: nil, type: :invalid_credentials }, 60011 => %{ description: nil, type: :invalid_credentials }, 60012 => %{ description: nil, type: :invalid_parameters }, 60013 => %{ description: nil, type: :invalid_parameters }, 60014 => %{ description: nil, type: :rate_limited }, 60015 => %{ description: nil, type: :network_error }, 60016 => %{ description: nil, type: :network_error }, 60017 => %{ description: nil, type: :invalid_parameters }, 60018 => %{ description: nil, type: :invalid_parameters }, 60019 => %{ description: nil, type: :invalid_parameters }, 60020 => %{ description: nil, type: :exchange_error }, 60021 => %{ description: nil, type: :access_restricted }, 60022 => %{ description: nil, type: :invalid_credentials }, 60023 => %{ description: nil, type: :rate_limited }, 60024 => %{ description: nil, type: :invalid_credentials }, 60025 => %{ description: nil, type: :exchange_error }, 60026 => %{ description: nil, type: :invalid_credentials }, 60027 => %{ description: nil, type: :invalid_parameters }, 60028 => %{ description: nil, type: :exchange_error }, 60029 => %{ description: nil, type: :access_restricted }, 60030 => %{ description: nil, type: :access_restricted }, 60031 => %{ description: nil, type: :invalid_credentials }, 60032 => %{ description: nil, type: :invalid_credentials }, 63999 => %{ description: nil, type: :exchange_error }, 64000 => %{ description: nil, type: :invalid_parameters }, 64001 => %{ description: nil, type: :invalid_parameters }, 64002 => %{ description: nil, type: :invalid_parameters }, 64003 => %{ description: nil, type: :access_restricted }, 70010 => %{ description: nil, type: :invalid_parameters }, 70013 => %{ description: nil, type: :invalid_parameters }, 70016 => %{ description: nil, type: :invalid_parameters }, 70060 => %{ description: nil, type: :invalid_parameters }, 70061 => %{ description: nil, type: :invalid_parameters }, 70062 => %{ description: nil, type: :invalid_parameters }, 70064 => %{ description: nil, type: :invalid_parameters }, 70065 => %{ description: nil, type: :invalid_parameters }, 70066 => %{ description: nil, type: :invalid_parameters }, 70067 => %{ description: nil, type: :invalid_parameters } }, error_codes: %{ 1 => :exchange_error, 1009 => :invalid_parameters, 2 => :exchange_error, 4001 => :invalid_credentials, 4002 => :invalid_parameters, 4003 => :rate_limited, 4004 => :network_error, 4005 => :network_error, 4006 => :invalid_parameters, 4007 => :invalid_credentials, 4008 => :rate_limited, 4088 => :exchange_error, 50000 => :invalid_parameters, 50001 => :network_error, 50002 => :invalid_parameters, 50004 => :network_error, 50005 => :network_error, 50006 => :invalid_parameters, 50007 => :access_restricted, 50008 => :invalid_credentials, 50009 => :access_restricted, 50010 => :exchange_error, 50011 => :rate_limited, 50012 => :exchange_error, 50013 => :network_error, 50014 => :invalid_parameters, 50015 => :exchange_error, 50016 => :exchange_error, 50017 => :exchange_error, 50018 => :exchange_error, 50019 => :exchange_error, 50020 => :exchange_error, 50021 => :exchange_error, 50022 => :exchange_error, 50023 => :exchange_error, 50024 => :invalid_parameters, 50025 => :exchange_error, 50026 => :network_error, 50027 => :access_restricted, 50028 => :exchange_error, 50044 => :invalid_parameters, 50061 => :exchange_error, 50062 => :exchange_error, 50100 => :exchange_error, 50101 => :invalid_credentials, 50102 => :invalid_credentials, 50103 => :invalid_credentials, 50104 => :invalid_credentials, 50105 => :invalid_credentials, 50106 => :invalid_credentials, 50107 => :invalid_credentials, 50108 => :exchange_error, 50109 => :exchange_error, 50110 => :access_restricted, 50111 => :invalid_credentials, 50112 => :invalid_credentials, 50113 => :invalid_credentials, 50114 => :invalid_credentials, 50115 => :invalid_parameters, 51000 => :invalid_parameters, 51001 => :invalid_order, 51002 => :invalid_order, 51003 => :invalid_parameters, 51004 => :invalid_order, 51005 => :invalid_order, 51006 => :invalid_order, 51007 => :invalid_order, 51008 => :insufficient_balance, 51009 => :access_restricted, 51010 => :access_restricted, 51011 => :invalid_order, 51012 => :invalid_order, 51014 => :invalid_order, 51015 => :invalid_order, 51016 => :invalid_order, 51017 => :exchange_error, 51018 => :exchange_error, 51019 => :exchange_error, 51020 => :invalid_order, 51021 => :market_closed, 51022 => :market_closed, 51023 => :exchange_error, 51024 => :access_restricted, 51025 => :exchange_error, 51026 => :invalid_order, 51027 => :market_closed, 51028 => :market_closed, 51029 => :market_closed, 51030 => :market_closed, 51031 => :invalid_order, 51046 => :invalid_order, 51047 => :invalid_order, 51051 => :invalid_order, 51072 => :invalid_order, 51073 => :invalid_order, 51074 => :invalid_order, 51090 => :invalid_order, 51091 => :invalid_order, 51092 => :invalid_order, 51093 => :invalid_order, 51094 => :invalid_order, 51095 => :invalid_order, 51096 => :invalid_order, 51098 => :invalid_order, 51099 => :invalid_order, 51100 => :invalid_order, 51101 => :invalid_order, 51102 => :invalid_order, 51103 => :invalid_order, 51104 => :invalid_order, 51105 => :invalid_order, 51106 => :invalid_order, 51107 => :invalid_order, 51108 => :invalid_order, 51109 => :invalid_order, 51110 => :invalid_order, 51111 => :invalid_parameters, 51112 => :invalid_order, 51113 => :rate_limited, 51115 => :invalid_order, 51116 => :invalid_order, 51117 => :invalid_order, 51118 => :invalid_order, 51119 => :insufficient_balance, 51120 => :invalid_order, 51121 => :invalid_order, 51122 => :invalid_order, 51124 => :invalid_order, 51125 => :invalid_order, 51126 => :invalid_order, 51127 => :insufficient_balance, 51128 => :invalid_order, 51129 => :invalid_order, 51130 => :invalid_order, 51131 => :insufficient_balance, 51132 => :invalid_order, 51133 => :invalid_order, 51134 => :invalid_order, 51135 => :invalid_order, 51136 => :invalid_order, 51137 => :invalid_order, 51138 => :invalid_order, 51139 => :invalid_order, 51155 => :access_restricted, 51156 => :invalid_parameters, 51159 => :invalid_parameters, 51162 => :invalid_order, 51163 => :invalid_order, 51166 => :invalid_order, 51174 => :invalid_order, 51185 => :invalid_order, 51201 => :invalid_order, 51202 => :invalid_order, 51203 => :invalid_order, 51204 => :invalid_order, 51205 => :invalid_order, 51250 => :invalid_order, 51251 => :invalid_order, 51252 => :invalid_order, 51253 => :invalid_order, 51254 => :invalid_order, 51255 => :invalid_order, 51256 => :invalid_order, 51257 => :invalid_order, 51258 => :invalid_order, 51259 => :invalid_order, 51260 => :invalid_order, 51261 => :invalid_order, 51262 => :invalid_order, 51263 => :invalid_order, 51264 => :invalid_order, 51265 => :invalid_order, 51267 => :invalid_order, 51268 => :invalid_order, 51269 => :invalid_order, 51270 => :invalid_order, 51271 => :invalid_order, 51272 => :invalid_order, 51273 => :invalid_order, 51274 => :invalid_order, 51275 => :invalid_order, 51276 => :invalid_order, 51277 => :invalid_order, 51278 => :invalid_order, 51279 => :invalid_order, 51280 => :invalid_order, 51321 => :invalid_order, 51322 => :invalid_order, 51323 => :invalid_parameters, 51324 => :invalid_parameters, 51325 => :invalid_order, 51327 => :invalid_order, 51328 => :invalid_order, 51329 => :invalid_order, 51330 => :invalid_order, 51400 => :order_not_found, 51401 => :order_not_found, 51402 => :order_not_found, 51403 => :invalid_order, 51404 => :invalid_order, 51405 => :exchange_error, 51406 => :exchange_error, 51407 => :invalid_parameters, 51408 => :exchange_error, 51409 => :exchange_error, 51410 => :exchange_error, 51500 => :exchange_error, 51501 => :exchange_error, 51502 => :insufficient_balance, 51503 => :exchange_error, 51506 => :exchange_error, 51508 => :exchange_error, 51509 => :exchange_error, 51510 => :exchange_error, 51511 => :exchange_error, 51600 => :exchange_error, 51601 => :exchange_error, 51602 => :exchange_error, 51603 => :order_not_found, 51732 => :invalid_credentials, 51733 => :invalid_credentials, 51734 => :invalid_credentials, 51735 => :exchange_error, 51736 => :insufficient_balance, 52000 => :exchange_error, 54000 => :exchange_error, 54001 => :exchange_error, 54008 => :invalid_order, 54009 => :invalid_order, 54011 => :invalid_order, 54072 => :exchange_error, 54073 => :invalid_parameters, 54074 => :exchange_error, 55100 => :invalid_order, 55101 => :invalid_order, 55102 => :invalid_order, 55103 => :invalid_order, 55104 => :invalid_order, 55111 => :invalid_order, 55112 => :invalid_order, 55113 => :invalid_order, 58000 => :exchange_error, 58001 => :invalid_credentials, 58002 => :access_restricted, 58003 => :exchange_error, 58004 => :access_restricted, 58005 => :exchange_error, 58006 => :exchange_error, 58007 => :exchange_error, 58100 => :exchange_error, 58101 => :access_restricted, 58102 => :rate_limited, 58103 => :exchange_error, 58104 => :exchange_error, 58105 => :exchange_error, 58106 => :exchange_error, 58107 => :exchange_error, 58108 => :exchange_error, 58109 => :exchange_error, 58110 => :exchange_error, 58111 => :exchange_error, 58112 => :exchange_error, 58114 => :exchange_error, 58115 => :exchange_error, 58116 => :exchange_error, 58117 => :exchange_error, 58125 => :invalid_parameters, 58126 => :invalid_parameters, 58127 => :invalid_parameters, 58128 => :invalid_parameters, 58200 => :exchange_error, 58201 => :exchange_error, 58202 => :exchange_error, 58203 => :invalid_parameters, 58204 => :access_restricted, 58205 => :exchange_error, 58206 => :exchange_error, 58207 => :invalid_parameters, 58208 => :exchange_error, 58209 => :exchange_error, 58210 => :exchange_error, 58211 => :exchange_error, 58212 => :exchange_error, 58213 => :invalid_credentials, 58221 => :invalid_parameters, 58222 => :invalid_parameters, 58224 => :invalid_parameters, 58227 => :invalid_parameters, 58228 => :invalid_parameters, 58229 => :insufficient_balance, 58300 => :exchange_error, 58350 => :insufficient_balance, 59000 => :exchange_error, 59001 => :exchange_error, 59100 => :exchange_error, 59101 => :exchange_error, 59102 => :exchange_error, 59103 => :insufficient_balance, 59104 => :exchange_error, 59105 => :exchange_error, 59106 => :exchange_error, 59107 => :exchange_error, 59108 => :insufficient_balance, 59109 => :exchange_error, 59128 => :invalid_order, 59200 => :insufficient_balance, 59201 => :insufficient_balance, 59216 => :invalid_parameters, 59260 => :access_restricted, 59262 => :access_restricted, 59300 => :exchange_error, 59301 => :exchange_error, 59313 => :exchange_error, 59401 => :exchange_error, 59410 => :exchange_error, 59411 => :insufficient_balance, 59412 => :exchange_error, 59413 => :exchange_error, 59414 => :invalid_parameters, 59500 => :exchange_error, 59501 => :exchange_error, 59502 => :exchange_error, 59503 => :exchange_error, 59504 => :exchange_error, 59505 => :exchange_error, 59506 => :exchange_error, 59507 => :exchange_error, 59508 => :access_restricted, 59515 => :exchange_error, 59516 => :exchange_error, 59517 => :exchange_error, 59518 => :exchange_error, 59519 => :exchange_error, 59642 => :invalid_parameters, 59643 => :exchange_error, 59683 => :exchange_error, 59684 => :invalid_parameters, 59686 => :invalid_parameters, 60001 => :invalid_credentials, 60002 => :invalid_credentials, 60003 => :invalid_credentials, 60004 => :invalid_credentials, 60005 => :invalid_credentials, 60006 => :invalid_credentials, 60007 => :invalid_credentials, 60008 => :invalid_credentials, 60009 => :invalid_credentials, 60010 => :invalid_credentials, 60011 => :invalid_credentials, 60012 => :invalid_parameters, 60013 => :invalid_parameters, 60014 => :rate_limited, 60015 => :network_error, 60016 => :network_error, 60017 => :invalid_parameters, 60018 => :invalid_parameters, 60019 => :invalid_parameters, 60020 => :exchange_error, 60021 => :access_restricted, 60022 => :invalid_credentials, 60023 => :rate_limited, 60024 => :invalid_credentials, 60025 => :exchange_error, 60026 => :invalid_credentials, 60027 => :invalid_parameters, 60028 => :exchange_error, 60029 => :access_restricted, 60030 => :access_restricted, 60031 => :invalid_credentials, 60032 => :invalid_credentials, 63999 => :exchange_error, 64000 => :invalid_parameters, 64001 => :invalid_parameters, 64002 => :invalid_parameters, 64003 => :access_restricted, 70010 => :invalid_parameters, 70013 => :invalid_parameters, 70016 => :invalid_parameters, 70060 => :invalid_parameters, 70061 => :invalid_parameters, 70062 => :invalid_parameters, 70064 => :invalid_parameters, 70065 => :invalid_parameters, 70066 => :invalid_parameters, 70067 => :invalid_parameters }, exceptions: %{ broad: %{ "Internal Server Error" => :exchange_not_available, "server error" => :exchange_not_available }, exact: %{ "1" => :exchange_error, "1009" => :bad_request, "2" => :exchange_error, "4001" => :authentication_error, "4002" => :bad_request, "4003" => :rate_limit_exceeded, "4004" => :network_error, "4005" => :exchange_not_available, "4006" => :bad_request, "4007" => :authentication_error, "4008" => :rate_limit_exceeded, "4088" => :manual_interaction_needed, "50000" => :bad_request, "50001" => :on_maintenance, "50002" => :bad_request, "50004" => :request_timeout, "50005" => :exchange_not_available, "50006" => :bad_request, "50007" => :account_suspended, "50008" => :authentication_error, "50009" => :account_suspended, "50010" => :exchange_error, "50011" => :rate_limit_exceeded, "50012" => :exchange_error, "50013" => :exchange_not_available, "50014" => :bad_request, "50015" => :exchange_error, "50016" => :exchange_error, "50017" => :exchange_error, "50018" => :exchange_error, "50019" => :exchange_error, "50020" => :exchange_error, "50021" => :exchange_error, "50022" => :exchange_error, "50023" => :exchange_error, "50024" => :bad_request, "50025" => :exchange_error, "50026" => :exchange_not_available, "50027" => :permission_denied, "50028" => :exchange_error, "50044" => :bad_request, "50061" => :exchange_error, "50062" => :exchange_error, "50100" => :exchange_error, "50101" => :authentication_error, "50102" => :invalid_nonce, "50103" => :authentication_error, "50104" => :authentication_error, "50105" => :authentication_error, "50106" => :authentication_error, "50107" => :authentication_error, "50108" => :exchange_error, "50109" => :exchange_error, "50110" => :permission_denied, "50111" => :authentication_error, "50112" => :authentication_error, "50113" => :authentication_error, "50114" => :authentication_error, "50115" => :bad_request, "51000" => :bad_request, "51001" => :bad_symbol, "51002" => :bad_symbol, "51003" => :bad_request, "51004" => :invalid_order, "51005" => :invalid_order, "51006" => :invalid_order, "51007" => :invalid_order, "51008" => :insufficient_funds, "51009" => :account_suspended, "51010" => :account_not_enabled, "51011" => :invalid_order, "51012" => :bad_symbol, "51014" => :bad_symbol, "51015" => :bad_symbol, "51016" => :invalid_order, "51017" => :exchange_error, "51018" => :exchange_error, "51019" => :exchange_error, "51020" => :invalid_order, "51021" => :contract_unavailable, "51022" => :contract_unavailable, "51023" => :exchange_error, "51024" => :account_suspended, "51025" => :exchange_error, "51026" => :bad_symbol, "51027" => :contract_unavailable, "51028" => :contract_unavailable, "51029" => :contract_unavailable, "51030" => :contract_unavailable, "51031" => :invalid_order, "51046" => :invalid_order, "51047" => :invalid_order, "51051" => :invalid_order, "51072" => :invalid_order, "51073" => :invalid_order, "51074" => :invalid_order, "51090" => :invalid_order, "51091" => :invalid_order, "51092" => :invalid_order, "51093" => :invalid_order, "51094" => :invalid_order, "51095" => :invalid_order, "51096" => :invalid_order, "51098" => :invalid_order, "51099" => :invalid_order, "51100" => :invalid_order, "51101" => :invalid_order, "51102" => :invalid_order, "51103" => :invalid_order, "51104" => :invalid_order, "51105" => :invalid_order, "51106" => :invalid_order, "51107" => :invalid_order, "51108" => :invalid_order, "51109" => :invalid_order, "51110" => :invalid_order, "51111" => :bad_request, "51112" => :invalid_order, "51113" => :rate_limit_exceeded, "51115" => :invalid_order, "51116" => :invalid_order, "51117" => :invalid_order, "51118" => :invalid_order, "51119" => :insufficient_funds, "51120" => :invalid_order, "51121" => :invalid_order, "51122" => :invalid_order, "51124" => :invalid_order, "51125" => :invalid_order, "51126" => :invalid_order, "51127" => :insufficient_funds, "51128" => :invalid_order, "51129" => :invalid_order, "51130" => :bad_symbol, "51131" => :insufficient_funds, "51132" => :invalid_order, "51133" => :invalid_order, "51134" => :invalid_order, "51135" => :invalid_order, "51136" => :invalid_order, "51137" => :invalid_order, "51138" => :invalid_order, "51139" => :invalid_order, "51155" => :restricted_location, "51156" => :bad_request, "51159" => :bad_request, "51162" => :invalid_order, "51163" => :invalid_order, "51166" => :invalid_order, "51174" => :invalid_order, "51185" => :invalid_order, "51201" => :invalid_order, "51202" => :invalid_order, "51203" => :invalid_order, "51204" => :invalid_order, "51205" => :invalid_order, "51250" => :invalid_order, "51251" => :invalid_order, "51252" => :invalid_order, "51253" => :invalid_order, "51254" => :invalid_order, "51255" => :invalid_order, "51256" => :invalid_order, "51257" => :invalid_order, "51258" => :invalid_order, "51259" => :invalid_order, "51260" => :invalid_order, "51261" => :invalid_order, "51262" => :invalid_order, "51263" => :invalid_order, "51264" => :invalid_order, "51265" => :invalid_order, "51267" => :invalid_order, "51268" => :invalid_order, "51269" => :invalid_order, "51270" => :invalid_order, "51271" => :invalid_order, "51272" => :invalid_order, "51273" => :invalid_order, "51274" => :invalid_order, "51275" => :invalid_order, "51276" => :invalid_order, "51277" => :invalid_order, "51278" => :invalid_order, "51279" => :invalid_order, "51280" => :invalid_order, "51321" => :invalid_order, "51322" => :invalid_order, "51323" => :bad_request, "51324" => :bad_request, "51325" => :invalid_order, "51327" => :invalid_order, "51328" => :invalid_order, "51329" => :invalid_order, "51330" => :invalid_order, "51400" => :order_not_found, "51401" => :order_not_found, "51402" => :order_not_found, "51403" => :invalid_order, "51404" => :invalid_order, "51405" => :exchange_error, "51406" => :exchange_error, "51407" => :bad_request, "51408" => :exchange_error, "51409" => :exchange_error, "51410" => :cancel_pending, "51500" => :exchange_error, "51501" => :exchange_error, "51502" => :insufficient_funds, "51503" => :exchange_error, "51506" => :exchange_error, "51508" => :exchange_error, "51509" => :exchange_error, "51510" => :exchange_error, "51511" => :exchange_error, "51600" => :exchange_error, "51601" => :exchange_error, "51602" => :exchange_error, "51603" => :order_not_found, "51732" => :authentication_error, "51733" => :authentication_error, "51734" => :authentication_error, "51735" => :exchange_error, "51736" => :insufficient_funds, "52000" => :exchange_error, "54000" => :exchange_error, "54001" => :exchange_error, "54008" => :invalid_order, "54009" => :invalid_order, "54011" => :invalid_order, "54072" => :exchange_error, "54073" => :bad_request, "54074" => :exchange_error, "55100" => :invalid_order, "55101" => :invalid_order, "55102" => :invalid_order, "55103" => :invalid_order, "55104" => :invalid_order, "55111" => :invalid_order, "55112" => :invalid_order, "55113" => :invalid_order, "58000" => :exchange_error, "58001" => :authentication_error, "58002" => :permission_denied, "58003" => :exchange_error, "58004" => :account_suspended, "58005" => :exchange_error, "58006" => :exchange_error, "58007" => :exchange_error, "58100" => :exchange_error, "58101" => :account_suspended, "58102" => :rate_limit_exceeded, "58103" => :exchange_error, "58104" => :exchange_error, "58105" => :exchange_error, "58106" => :exchange_error, "58107" => :exchange_error, "58108" => :exchange_error, "58109" => :exchange_error, "58110" => :exchange_error, "58111" => :exchange_error, "58112" => :exchange_error, "58114" => :exchange_error, "58115" => :exchange_error, "58116" => :exchange_error, "58117" => :exchange_error, "58125" => :bad_request, "58126" => :bad_request, "58127" => :bad_request, "58128" => :bad_request, "58200" => :exchange_error, "58201" => :exchange_error, "58202" => :exchange_error, "58203" => :invalid_address, "58204" => :account_suspended, "58205" => :exchange_error, "58206" => :exchange_error, "58207" => :invalid_address, "58208" => :exchange_error, "58209" => :exchange_error, "58210" => :exchange_error, "58211" => :exchange_error, "58212" => :exchange_error, "58213" => :authentication_error, "58221" => :bad_request, "58222" => :bad_request, "58224" => :bad_request, "58227" => :bad_request, "58228" => :bad_request, "58229" => :insufficient_funds, "58300" => :exchange_error, "58350" => :insufficient_funds, "59000" => :exchange_error, "59001" => :exchange_error, "59100" => :exchange_error, "59101" => :exchange_error, "59102" => :exchange_error, "59103" => :insufficient_funds, "59104" => :exchange_error, "59105" => :exchange_error, "59106" => :exchange_error, "59107" => :exchange_error, "59108" => :insufficient_funds, "59109" => :exchange_error, "59128" => :invalid_order, "59200" => :insufficient_funds, "59201" => :insufficient_funds, "59216" => :bad_request, "59260" => :permission_denied, "59262" => :permission_denied, "59300" => :exchange_error, "59301" => :exchange_error, "59313" => :exchange_error, "59401" => :exchange_error, "59410" => :operation_rejected, "59411" => :insufficient_funds, "59412" => :operation_rejected, "59413" => :operation_rejected, "59414" => :bad_request, "59500" => :exchange_error, "59501" => :exchange_error, "59502" => :exchange_error, "59503" => :exchange_error, "59504" => :exchange_error, "59505" => :exchange_error, "59506" => :exchange_error, "59507" => :exchange_error, "59508" => :account_suspended, "59515" => :exchange_error, "59516" => :exchange_error, "59517" => :exchange_error, "59518" => :exchange_error, "59519" => :exchange_error, "59642" => :bad_request, "59643" => :exchange_error, "59683" => :exchange_error, "59684" => :bad_request, "59686" => :bad_request, "60001" => :authentication_error, "60002" => :authentication_error, "60003" => :authentication_error, "60004" => :authentication_error, "60005" => :authentication_error, "60006" => :invalid_nonce, "60007" => :authentication_error, "60008" => :authentication_error, "60009" => :authentication_error, "60010" => :authentication_error, "60011" => :authentication_error, "60012" => :bad_request, "60013" => :bad_request, "60014" => :rate_limit_exceeded, "60015" => :network_error, "60016" => :exchange_not_available, "60017" => :bad_request, "60018" => :bad_request, "60019" => :bad_request, "60020" => :exchange_error, "60021" => :account_not_enabled, "60022" => :authentication_error, "60023" => :ddos_protection, "60024" => :authentication_error, "60025" => :exchange_error, "60026" => :authentication_error, "60027" => :arguments_required, "60028" => :not_supported, "60029" => :account_not_enabled, "60030" => :account_not_enabled, "60031" => :authentication_error, "60032" => :authentication_error, "63999" => :exchange_error, "64000" => :bad_request, "64001" => :bad_request, "64002" => :bad_request, "64003" => :account_not_enabled, "70010" => :bad_request, "70013" => :bad_request, "70016" => :bad_request, "70060" => :bad_request, "70061" => :bad_request, "70062" => :bad_request, "70064" => :bad_request, "70065" => :bad_request, "70066" => :bad_request, "70067" => :bad_request } }, exchange_options: %{ "accountsById" => %{ "18" => "trading", "6" => "funding" }, "accountsByType" => %{ "funding" => "6", "future" => "18", "futures" => "18", "margin" => "18", "option" => "18", "spot" => "18", "swap" => "18", "trading" => "18" }, "adjustForTimeDifference" => false, "algoOrderTypes" => %{ "conditional" => true, "iceberg" => true, "move_order_stop" => true, "oco" => true, "trigger" => true, "twap" => true }, "brokerId" => "6b9ad766b55dBCDE", "cancelOrders" => %{ "method" => "privatePostTradeCancelBatchOrders" }, "createMarketBuyOrderRequiresPrice" => false, "createOrder" => "privatePostTradeBatchOrders", "defaultNetwork" => "ERC20", "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "defaultNetworks" => %{ "BTC" => "BTC", "ETH" => "ERC20", "USDT" => "TRC20" }, "defaultType" => "spot", "exchangeType" => %{ "FUTURES" => "FUTURES", "MARGIN" => "MARGIN", "OPTION" => "OPTION", "SPOT" => "SPOT", "SWAP" => "SWAP", "future" => "FUTURES", "futures" => "FUTURES", "margin" => "MARGIN", "option" => "OPTION", "spot" => "SPOT", "swap" => "SWAP" }, "fetchCanceledOrders" => %{ "method" => "privateGetTradeOrdersHistory" }, "fetchClosedOrders" => %{ "method" => "privateGetTradeOrdersHistory" }, "fetchLedger" => %{ "method" => "privateGetAccountBills" }, "fetchMarkets" => %{ "types" => [ "spot", "future", "swap", "option" ] }, "fetchOHLCV" => %{ "timezone" => "UTC" }, "fetchOpenInterestHistory" => %{ "timeframes" => %{ "1D" => "1D", "1H" => "1H", "1d" => "1D", "1h" => "1H", "5M" => "5m", "5m" => "5m", "8H" => "8H", "8h" => "8H" } }, "fetchOpenOrders" => %{ "method" => "privateGetTradeOrdersPending" }, "fetchOrder" => %{ "method" => "privateGetTradeOrder" }, "fetchPositions" => %{ "method" => "privateGetAccountPositions" }, "networks" => %{ "ACA" => "Acala", "ADA" => "Cardano", "ALGO" => "Algorand", "APT" => "Aptos", "AR" => "Arweave", "ARBONE" => "Arbitrum One", "ASTR" => "Astar", "ATOM" => "Cosmos", "AVAXC" => "Avalanche C-Chain", "AVAXX" => "Avalanche X-Chain", "BASE" => "Base", "BCH" => "BitcoinCash", "BEP20" => "BSC", "BRC20" => "BRC20", "BSV" => "Bitcoin SV", "BTC" => "Bitcoin", "BTCLIGHTNING" => "Lightning", "BTCLN" => "Lightning", "CELO" => "CELO", "CFX" => "Conflux", "CORE" => "CORE", "CRC20" => "Crypto", "CSPR" => "Casper", "DGB" => "Digibyte", "DOGE" => "Dogecoin", "DOT" => "Polkadot", "EGLD" => "Elrond", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "Ethereum Classic", "ETHW" => "EthereumPow", "FIL" => "Filecoin", "GLRM" => "Moonbeam", "HBAR" => "Hedera", "ICP" => "Dfinity", "ICX" => "ICON", "IOST" => "IOST", "IOTA" => "MIOTA", "KLAY" => "Klaytn", "KSM" => "Kusama", "LAT" => "PlatON", "LINEA" => "Linea", "LSK" => "Lisk", "LTC" => "Litecoin", "MATIC" => "Polygon", "METIS" => "Metis", "MINA" => "Mina", "MOVR" => "Moonriver", "NANO" => "Nano", "NEAR" => "NEAR", "NULS" => "NULS", "OASYS" => "OASYS", "ONE" => "Harmony", "ONT" => "Ontology", "OPTIMISM" => "Optimism", "RVN" => "Ravencoin", "SC" => "Siacoin", "SCROLL" => "Scroll", "SOL" => "Solana", "STX" => "l-Stacks", "SUI" => "SUI", "THETA" => "Theta", "TON" => "TON", "TRC20" => "TRC20", "WAX" => "Wax", "XCH" => "Chia", "XLM" => "Stellar Lumens", "XRP" => "Ripple", "XTZ" => "Tezos", "ZIL" => "Zilliqa", "ZKSYNCERA" => "zkSync Era" }, "networksById" => %{ "Acala" => "ACA", "Algorand" => "ALGO", "Aptos" => "APT", "Arbitrum One" => "ARBONE", "Arweave" => "AR", "Astar" => "ASTR", "Avalanche C-Chain" => "AVAXC", "Avalanche X-Chain" => "AVAXX", "BRC20" => "BRC20", "BSC" => "BEP20", "Base" => "BASE", "Bitcoin" => "BTC", "Bitcoin SV" => "BSV", "BitcoinCash" => "BCH", "CELO" => "CELO", "CORE" => "CORE", "Cardano" => "ADA", "Casper" => "CSPR", "Chia" => "XCH", "Conflux" => "CFX", "Cosmos" => "ATOM", "Crypto" => "CRC20", "Dfinity" => "ICP", "Digibyte" => "DGB", "Dogecoin" => "DOGE", "EOS" => "EOS", "ERC20" => "ERC20", "Elrond" => "EGLD", "Ethereum Classic" => "ETC", "EthereumPow" => "ETHW", "Filecoin" => "FIL", "Harmony" => "ONE", "Hedera" => "HBAR", "ICON" => "ICX", "IOST" => "IOST", "Klaytn" => "KLAY", "Kusama" => "KSM", "Lightning" => "BTCLIGHTNING", "Linea" => "LINEA", "Lisk" => "LSK", "Litecoin" => "LTC", "MIOTA" => "IOTA", "Metis" => "METIS", "Mina" => "MINA", "Moonbeam" => "GLRM", "Moonriver" => "MOVR", "NEAR" => "NEAR", "NULS" => "NULS", "Nano" => "NANO", "OASYS" => "OASYS", "Ontology" => "ONT", "Optimism" => "OPTIMISM", "PlatON" => "LAT", "Polkadot" => "DOT", "Polygon" => "MATIC", "Ravencoin" => "RVN", "Ripple" => "XRP", "SUI" => "SUI", "Scroll" => "SCROLL", "Siacoin" => "SC", "Solana" => "SOL", "Stellar Lumens" => "XLM", "TON" => "TON", "TRC20" => "TRC20", "Tezos" => "XTZ", "Theta" => "THETA", "Wax" => "WAX", "Zilliqa" => "ZIL", "l-Stacks" => "STX", "zkSync Era" => "ZKSYNCERA" }, "sandboxMode" => false, "timeDifference" => 0, "withdraw" => %{} }, extended_metadata: %{ fees_url: "https://app.okx.com/pages/products/fees.html", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg", referral_discount: 0.2, referral_url: "https://www.app.okx.com/join/CCXT2023" }, extracted_metadata: %{ ccxt_version: "4.5.42" }, features: %{ default: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: true, trigger_price_type: %{ index: true, last: true, mark: true } }, hedged: true, iceberg: true, leverage: false, margin_mode: true, 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: false, ioc: true, po: true }, trailing: true, trigger_direction: false, trigger_price: true, trigger_price_type: %{ index: true, last: true, mark: true } }, create_orders: %{ max: 20 }, fetch_closed_orders: %{ days_back: 90, days_back_canceled: 0.08333333333333333, limit: 100, margin_mode: false, symbol_required: false, trailing: true, trigger: true }, fetch_my_trades: %{ days_back: 90, limit: 100, margin_mode: false, symbol_required: false, until_days: 10000 }, fetch_ohlcv: %{ index: 100, limit: 300, mark: 100 }, fetch_open_orders: %{ limit: 100, margin_mode: false, symbol_required: false, trailing: true, trigger: true }, fetch_order: %{ margin_mode: false, symbol_required: true, trailing: true, trigger: true }, sandbox: true }, future: %{}, spot: %{ extends: "default", fetch_currencies: %{ private: true } }, swap: %{} }, fees: %{ future: %{ maker: 0.0002, taker: 0.0005 }, spot: %{ maker: 0.001, taker: 0.0015 }, swap: %{ maker: 0.0002, taker: 0.0005 }, trading: %{ maker: 0.001, taker: 0.0015 } }, forward_aliases: nil, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (!response) {\n return undefined; // fallback to default error handler\n }\n //\n // {\n // \"code\": \"1\",\n // \"data\": [\n // {\n // \"clOrdId\": \"\",\n // \"ordId\": \"\",\n // \"sCode\": \"51119\",\n // \"sMsg\": \"Order placement failed due to insufficient balance. \",\n // \"tag\": \"\"\n // }\n // ],\n // \"msg\": \"\"\n // },\n // {\n // \"code\": \"58001\",\n // \"data\": [],\n // \"msg\": \"Incorrect trade password\"\n // }\n //\n const code = this.safeString(response, 'code');\n if ((code !== '0') && (code !== '2')) { // 2 means that bulk operation partially succeeded\n const feedback = this.id + ' ' + body;\n const data = this.safeList(response, 'data', []);\n for (let i = 0; i < data.length; i++) {\n const error = data[i];\n const errorCode = this.safeString(error, 'sCode');\n const message = this.safeString(error, 'sMsg');\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);\n this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);\n }\n this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }", has: %{ add_margin: true, borrow_cross_margin: false, borrow_isolated_margin: false, borrow_margin: false, c_o_r_s: false, cancel_all_orders: false, cancel_all_orders_after: true, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: true, cancel_orders_for_symbols: true, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, close_all_positions: false, close_position: true, create_convert_trade: true, create_deposit_address: false, create_limit_buy_order: false, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: false, create_limit_sell_order_ws: false, create_market_buy_order: false, create_market_buy_order_with_cost: true, create_market_buy_order_with_cost_ws: false, create_market_buy_order_ws: false, create_market_order: true, create_market_order_with_cost: false, create_market_order_with_cost_ws: false, create_market_order_ws: true, create_market_sell_order: false, create_market_sell_order_with_cost: true, create_market_sell_order_with_cost_ws: false, create_market_sell_order_ws: false, create_order: true, create_order_with_take_profit_and_stop_loss: true, create_order_with_take_profit_and_stop_loss_ws: false, create_order_ws: false, create_orders: true, create_post_only_order: 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: true, 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: false, fetch_a_d_l_rank: false, fetch_accounts: true, fetch_all_greeks: true, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: false, fetch_borrow_interest: true, fetch_borrow_rate: false, fetch_borrow_rate_histories: true, fetch_borrow_rate_history: true, fetch_borrow_rates: false, fetch_borrow_rates_per_symbol: false, fetch_canceled_and_closed_orders: false, fetch_canceled_orders: true, fetch_closed_order: false, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: true, fetch_convert_quote: true, fetch_convert_trade: true, fetch_convert_trade_history: true, fetch_cross_borrow_rate: true, fetch_cross_borrow_rates: true, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: true, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: true, fetch_deposit_withdraw_fee: true, fetch_deposit_withdraw_fees: true, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: true, fetch_funding_interval: true, fetch_funding_intervals: false, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: true, fetch_greeks: true, fetch_index_ohlcv: true, fetch_isolated_borrow_rate: false, fetch_isolated_borrow_rates: false, fetch_isolated_positions: false, fetch_l2_order_book: true, fetch_l3_order_book: false, fetch_last_prices: false, fetch_ledger: true, fetch_ledger_entry: false, fetch_leverage: true, fetch_leverage_tiers: false, fetch_leverages: false, fetch_liquidations: false, fetch_long_short_ratio: false, fetch_long_short_ratio_history: true, fetch_margin_adjustment_history: true, fetch_margin_mode: false, fetch_margin_modes: false, fetch_mark_ohlcv: true, fetch_mark_price: true, fetch_mark_prices: true, fetch_market_leverage_tiers: true, fetch_markets: true, fetch_markets_ws: false, fetch_my_liquidations: false, fetch_my_settlement_history: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: true, fetch_open_interest_history: true, fetch_open_interests: true, fetch_open_order: false, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: true, fetch_option_chain: true, 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: false, fetch_orders_by_status: false, fetch_orders_ws: false, fetch_position: true, fetch_position_a_d_l_rank: false, fetch_position_history: true, fetch_position_mode: false, fetch_position_ws: false, fetch_positions: true, fetch_positions_a_d_l_rank: false, fetch_positions_for_symbol: true, fetch_positions_for_symbol_ws: false, fetch_positions_history: true, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: false, fetch_settlement_history: 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: false, fetch_trading_fees_ws: false, fetch_trading_limits: false, fetch_transaction_fee: false, fetch_transaction_fees: false, fetch_transactions: false, fetch_transfer: true, fetch_transfers: true, fetch_underlying_assets: true, fetch_volatility_history: false, fetch_withdraw_addresses: false, fetch_withdrawal: true, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: false, margin: false, option: false, private_api: true, public_api: true, reduce_margin: true, repay_cross_margin: true, repay_isolated_margin: false, sandbox: true, set_leverage: true, set_margin: false, set_margin_mode: true, set_position_mode: true, sign_in: false, spot: true, swap: false, transfer: true, un_watch_my_trades: false, un_watch_ohlcv: false, un_watch_ohlcv_for_symbols: false, un_watch_order_book: false, un_watch_order_book_for_symbols: false, un_watch_orders: false, un_watch_positions: false, un_watch_ticker: false, un_watch_tickers: false, un_watch_trades: false, un_watch_trades_for_symbols: false, watch_balance: true, watch_bids_asks: true, watch_funding_rate: true, watch_funding_rates: 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: false, 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: "okxus", markets: nil, name: "OKX (US)", ohlcv_timestamp_resolution: :unknown, options: %{ accounts_by_id: %{ "18" => "trading", "6" => "funding" }, accounts_by_type: %{ "funding" => "6", "future" => "18", "futures" => "18", "margin" => "18", "option" => "18", "spot" => "18", "swap" => "18", "trading" => "18" }, adjust_for_time_difference: false, algo_order_types: %{ "conditional" => true, "iceberg" => true, "move_order_stop" => true, "oco" => true, "trigger" => true, "twap" => true }, broker_id: "6b9ad766b55dBCDE", cancel_orders: %{ "method" => "privatePostTradeCancelBatchOrders" }, create_market_buy_order_requires_price: false, create_order: "privatePostTradeBatchOrders", default_account_type: "spot", default_network: "ERC20", default_networks: %{ "BTC" => "BTC", "ETH" => "ERC20", "USDT" => "TRC20" }, default_type: "spot", exchange_type: %{ "FUTURES" => "FUTURES", "MARGIN" => "MARGIN", "OPTION" => "OPTION", "SPOT" => "SPOT", "SWAP" => "SWAP", "future" => "FUTURES", "futures" => "FUTURES", "margin" => "MARGIN", "option" => "OPTION", "spot" => "SPOT", "swap" => "SWAP" }, fetch_canceled_orders: %{ "method" => "privateGetTradeOrdersHistory" }, fetch_closed_orders: %{ "method" => "privateGetTradeOrdersHistory" }, fetch_ledger: %{ "method" => "privateGetAccountBills" }, fetch_markets: %{ "types" => [ "spot", "future", "swap", "option" ] }, fetch_o_h_l_c_v: %{ "timezone" => "UTC" }, fetch_open_interest_history: %{ "timeframes" => %{ "1D" => "1D", "1H" => "1H", "1d" => "1D", "1h" => "1H", "5M" => "5m", "5m" => "5m", "8H" => "8H", "8h" => "8H" } }, fetch_open_orders: %{ "method" => "privateGetTradeOrdersPending" }, fetch_order: %{ "method" => "privateGetTradeOrder" }, fetch_positions: %{ "method" => "privateGetAccountPositions" }, networks: %{ "ACA" => "Acala", "ADA" => "Cardano", "ALGO" => "Algorand", "APT" => "Aptos", "AR" => "Arweave", "ARBONE" => "Arbitrum One", "ASTR" => "Astar", "ATOM" => "Cosmos", "AVAXC" => "Avalanche C-Chain", "AVAXX" => "Avalanche X-Chain", "BASE" => "Base", "BCH" => "BitcoinCash", "BEP20" => "BSC", "BRC20" => "BRC20", "BSV" => "Bitcoin SV", "BTC" => "Bitcoin", "BTCLIGHTNING" => "Lightning", "BTCLN" => "Lightning", "CELO" => "CELO", "CFX" => "Conflux", "CORE" => "CORE", "CRC20" => "Crypto", "CSPR" => "Casper", "DGB" => "Digibyte", "DOGE" => "Dogecoin", "DOT" => "Polkadot", "EGLD" => "Elrond", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "Ethereum Classic", "ETHW" => "EthereumPow", "FIL" => "Filecoin", "GLRM" => "Moonbeam", "HBAR" => "Hedera", "ICP" => "Dfinity", "ICX" => "ICON", "IOST" => "IOST", "IOTA" => "MIOTA", "KLAY" => "Klaytn", "KSM" => "Kusama", "LAT" => "PlatON", "LINEA" => "Linea", "LSK" => "Lisk", "LTC" => "Litecoin", "MATIC" => "Polygon", "METIS" => "Metis", "MINA" => "Mina", "MOVR" => "Moonriver", "NANO" => "Nano", "NEAR" => "NEAR", "NULS" => "NULS", "OASYS" => "OASYS", "ONE" => "Harmony", "ONT" => "Ontology", "OPTIMISM" => "Optimism", "RVN" => "Ravencoin", "SC" => "Siacoin", "SCROLL" => "Scroll", "SOL" => "Solana", "STX" => "l-Stacks", "SUI" => "SUI", "THETA" => "Theta", "TON" => "TON", "TRC20" => "TRC20", "WAX" => "Wax", "XCH" => "Chia", "XLM" => "Stellar Lumens", "XRP" => "Ripple", "XTZ" => "Tezos", "ZIL" => "Zilliqa", "ZKSYNCERA" => "zkSync Era" }, sandbox_mode: false, time_difference: 0, withdraw: %{} }, order_mappings: %{ side_format: :lowercase, side_key: "side", type_format: :lowercase, type_key: "ordType" }, param_mappings: %{ "amount" => "amt", "code" => "ccy", "fromAccount" => "from", "id" => "wdId", "leverage" => "lever", "limit" => "sz", "price" => "newPx", "stopLossPrice" => "slTriggerPx", "symbol" => "instId", "takeProfitPrice" => "tpTriggerPx", "timeframe" => "period", "toAccount" => "to", "toCode" => "quoteCcy", "triggerPrice" => "triggerPx" }, parse_methods: [ %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 2728, "line_start" => 2722, "mappings" => [], "name" => "parseBalanceByType", "signature" => "parseBalanceByType (type, response)", "source" => "parseBalanceByType (type, response) {\n if (type === 'funding') {\n return this.parseFundingBalance (response);\n } else {\n return this.parseTradingBalance (response);\n }\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 7537, "line_start" => 7520, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeString (market, 'symbol')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (this.safeString (info, 'ccy'))" }, %{ "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, 'liab')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "this.safeString (info, 'mgnMode')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" } ], "name" => "parseBorrowInterest", "signature" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest", "source" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest {\n const instId = this.safeString (info, 'instId');\n if (instId !== undefined) {\n market = this.safeMarket (instId, market);\n }\n const timestamp = this.safeInteger (info, 'ts');\n return {\n 'info': info,\n 'symbol': this.safeString (market, 'symbol'),\n 'currency': this.safeCurrencyCode (this.safeString (info, 'ccy')),\n 'interest': this.safeNumber (info, 'interest'),\n 'interestRate': this.safeNumber (info, 'interestRate'),\n 'amountBorrowed': this.safeNumber (info, 'liab'),\n 'marginMode': this.safeString (info, 'mgnMode'),\n 'timestamp': timestamp, // Interest accrued time\n 'datetime': this.iso8601 (timestamp),\n } as BorrowInterest;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amt\": \"992.10341195\",\n \"ccy\": \"BTC\",\n \"rate\": \"0.01\",\n \"ts\": \"1643954400000\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 7093, "line_start" => 7074, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (ccy)" }, %{ "comment" => nil, "key" => "rate", "value" => "this.safeNumber2 (info, 'interestRate', 'rate')" }, %{ "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 // \"amt\": \"992.10341195\",\n // \"ccy\": \"BTC\",\n // \"rate\": \"0.01\",\n // \"ts\": \"1643954400000\"\n // }\n //\n const ccy = this.safeString (info, 'ccy');\n const timestamp = this.safeInteger (info, 'ts');\n return {\n 'currency': this.safeCurrencyCode (ccy),\n 'rate': this.safeNumber2 (info, 'interestRate', 'rate'),\n 'period': 86400000,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"amt\": \"992.10341195\",\n \"ccy\": \"BTC\",\n \"rate\": \"0.01\",\n \"ts\": \"1643954400000\"\n },\n ...\n ]" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 7126, "line_start" => 7095, "mappings" => [], "name" => "parseBorrowRateHistories", "signature" => "parseBorrowRateHistories (response, codes, since, limit)", "source" => "parseBorrowRateHistories (response, codes, since, limit) {\n //\n // [\n // {\n // \"amt\": \"992.10341195\",\n // \"ccy\": \"BTC\",\n // \"rate\": \"0.01\",\n // \"ts\": \"1643954400000\"\n // },\n // ...\n // ]\n //\n const borrowRateHistories: Dict = {};\n for (let i = 0; i < response.length; i++) {\n const item = response[i];\n const code = this.safeCurrencyCode (this.safeString (item, 'ccy'));\n if (codes === undefined || this.inArray (code, codes)) {\n if (!(code in borrowRateHistories)) {\n borrowRateHistories[code] = [];\n }\n const borrowRateStructure = this.parseBorrowRate (item);\n const borrrowRateCode = borrowRateHistories[code];\n borrrowRateCode.push (borrowRateStructure);\n }\n }\n const keys = Object.keys (borrowRateHistories);\n for (let i = 0; i < keys.length; i++) {\n const code = keys[i];\n borrowRateHistories[code] = this.filterByCurrencySinceLimit (borrowRateHistories[code], code, since, limit);\n }\n return borrowRateHistories;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"baseCcy\": \"ETH\",\n \"baseSz\": \"0.01023052\",\n \"clQReqId\": \"\",\n \"cnvtPx\": \"2932.40104429\",\n \"origRfqSz\": \"30\",\n \"quoteCcy\": \"USDT\",\n \"quoteId\": \"quoterETH-USDT16461885104612381\",\n \"quoteSz\": \"30\",\n \"quoteTime\": \"1646188510461\",\n \"rfqSz\": \"30\",\n \"rfqSzCcy\": \"USDT\",\n \"side\": \"buy\",\n \"ttlMs\": \"10000\"\n }", "{\n \"baseCcy\": \"ETH\",\n \"clTReqId\": \"\",\n \"fillBaseSz\": \"0.01023052\",\n \"fillPx\": \"2932.40104429\",\n \"fillQuoteSz\": \"30\",\n \"instId\": \"ETH-USDT\",\n \"quoteCcy\": \"USDT\",\n \"quoteId\": \"quoterETH-USDT16461885104612381\",\n \"side\": \"buy\",\n \"state\": \"fullyFilled\",\n \"tradeId\": \"trader16461885203381437\",\n \"ts\": \"1646188520338\"\n }", "{\n \"clTReqId\": \"\",\n \"instId\": \"ETH-USDT\",\n \"side\": \"buy\",\n \"fillPx\": \"2932.401044\",\n \"baseCcy\": \"ETH\",\n \"quoteCcy\": \"USDT\",\n \"fillBaseSz\": \"0.01023052\",\n \"state\": \"fullyFilled\",\n \"tradeId\": \"trader16461885203381437\",\n \"fillQuoteSz\": \"30\",\n \"ts\": \"1646188520000\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 8828, "line_start" => 8758, "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, [ 'clQReqId', 'tradeId', 'quoteId' ])" }, %{ "comment" => nil, "key" => "fromCurrency", "value" => "fromCode" }, %{ "comment" => nil, "key" => "fromAmount", "value" => "this.safeNumber2 (conversion, 'baseSz', 'fillBaseSz')" }, %{ "comment" => nil, "key" => "toCurrency", "value" => "toCode" }, %{ "comment" => nil, "key" => "toAmount", "value" => "this.safeNumber2 (conversion, 'quoteSz', 'fillQuoteSz')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber2 (conversion, 'cnvtPx', 'fillPx')" }, %{ "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 // \"baseCcy\": \"ETH\",\n // \"baseSz\": \"0.01023052\",\n // \"clQReqId\": \"\",\n // \"cnvtPx\": \"2932.40104429\",\n // \"origRfqSz\": \"30\",\n // \"quoteCcy\": \"USDT\",\n // \"quoteId\": \"quoterETH-USDT16461885104612381\",\n // \"quoteSz\": \"30\",\n // \"quoteTime\": \"1646188510461\",\n // \"rfqSz\": \"30\",\n // \"rfqSzCcy\": \"USDT\",\n // \"side\": \"buy\",\n // \"ttlMs\": \"10000\"\n // }\n //\n // createConvertTrade\n //\n // {\n // \"baseCcy\": \"ETH\",\n // \"clTReqId\": \"\",\n // \"fillBaseSz\": \"0.01023052\",\n // \"fillPx\": \"2932.40104429\",\n // \"fillQuoteSz\": \"30\",\n // \"instId\": \"ETH-USDT\",\n // \"quoteCcy\": \"USDT\",\n // \"quoteId\": \"quoterETH-USDT16461885104612381\",\n // \"side\": \"buy\",\n // \"state\": \"fullyFilled\",\n // \"tradeId\": \"trader16461885203381437\",\n // \"ts\": \"1646188520338\"\n // }\n //\n // fetchConvertTrade, fetchConvertTradeHistory\n //\n // {\n // \"clTReqId\": \"\",\n // \"instId\": \"ETH-USDT\",\n // \"side\": \"buy\",\n // \"fillPx\": \"2932.401044\",\n // \"baseCcy\": \"ETH\",\n // \"quoteCcy\": \"USDT\",\n // \"fillBaseSz\": \"0.01023052\",\n // \"state\": \"fullyFilled\",\n // \"tradeId\": \"trader16461885203381437\",\n // \"fillQuoteSz\": \"30\",\n // \"ts\": \"1646188520000\"\n // }\n //\n const timestamp = this.safeInteger2 (conversion, 'quoteTime', 'ts');\n const fromCoin = this.safeString (conversion, 'baseCcy');\n const fromCode = this.safeCurrencyCode (fromCoin, fromCurrency);\n const to = this.safeString (conversion, 'quoteCcy');\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, [ 'clQReqId', 'tradeId', 'quoteId' ]),\n 'fromCurrency': fromCode,\n 'fromAmount': this.safeNumber2 (conversion, 'baseSz', 'fillBaseSz'),\n 'toCurrency': toCode,\n 'toAmount': this.safeNumber2 (conversion, 'quoteSz', 'fillQuoteSz'),\n 'price': this.safeNumber2 (conversion, 'cnvtPx', 'fillPx'),\n 'fee': undefined,\n } as Conversion;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"addr\": \"okbtothemoon\",\n \"memo\": \"971668\", // may be missing\n \"tag\":\"52055\", // may be missing\n \"pmtId\": \"\", // may be missing\n \"ccy\": \"BTC\",\n \"to\": \"6\", // 1 SPOT, 3 FUTURES, 6 FUNDING, 9 SWAP, 12 OPTION, 18 Unified account\n \"selected\": true\n }", "{\n \"ccy\":\"usdt-erc20\",\n \"to\":\"6\",\n \"addr\":\"0x696abb81974a8793352cbd33aadcf78eda3cfdfa\",\n \"selected\":true\n }", "{\n \"chain\": \"ETH-OKExChain\",\n \"addrEx\": { \"comment\": \"6040348\" }, // some currencies like TON may have this field,\n \"ctAddr\": \"72315c\",\n \"ccy\": \"ETH\",\n \"to\": \"6\",\n \"addr\": \"0x1c9f2244d1ccaa060bd536827c18925db10db102\",\n \"selected\": true\n }", "{\n \"chain\": \"USDT-Polygon\",\n \"ctAddr\": \"\",\n \"ccy\": \"USDT\",\n \"to\":\"6\" ,\n \"addr\": \"0x1903441e386cc49d937f6302955b5feb4286dcfa\",\n \"selected\": true\n }", "network information from currency['networks'] field:" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 5267, "line_start" => 5171, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "depositAddress" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "network", "value" => "networkCode" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" } ], "name" => "parseDepositAddress", "signature" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress", "source" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress {\n //\n // {\n // \"addr\": \"okbtothemoon\",\n // \"memo\": \"971668\", // may be missing\n // \"tag\":\"52055\", // may be missing\n // \"pmtId\": \"\", // may be missing\n // \"ccy\": \"BTC\",\n // \"to\": \"6\", // 1 SPOT, 3 FUTURES, 6 FUNDING, 9 SWAP, 12 OPTION, 18 Unified account\n // \"selected\": true\n // }\n //\n // {\n // \"ccy\":\"usdt-erc20\",\n // \"to\":\"6\",\n // \"addr\":\"0x696abb81974a8793352cbd33aadcf78eda3cfdfa\",\n // \"selected\":true\n // }\n //\n // {\n // \"chain\": \"ETH-OKExChain\",\n // \"addrEx\": { \"comment\": \"6040348\" }, // some currencies like TON may have this field,\n // \"ctAddr\": \"72315c\",\n // \"ccy\": \"ETH\",\n // \"to\": \"6\",\n // \"addr\": \"0x1c9f2244d1ccaa060bd536827c18925db10db102\",\n // \"selected\": true\n // }\n //\n const address = this.safeString (depositAddress, 'addr');\n let tag = this.safeStringN (depositAddress, [ 'tag', 'pmtId', 'memo' ]);\n if (tag === undefined) {\n const addrEx = this.safeValue (depositAddress, 'addrEx', {});\n tag = this.safeString (addrEx, 'comment');\n }\n const currencyId = this.safeString (depositAddress, 'ccy');\n currency = this.safeCurrency (currencyId, currency);\n const code = currency['code'];\n const chain = this.safeString (depositAddress, 'chain');\n const networks = this.safeValue (currency, 'networks', {});\n const networksById = this.indexBy (networks, 'id');\n let networkData = this.safeValue (networksById, chain);\n // inconsistent naming responses from exchange\n // with respect to network naming provided in currency info vs address chain-names and ids\n //\n // response from address endpoint:\n // {\n // \"chain\": \"USDT-Polygon\",\n // \"ctAddr\": \"\",\n // \"ccy\": \"USDT\",\n // \"to\":\"6\" ,\n // \"addr\": \"0x1903441e386cc49d937f6302955b5feb4286dcfa\",\n // \"selected\": true\n // }\n // network information from currency['networks'] field:\n // Polygon: {\n // info: {\n // canDep: false,\n // canInternal: false,\n // canWd: false,\n // ccy: 'USDT',\n // chain: 'USDT-Polygon-Bridge',\n // mainNet: false,\n // maxFee: '26.879528',\n // minFee: '13.439764',\n // minWd: '0.001',\n // name: ''\n // },\n // id: 'USDT-Polygon-Bridge',\n // network: 'Polygon',\n // active: false,\n // deposit: false,\n // withdraw: false,\n // fee: 13.439764,\n // precision: undefined,\n // limits: {\n // withdraw: {\n // min: 0.001,\n // max: undefined\n // }\n // }\n // },\n //\n if (chain === 'USDT-Polygon') {\n networkData = this.safeValue2 (networksById, 'USDT-Polygon-Bridge', 'USDT-Polygon');\n }\n const network = this.safeString (networkData, 'network');\n const networkCode = this.networkIdToCode (network, code);\n this.checkAddress (address);\n return {\n 'info': depositAddress,\n 'currency': code,\n 'network': networkCode,\n 'address': address,\n 'tag': tag,\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"canDep\": true,\n \"canInternal\": false,\n \"canWd\": true,\n \"ccy\": \"USDT\",\n \"chain\": \"USDT-TRC20\",\n \"logoLink\": \"https://static.coinall.ltd/cdn/assets/imgs/221/5F74EB20302D7761.png\",\n \"mainNet\": false,\n \"maxFee\": \"1.6\",\n \"maxWd\": \"8852150\",\n \"minFee\": \"0.8\",\n \"minWd\": \"2\",\n \"name\": \"Tether\",\n \"usedWdQuota\": \"0\",\n \"wdQuota\": \"500\",\n \"wdTickSz\": \"3\"\n }\n ]" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 8011, "line_start" => 7948, "mappings" => [ %{ "comment" => nil, "key" => "fee", "value" => "withdrawFee" }, %{ "comment" => nil, "key" => "percentage", "value" => "(withdrawFee !== undefined) ? false : undefined" } ], "name" => "parseDepositWithdrawFees", "signature" => "parseDepositWithdrawFees (response, codes = undefined, currencyIdKey = undefined)", "source" => "parseDepositWithdrawFees (response, codes = undefined, currencyIdKey = undefined) {\n //\n // [\n // {\n // \"canDep\": true,\n // \"canInternal\": false,\n // \"canWd\": true,\n // \"ccy\": \"USDT\",\n // \"chain\": \"USDT-TRC20\",\n // \"logoLink\": \"https://static.coinall.ltd/cdn/assets/imgs/221/5F74EB20302D7761.png\",\n // \"mainNet\": false,\n // \"maxFee\": \"1.6\",\n // \"maxWd\": \"8852150\",\n // \"minFee\": \"0.8\",\n // \"minWd\": \"2\",\n // \"name\": \"Tether\",\n // \"usedWdQuota\": \"0\",\n // \"wdQuota\": \"500\",\n // \"wdTickSz\": \"3\"\n // }\n // ]\n //\n const depositWithdrawFees: Dict = {};\n codes = this.marketCodes (codes);\n for (let i = 0; i < response.length; i++) {\n const feeInfo = response[i];\n const currencyId = this.safeString (feeInfo, 'ccy');\n const code = this.safeCurrencyCode (currencyId);\n if ((codes === undefined) || (this.inArray (code, codes))) {\n const depositWithdrawFee = this.safeValue (depositWithdrawFees, code);\n if (depositWithdrawFee === undefined) {\n depositWithdrawFees[code] = this.depositWithdrawFee ({});\n }\n depositWithdrawFees[code]['info'][currencyId] = feeInfo;\n const chain = this.safeString (feeInfo, 'chain');\n if (chain === undefined) {\n continue;\n }\n const chainSplit = chain.split ('-');\n const networkId = this.safeValue (chainSplit, 1);\n const withdrawFee = this.safeNumber (feeInfo, 'fee');\n const withdrawResult: Dict = {\n 'fee': withdrawFee,\n 'percentage': (withdrawFee !== undefined) ? false : undefined,\n };\n const depositResult: Dict = {\n 'fee': undefined,\n 'percentage': undefined,\n };\n const networkCode = this.networkIdToCode (networkId, code);\n depositWithdrawFees[code]['networks'][networkCode] = {\n 'withdraw': withdrawResult,\n 'deposit': depositResult,\n };\n }\n }\n const depositWithdrawCodes = Object.keys (depositWithdrawFees);\n for (let i = 0; i < depositWithdrawCodes.length; i++) {\n const code = depositWithdrawCodes[i];\n const currency = this.currency (code);\n depositWithdrawFees[code] = this.assignDefaultDepositWithdrawFees (depositWithdrawFees[code], currency);\n }\n return depositWithdrawFees;\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 2773, "line_start" => 2758, "mappings" => [], "name" => "parseFundingBalance", "signature" => "parseFundingBalance (response)", "source" => "parseFundingBalance (response) {\n const result: Dict = { 'info': response };\n const data = this.safeList (response, 'data', []);\n for (let i = 0; i < data.length; i++) {\n const balance = data[i];\n const currencyId = this.safeString (balance, 'ccy');\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n // it may be incorrect to use total, free and used for swap accounts\n account['total'] = this.safeString (balance, 'bal');\n account['free'] = this.safeString (balance, 'availBal');\n account['used'] = this.safeString (balance, 'frozenBal');\n result[code] = account;\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 6579, "line_start" => 6570, "mappings" => [], "name" => "parseFundingInterval", "signature" => "parseFundingInterval (interval)", "source" => "parseFundingInterval (interval) {\n const intervals: Dict = {\n '3600000': '1h',\n '14400000': '4h',\n '28800000': '8h',\n '57600000': '16h',\n '86400000': '24h',\n };\n return this.safeString (intervals, interval, interval);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"fundingRate\": \"0.00027815\",\n \"fundingTime\": \"1634256000000\",\n \"instId\": \"BTC-USD-SWAP\",\n \"instType\": \"SWAP\",\n \"nextFundingRate\": \"0.00017\",\n \"nextFundingTime\": \"1634284800000\"\n }", "{\n \"fundingRate\":\"0.0001875391284828\",\n \"fundingTime\":\"1700726400000\",\n \"instId\":\"BTC-USD-SWAP\",\n \"instType\":\"SWAP\",\n \"method\": \"next_period\",\n \"maxFundingRate\":\"0.00375\",\n \"minFundingRate\":\"-0.00375\",\n \"nextFundingRate\":\"0.0002608059239328\",\n \"nextFundingTime\":\"1700755200000\",\n \"premium\": \"0.0001233824646391\",\n \"settFundingRate\":\"0.0001699799259033\",\n \"settState\":\"settled\",\n \"ts\":\"1700724675402\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 6568, "line_start" => 6509, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "interestRate", "value" => "this.parseNumber ('0')" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "this.safeNumber (contract, 'fundingRate')" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "fundingTime" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "this.iso8601 (fundingTime)" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "nextFundingRate" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "nextFundingRateTimestamp" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "this.iso8601 (nextFundingRateTimestamp)" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "interval", "value" => "this.parseFundingInterval (millisecondsInterval)" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n //\n // {\n // \"fundingRate\": \"0.00027815\",\n // \"fundingTime\": \"1634256000000\",\n // \"instId\": \"BTC-USD-SWAP\",\n // \"instType\": \"SWAP\",\n // \"nextFundingRate\": \"0.00017\",\n // \"nextFundingTime\": \"1634284800000\"\n // }\n // ws\n // {\n // \"fundingRate\":\"0.0001875391284828\",\n // \"fundingTime\":\"1700726400000\",\n // \"instId\":\"BTC-USD-SWAP\",\n // \"instType\":\"SWAP\",\n // \"method\": \"next_period\",\n // \"maxFundingRate\":\"0.00375\",\n // \"minFundingRate\":\"-0.00375\",\n // \"nextFundingRate\":\"0.0002608059239328\",\n // \"nextFundingTime\":\"1700755200000\",\n // \"premium\": \"0.0001233824646391\",\n // \"settFundingRate\":\"0.0001699799259033\",\n // \"settState\":\"settled\",\n // \"ts\":\"1700724675402\"\n // }\n //\n // in the response above nextFundingRate is actually two funding rates from now\n //\n const nextFundingRateTimestamp = this.safeInteger (contract, 'nextFundingTime');\n const marketId = this.safeString (contract, 'instId');\n const symbol = this.safeSymbol (marketId, market);\n const nextFundingRate = this.safeNumber (contract, 'nextFundingRate');\n const fundingTime = this.safeInteger (contract, 'fundingTime');\n const fundingTimeString = this.safeString (contract, 'fundingTime');\n const nextFundingTimeString = this.safeString (contract, 'nextFundingTime');\n const millisecondsInterval = Precise.stringSub (nextFundingTimeString, fundingTimeString);\n // https://www.okx.com/support/hc/en-us/articles/360053909272-â…¨-Introduction-to-perpetual-swap-funding-fee\n // > The current interest is 0.\n return {\n 'info': contract,\n 'symbol': symbol,\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': this.parseNumber ('0'),\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'fundingRate': this.safeNumber (contract, 'fundingRate'),\n 'fundingTimestamp': fundingTime,\n 'fundingDatetime': this.iso8601 (fundingTime),\n 'nextFundingRate': nextFundingRate,\n 'nextFundingTimestamp': nextFundingRateTimestamp,\n 'nextFundingDatetime': this.iso8601 (nextFundingRateTimestamp),\n 'previousFundingRate': undefined,\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n 'interval': this.parseFundingInterval (millisecondsInterval),\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"askVol\": \"0\",\n \"bidVol\": \"0\",\n \"delta\": \"0.5105464486882039\",\n \"deltaBS\": \"0.7325502184143025\",\n \"fwdPx\": \"37675.80158694987186\",\n \"gamma\": \"-0.13183515090501083\",\n \"gammaBS\": \"0.000024139685826358558\",\n \"instId\": \"BTC-USD-240329-32000-C\",\n \"instType\": \"OPTION\",\n \"lever\": \"4.504428015946619\",\n \"markVol\": \"0.5916253554539876\",\n \"realVol\": \"0\",\n \"theta\": \"-0.0004202992014012855\",\n \"thetaBS\": \"-18.52354631567909\",\n \"ts\": \"1699586421976\",\n \"uly\": \"BTC-USD\",\n \"vega\": \"0.0020207455080045846\",\n \"vegaBS\": \"74.44022302387287\",\n \"volLv\": \"0.5948549730405797\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 8342, "line_start" => 8294, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "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, 'bidVol')" }, %{ "comment" => nil, "key" => "askImpliedVolatility", "value" => "this.safeNumber (greeks, 'askVol')" }, %{ "comment" => nil, "key" => "markImpliedVolatility", "value" => "this.safeNumber (greeks, 'markVol')" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "askPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "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 // \"askVol\": \"0\",\n // \"bidVol\": \"0\",\n // \"delta\": \"0.5105464486882039\",\n // \"deltaBS\": \"0.7325502184143025\",\n // \"fwdPx\": \"37675.80158694987186\",\n // \"gamma\": \"-0.13183515090501083\",\n // \"gammaBS\": \"0.000024139685826358558\",\n // \"instId\": \"BTC-USD-240329-32000-C\",\n // \"instType\": \"OPTION\",\n // \"lever\": \"4.504428015946619\",\n // \"markVol\": \"0.5916253554539876\",\n // \"realVol\": \"0\",\n // \"theta\": \"-0.0004202992014012855\",\n // \"thetaBS\": \"-18.52354631567909\",\n // \"ts\": \"1699586421976\",\n // \"uly\": \"BTC-USD\",\n // \"vega\": \"0.0020207455080045846\",\n // \"vegaBS\": \"74.44022302387287\",\n // \"volLv\": \"0.5948549730405797\"\n // }\n //\n const timestamp = this.safeInteger (greeks, 'ts');\n const marketId = this.safeString (greeks, 'instId');\n const symbol = this.safeSymbol (marketId, market);\n return {\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\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, 'bidVol'),\n 'askImpliedVolatility': this.safeNumber (greeks, 'askVol'),\n 'markImpliedVolatility': this.safeNumber (greeks, 'markVol'),\n 'bidPrice': undefined,\n 'askPrice': undefined,\n 'markPrice': undefined,\n 'lastPrice': undefined,\n 'underlyingPrice': undefined,\n 'info': greeks,\n };\n }" }, %{ "comment" => nil, "examples" => [ "@param {string[]|string} ids order ids", "@returns {string[]} list of order ids" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 3660, "line_start" => 3647, "mappings" => [], "name" => "parseIds", "signature" => "parseIds (ids)", "source" => "parseIds (ids) {\n /**\n * @ignore\n * @method\n * @name okx#parseIds\n * @param {string[]|string} ids order ids\n * @returns {string[]} list of order ids\n */\n if ((ids !== undefined) && typeof ids === 'string') {\n return ids.split (',');\n } else {\n return ids;\n }\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"bal\": \"0.0000819307998198\",\n \"balChg\": \"-664.2679586599999802\",\n \"billId\": \"310394313544966151\",\n \"ccy\": \"USDT\",\n \"fee\": \"0\",\n \"from\": \"\",\n \"instId\": \"LTC-USDT\",\n \"instType\": \"SPOT\",\n \"mgnMode\": \"cross\",\n \"notes\": \"\",\n \"ordId\": \"310394313519800320\",\n \"pnl\": \"0\",\n \"posBal\": \"0\",\n \"posBalChg\": \"0\",\n \"subType\": \"2\",\n \"sz\": \"664.26795866\",\n \"to\": \"\",\n \"ts\": \"1620275771196\",\n \"type\": \"2\"\n }", "{\n \"billId\": \"12344\",\n \"ccy\": \"BTC\",\n \"balChg\": \"2\",\n \"bal\": \"12\",\n \"type\": \"1\",\n \"ts\": \"1597026383085\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 5169, "line_start" => 5101, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (item, 'billId')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "account", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceId", "value" => "this.safeString (item, 'ordId')" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseLedgerEntryType (this.safeString (item, 'type'))" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (item, 'balChg')" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "this.safeNumber (item, 'bal')" }, %{ "comment" => nil, "key" => "status", "value" => "'ok'" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // privateGetAccountBills, privateGetAccountBillsArchive\n //\n // {\n // \"bal\": \"0.0000819307998198\",\n // \"balChg\": \"-664.2679586599999802\",\n // \"billId\": \"310394313544966151\",\n // \"ccy\": \"USDT\",\n // \"fee\": \"0\",\n // \"from\": \"\",\n // \"instId\": \"LTC-USDT\",\n // \"instType\": \"SPOT\",\n // \"mgnMode\": \"cross\",\n // \"notes\": \"\",\n // \"ordId\": \"310394313519800320\",\n // \"pnl\": \"0\",\n // \"posBal\": \"0\",\n // \"posBalChg\": \"0\",\n // \"subType\": \"2\",\n // \"sz\": \"664.26795866\",\n // \"to\": \"\",\n // \"ts\": \"1620275771196\",\n // \"type\": \"2\"\n // }\n //\n // privateGetAssetBills\n //\n // {\n // \"billId\": \"12344\",\n // \"ccy\": \"BTC\",\n // \"balChg\": \"2\",\n // \"bal\": \"12\",\n // \"type\": \"1\",\n // \"ts\": \"1597026383085\"\n // }\n //\n const currencyId = this.safeString (item, 'ccy');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const timestamp = this.safeInteger (item, 'ts');\n const feeCostString = this.safeString (item, 'fee');\n let fee = undefined;\n if (feeCostString !== undefined) {\n fee = {\n 'cost': this.parseNumber (Precise.stringNeg (feeCostString)),\n 'currency': code,\n };\n }\n const marketId = this.safeString (item, 'instId');\n const symbol = this.safeSymbol (marketId, undefined, '-');\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': this.safeString (item, 'billId'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'account': undefined,\n 'referenceId': this.safeString (item, 'ordId'),\n 'referenceAccount': undefined,\n 'type': this.parseLedgerEntryType (this.safeString (item, 'type')),\n 'currency': code,\n 'symbol': symbol,\n 'amount': this.safeNumber (item, 'balChg'),\n 'before': undefined,\n 'after': this.safeNumber (item, 'bal'),\n 'status': 'ok',\n 'fee': fee,\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 5099, "line_start" => 5084, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const types: Dict = {\n '1': 'transfer', // transfer\n '2': 'trade', // trade\n '3': 'trade', // delivery\n '4': 'rebate', // auto token conversion\n '5': 'trade', // liquidation\n '6': 'transfer', // margin transfer\n '7': 'trade', // interest deduction\n '8': 'fee', // funding rate\n '9': 'trade', // adl\n '10': 'trade', // clawback\n '11': 'trade', // system token conversion\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 5851, "line_start" => 5825, "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 let marketId = undefined;\n let marginMode = undefined;\n let longLeverage = undefined;\n let shortLeverage = undefined;\n for (let i = 0; i < leverage.length; i++) {\n const entry = leverage[i];\n marginMode = this.safeStringLower (entry, 'mgnMode');\n marketId = this.safeString (entry, 'instId');\n const positionSide = this.safeStringLower (entry, 'posSide');\n if (positionSide === 'long') {\n longLeverage = this.safeInteger (entry, 'lever');\n } else if (positionSide === 'short') {\n shortLeverage = this.safeInteger (entry, 'lever');\n } else {\n longLeverage = this.safeInteger (entry, 'lever');\n shortLeverage = this.safeInteger (entry, 'lever');\n }\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" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 9188, "line_start" => 9174, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "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 const timestamp = this.safeInteger (info, 'timestamp');\n let symbol = undefined;\n if (market !== undefined) {\n symbol = market['symbol'];\n }\n return {\n 'info': info,\n 'symbol': symbol,\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 \"amt\": \"102\",\n \"availLoan\": \"97\",\n \"ccy\": \"USDT\",\n \"loanQuota\": \"6000000\",\n \"posLoan\": \"0\",\n \"side\": \"repay\",\n \"usedLoan\": \"97\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 7646, "line_start" => 7624, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (info, 'amt')" }, %{ "comment" => nil, "key" => "symbol", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseMarginLoan", "signature" => "parseMarginLoan (info, currency: Currency = undefined)", "source" => "parseMarginLoan (info, currency: Currency = undefined) {\n //\n // {\n // \"amt\": \"102\",\n // \"availLoan\": \"97\",\n // \"ccy\": \"USDT\",\n // \"loanQuota\": \"6000000\",\n // \"posLoan\": \"0\",\n // \"side\": \"repay\",\n // \"usedLoan\": \"97\"\n // }\n //\n const currencyId = this.safeString (info, 'ccy');\n return {\n 'id': undefined,\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'amount': this.safeNumber (info, 'amt'),\n 'symbol': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amt\": \"0.01\",\n \"instId\": \"ETH-USD-SWAP\",\n \"posSide\": \"net\",\n \"type\": \"reduce\"\n }", "{\n bal: '67621.4325135010619812',\n balChg: '-10.0000000000000000',\n billId: '691293628710342659',\n ccy: 'USDT',\n clOrdId: '',\n execType: '',\n fee: '0',\n fillFwdPx: '',\n fillIdxPx: '',\n fillMarkPx: '',\n fillMarkVol: '',\n fillPxUsd: '',\n fillPxVol: '',\n fillTime: '1711089244850',\n from: '',\n instId: 'XRP-USDT-SWAP',\n instType: 'SWAP',\n interest: '0',\n mgnMode: 'isolated',\n notes: '',\n ordId: '',\n pnl: '0',\n posBal: '73.12',\n posBalChg: '10.00',\n px: '',\n subType: '160',\n sz: '10',\n tag: '',\n to: '',\n tradeId: '0',\n ts: '1711089244699',\n type: '6'\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 7324, "line_start" => 7251, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "data" }, %{ "comment" => nil, "key" => "symbol", "value" => "responseMarket['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'isolated'" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amount)" }, %{ "comment" => nil, "key" => "code", "value" => "code" }, %{ "comment" => nil, "key" => "total", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" }, %{ "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 // addMargin/reduceMargin\n //\n // {\n // \"amt\": \"0.01\",\n // \"instId\": \"ETH-USD-SWAP\",\n // \"posSide\": \"net\",\n // \"type\": \"reduce\"\n // }\n //\n // fetchMarginAdjustmentHistory\n //\n // {\n // bal: '67621.4325135010619812',\n // balChg: '-10.0000000000000000',\n // billId: '691293628710342659',\n // ccy: 'USDT',\n // clOrdId: '',\n // execType: '',\n // fee: '0',\n // fillFwdPx: '',\n // fillIdxPx: '',\n // fillMarkPx: '',\n // fillMarkVol: '',\n // fillPxUsd: '',\n // fillPxVol: '',\n // fillTime: '1711089244850',\n // from: '',\n // instId: 'XRP-USDT-SWAP',\n // instType: 'SWAP',\n // interest: '0',\n // mgnMode: 'isolated',\n // notes: '',\n // ordId: '',\n // pnl: '0',\n // posBal: '73.12',\n // posBalChg: '10.00',\n // px: '',\n // subType: '160',\n // sz: '10',\n // tag: '',\n // to: '',\n // tradeId: '0',\n // ts: '1711089244699',\n // type: '6'\n // }\n //\n const amountRaw = this.safeString2 (data, 'amt', 'posBalChg');\n const typeRaw = this.safeString (data, 'type');\n let type = undefined;\n if (typeRaw === '6') {\n type = Precise.stringGt (amountRaw, '0') ? 'add' : 'reduce';\n } else {\n type = typeRaw;\n }\n const amount = Precise.stringAbs (amountRaw);\n const marketId = this.safeString (data, 'instId');\n const responseMarket = this.safeMarket (marketId, market);\n const code = responseMarket['inverse'] ? responseMarket['base'] : responseMarket['quote'];\n const timestamp = this.safeInteger (data, 'ts');\n return {\n 'info': data,\n 'symbol': responseMarket['symbol'],\n 'type': type,\n 'marginMode': 'isolated',\n 'amount': this.parseNumber (amount),\n 'code': code,\n 'total': undefined,\n 'status': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"alias\": \"\", // this_week, next_week, quarter, next_quarter\n \"baseCcy\": \"BTC\",\n \"category\": \"1\",\n \"ctMult\": \"\",\n \"ctType\": \"\", // inverse, linear\n \"ctVal\": \"\",\n \"ctValCcy\": \"\",\n \"expTime\": \"\",\n \"instId\": \"BTC-USDT\", // BTC-USD-210521, CSPR-USDT-SWAP, BTC-USD-210517-44000-C\n \"instType\": \"SPOT\", // SPOT, FUTURES, SWAP, OPTION\n \"lever\": \"10\",\n \"listTime\": \"1548133413000\",\n \"lotSz\": \"0.00000001\",\n \"minSz\": \"0.00001\",\n \"optType\": \"\",\n \"quoteCcy\": \"USDT\",\n \"settleCcy\": \"\",\n \"state\": \"live\",\n \"stk\": \"\",\n \"tickSz\": \"0.1\",\n \"uly\": \"\"\n }", "{\n \"alias\": \"\",\n \"baseCcy\": \"\",\n \"category\": \"1\",\n \"ctMult\": \"0.1\",\n \"ctType\": \"\",\n \"ctVal\": \"1\",\n \"ctValCcy\": \"BTC\",\n \"expTime\": \"1648195200000\",\n \"instId\": \"BTC-USD-220325-194000-P\",\n \"instType\": \"OPTION\",\n \"lever\": \"\",\n \"listTime\": \"1631262612280\",\n \"contTdSwTime\": \"1631262812280\",\n \"lotSz\": \"1\",\n \"minSz\": \"1\",\n \"optType\": \"P\",\n \"quoteCcy\": \"\",\n \"settleCcy\": \"BTC\",\n \"state\": \"live\",\n \"stk\": \"194000\",\n \"tickSz\": \"0.0005\",\n \"uly\": \"BTC-USD\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 1839, "line_start" => 1669, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "instIdCode", "value" => "instIdCode" }, %{ "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" => "type" }, %{ "comment" => nil, "key" => "spot", "value" => "spot" }, %{ "comment" => nil, "key" => "margin", "value" => "spot && (Precise.stringGt (maxLeverage, '1'))" }, %{ "comment" => nil, "key" => "swap", "value" => "swap" }, %{ "comment" => nil, "key" => "future", "value" => "future" }, %{ "comment" => nil, "key" => "option", "value" => "option" }, %{ "comment" => nil, "key" => "active", "value" => "status === 'live'" }, %{ "comment" => nil, "key" => "contract", "value" => "contract" }, %{ "comment" => nil, "key" => "linear", "value" => "contract ? (quoteId === settleId) : undefined" }, %{ "comment" => nil, "key" => "inverse", "value" => "contract ? (baseId === settleId) : undefined" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contract ? this.safeNumber (market, 'ctVal') : undefined" }, %{ "comment" => nil, "key" => "expiry", "value" => "expiry" }, %{ "comment" => nil, "key" => "expiryDatetime", "value" => "this.iso8601 (expiry)" }, %{ "comment" => nil, "key" => "strike", "value" => "this.parseNumber (strikePrice)" }, %{ "comment" => nil, "key" => "optionType", "value" => "optionType" }, %{ "comment" => nil, "key" => "created", "value" => "this.safeInteger2 (market, 'contTdSwTime', 'listTime')" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'leverage': {\n 'min': this.parseNumber ('1'),\n 'max': this.parseNumber (maxLeverage),\n },\n 'amount': {\n 'min': this.safeNumber (market, 'minSz'),\n 'max': undefined,\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': contract ? undefined : maxSpotCost,\n },\n }" }, %{ "comment" => nil, "key" => "info", "value" => "market" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (market, 'lotSz')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (market, 'tickSz')" }, %{ "comment" => nil, "key" => "leverage", "value" => "{\n 'min': this.parseNumber ('1'),\n 'max': this.parseNumber (maxLeverage),\n }" }, %{ "comment" => nil, "key" => "amount", "value" => "{\n 'min': this.safeNumber (market, 'minSz'),\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "price", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "{\n 'min': undefined,\n 'max': contract ? undefined : maxSpotCost,\n }" }, %{ "comment" => nil, "key" => "min", "value" => "undefined" }, %{ "comment" => nil, "key" => "max", "value" => "undefined" } ], "name" => "parseMarket", "signature" => "parseMarket (market: Dict): Market", "source" => "parseMarket (market: Dict): Market {\n //\n // {\n // \"alias\": \"\", // this_week, next_week, quarter, next_quarter\n // \"baseCcy\": \"BTC\",\n // \"category\": \"1\",\n // \"ctMult\": \"\",\n // \"ctType\": \"\", // inverse, linear\n // \"ctVal\": \"\",\n // \"ctValCcy\": \"\",\n // \"expTime\": \"\",\n // \"instId\": \"BTC-USDT\", // BTC-USD-210521, CSPR-USDT-SWAP, BTC-USD-210517-44000-C\n // \"instType\": \"SPOT\", // SPOT, FUTURES, SWAP, OPTION\n // \"lever\": \"10\",\n // \"listTime\": \"1548133413000\",\n // \"lotSz\": \"0.00000001\",\n // \"minSz\": \"0.00001\",\n // \"optType\": \"\",\n // \"quoteCcy\": \"USDT\",\n // \"settleCcy\": \"\",\n // \"state\": \"live\",\n // \"stk\": \"\",\n // \"tickSz\": \"0.1\",\n // \"uly\": \"\"\n // }\n //\n // {\n // \"alias\": \"\",\n // \"baseCcy\": \"\",\n // \"category\": \"1\",\n // \"ctMult\": \"0.1\",\n // \"ctType\": \"\",\n // \"ctVal\": \"1\",\n // \"ctValCcy\": \"BTC\",\n // \"expTime\": \"1648195200000\",\n // \"instId\": \"BTC-USD-220325-194000-P\",\n // \"instType\": \"OPTION\",\n // \"lever\": \"\",\n // \"listTime\": \"1631262612280\",\n // \"contTdSwTime\": \"1631262812280\",\n // \"lotSz\": \"1\",\n // \"minSz\": \"1\",\n // \"optType\": \"P\",\n // \"quoteCcy\": \"\",\n // \"settleCcy\": \"BTC\",\n // \"state\": \"live\",\n // \"stk\": \"194000\",\n // \"tickSz\": \"0.0005\",\n // \"uly\": \"BTC-USD\"\n // }\n //\n // for swap \"preopen\" markets, only `instId` and `instType` are present\n //\n // instId: \"ETH-USD_UM-SWAP\",\n // instType: \"SWAP\",\n // state: \"preopen\",\n //\n const id = this.safeString (market, 'instId');\n let type = this.safeStringLower (market, 'instType');\n if (type === 'futures') {\n type = 'future';\n }\n const spot = (type === 'spot');\n const future = (type === 'future');\n const swap = (type === 'swap');\n const option = (type === 'option');\n const contract = swap || future || option;\n let baseId = this.safeString (market, 'baseCcy', ''); // defaulting to '' because some weird preopen markets have empty baseId\n let quoteId = this.safeString (market, 'quoteCcy', '');\n const settleId = this.safeString (market, 'settleCcy');\n const settle = this.safeCurrencyCode (settleId);\n const underlying = this.safeString (market, 'uly');\n if ((underlying !== undefined) && !spot) {\n const parts = underlying.split ('-');\n baseId = this.safeString (parts, 0);\n quoteId = this.safeString (parts, 1);\n }\n if (((baseId === '') || (quoteId === '')) && spot) { // to fix weird preopen markets\n const instId = this.safeString (market, 'instId', '');\n const parts = instId.split ('-');\n baseId = this.safeString (parts, 0);\n quoteId = this.safeString (parts, 1);\n }\n const base = this.safeCurrencyCode (baseId);\n const quote = this.safeCurrencyCode (quoteId);\n let symbol = base + '/' + quote;\n // handle preopen empty markets\n if (base === '' || quote === '') {\n symbol = id;\n }\n let expiry = undefined;\n let strikePrice = undefined;\n let optionType = undefined;\n if (contract) {\n if (settle !== undefined) {\n symbol = symbol + ':' + settle;\n }\n if (future) {\n expiry = this.safeInteger (market, 'expTime');\n if (expiry !== undefined) {\n const ymd = this.yymmdd (expiry);\n symbol = symbol + '-' + ymd;\n }\n } else if (option) {\n expiry = this.safeInteger (market, 'expTime');\n strikePrice = this.safeString (market, 'stk');\n optionType = this.safeString (market, 'optType');\n if (expiry !== undefined) {\n const ymd = this.yymmdd (expiry);\n symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType;\n optionType = (optionType === 'P') ? 'put' : 'call';\n }\n }\n }\n const fees = this.safeDict2 (this.fees, type, 'trading', {});\n let maxLeverage = this.safeString (market, 'lever', '1');\n maxLeverage = Precise.stringMax (maxLeverage, '1');\n const maxSpotCost = this.safeNumber (market, 'maxMktSz');\n const status = this.safeString (market, 'state');\n const instIdCode = this.safeInteger (market, 'instIdCode');\n return this.extend (fees, {\n 'id': id,\n 'instIdCode': instIdCode,\n 'symbol': symbol,\n 'base': base,\n 'quote': quote,\n 'settle': settle,\n 'baseId': baseId,\n 'quoteId': quoteId,\n 'settleId': settleId,\n 'type': type,\n 'spot': spot,\n 'margin': spot && (Precise.stringGt (maxLeverage, '1')),\n 'swap': swap,\n 'future': future,\n 'option': option,\n 'active': status === 'live',\n 'contract': contract,\n 'linear': contract ? (quoteId === settleId) : undefined,\n 'inverse': contract ? (baseId === settleId) : undefined,\n 'contractSize': contract ? this.safeNumber (market, 'ctVal') : undefined,\n 'expiry': expiry,\n 'expiryDatetime': this.iso8601 (expiry),\n 'strike': this.parseNumber (strikePrice),\n 'optionType': optionType,\n 'created': this.safeInteger2 (market, 'contTdSwTime', 'listTime'), // contTdSwTime is public trading start time, while listTime considers pre-trading too\n 'precision': {\n 'amount': this.safeNumber (market, 'lotSz'),\n 'price': this.safeNumber (market, 'tickSz'),\n },\n 'limits': {\n 'leverage': {\n 'min': this.parseNumber ('1'),\n 'max': this.parseNumber (maxLeverage),\n },\n 'amount': {\n 'min': this.safeNumber (market, 'minSz'),\n 'max': undefined,\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': contract ? undefined : maxSpotCost,\n },\n },\n 'info': market,\n });\n }" }, %{ "comment" => nil, "examples" => [ "@param {object} info Exchange response for 1 market", "@param {object} market CCXT market", "[\n {\n \"baseMaxLoan\": \"500\",\n \"imr\": \"0.1\",\n \"instId\": \"ETH-USDT\",\n \"maxLever\": \"10\",\n \"maxSz\": \"500\",\n \"minSz\": \"0\",\n \"mmr\": \"0.03\",\n \"optMgnFactor\": \"0\",\n \"quoteMaxLoan\": \"200000\",\n \"tier\": \"1\",\n \"uly\": \"\"\n },\n ...\n ]" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 7454, "line_start" => 7413, "mappings" => [ %{ "comment" => nil, "key" => "tier", "value" => "this.safeInteger (tier, 'tier')" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "currency", "value" => "market['quote']" }, %{ "comment" => nil, "key" => "minNotional", "value" => "this.safeNumber (tier, 'minSz')" }, %{ "comment" => nil, "key" => "maxNotional", "value" => "this.safeNumber (tier, 'maxSz')" }, %{ "comment" => nil, "key" => "maintenanceMarginRate", "value" => "this.safeNumber (tier, 'mmr')" }, %{ "comment" => nil, "key" => "maxLeverage", "value" => "this.safeNumber (tier, 'maxLever')" }, %{ "comment" => nil, "key" => "info", "value" => "tier" } ], "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 // {\n // \"baseMaxLoan\": \"500\",\n // \"imr\": \"0.1\",\n // \"instId\": \"ETH-USDT\",\n // \"maxLever\": \"10\",\n // \"maxSz\": \"500\",\n // \"minSz\": \"0\",\n // \"mmr\": \"0.03\",\n // \"optMgnFactor\": \"0\",\n // \"quoteMaxLoan\": \"200000\",\n // \"tier\": \"1\",\n // \"uly\": \"\"\n // },\n // ...\n // ]\n //\n const tiers = [];\n for (let i = 0; i < info.length; i++) {\n const tier = info[i];\n const marketId = this.safeString (tier, 'instId');\n tiers.push ({\n 'tier': this.safeInteger (tier, 'tier'),\n 'symbol': this.safeSymbol (marketId, market),\n 'currency': market['quote'],\n 'minNotional': this.safeNumber (tier, 'minSz'),\n 'maxNotional': this.safeNumber (tier, 'maxSz'),\n 'maintenanceMarginRate': this.safeNumber (tier, 'mmr'),\n 'maxLeverage': this.safeNumber (tier, 'maxLever'),\n 'info': tier,\n });\n }\n return tiers as LeverageTier[];\n }" }, %{ "comment" => nil, "examples" => [ "[\n \"1678928760000\", // timestamp\n \"24341.4\", // open\n \"24344\", // high\n \"24313.2\", // low\n \"24323\", // close\n \"628\", // contract volume\n \"2.5819\", // base volume\n \"62800\", // quote volume\n \"0\" // candlestick state\n ]" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 2532, "line_start" => 2507, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // [\n // \"1678928760000\", // timestamp\n // \"24341.4\", // open\n // \"24344\", // high\n // \"24313.2\", // low\n // \"24323\", // close\n // \"628\", // contract volume\n // \"2.5819\", // base volume\n // \"62800\", // quote volume\n // \"0\" // candlestick state\n // ]\n //\n const res = this.handleMarketTypeAndParams ('fetchOHLCV', market, undefined);\n const type = res[0];\n const volumeIndex = (type === 'spot') ? 5 : 6;\n return [\n this.safeInteger (ohlcv, 0),\n this.safeNumber (ohlcv, 1),\n this.safeNumber (ohlcv, 2),\n this.safeNumber (ohlcv, 3),\n this.safeNumber (ohlcv, 4),\n this.safeNumber (ohlcv, volumeIndex),\n ];\n }" }, %{ "comment" => nil, "examples" => [ "[\n \"1648221300000\", // timestamp\n \"2183354317.945\", // open interest (USD) - (coin) for options\n \"74285877.617\", // volume (USD) - (coin) for options\n ]", "{\n \"instId\": \"BTC-USD-230520-25500-P\",\n \"instType\": \"OPTION\",\n \"oi\": \"300\",\n \"oiCcy\": \"3\",\n \"oiUsd\": \"3\",\n \"ts\": \"1684551166251\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 7872, "line_start" => 7819, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (id)" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "baseVolume" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "openInterestValue" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "interest" } ], "name" => "parseOpenInterest", "signature" => "parseOpenInterest (interest, market: Market = undefined)", "source" => "parseOpenInterest (interest, market: Market = undefined) {\n //\n // fetchOpenInterestHistory\n //\n // [\n // \"1648221300000\", // timestamp\n // \"2183354317.945\", // open interest (USD) - (coin) for options\n // \"74285877.617\", // volume (USD) - (coin) for options\n // ]\n //\n // fetchOpenInterest\n //\n // {\n // \"instId\": \"BTC-USD-230520-25500-P\",\n // \"instType\": \"OPTION\",\n // \"oi\": \"300\",\n // \"oiCcy\": \"3\",\n // \"oiUsd\": \"3\",\n // \"ts\": \"1684551166251\"\n // }\n //\n const id = this.safeString (interest, 'instId');\n market = this.safeMarket (id, market);\n const time = this.safeInteger (interest, 'ts');\n const timestamp = this.safeInteger (interest, 0, time);\n let baseVolume = undefined;\n let quoteVolume = undefined;\n let openInterestAmount = undefined;\n let openInterestValue = undefined;\n const type = this.safeString (this.options, 'defaultType');\n if (Array.isArray (interest)) {\n if (type === 'option') {\n openInterestAmount = this.safeNumber (interest, 1);\n baseVolume = this.safeNumber (interest, 2);\n } else {\n openInterestValue = this.safeNumber (interest, 1);\n quoteVolume = this.safeNumber (interest, 2);\n }\n } else {\n baseVolume = this.safeNumber (interest, 'oiCcy');\n openInterestAmount = this.safeNumber (interest, 'oi');\n openInterestValue = this.safeNumber (interest, 'oiUsd');\n }\n return this.safeOpenInterest ({\n 'symbol': this.safeSymbol (id),\n 'baseVolume': baseVolume, // deprecated\n 'quoteVolume': quoteVolume, // deprecated\n 'openInterestAmount': openInterestAmount,\n 'openInterestValue': openInterestValue,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"instType\": \"OPTION\",\n \"instId\": \"BTC-USD-241227-60000-P\",\n \"last\": \"\",\n \"lastSz\": \"0\",\n \"askPx\": \"\",\n \"askSz\": \"0\",\n \"bidPx\": \"\",\n \"bidSz\": \"0\",\n \"open24h\": \"\",\n \"high24h\": \"\",\n \"low24h\": \"\",\n \"volCcy24h\": \"0\",\n \"vol24h\": \"0\",\n \"ts\": \"1711176035035\",\n \"sodUtc0\": \"\",\n \"sodUtc8\": \"\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 8549, "line_start" => 8506, "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" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "impliedVolatility", "value" => "undefined" }, %{ "comment" => nil, "key" => "openInterest", "value" => "undefined" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "this.safeNumber (chain, 'bidPx')" }, %{ "comment" => nil, "key" => "askPrice", "value" => "this.safeNumber (chain, 'askPx')" }, %{ "comment" => nil, "key" => "midPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber (chain, 'last')" }, %{ "comment" => nil, "key" => "underlyingPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeNumber (chain, 'volCcy24h')" }, %{ "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 // \"instType\": \"OPTION\",\n // \"instId\": \"BTC-USD-241227-60000-P\",\n // \"last\": \"\",\n // \"lastSz\": \"0\",\n // \"askPx\": \"\",\n // \"askSz\": \"0\",\n // \"bidPx\": \"\",\n // \"bidSz\": \"0\",\n // \"open24h\": \"\",\n // \"high24h\": \"\",\n // \"low24h\": \"\",\n // \"volCcy24h\": \"0\",\n // \"vol24h\": \"0\",\n // \"ts\": \"1711176035035\",\n // \"sodUtc0\": \"\",\n // \"sodUtc8\": \"\"\n // }\n //\n const marketId = this.safeString (chain, 'instId');\n market = this.safeMarket (marketId, market);\n const timestamp = this.safeInteger (chain, 'ts');\n return {\n 'info': chain,\n 'currency': undefined,\n 'symbol': market['symbol'],\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'impliedVolatility': undefined,\n 'openInterest': undefined,\n 'bidPrice': this.safeNumber (chain, 'bidPx'),\n 'askPrice': this.safeNumber (chain, 'askPx'),\n 'midPrice': undefined,\n 'markPrice': undefined,\n 'lastPrice': this.safeNumber (chain, 'last'),\n 'underlyingPrice': undefined,\n 'change': undefined,\n 'percentage': undefined,\n 'baseVolume': this.safeNumber (chain, 'volCcy24h'),\n 'quoteVolume': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"clOrdId\": \"oktswap6\",\n \"ordId\": \"312269865356374016\",\n \"tag\": \"\",\n \"sCode\": \"0\",\n \"sMsg\": \"\"\n }", "{\n \"clOrdId\": \"e847386590ce4dBCc1a045253497a547\",\n \"ordId\": \"559176536793178112\",\n \"reqId\": \"\",\n \"sCode\": \"0\",\n \"sMsg\": \"\"\n }", "{\n \"accFillSz\": \"0\",\n \"avgPx\": \"\",\n \"cTime\": \"1621910749815\",\n \"category\": \"normal\",\n \"ccy\": \"\",\n \"clOrdId\": \"\",\n \"fee\": \"0\",\n \"feeCcy\": \"ETH\",\n \"fillPx\": \"\",\n \"fillSz\": \"0\",\n \"fillTime\": \"\",\n \"instId\": \"ETH-USDT\",\n \"instType\": \"SPOT\",\n \"lever\": \"\",\n \"ordId\": \"317251910906576896\",\n \"ordType\": \"limit\",\n \"pnl\": \"0\",\n \"posSide\": \"net\",\n \"px\": \"2000\",\n \"rebate\": \"0\",\n \"rebateCcy\": \"USDT\",\n \"side\": \"buy\",\n \"slOrdPx\": \"\",\n \"slTriggerPx\": \"\",\n \"state\": \"live\",\n \"sz\": \"0.001\",\n \"tag\": \"\",\n \"tdMode\": \"cash\",\n \"tpOrdPx\": \"\",\n \"tpTriggerPx\": \"\",\n \"tradeId\": \"\",\n \"uTime\": \"1621910749815\"\n }", "{\n \"algoClOrdId\": \"\",\n \"algoId\": \"\",\n \"attachAlgoClOrdId\": \"\",\n \"attachAlgoOrds\": [],\n \"cancelSource\": \"\",\n \"cancelSourceReason\": \"\", // not present in WS, but present in fetchClosedOrders\n \"category\": \"normal\",\n \"ccy\": \"\", // empty in WS, but eg. `USDT` in fetchClosedOrders\n \"clOrdId\": \"\",\n \"cTime\": \"1751705801423\",\n \"feeCcy\": \"USDT\",\n \"instId\": \"LINK-USDT-SWAP\",\n \"instType\": \"SWAP\",\n \"isTpLimit\": \"false\",\n \"lever\": \"3\",\n \"linkedAlgoOrd\": { \"algoId\": \"\" },\n \"ordId\": \"2657625147249614848\",\n \"ordType\": \"limit\",\n \"posSide\": \"net\",\n \"px\": \"13.142\",\n \"pxType\": \"\",\n \"pxUsd\": \"\",\n \"pxVol\": \"\",\n \"quickMgnType\": \"\",\n \"rebate\": \"0\",\n \"rebateCcy\": \"USDT\",\n \"reduceOnly\": \"true\",\n \"side\": \"sell\",\n \"slOrdPx\": \"\",\n \"slTriggerPx\": \"\",\n \"slTriggerPxType\": \"\",\n \"source\": \"\",\n \"stpId\": \"\",\n \"stpMode\": \"cancel_maker\",\n \"sz\": \"0.1\",\n \"tag\": \"\",\n \"tdMode\": \"isolated\",\n \"tgtCcy\": \"\",\n \"tpOrdPx\": \"\",\n \"tpTriggerPx\": \"\",\n \"tpTriggerPxType\": \"\",\n \"uTime\": \"1751705807467\",\n \"reqId\": \"\", // field present only in WS\n \"msg\": \"\", // field present only in WS\n \"amendResult\": \"\", // field present only in WS\n \"amendSource\": \"\", // field present only in WS\n \"code\": \"0\", // field present only in WS\n \"fillFwdPx\": \"\", // field present only in WS\n \"fillMarkVol\": \"\", // field present only in WS\n \"fillPxUsd\": \"\", // field present only in WS\n \"fillPxVol\": \"\", // field present only in WS\n \"lastPx\": \"13.142\", // field present only in WS\n \"notionalUsd\": \"1.314515408\", // field present only in WS\n\n #### these below fields are empty on first omit from websocket, because of \"creation\" event. however, if order is executed, it also immediately sends another update with these fields filled ###\n\n \"pnl\": \"-0.0001\",\n \"accFillSz\": \"0.1\",\n \"avgPx\": \"13.142\",\n \"state\": \"filled\",\n \"fee\": \"-0.00026284\",\n \"fillPx\": \"13.142\",\n \"tradeId\": \"293429690\",\n \"fillSz\": \"0.1\",\n \"fillTime\": \"1751705807467\",\n \"fillNotionalUsd\": \"1.314515408\", // field present only in WS\n \"fillPnl\": \"-0.0001\", // field present only in WS\n \"fillFee\": \"-0.00026284\", // field present only in WS\n \"fillFeeCcy\": \"USDT\", // field present only in WS\n \"execType\": \"M\", // field present only in WS\n \"fillMarkPx\": \"13.141\", // field present only in WS\n \"fillIdxPx\": \"13.147\" // field present only in WS\n }", "{\n \"activePx\": \"\",\n \"activePxType\": \"\",\n \"actualPx\": \"\",\n \"actualSide\": \"buy\",\n \"actualSz\": \"0\",\n \"algoId\": \"431375349042380800\",\n \"cTime\": \"1649119897778\",\n \"callbackRatio\": \"\",\n \"callbackSpread\": \"\",\n \"ccy\": \"\",\n \"ctVal\": \"0.01\",\n \"instId\": \"BTC-USDT-SWAP\",\n \"instType\": \"SWAP\",\n \"last\": \"46538.9\",\n \"lever\": \"125\",\n \"moveTriggerPx\": \"\",\n \"notionalUsd\": \"467.059\",\n \"ordId\": \"\",\n \"ordPx\": \"50000\",\n \"ordType\": \"trigger\",\n \"posSide\": \"long\",\n \"pxLimit\": \"\",\n \"pxSpread\": \"\",\n \"pxVar\": \"\",\n \"side\": \"buy\",\n \"slOrdPx\": \"\",\n \"slTriggerPx\": \"\",\n \"slTriggerPxType\": \"\",\n \"state\": \"live\",\n \"sz\": \"1\",\n \"szLimit\": \"\",\n \"tag\": \"\",\n \"tdMode\": \"isolated\",\n \"tgtCcy\": \"\",\n \"timeInterval\": \"\",\n \"tpOrdPx\": \"\",\n \"tpTriggerPx\": \"\",\n \"tpTriggerPxType\": \"\",\n \"triggerPx\": \"50000\",\n \"triggerPxType\": \"last\",\n \"triggerTime\": \"\",\n \"uly\": \"BTC-USDT\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 4178, "line_start" => 3897, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (order, 'ordId')" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString (order, 'clOrdId')" }, %{ "comment" => nil, "key" => "status", "value" => "'rejected'" }, %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "clientOrderId" }, %{ "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" => "type" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "timeInForce" }, %{ "comment" => nil, "key" => "postOnly", "value" => "postOnly" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "stopLossPrice" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "takeProfitPrice" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "this.safeNumberN (order, [ 'triggerPx', 'moveTriggerPx' ])" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "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" => "undefined" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "reduceOnly" }, %{ "comment" => nil, "key" => "cost", "value" => "this.parseNumber (feeCostSigned)" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrencyCode" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // createOrder\n //\n // {\n // \"clOrdId\": \"oktswap6\",\n // \"ordId\": \"312269865356374016\",\n // \"tag\": \"\",\n // \"sCode\": \"0\",\n // \"sMsg\": \"\"\n // }\n //\n // editOrder\n //\n // {\n // \"clOrdId\": \"e847386590ce4dBCc1a045253497a547\",\n // \"ordId\": \"559176536793178112\",\n // \"reqId\": \"\",\n // \"sCode\": \"0\",\n // \"sMsg\": \"\"\n // }\n //\n // Spot and Swap fetchOrder, fetchOpenOrders\n //\n // {\n // \"accFillSz\": \"0\",\n // \"avgPx\": \"\",\n // \"cTime\": \"1621910749815\",\n // \"category\": \"normal\",\n // \"ccy\": \"\",\n // \"clOrdId\": \"\",\n // \"fee\": \"0\",\n // \"feeCcy\": \"ETH\",\n // \"fillPx\": \"\",\n // \"fillSz\": \"0\",\n // \"fillTime\": \"\",\n // \"instId\": \"ETH-USDT\",\n // \"instType\": \"SPOT\",\n // \"lever\": \"\",\n // \"ordId\": \"317251910906576896\",\n // \"ordType\": \"limit\",\n // \"pnl\": \"0\",\n // \"posSide\": \"net\",\n // \"px\": \"2000\",\n // \"rebate\": \"0\",\n // \"rebateCcy\": \"USDT\",\n // \"side\": \"buy\",\n // \"slOrdPx\": \"\",\n // \"slTriggerPx\": \"\",\n // \"state\": \"live\",\n // \"sz\": \"0.001\",\n // \"tag\": \"\",\n // \"tdMode\": \"cash\",\n // \"tpOrdPx\": \"\",\n // \"tpTriggerPx\": \"\",\n // \"tradeId\": \"\",\n // \"uTime\": \"1621910749815\"\n // }\n //\n // watchOrders & fetchClosedOrders\n //\n // {\n // \"algoClOrdId\": \"\",\n // \"algoId\": \"\",\n // \"attachAlgoClOrdId\": \"\",\n // \"attachAlgoOrds\": [],\n // \"cancelSource\": \"\",\n // \"cancelSourceReason\": \"\", // not present in WS, but present in fetchClosedOrders\n // \"category\": \"normal\",\n // \"ccy\": \"\", // empty in WS, but eg. `USDT` in fetchClosedOrders\n // \"clOrdId\": \"\",\n // \"cTime\": \"1751705801423\",\n // \"feeCcy\": \"USDT\",\n // \"instId\": \"LINK-USDT-SWAP\",\n // \"instType\": \"SWAP\",\n // \"isTpLimit\": \"false\",\n // \"lever\": \"3\",\n // \"linkedAlgoOrd\": { \"algoId\": \"\" },\n // \"ordId\": \"2657625147249614848\",\n // \"ordType\": \"limit\",\n // \"posSide\": \"net\",\n // \"px\": \"13.142\",\n // \"pxType\": \"\",\n // \"pxUsd\": \"\",\n // \"pxVol\": \"\",\n // \"quickMgnType\": \"\",\n // \"rebate\": \"0\",\n // \"rebateCcy\": \"USDT\",\n // \"reduceOnly\": \"true\",\n // \"side\": \"sell\",\n // \"slOrdPx\": \"\",\n // \"slTriggerPx\": \"\",\n // \"slTriggerPxType\": \"\",\n // \"source\": \"\",\n // \"stpId\": \"\",\n // \"stpMode\": \"cancel_maker\",\n // \"sz\": \"0.1\",\n // \"tag\": \"\",\n // \"tdMode\": \"isolated\",\n // \"tgtCcy\": \"\",\n // \"tpOrdPx\": \"\",\n // \"tpTriggerPx\": \"\",\n // \"tpTriggerPxType\": \"\",\n // \"uTime\": \"1751705807467\",\n // \"reqId\": \"\", // field present only in WS\n // \"msg\": \"\", // field present only in WS\n // \"amendResult\": \"\", // field present only in WS\n // \"amendSource\": \"\", // field present only in WS\n // \"code\": \"0\", // field present only in WS\n // \"fillFwdPx\": \"\", // field present only in WS\n // \"fillMarkVol\": \"\", // field present only in WS\n // \"fillPxUsd\": \"\", // field present only in WS\n // \"fillPxVol\": \"\", // field present only in WS\n // \"lastPx\": \"13.142\", // field present only in WS\n // \"notionalUsd\": \"1.314515408\", // field present only in WS\n //\n // #### these below fields are empty on first omit from websocket, because of \"creation\" event. however, if order is executed, it also immediately sends another update with these fields filled ###\n //\n // \"pnl\": \"-0.0001\",\n // \"accFillSz\": \"0.1\",\n // \"avgPx\": \"13.142\",\n // \"state\": \"filled\",\n // \"fee\": \"-0.00026284\",\n // \"fillPx\": \"13.142\",\n // \"tradeId\": \"293429690\",\n // \"fillSz\": \"0.1\",\n // \"fillTime\": \"1751705807467\",\n // \"fillNotionalUsd\": \"1.314515408\", // field present only in WS\n // \"fillPnl\": \"-0.0001\", // field present only in WS\n // \"fillFee\": \"-0.00026284\", // field present only in WS\n // \"fillFeeCcy\": \"USDT\", // field present only in WS\n // \"execType\": \"M\", // field present only in WS\n // \"fillMarkPx\": \"13.141\", // field present only in WS\n // \"fillIdxPx\": \"13.147\" // field present only in WS\n // }\n //\n //\n // Algo Order fetchOpenOrders, fetchCanceledOrders, fetchClosedOrders\n //\n // {\n // \"activePx\": \"\",\n // \"activePxType\": \"\",\n // \"actualPx\": \"\",\n // \"actualSide\": \"buy\",\n // \"actualSz\": \"0\",\n // \"algoId\": \"431375349042380800\",\n // \"cTime\": \"1649119897778\",\n // \"callbackRatio\": \"\",\n // \"callbackSpread\": \"\",\n // \"ccy\": \"\",\n // \"ctVal\": \"0.01\",\n // \"instId\": \"BTC-USDT-SWAP\",\n // \"instType\": \"SWAP\",\n // \"last\": \"46538.9\",\n // \"lever\": \"125\",\n // \"moveTriggerPx\": \"\",\n // \"notionalUsd\": \"467.059\",\n // \"ordId\": \"\",\n // \"ordPx\": \"50000\",\n // \"ordType\": \"trigger\",\n // \"posSide\": \"long\",\n // \"pxLimit\": \"\",\n // \"pxSpread\": \"\",\n // \"pxVar\": \"\",\n // \"side\": \"buy\",\n // \"slOrdPx\": \"\",\n // \"slTriggerPx\": \"\",\n // \"slTriggerPxType\": \"\",\n // \"state\": \"live\",\n // \"sz\": \"1\",\n // \"szLimit\": \"\",\n // \"tag\": \"\",\n // \"tdMode\": \"isolated\",\n // \"tgtCcy\": \"\",\n // \"timeInterval\": \"\",\n // \"tpOrdPx\": \"\",\n // \"tpTriggerPx\": \"\",\n // \"tpTriggerPxType\": \"\",\n // \"triggerPx\": \"50000\",\n // \"triggerPxType\": \"last\",\n // \"triggerTime\": \"\",\n // \"uly\": \"BTC-USDT\"\n // }\n //\n const scode = this.safeString (order, 'sCode');\n if ((scode !== undefined) && (scode !== '0')) {\n return this.safeOrder ({\n 'id': this.safeString (order, 'ordId'),\n 'clientOrderId': this.safeString (order, 'clOrdId'),\n 'status': 'rejected',\n 'info': order,\n });\n }\n const id = this.safeString2 (order, 'algoId', 'ordId');\n const timestamp = this.safeInteger (order, 'cTime');\n const lastUpdateTimestamp = this.safeInteger (order, 'uTime');\n const lastTradeTimestamp = this.safeInteger (order, 'fillTime');\n const side = this.safeString (order, 'side');\n let type = this.safeString (order, 'ordType');\n let postOnly = undefined;\n let timeInForce = undefined;\n if (type === 'post_only') {\n postOnly = true;\n type = 'limit';\n } else if (type === 'fok') {\n timeInForce = 'FOK';\n type = 'limit';\n } else if (type === 'ioc') {\n timeInForce = 'IOC';\n type = 'limit';\n }\n const marketId = this.safeString (order, 'instId');\n market = this.safeMarket (marketId, market);\n const symbol = this.safeSymbol (marketId, market, '-');\n const filled = this.safeString (order, 'accFillSz');\n const price = this.safeString2 (order, 'px', 'ordPx');\n const average = this.safeString (order, 'avgPx');\n const status = this.parseOrderStatus (this.safeString (order, 'state'));\n const feeCostString = this.safeString (order, 'fee');\n let amount = undefined;\n let cost = undefined;\n // spot market buy: \"sz\" can refer either to base currency units or to quote currency units\n // see documentation: https://www.okx.com/docs-v5/en/#rest-api-trade-place-order\n const defaultTgtCcy = this.safeString (this.options, 'tgtCcy', 'base_ccy');\n const tgtCcy = this.safeString (order, 'tgtCcy', defaultTgtCcy);\n const instType = this.safeString (order, 'instType');\n if ((side === 'buy') && (type === 'market') && (instType === 'SPOT') && (tgtCcy === 'quote_ccy')) {\n // \"sz\" refers to the cost\n cost = this.safeString (order, 'sz');\n } else {\n // \"sz\" refers to the trade currency amount\n amount = this.safeString (order, 'sz');\n }\n let fee = undefined;\n if (feeCostString !== undefined) {\n const feeCostSigned = Precise.stringNeg (feeCostString);\n const feeCurrencyId = this.safeString (order, 'feeCcy');\n const feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);\n fee = {\n 'cost': this.parseNumber (feeCostSigned),\n 'currency': feeCurrencyCode,\n };\n }\n let clientOrderId = this.safeString (order, 'clOrdId');\n if ((clientOrderId !== undefined) && (clientOrderId.length < 1)) {\n clientOrderId = undefined; // fix empty clientOrderId string\n }\n const stopLossPrice = this.safeNumber2 (order, 'slTriggerPx', 'slOrdPx');\n const takeProfitPrice = this.safeNumber2 (order, 'tpTriggerPx', 'tpOrdPx');\n const reduceOnlyRaw = this.safeString (order, 'reduceOnly');\n let reduceOnly = false;\n if (reduceOnly !== undefined) {\n reduceOnly = (reduceOnlyRaw === 'true');\n }\n return this.safeOrder ({\n 'info': order,\n 'id': id,\n 'clientOrderId': clientOrderId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': lastTradeTimestamp,\n 'lastUpdateTimestamp': lastUpdateTimestamp,\n 'symbol': symbol,\n 'type': type,\n 'timeInForce': timeInForce,\n 'postOnly': postOnly,\n 'side': side,\n 'price': price,\n 'stopLossPrice': stopLossPrice,\n 'takeProfitPrice': takeProfitPrice,\n 'triggerPrice': this.safeNumberN (order, [ 'triggerPx', 'moveTriggerPx' ]),\n 'average': average,\n 'cost': cost,\n 'amount': amount,\n 'filled': filled,\n 'remaining': undefined,\n 'status': status,\n 'fee': fee,\n 'trades': undefined,\n 'reduceOnly': reduceOnly,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 3895, "line_start" => 3885, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n 'canceled': 'canceled',\n 'order_failed': 'canceled',\n 'live': 'open',\n 'partially_filled': 'open',\n 'filled': 'closed',\n 'effective': 'closed',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"adl\": \"3\",\n \"availPos\": \"1\",\n \"avgPx\": \"34131.1\",\n \"cTime\": \"1627227626502\",\n \"ccy\": \"USDT\",\n \"deltaBS\": \"\",\n \"deltaPA\": \"\",\n \"gammaBS\": \"\",\n \"gammaPA\": \"\",\n \"imr\": \"170.66093041794787\",\n \"instId\": \"BTC-USDT-SWAP\",\n \"instType\": \"SWAP\",\n \"interest\": \"0\",\n \"last\": \"34134.4\",\n \"lever\": \"2\",\n \"liab\": \"\",\n \"liabCcy\": \"\",\n \"liqPx\": \"12608.959083877446\",\n \"markPx\": \"4786.459271773621\",\n \"margin\": \"\",\n \"mgnMode\": \"cross\",\n \"mgnRatio\": \"140.49930117599155\",\n \"mmr\": \"1.3652874433435829\",\n \"notionalUsd\": \"341.5130010779638\",\n \"optVal\": \"\",\n \"pos\": \"1\",\n \"posCcy\": \"\",\n \"posId\": \"339552508062380036\",\n \"posSide\": \"long\",\n \"thetaBS\": \"\",\n \"thetaPA\": \"\",\n \"tradeId\": \"98617799\",\n \"uTime\": \"1627227626502\",\n \"upl\": \"0.0108608358957281\",\n \"uplRatio\": \"0.0000636418743944\",\n \"vegaBS\": \"\",\n \"vegaPA\": \"\"\n }", "{\n \"cTime\":\"1708351230102\",\n \"ccy\":\"USDT\",\n \"closeAvgPx\":\"1.2567\",\n \"closeTotalPos\":\"40\",\n \"direction\":\"short\",\n \"fee\":\"-0.0351036\",\n \"fundingFee\":\"0\",\n \"instId\":\"SUSHI-USDT-SWAP\",\n \"instType\":\"SWAP\",\n \"lever\":\"10.0\",\n \"liqPenalty\":\"0\",\n \"mgnMode\":\"isolated\",\n \"openAvgPx\":\"1.2462\",\n \"openMaxPos\":\"40\",\n \"pnl\":\"-0.42\",\n \"pnlRatio\":\"-0.0912982667308618\",\n \"posId\":\"666159086676836352\",\n \"realizedPnl\":\"-0.4551036\",\n \"triggerPx\":\"\",\n \"type\":\"2\",\n \"uTime\":\"1708354805699\",\n \"uly\":\"SUSHI-USDT\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 6203, "line_start" => 6036, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (position, 'posId')" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "notional", "value" => "notional" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "liquidationPrice" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.parseNumber (entryPriceString)" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.parseNumber (unrealizedPnlString)" }, %{ "comment" => nil, "key" => "realizedPnl", "value" => "this.safeNumber (position, 'realizedPnl')" }, %{ "comment" => nil, "key" => "percentage", "value" => "percentage" }, %{ "comment" => nil, "key" => "contracts", "value" => "contracts" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contractSize" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.parseNumber (markPriceString)" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber (position, 'closeAvgPx')" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "hedged", "value" => "hedged" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "this.safeInteger (position, 'uTime')" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "maintenanceMargin" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "maintenanceMarginPercentage" }, %{ "comment" => nil, "key" => "collateral", "value" => "this.parseNumber (collateralString)" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "this.parseNumber (initialMarginString)" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "this.parseNumber (initialMarginPercentage)" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.parseNumber (leverageString)" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "marginRatio" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"adl\": \"3\",\n // \"availPos\": \"1\",\n // \"avgPx\": \"34131.1\",\n // \"cTime\": \"1627227626502\",\n // \"ccy\": \"USDT\",\n // \"deltaBS\": \"\",\n // \"deltaPA\": \"\",\n // \"gammaBS\": \"\",\n // \"gammaPA\": \"\",\n // \"imr\": \"170.66093041794787\",\n // \"instId\": \"BTC-USDT-SWAP\",\n // \"instType\": \"SWAP\",\n // \"interest\": \"0\",\n // \"last\": \"34134.4\",\n // \"lever\": \"2\",\n // \"liab\": \"\",\n // \"liabCcy\": \"\",\n // \"liqPx\": \"12608.959083877446\",\n // \"markPx\": \"4786.459271773621\",\n // \"margin\": \"\",\n // \"mgnMode\": \"cross\",\n // \"mgnRatio\": \"140.49930117599155\",\n // \"mmr\": \"1.3652874433435829\",\n // \"notionalUsd\": \"341.5130010779638\",\n // \"optVal\": \"\",\n // \"pos\": \"1\",\n // \"posCcy\": \"\",\n // \"posId\": \"339552508062380036\",\n // \"posSide\": \"long\",\n // \"thetaBS\": \"\",\n // \"thetaPA\": \"\",\n // \"tradeId\": \"98617799\",\n // \"uTime\": \"1627227626502\",\n // \"upl\": \"0.0108608358957281\",\n // \"uplRatio\": \"0.0000636418743944\",\n // \"vegaBS\": \"\",\n // \"vegaPA\": \"\"\n // }\n // history\n // {\n // \"cTime\":\"1708351230102\",\n // \"ccy\":\"USDT\",\n // \"closeAvgPx\":\"1.2567\",\n // \"closeTotalPos\":\"40\",\n // \"direction\":\"short\",\n // \"fee\":\"-0.0351036\",\n // \"fundingFee\":\"0\",\n // \"instId\":\"SUSHI-USDT-SWAP\",\n // \"instType\":\"SWAP\",\n // \"lever\":\"10.0\",\n // \"liqPenalty\":\"0\",\n // \"mgnMode\":\"isolated\",\n // \"openAvgPx\":\"1.2462\",\n // \"openMaxPos\":\"40\",\n // \"pnl\":\"-0.42\",\n // \"pnlRatio\":\"-0.0912982667308618\",\n // \"posId\":\"666159086676836352\",\n // \"realizedPnl\":\"-0.4551036\",\n // \"triggerPx\":\"\",\n // \"type\":\"2\",\n // \"uTime\":\"1708354805699\",\n // \"uly\":\"SUSHI-USDT\"\n // }\n //\n const marketId = this.safeString (position, 'instId');\n market = this.safeMarket (marketId, market, undefined, 'contract');\n const symbol = market['symbol'];\n const pos = this.safeString (position, 'pos'); // 'pos' field: One way mode: 0 if position is not open, 1 if open | Two way (hedge) mode: -1 if short, 1 if long, 0 if position is not open\n const contractsAbs = Precise.stringAbs (pos);\n let side = this.safeString2 (position, 'posSide', 'direction');\n const hedged = side !== 'net';\n const contracts = this.parseNumber (contractsAbs);\n if (market['margin']) {\n // margin position\n if (side === 'net') {\n const posCcy = this.safeString (position, 'posCcy');\n const parsedCurrency = this.safeCurrencyCode (posCcy);\n if (parsedCurrency !== undefined) {\n side = (market['base'] === parsedCurrency) ? 'long' : 'short';\n }\n }\n if (side === undefined) {\n side = this.safeString (position, 'direction');\n }\n } else {\n if (pos !== undefined) {\n if (side === 'net') {\n if (Precise.stringGt (pos, '0')) {\n side = 'long';\n } else if (Precise.stringLt (pos, '0')) {\n side = 'short';\n } else {\n side = undefined;\n }\n }\n }\n }\n const contractSize = this.safeNumber (market, 'contractSize');\n const contractSizeString = this.numberToString (contractSize);\n const markPriceString = this.safeString (position, 'markPx');\n let notionalString = this.safeString (position, 'notionalUsd');\n if (market['inverse']) {\n notionalString = Precise.stringDiv (Precise.stringMul (contractsAbs, contractSizeString), markPriceString);\n }\n const notional = this.parseNumber (notionalString);\n const marginMode = this.safeString (position, 'mgnMode');\n let initialMarginString = undefined;\n const entryPriceString = this.safeString2 (position, 'avgPx', 'openAvgPx');\n const unrealizedPnlString = this.safeString (position, 'upl');\n const leverageString = this.safeString (position, 'lever');\n let initialMarginPercentage = undefined;\n let collateralString = undefined;\n if (marginMode === 'cross') {\n initialMarginString = this.safeString (position, 'imr');\n collateralString = Precise.stringAdd (initialMarginString, unrealizedPnlString);\n } else if (marginMode === 'isolated') {\n initialMarginPercentage = Precise.stringDiv ('1', leverageString);\n collateralString = this.safeString (position, 'margin');\n }\n const maintenanceMarginString = this.safeString (position, 'mmr');\n const maintenanceMargin = this.parseNumber (maintenanceMarginString);\n const maintenanceMarginPercentageString = Precise.stringDiv (maintenanceMarginString, notionalString);\n if (initialMarginPercentage === undefined) {\n initialMarginPercentage = this.parseNumber (Precise.stringDiv (initialMarginString, notionalString, 4));\n } else if (initialMarginString === undefined) {\n initialMarginString = Precise.stringDiv (Precise.stringDiv (Precise.stringMul (contractsAbs, contractSizeString), entryPriceString), leverageString);\n }\n const rounder = '0.00005'; // round to closest 0.01%\n const maintenanceMarginPercentage = this.parseNumber (Precise.stringDiv (Precise.stringAdd (maintenanceMarginPercentageString, rounder), '1', 4));\n const liquidationPrice = this.safeNumber (position, 'liqPx');\n const percentageString = this.safeString (position, 'uplRatio');\n const percentage = this.parseNumber (Precise.stringMul (percentageString, '100'));\n const timestamp = this.safeInteger (position, 'cTime');\n const marginRatio = this.parseNumber (Precise.stringDiv (maintenanceMarginString, collateralString, 4));\n return this.safePosition ({\n 'info': position,\n 'id': this.safeString (position, 'posId'),\n 'symbol': symbol,\n 'notional': notional,\n 'marginMode': marginMode,\n 'liquidationPrice': liquidationPrice,\n 'entryPrice': this.parseNumber (entryPriceString),\n 'unrealizedPnl': this.parseNumber (unrealizedPnlString),\n 'realizedPnl': this.safeNumber (position, 'realizedPnl'),\n 'percentage': percentage,\n 'contracts': contracts,\n 'contractSize': contractSize,\n 'markPrice': this.parseNumber (markPriceString),\n 'lastPrice': this.safeNumber (position, 'closeAvgPx'),\n 'side': side,\n 'hedged': hedged,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastUpdateTimestamp': this.safeInteger (position, 'uTime'),\n 'maintenanceMargin': maintenanceMargin,\n 'maintenanceMarginPercentage': maintenanceMarginPercentage,\n 'collateral': this.parseNumber (collateralString),\n 'initialMargin': this.parseNumber (initialMarginString),\n 'initialMarginPercentage': this.parseNumber (initialMarginPercentage),\n 'leverage': this.parseNumber (leverageString),\n 'marginRatio': marginRatio,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"insId\": \"BTC-USD-230521-28500-P\",\n \"px\": \"27081.2007345984751516\",\n \"type\": \"exercised\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 8086, "line_start" => 8070, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "settlement" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (settlement, 'px')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" } ], "name" => "parseSettlement", "signature" => "parseSettlement (settlement, market)", "source" => "parseSettlement (settlement, market) {\n //\n // {\n // \"insId\": \"BTC-USD-230521-28500-P\",\n // \"px\": \"27081.2007345984751516\",\n // \"type\": \"exercised\"\n // }\n //\n const marketId = this.safeString (settlement, 'insId');\n return {\n 'info': settlement,\n 'symbol': this.safeSymbol (marketId, market),\n 'price': this.safeNumber (settlement, 'px'),\n 'timestamp': undefined,\n 'datetime': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"details\": [\n {\n \"insId\": \"BTC-USD-230523-25750-C\",\n \"px\": \"27290.1486867000556483\",\n \"type\": \"exercised\"\n },\n ],\n \"ts\":\"1684656000000\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 8115, "line_start" => 8088, "mappings" => [ %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseSettlements", "signature" => "parseSettlements (settlements, market)", "source" => "parseSettlements (settlements, market) {\n //\n // {\n // \"details\": [\n // {\n // \"insId\": \"BTC-USD-230523-25750-C\",\n // \"px\": \"27290.1486867000556483\",\n // \"type\": \"exercised\"\n // },\n // ],\n // \"ts\":\"1684656000000\"\n // }\n //\n const result = [];\n for (let i = 0; i < settlements.length; i++) {\n const entry = settlements[i];\n const timestamp = this.safeInteger (entry, 'ts');\n const details = this.safeList (entry, 'details', []);\n for (let j = 0; j < details.length; j++) {\n const settlement = this.parseSettlement (details[j], market);\n result.push (this.extend (settlement, {\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n }));\n }\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"instType\":\"SWAP\",\n \"instId\":\"BTC-USDT-SWAP\",\n \"markPx\":\"200\",\n \"ts\":\"1597026383085\"\n }", "{\n \"instType\": \"SPOT\",\n \"instId\": \"ETH-BTC\",\n \"last\": \"0.07319\",\n \"lastSz\": \"0.044378\",\n \"askPx\": \"0.07322\",\n \"askSz\": \"4.2\",\n \"bidPx\": \"0.0732\",\n \"bidSz\": \"6.050058\",\n \"open24h\": \"0.07801\",\n \"high24h\": \"0.07975\",\n \"low24h\": \"0.06019\",\n \"volCcy24h\": \"11788.887619\",\n \"vol24h\": \"167493.829229\",\n \"ts\": \"1621440583784\",\n \"sodUtc0\": \"0.07872\",\n \"sodUtc8\": \"0.07345\"\n }", "{\n instId: 'LTC-USDT',\n idxPx: '65.74',\n open24h: '65.37',\n high24h: '66.15',\n low24h: '64.97',\n sodUtc0: '65.68',\n sodUtc8: '65.54',\n ts: '1728467346900'\n }," ], "inherited" => true, "inherited_from" => "okx", "line_end" => 2163, "line_start" => 2090, "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" => "high" }, %{ "comment" => nil, "key" => "low", "value" => "low" }, %{ "comment" => nil, "key" => "bid", "value" => "this.safeString (ticker, 'bidPx')" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "this.safeString (ticker, 'bidSz')" }, %{ "comment" => nil, "key" => "ask", "value" => "this.safeString (ticker, 'askPx')" }, %{ "comment" => nil, "key" => "askVolume", "value" => "this.safeString (ticker, 'askSz')" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "open" }, %{ "comment" => nil, "key" => "close", "value" => "last" }, %{ "comment" => nil, "key" => "last", "value" => "last" }, %{ "comment" => nil, "key" => "previousClose", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "baseVolume" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "quoteVolume" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeString (ticker, 'markPx')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeString (ticker, 'idxPx')" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker", "source" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker {\n //\n // {\n // \"instType\":\"SWAP\",\n // \"instId\":\"BTC-USDT-SWAP\",\n // \"markPx\":\"200\",\n // \"ts\":\"1597026383085\"\n // }\n //\n // {\n // \"instType\": \"SPOT\",\n // \"instId\": \"ETH-BTC\",\n // \"last\": \"0.07319\",\n // \"lastSz\": \"0.044378\",\n // \"askPx\": \"0.07322\",\n // \"askSz\": \"4.2\",\n // \"bidPx\": \"0.0732\",\n // \"bidSz\": \"6.050058\",\n // \"open24h\": \"0.07801\",\n // \"high24h\": \"0.07975\",\n // \"low24h\": \"0.06019\",\n // \"volCcy24h\": \"11788.887619\",\n // \"vol24h\": \"167493.829229\",\n // \"ts\": \"1621440583784\",\n // \"sodUtc0\": \"0.07872\",\n // \"sodUtc8\": \"0.07345\"\n // }\n // {\n // instId: 'LTC-USDT',\n // idxPx: '65.74',\n // open24h: '65.37',\n // high24h: '66.15',\n // low24h: '64.97',\n // sodUtc0: '65.68',\n // sodUtc8: '65.54',\n // ts: '1728467346900'\n // },\n //\n const timestamp = this.safeInteger (ticker, 'ts');\n const marketId = this.safeString (ticker, 'instId');\n market = this.safeMarket (marketId, market, '-');\n const symbol = market['symbol'];\n const last = this.safeString (ticker, 'last');\n const open = this.safeString (ticker, 'open24h');\n const spot = this.safeBool (market, 'spot', false);\n const quoteVolume = spot ? this.safeString (ticker, 'volCcy24h') : undefined;\n const baseVolume = this.safeString (ticker, 'vol24h');\n const high = this.safeString (ticker, 'high24h');\n const low = this.safeString (ticker, 'low24h');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': high,\n 'low': low,\n 'bid': this.safeString (ticker, 'bidPx'),\n 'bidVolume': this.safeString (ticker, 'bidSz'),\n 'ask': this.safeString (ticker, 'askPx'),\n 'askVolume': this.safeString (ticker, 'askSz'),\n 'vwap': undefined,\n 'open': open,\n 'close': last,\n 'last': last,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': undefined,\n 'average': undefined,\n 'baseVolume': baseVolume,\n 'quoteVolume': quoteVolume,\n 'markPrice': this.safeString (ticker, 'markPx'),\n 'indexPrice': this.safeString (ticker, 'idxPx'),\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"instId\": \"ETH-BTC\",\n \"side\": \"sell\",\n \"sz\": \"0.119501\",\n \"px\": \"0.07065\",\n \"tradeId\": \"15826757\",\n \"ts\": \"1621446178316\"\n }", "{\n \"fillVol\": \"0.46387625976562497\",\n \"fwdPx\": \"26299.754935451125\",\n \"indexPx\": \"26309.7\",\n \"instFamily\": \"BTC-USD\",\n \"instId\": \"BTC-USD-230526-26000-C\",\n \"markPx\": \"0.042386283557554236\",\n \"optType\": \"C\",\n \"px\": \"0.0415\",\n \"side\": \"sell\",\n \"sz\": \"90\",\n \"tradeId\": \"112\",\n \"ts\": \"1683907480154\"\n }", "{\n \"side\": \"buy\",\n \"fillSz\": \"0.007533\",\n \"fillPx\": \"2654.98\",\n \"fee\": \"-0.000007533\",\n \"ordId\": \"317321390244397056\",\n \"instType\": \"SPOT\",\n \"instId\": \"ETH-USDT\",\n \"clOrdId\": \"\",\n \"posSide\": \"net\",\n \"billId\": \"317321390265368576\",\n \"tag\": \"0\",\n \"execType\": \"T\",\n \"tradeId\": \"107601752\",\n \"feeCcy\": \"ETH\",\n \"ts\": \"1621927314985\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 2427, "line_start" => 2336, "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" => "id" }, %{ "comment" => nil, "key" => "order", "value" => "orderId" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "cost", "value" => "feeCostSigned" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrencyCode" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // public fetchTrades\n //\n // {\n // \"instId\": \"ETH-BTC\",\n // \"side\": \"sell\",\n // \"sz\": \"0.119501\",\n // \"px\": \"0.07065\",\n // \"tradeId\": \"15826757\",\n // \"ts\": \"1621446178316\"\n // }\n //\n // option: fetchTrades\n //\n // {\n // \"fillVol\": \"0.46387625976562497\",\n // \"fwdPx\": \"26299.754935451125\",\n // \"indexPx\": \"26309.7\",\n // \"instFamily\": \"BTC-USD\",\n // \"instId\": \"BTC-USD-230526-26000-C\",\n // \"markPx\": \"0.042386283557554236\",\n // \"optType\": \"C\",\n // \"px\": \"0.0415\",\n // \"side\": \"sell\",\n // \"sz\": \"90\",\n // \"tradeId\": \"112\",\n // \"ts\": \"1683907480154\"\n // }\n //\n // private fetchMyTrades\n //\n // {\n // \"side\": \"buy\",\n // \"fillSz\": \"0.007533\",\n // \"fillPx\": \"2654.98\",\n // \"fee\": \"-0.000007533\",\n // \"ordId\": \"317321390244397056\",\n // \"instType\": \"SPOT\",\n // \"instId\": \"ETH-USDT\",\n // \"clOrdId\": \"\",\n // \"posSide\": \"net\",\n // \"billId\": \"317321390265368576\",\n // \"tag\": \"0\",\n // \"execType\": \"T\",\n // \"tradeId\": \"107601752\",\n // \"feeCcy\": \"ETH\",\n // \"ts\": \"1621927314985\"\n // }\n //\n const id = this.safeString (trade, 'tradeId');\n const marketId = this.safeString (trade, 'instId');\n market = this.safeMarket (marketId, market, '-');\n const symbol = market['symbol'];\n const timestamp = this.safeInteger (trade, 'ts');\n const price = this.safeString2 (trade, 'fillPx', 'px');\n const amount = this.safeString2 (trade, 'fillSz', 'sz');\n const side = this.safeString (trade, 'side');\n const orderId = this.safeString (trade, 'ordId');\n const feeCostString = this.safeString (trade, 'fee');\n let fee = undefined;\n if (feeCostString !== undefined) {\n const feeCostSigned = Precise.stringNeg (feeCostString);\n const feeCurrencyId = this.safeString (trade, 'feeCcy');\n const feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);\n fee = {\n 'cost': feeCostSigned,\n 'currency': feeCurrencyCode,\n };\n }\n let takerOrMaker = this.safeString (trade, 'execType');\n if (takerOrMaker === 'T') {\n takerOrMaker = 'taker';\n } else if (takerOrMaker === 'M') {\n takerOrMaker = 'maker';\n }\n return this.safeTrade ({\n 'info': trade,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'id': id,\n 'order': orderId,\n 'type': undefined,\n 'takerOrMaker': takerOrMaker,\n 'side': side,\n 'price': price,\n 'amount': amount,\n 'cost': undefined,\n 'fee': fee,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 2756, "line_start" => 2730, "mappings" => [], "name" => "parseTradingBalance", "signature" => "parseTradingBalance (response)", "source" => "parseTradingBalance (response) {\n const result: Dict = { 'info': response };\n const data = this.safeList (response, 'data', []);\n const first = this.safeDict (data, 0, {});\n const timestamp = this.safeInteger (first, 'uTime');\n const details = this.safeList (first, 'details', []);\n for (let i = 0; i < details.length; i++) {\n const balance = details[i];\n const currencyId = this.safeString (balance, 'ccy');\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n // it may be incorrect to use total, free and used for swap accounts\n const eq = this.safeString (balance, 'eq');\n const availEq = this.safeString (balance, 'availEq');\n account['total'] = eq;\n if (availEq === undefined) {\n account['free'] = this.safeString (balance, 'availBal');\n account['used'] = this.safeString (balance, 'frozenBal');\n } else {\n account['free'] = availEq;\n }\n result[code] = account;\n }\n result['timestamp'] = timestamp;\n result['datetime'] = this.iso8601 (timestamp);\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"category\": \"1\",\n \"delivery\": \"\",\n \"exercise\": \"\",\n \"instType\": \"SPOT\",\n \"level\": \"Lv1\",\n \"maker\": \"-0.0008\",\n \"taker\": \"-0.001\",\n \"ts\": \"1639043138472\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 2798, "line_start" => 2775, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (undefined, market)" }, %{ "comment" => nil, "key" => "taker", "value" => "this.parseNumber (Precise.stringNeg (this.safeString2 (fee, 'taker', 'takerU')))" }, %{ "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 // https://www.okx.com/docs-v5/en/#rest-api-account-get-fee-rates\n //\n // {\n // \"category\": \"1\",\n // \"delivery\": \"\",\n // \"exercise\": \"\",\n // \"instType\": \"SPOT\",\n // \"level\": \"Lv1\",\n // \"maker\": \"-0.0008\",\n // \"taker\": \"-0.001\",\n // \"ts\": \"1639043138472\"\n // }\n //\n return {\n 'info': fee,\n 'symbol': this.safeSymbol (undefined, market),\n // OKX returns the fees as negative values opposed to other exchanges, so the sign needs to be flipped\n 'maker': this.parseNumber (Precise.stringNeg (this.safeString2 (fee, 'maker', 'makerU'))),\n 'taker': this.parseNumber (Precise.stringNeg (this.safeString2 (fee, 'taker', 'takerU'))),\n 'percentage': undefined,\n 'tierBased': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amt\": \"0.1\",\n \"wdId\": \"67485\",\n \"ccy\": \"BTC\"\n }", "{\n \"amt\": \"0.094\",\n \"wdId\": \"4703879\",\n \"fee\": \"0.01000000eth\",\n \"txId\": \"0x62477bac6509a04512819bb1455e923a60dea5966c7caeaa0b24eb8fb0432b85\",\n \"ccy\": \"ETH\",\n \"from\": \"13426335357\",\n \"to\": \"0xA41446125D0B5b6785f6898c9D67874D763A1519\",\n \"tag\",\n \"pmtId\",\n \"memo\",\n \"ts\": \"1597026383085\",\n \"state\": \"2\"\n }", "{\n \"amt\": \"0.01044408\",\n \"txId\": \"1915737_3_0_0_asset\",\n \"ccy\": \"BTC\",\n \"from\": \"13801825426\",\n \"to\": \"\",\n \"ts\": \"1597026383085\",\n \"state\": \"2\",\n \"depId\": \"4703879\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 5779, "line_start" => 5685, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "network", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "addressFrom" }, %{ "comment" => nil, "key" => "addressTo", "value" => "addressTo" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagTo", "value" => "tagTo" }, %{ "comment" => nil, "key" => "tag", "value" => "tagTo" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "updated", "value" => "undefined" }, %{ "comment" => nil, "key" => "txid", "value" => "txid" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': code,\n 'cost': feeCost,\n }" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // withdraw\n //\n // {\n // \"amt\": \"0.1\",\n // \"wdId\": \"67485\",\n // \"ccy\": \"BTC\"\n // }\n //\n // fetchWithdrawals\n //\n // {\n // \"amt\": \"0.094\",\n // \"wdId\": \"4703879\",\n // \"fee\": \"0.01000000eth\",\n // \"txId\": \"0x62477bac6509a04512819bb1455e923a60dea5966c7caeaa0b24eb8fb0432b85\",\n // \"ccy\": \"ETH\",\n // \"from\": \"13426335357\",\n // \"to\": \"0xA41446125D0B5b6785f6898c9D67874D763A1519\",\n // \"tag\",\n // \"pmtId\",\n // \"memo\",\n // \"ts\": \"1597026383085\",\n // \"state\": \"2\"\n // }\n //\n // fetchDeposits\n //\n // {\n // \"amt\": \"0.01044408\",\n // \"txId\": \"1915737_3_0_0_asset\",\n // \"ccy\": \"BTC\",\n // \"from\": \"13801825426\",\n // \"to\": \"\",\n // \"ts\": \"1597026383085\",\n // \"state\": \"2\",\n // \"depId\": \"4703879\"\n // }\n //\n let type = undefined;\n let id = undefined;\n const withdrawalId = this.safeString (transaction, 'wdId');\n const addressFrom = this.safeString (transaction, 'from');\n const addressTo = this.safeString (transaction, 'to');\n const address = addressTo;\n let tagTo = this.safeString2 (transaction, 'tag', 'memo');\n tagTo = this.safeString2 (transaction, 'pmtId', tagTo);\n if (withdrawalId !== undefined) {\n type = 'withdrawal';\n id = withdrawalId;\n } else {\n // the payment_id will appear on new deposits but appears to be removed from the response after 2 months\n id = this.safeString (transaction, 'depId');\n type = 'deposit';\n }\n const currencyId = this.safeString (transaction, 'ccy');\n const code = this.safeCurrencyCode (currencyId);\n const amount = this.safeNumber (transaction, 'amt');\n const status = this.parseTransactionStatus (this.safeString (transaction, 'state'));\n const txid = this.safeString (transaction, 'txId');\n const timestamp = this.safeInteger (transaction, 'ts');\n let feeCost = undefined;\n if (type === 'deposit') {\n feeCost = 0;\n } else {\n feeCost = this.safeNumber (transaction, 'fee');\n }\n // todo parse tags\n return {\n 'info': transaction,\n 'id': id,\n 'currency': code,\n 'amount': amount,\n 'network': undefined,\n 'addressFrom': addressFrom,\n 'addressTo': addressTo,\n 'address': address,\n 'tagFrom': undefined,\n 'tagTo': tagTo,\n 'tag': tagTo,\n 'status': status,\n 'type': type,\n 'updated': undefined,\n 'txid': txid,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'internal': undefined,\n 'comment': undefined,\n 'fee': {\n 'currency': code,\n 'cost': feeCost,\n },\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"0\": \"waiting for confirmation\",\n \"1\": \"deposit credited\",\n \"2\": \"deposit successful\"\n }", "{\n '-3': \"pending cancel\",\n \"-2\": \"canceled\",\n \"-1\": \"failed\",\n \"0\": \"pending\",\n \"1\": \"sending\",\n \"2\": \"sent\",\n \"3\": \"awaiting email verification\",\n \"4\": \"awaiting manual verification\",\n \"5\": \"awaiting identity verification\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 5683, "line_start" => 5639, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: Str)", "source" => "parseTransactionStatus (status: Str) {\n //\n // deposit statuses\n //\n // {\n // \"0\": \"waiting for confirmation\",\n // \"1\": \"deposit credited\",\n // \"2\": \"deposit successful\"\n // }\n //\n // withdrawal statuses\n //\n // {\n // '-3': \"pending cancel\",\n // \"-2\": \"canceled\",\n // \"-1\": \"failed\",\n // \"0\": \"pending\",\n // \"1\": \"sending\",\n // \"2\": \"sent\",\n // \"3\": \"awaiting email verification\",\n // \"4\": \"awaiting manual verification\",\n // \"5\": \"awaiting identity verification\"\n // }\n //\n const statuses: Dict = {\n '-3': 'pending',\n '-2': 'canceled',\n '-1': 'failed',\n '0': 'pending',\n '1': 'pending',\n '2': 'ok',\n '3': 'pending',\n '4': 'pending',\n '5': 'pending',\n '6': 'pending',\n '7': 'pending',\n '8': 'pending',\n '9': 'pending',\n '10': 'pending',\n '12': 'pending',\n '15': 'pending',\n '16': 'pending',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"transId\": \"754147\",\n \"ccy\": \"USDT\",\n \"from\": \"6\",\n \"amt\": \"0.1\",\n \"to\": \"18\"\n }", "{\n \"amt\": \"5\",\n \"ccy\": \"USDT\",\n \"from\": \"18\",\n \"instId\": \"\",\n \"state\": \"success\",\n \"subAcct\": \"\",\n \"to\": \"6\",\n \"toInstId\": \"\",\n \"transId\": \"464424732\",\n \"type\": \"0\"\n }", "{\n \"bal\": \"70.6874353780312913\",\n \"balChg\": \"-4.0000000000000000\", // negative means \"to funding\", positive meand \"from funding\"\n \"billId\": \"588900695232225299\",\n \"ccy\": \"USDT\",\n \"execType\": \"\",\n \"fee\": \"\",\n \"from\": \"18\",\n \"instId\": \"\",\n \"instType\": \"\",\n \"mgnMode\": \"\",\n \"notes\": \"To Funding Account\",\n \"ordId\": \"\",\n \"pnl\": \"\",\n \"posBal\": \"\",\n \"posBalChg\": \"\",\n \"price\": \"0\",\n \"subType\": \"12\",\n \"sz\": \"-4\",\n \"to\": \"6\",\n \"ts\": \"1686676866989\",\n \"type\": \"1\"\n }" ], "inherited" => true, "inherited_from" => "okx", "line_end" => 6342, "line_start" => 6266, "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" => "this.safeString (accountsById, fromAccountId)" }, %{ "comment" => nil, "key" => "toAccount", "value" => "this.safeString (accountsById, toAccountId)" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransferStatus (this.safeString (transfer, 'state'))" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry", "source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n //\n // transfer\n //\n // {\n // \"transId\": \"754147\",\n // \"ccy\": \"USDT\",\n // \"from\": \"6\",\n // \"amt\": \"0.1\",\n // \"to\": \"18\"\n // }\n //\n // fetchTransfer\n //\n // {\n // \"amt\": \"5\",\n // \"ccy\": \"USDT\",\n // \"from\": \"18\",\n // \"instId\": \"\",\n // \"state\": \"success\",\n // \"subAcct\": \"\",\n // \"to\": \"6\",\n // \"toInstId\": \"\",\n // \"transId\": \"464424732\",\n // \"type\": \"0\"\n // }\n //\n // fetchTransfers\n //\n // {\n // \"bal\": \"70.6874353780312913\",\n // \"balChg\": \"-4.0000000000000000\", // negative means \"to funding\", positive meand \"from funding\"\n // \"billId\": \"588900695232225299\",\n // \"ccy\": \"USDT\",\n // \"execType\": \"\",\n // \"fee\": \"\",\n // \"from\": \"18\",\n // \"instId\": \"\",\n // \"instType\": \"\",\n // \"mgnMode\": \"\",\n // \"notes\": \"To Funding Account\",\n // \"ordId\": \"\",\n // \"pnl\": \"\",\n // \"posBal\": \"\",\n // \"posBalChg\": \"\",\n // \"price\": \"0\",\n // \"subType\": \"12\",\n // \"sz\": \"-4\",\n // \"to\": \"6\",\n // \"ts\": \"1686676866989\",\n // \"type\": \"1\"\n // }\n //\n const id = this.safeString2 (transfer, 'transId', 'billId');\n const currencyId = this.safeString (transfer, 'ccy');\n const code = this.safeCurrencyCode (currencyId, currency);\n let amount = this.safeNumber (transfer, 'amt');\n const fromAccountId = this.safeString (transfer, 'from');\n const toAccountId = this.safeString (transfer, 'to');\n const accountsById = this.safeDict (this.options, 'accountsById', {});\n const timestamp = this.safeInteger (transfer, 'ts');\n const balanceChange = this.safeString (transfer, 'sz');\n if (balanceChange !== undefined) {\n amount = this.parseNumber (Precise.stringAbs (balanceChange));\n }\n return {\n 'info': transfer,\n 'id': id,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'currency': code,\n 'amount': amount,\n 'fromAccount': this.safeString (accountsById, fromAccountId),\n 'toAccount': this.safeString (accountsById, toAccountId),\n 'status': this.parseTransferStatus (this.safeString (transfer, 'state')),\n };\n }" }, %{ "comment" => nil, "examples" => [], "inherited" => true, "inherited_from" => "okx", "line_end" => 6349, "line_start" => 6344, "mappings" => [], "name" => "parseTransferStatus", "signature" => "parseTransferStatus (status: Str): Str", "source" => "parseTransferStatus (status: Str): Str {\n const statuses: Dict = {\n 'success': 'ok',\n };\n return this.safeString (statuses, status, status);\n }" } ], path_prefix: "/api/v5/", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 110, period: 1000, requests: 9, rolling_window_size: 60000 }, raw_endpoints: %{ private: [ %{ auth: false, cost: 1, method: :get, path: "/trade/orders-algo-history" }, %{ auth: false, cost: 20, method: :get, path: "/trade/easy-convert-history" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/sub-orders" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/order" }, %{ auth: false, cost: 10, method: :get, path: "/users/subaccount/list" }, %{ auth: false, cost: 4, method: :get, path: "/account/vip-loan-order-list" }, %{ auth: false, cost: 2, method: :get, path: "/account/position-tiers" }, %{ auth: false, cost: 100, method: :get, path: "/broker/nd/rebate-daily" }, %{ auth: false, cost: 10, method: :get, path: "/users/subaccount/apikey" }, %{ auth: false, cost: 4, method: :get, path: "/account/vip-interest-deducted" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/unrealized-profit-sharing-details" }, %{ auth: false, cost: 4, method: :get, path: "/account/set-account-switch-precheck" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/bills" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/instruments" }, %{ auth: false, cost: 10, method: :get, path: "/broker/dma/subaccount-trade-fee" }, %{ auth: false, cost: 2, method: :get, path: "/tradingBot/signal/positions-history" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/current-lead-traders" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/staking-defi/eth/purchase-redeem-history" }, %{ auth: false, cost: 4, method: :get, path: "/account/subaccount/interest-limits" }, %{ auth: false, cost: 4, method: :get, path: "/account/interest-accrued" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/broker/nd/subaccount-deposit-address" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/account/subaccount/balances" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/staking-defi/offers" }, %{ auth: false, cost: 4, method: :get, path: "/rfq/maker-instrument-settings" }, %{ auth: false, cost: 2, method: :get, path: "/account/balance" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/config" }, %{ auth: false, cost: 4, method: :get, path: "/account/interest-rate" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/staking-defi/orders-active" }, %{ auth: false, cost: 30, method: :get, path: "/account/spot-manual-borrow-repay" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/signal/sub-orders" }, %{ auth: false, cost: 4, method: :get, path: "/asset/broker/nd/subaccount-deposit-history" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/orders-algo-history" }, %{ auth: false, cost: 5, method: :get, path: "/account/fixed-loan/borrowing-quote" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/subaccount/managed-subaccount-bills" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/withdrawal-history" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/signal/orders-algo-pending" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/trades" }, %{ auth: false, cost: 0.3333333333333333, method: :get, path: "/trade/orders-pending" }, %{ auth: false, cost: 4, method: :get, path: "/finance/flexible-loan/loan-info" }, %{ auth: false, cost: 10, method: :get, path: "/account/move-positions-history" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/orders-history" }, %{ auth: false, cost: 1, method: :get, path: "/account/max-avail-size" }, %{ auth: false, cost: 0.3333333333333333, method: :get, path: "/trade/fills" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/convert/currencies" }, %{ auth: false, cost: 1, method: :get, path: "/account/max-size" }, %{ auth: false, cost: 1, method: :get, path: "/trade/orders-history-archive" }, %{ auth: false, cost: 20, method: :get, path: "/trade/one-click-repay-history-v2" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/recurring/orders-algo-history" }, %{ auth: false, cost: 1, method: :get, path: "/account/instruments" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/lead-traders-history" }, %{ auth: false, cost: 2, method: :get, path: "/trade/fills-history" }, %{ auth: false, cost: 4, method: :get, path: "/account/quick-margin-borrow-repay-history" }, %{ auth: false, cost: 20, method: :get, path: "/trade/easy-convert-currency-list" }, %{ auth: false, cost: 4, method: :get, path: "/support/announcements" }, %{ auth: false, cost: 10, method: :get, path: "/asset/bills-history" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/total-profit-sharing" }, %{ auth: false, cost: 4, method: :get, path: "/finance/flexible-loan/borrow-currencies" }, %{ auth: false, cost: 2, method: :get, path: "/account/risk-state" }, %{ auth: false, cost: 0.3333333333333333, method: :get, path: "/trade/order" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/orders-history-archive" }, %{ auth: false, cost: 2, method: :get, path: "/sprd/orders-pending" }, %{ auth: false, cost: 4, method: :get, path: "/asset/broker/nd/subaccount-withdrawal-history" }, %{ auth: false, cost: 2, method: :get, path: "/account/greeks" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/staking-defi/eth/product-info" }, %{ auth: false, cost: 1, method: :get, path: "/copytrading/subpositions-history" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/convert/currency-pair" }, %{ auth: false, cost: 4, method: :get, path: "/account/vip-loan-order-detail" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/currencies" }, %{ auth: false, cost: 10, method: :get, path: "/broker/nd/subaccount-info" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/ai-param" }, %{ auth: false, cost: 4, method: :get, path: "/account/interest-limits" }, %{ auth: false, cost: 2, method: :get, path: "/account/bills" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/staking-defi/eth/balance" }, %{ auth: false, cost: 20, method: :get, path: "/trade/one-click-repay-history" }, %{ auth: false, cost: 2, method: :get, path: "/asset/monthly-statement" }, %{ auth: false, cost: 5, method: :get, path: "/account/fixed-loan/borrowing-orders-list" }, %{ auth: false, cost: 10, method: :get, path: "/asset/asset-valuation" }, %{ auth: false, cost: 1, method: :get, path: "/account/subaccount/max-withdrawal" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/signal/orders-algo-history" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/recurring/orders-algo-details" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/savings/balance" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/convert/history" }, %{ auth: false, cost: 4, method: :get, path: "/rfq/trades" }, %{ auth: false, cost: 2, method: :get, path: "/account/positions-history" }, %{ auth: false, cost: 2, method: :get, path: "/finance/sfp/dcd/orders" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/non-tradable-assets" }, %{ auth: false, cost: 4, method: :get, path: "/account/fixed-loan/borrowing-limit" }, %{ auth: false, cost: 1, method: :get, path: "/trade/orders-algo-pending" }, %{ auth: false, cost: 4, method: :get, path: "/account/mmp-config" }, %{ auth: false, cost: 4, method: :get, path: "/account/set-auto-repay" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/batch-leverage-info" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/staking-defi/sol/balance" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/balances" }, %{ auth: false, cost: 20, method: :get, path: "/account/precheck-set-delta-neutral" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/profit-sharing-details" }, %{ auth: false, cost: 4, method: :get, path: "/finance/flexible-loan/max-collateral-redeem-amount" }, %{ auth: false, cost: 2, method: :get, path: "/account/bills-history-archive" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/signal/orders-algo-details" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/positions" }, %{ auth: false, cost: 1, method: :get, path: "/account/max-withdrawal" }, %{ auth: false, cost: 4, method: :get, path: "/account/spot-borrow-repay-history" }, %{ auth: false, cost: 1, method: :get, path: "/trade/account-rate-limit" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/deposit-address" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/staking-defi/orders-history" }, %{ auth: false, cost: 2, method: :get, path: "/trade/fills-archive" }, %{ auth: false, cost: 4, method: :get, path: "/account/collateral-assets" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/copy-settings" }, %{ auth: false, cost: 20, method: :get, path: "/trade/one-click-repay-currency-list-v2" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/savings/lending-history" }, %{ auth: false, cost: 10, method: :get, path: "/broker/nd/subaccount/apikey" }, %{ auth: false, cost: 1, method: :get, path: "/asset/transfer-state" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/signal/event-history" }, %{ auth: false, cost: 2, method: :get, path: "/broker/dma/subaccount-info" }, %{ auth: false, cost: 20, method: :get, path: "/asset/deposit-withdraw-status" }, %{ auth: false, cost: 4, method: :get, path: "/account/config" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/orders-algo-pending" }, %{ auth: false, cost: 5, method: :get, path: "/broker/fd/if-rebate" }, %{ auth: false, cost: 300, method: :get, path: "/broker/fd/rebate-per-orders" }, %{ auth: false, cost: 4, method: :get, path: "/finance/flexible-loan/collateral-assets" }, %{ auth: false, cost: 2, method: :get, path: "/finance/sfp/dcd/order" }, %{ auth: false, cost: 300, method: :get, path: "/broker/dma/rebate-per-orders" }, %{ auth: false, cost: 10, method: :get, path: "/broker/dma/subaccount/apikey" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/signal/positions" }, %{ auth: false, cost: 4, method: :get, path: "/account/vip-interest-accrued" }, %{ auth: false, cost: 20, method: :get, path: "/trade/one-click-repay-currency-list" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/staking-defi/sol/product-info" }, %{ auth: false, cost: 10, method: :get, path: "/broker/nd/info" }, %{ auth: false, cost: 4, method: :get, path: "/rfq/counterparties" }, %{ auth: false, cost: 4, method: :get, path: "/account/adjust-leverage-info" }, %{ auth: false, cost: 1, method: :get, path: "/trade/order-algo" }, %{ auth: false, cost: 4, method: :get, path: "/rfq/mmp-config" }, %{ auth: false, cost: 4, method: :get, path: "/finance/flexible-loan/interest-accrued" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/subaccount/bills" }, %{ auth: false, cost: 10, method: :get, path: "/rfq/quotes" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/staking-defi/sol/purchase-redeem-history" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/recurring/orders-algo-pending" }, %{ auth: false, cost: 4, method: :get, path: "/account/borrow-repay-history" }, %{ auth: false, cost: 2, method: :get, path: "/account/positions" }, %{ auth: false, cost: 0.5, method: :get, path: "/trade/orders-history" }, %{ auth: false, cost: 4, method: :get, path: "/finance/flexible-loan/loan-history" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/recurring/sub-orders" }, %{ auth: false, cost: 4, method: :get, path: "/account/trade-fee" }, %{ auth: false, cost: 10, method: :get, path: "/rfq/rfqs" }, %{ auth: false, cost: 1, method: :get, path: "/copytrading/current-subpositions" }, %{ auth: false, cost: 4, method: :get, path: "/account/bills-archive" }, %{ auth: false, cost: 1, method: :get, path: "/account/leverage-info" }, %{ auth: false, cost: 5, method: :get, path: "/asset/deposit-lightning" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/orders-algo-details" }, %{ auth: false, cost: 300, method: :get, path: "/broker/nd/rebate-per-orders" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/signal/signals" }, %{ auth: false, cost: 4, method: :get, path: "/rfq/public-trades" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/deposit-history" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/asset/subaccount/balances" }, %{ auth: false, cost: 1, method: :get, path: "/affiliate/invitee/detail" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/total-unrealized-profit-sharing" }, %{ auth: false, cost: 1, method: :get, path: "/users/partner/if-rebate" }, %{ auth: false, cost: 1, method: :get, path: "/account/max-loan" }, %{ auth: false, cost: 10, method: :get, path: "/users/entrust-subaccount-list" }, %{ auth: false, cost: 2, method: :get, path: "/account/account-position-risk" }, %{ auth: false, cost: 20, method: :post, path: "/trade/one-click-repay" }, %{ auth: false, cost: 1, method: :post, path: "/sprd/order" }, %{ auth: false, cost: 1, method: :post, path: "/trade/cancel-algos" }, %{ auth: false, cost: 4, method: :post, path: "/broker/nd/set-subaccount-level" }, %{ auth: false, cost: 10, method: :post, path: "/sprd/cancel-all-after" }, %{ auth: false, cost: 10, method: :post, path: "/asset/convert-dust-assets" }, %{ auth: false, cost: 10, method: :post, path: "/rfq/cancel-all-quotes" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-greeks" }, %{ auth: false, cost: 10, method: :post, path: "/users/subaccount/apikey" }, %{ auth: false, cost: 36000, method: :post, path: "/broker/dma/trades" }, %{ auth: false, cost: 4, method: :post, path: "/account/account-level-switch-preset" }, %{ auth: false, cost: 1, method: :post, path: "/trade/cancel-advance-algos" }, %{ auth: false, cost: 20, method: :post, path: "/account/set-trading-config" }, %{ auth: false, cost: 0.25, method: :post, path: "/broker/nd/set-subaccount-assets" }, %{ auth: false, cost: 1, method: :post, path: "/broker/nd/delete-subaccount" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/amendTPSL" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/cancel-close-order" }, %{ auth: false, cost: 1, method: :post, path: "/asset/broker/nd/subaccount-deposit-address" }, %{ auth: false, cost: 4, method: :post, path: "/rfq/maker-instrument-settings" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/sub-order" }, %{ auth: false, cost: 4, method: :post, path: "/copytrading/first-copy-settings" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/amend-algo-basic-param" }, %{ auth: false, cost: 10, method: :post, path: "/rfq/cancel-all-rfqs" }, %{ auth: false, cost: 4, method: :post, path: "/account/activate-option" }, %{ auth: false, cost: 10, method: :post, path: "/finance/sfp/dcd/quote" }, %{ auth: false, cost: 1, method: :post, path: "/account/set-settle-currency" }, %{ auth: false, cost: 10, method: :post, path: "/rfq/cancel-batch-rfqs" }, %{ auth: false, cost: 30, method: :post, path: "/account/spot-manual-borrow-repay" }, %{ auth: false, cost: 1, method: :post, path: "/sprd/cancel-order" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/sol/purchase" }, %{ auth: false, cost: 4, method: :post, path: "/copytrading/batch-set-leverage" }, %{ auth: false, cost: 4, method: :post, path: "/finance/flexible-loan/adjust-collateral" }, %{ auth: false, cost: 1.6666666666666667, method: :post, path: "/asset/withdrawal" }, %{ auth: false, cost: 0.3333333333333333, method: :post, path: "/trade/cancel-order" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-account-level" }, %{ auth: false, cost: 4, method: :post, path: "/account/mmp-reset" }, %{ auth: false, cost: 10, method: :post, path: "/users/subaccount/subaccount-apikey" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/create-signal" }, %{ auth: false, cost: 2, method: :post, path: "/account/set-riskOffset-type" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/order-algo" }, %{ auth: false, cost: 4, method: :post, path: "/copytrading/amend-profit-sharing-ratio" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/stop-order-algo" }, %{ auth: false, cost: 0.25, method: :post, path: "/broker/nd/create-subaccount" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/stop-order-algo" }, %{ auth: false, cost: 0.006666666666666667, method: :post, path: "/trade/amend-batch-orders" }, %{ auth: false, cost: 1, method: :post, path: "/sprd/mass-cancel" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-auto-loan" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/margin-balance" }, %{ auth: false, cost: 4, method: :post, path: "/copytrading/amend-copy-settings" }, %{ auth: false, cost: 5, method: :post, path: "/asset/withdrawal-lightning" }, %{ auth: false, cost: 4, method: :post, path: "/rfq/create-rfq" }, %{ auth: false, cost: 5, method: :post, path: "/account/fixed-loan/borrowing-order" }, %{ auth: false, cost: 1, method: :post, path: "/sprd/amend-order" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/min-investment" }, %{ auth: false, cost: 10, method: :post, path: "/account/set-auto-earn" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/adjust-investment" }, %{ auth: false, cost: 0.4, method: :post, path: "/rfq/create-quote" }, %{ auth: false, cost: 1, method: :post, path: "/trade/amend-algos" }, %{ auth: false, cost: 10, method: :post, path: "/rfq/cancel-batch-quotes" }, %{ auth: false, cost: 1.6666666666666667, method: :post, path: "/asset/broker/nd/modify-subaccount-deposit-address" }, %{ auth: false, cost: 1.6666666666666667, method: :post, path: "/account/borrow-repay" }, %{ auth: false, cost: 0.3333333333333333, method: :post, path: "/trade/order" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/recurring/stop-order-algo" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/order-instant-trigger" }, %{ auth: false, cost: 10, method: :post, path: "/users/subaccount/create-subaccount" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/eth/cancel-redeem" }, %{ auth: false, cost: 5, method: :post, path: "/asset/transfer" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/cancel-sub-order" }, %{ auth: false, cost: 5, method: :post, path: "/account/fixed-loan/amend-borrowing-order" }, %{ auth: false, cost: 10, method: :post, path: "/users/subaccount/delete-apikey" }, %{ auth: false, cost: 5, method: :post, path: "/account/fixed-loan/manual-reborrow" }, %{ auth: false, cost: 1296000, method: :post, path: "/asset/monthly-statement" }, %{ auth: false, cost: 5, method: :post, path: "/account/fixed-loan/repay-borrowing-order" }, %{ auth: false, cost: 4, method: :post, path: "/trade/mass-cancel" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-position-mode" }, %{ auth: false, cost: 0.06666666666666667, method: :post, path: "/trade/cancel-batch-orders" }, %{ auth: false, cost: 20, method: :post, path: "/trade/easy-convert" }, %{ auth: false, cost: 50, method: :post, path: "/account/position-builder-graph" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/cancel" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/eth/purchase" }, %{ auth: false, cost: 1.6666666666666667, method: :post, path: "/finance/savings/set-lending-rate" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/withdraw-income" }, %{ auth: false, cost: 50, method: :post, path: "/account/mmp-config" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-auto-repay" }, %{ auth: false, cost: 0.06666666666666667, method: :post, path: "/trade/batch-orders" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-fee-type" }, %{ auth: false, cost: 4, method: :post, path: "/account/subaccount/set-loan-allocation" }, %{ auth: false, cost: 10, method: :post, path: "/rfq/cancel-all-after" }, %{ auth: false, cost: 10, method: :post, path: "/account/move-positions" }, %{ auth: false, cost: 72000, method: :post, path: "/account/bills-history-archive" }, %{ auth: false, cost: 4, method: :post, path: "/finance/flexible-loan/max-loan" }, %{ auth: false, cost: 50, method: :post, path: "/asset/convert/estimate-quote" }, %{ auth: false, cost: 172800, method: :post, path: "/trade/fills-archive" }, %{ auth: false, cost: 0.25, method: :post, path: "/broker/nd/subaccount/apikey" }, %{ auth: false, cost: 10, method: :post, path: "/account/simulated_margin" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/recurring/order-algo" }, %{ auth: false, cost: 1, method: :post, path: "/account/set-leverage" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/close-position" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-collateral-assets" }, %{ auth: false, cost: 15, method: :post, path: "/rfq/execute-quote" }, %{ auth: false, cost: 1.6666666666666667, method: :post, path: "/finance/savings/purchase-redempt" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/recurring/amend-order-algo" }, %{ auth: false, cost: 4, method: :post, path: "/account/set-isolated-mode" }, %{ auth: false, cost: 36000, method: :post, path: "/broker/fd/rebate-per-orders" }, %{ auth: false, cost: 10, method: :post, path: "/finance/sfp/dcd/order" }, %{ auth: false, cost: 1, method: :post, path: "/broker/nd/subaccount/delete-apikey" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/margin-balance" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/sol/cancel-redeem" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/order-algo" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/redeem" }, %{ auth: false, cost: 4, method: :post, path: "/account/quick-margin-borrow-repay" }, %{ auth: false, cost: 20, method: :post, path: "/trade/one-click-repay-v2" }, %{ auth: false, cost: 1, method: :post, path: "/asset/convert/trade" }, %{ auth: false, cost: 0.25, method: :post, path: "/broker/dma/subaccount/apikey" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/eth/redeem" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/sol/redeem" }, %{ auth: false, cost: 10, method: :post, path: "/users/subaccount/set-transfer-out" }, %{ auth: false, cost: 10, method: :post, path: "/account/position-builder" }, %{ auth: false, cost: 10, method: :post, path: "/asset/subaccount/transfer" }, %{ auth: false, cost: 10, method: :post, path: "/users/subaccount/modify-apikey" }, %{ auth: false, cost: 4, method: :post, path: "/rfq/cancel-rfq" }, %{ auth: false, cost: 1, method: :post, path: "/trade/order-algo" }, %{ auth: false, cost: 100, method: :post, path: "/rfq/mmp-config" }, %{ auth: false, cost: 4, method: :post, path: "/copytrading/stop-copy-trading" }, %{ auth: false, cost: 4, method: :post, path: "/rfq/mmp-reset" }, %{ auth: false, cost: 4, method: :post, path: "/copytrading/set-instruments" }, %{ auth: false, cost: 1.6666666666666667, method: :post, path: "/asset/cancel-withdrawal" }, %{ auth: false, cost: 1, method: :post, path: "/copytrading/close-subposition" }, %{ auth: false, cost: 1, method: :post, path: "/account/position/margin-balance" }, %{ auth: false, cost: 4, method: :post, path: "/broker/nd/set-subaccount-fee-rate" }, %{ auth: false, cost: 0.25, method: :post, path: "/broker/nd/report-subaccount-ip" }, %{ auth: false, cost: 1, method: :post, path: "/copytrading/algo-order" }, %{ auth: false, cost: 1, method: :post, path: "/broker/nd/subaccount/modify-apikey" }, %{ auth: false, cost: 36000, method: :post, path: "/broker/nd/rebate-per-orders" }, %{ auth: false, cost: 0.4, method: :post, path: "/rfq/cancel-quote" }, %{ auth: false, cost: 4, method: :post, path: "/trade/order-precheck" }, %{ auth: false, cost: 10, method: :post, path: "/trade/cancel-all-after" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/amend-order-algo" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/compute-margin-balance" }, %{ auth: false, cost: 0.3333333333333333, method: :post, path: "/trade/amend-order" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/close-position" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/signal/set-instruments" }, %{ auth: false, cost: 5, method: :post, path: "/finance/staking-defi/purchase" }, %{ auth: false, cost: 1, method: :post, path: "/trade/close-position" } ], public: [ %{ auth: false, cost: 1, method: :get, path: "/public/open-interest" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-weekly-pnl" }, %{ auth: false, cost: 2, method: :get, path: "/public/funding-rate" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-pnl" }, %{ auth: false, cost: 2, method: :get, path: "/public/estimated-price" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/taker-volume-contract" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/taker-volume" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/asset/exchange-list" }, %{ auth: false, cost: 20, method: :get, path: "/support/announcements-types" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/contracts/long-short-account-ratio-contract" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/staking-defi/eth/apy-history" }, %{ auth: false, cost: 50, method: :get, path: "/system/status" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/market/books-lite" }, %{ auth: false, cost: 1, method: :get, path: "/market/block-ticker" }, %{ auth: false, cost: 1, method: :get, path: "/market/history-mark-price-candles" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/option/open-interest-volume" }, %{ auth: false, cost: 1, method: :get, path: "/market/sprd-ticker" }, %{ auth: false, cost: 2, method: :get, path: "/public/time" }, %{ auth: false, cost: 50, method: :get, path: "/public/economic-calendar" }, %{ auth: false, cost: 1, method: :get, path: "/market/tickers" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/contracts/long-short-account-ratio-contract-top-trader" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/savings/lending-rate-summary" }, %{ auth: false, cost: 1, method: :get, path: "/public/instruments" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/fixed-loan/lending-offers" }, %{ auth: false, cost: 1, method: :get, path: "/public/option-trades" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/fixed-loan/lending-apy-history" }, %{ auth: false, cost: 1, method: :get, path: "/market/index-candles" }, %{ auth: false, cost: 2, method: :get, path: "/market/books-full" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-lead-traders" }, %{ auth: false, cost: 10, method: :get, path: "/public/interest-rate-loan-quota" }, %{ auth: false, cost: 2, method: :get, path: "/public/insurance-fund" }, %{ auth: false, cost: 1, method: :get, path: "/market/option/instrument-family-trades" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/min-investment" }, %{ auth: false, cost: 4, method: :get, path: "/support/announcements" }, %{ auth: false, cost: 0.5, method: :get, path: "/market/sprd-candles" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/option/open-interest-volume-expiry" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/trading-data/support-coin" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/grid/ai-param" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-stats" }, %{ auth: false, cost: 0.6666666666666666, method: :get, path: "/finance/sfp/dcd/products" }, %{ auth: false, cost: 1, method: :get, path: "/market/mark-price-candles" }, %{ auth: false, cost: 0.5, method: :get, path: "/public/settlement-history" }, %{ auth: false, cost: 10, method: :get, path: "/market/platform-24-volume" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-preference-currency" }, %{ auth: false, cost: 2, method: :get, path: "/rubik/stat/contracts/open-interest-history" }, %{ auth: false, cost: 2, method: :get, path: "/public/estimated-settlement-info" }, %{ auth: false, cost: 20, method: :get, path: "/market/exchange-rate" }, %{ auth: false, cost: 0.2, method: :get, path: "/market/trades" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/option/taker-block-volume" }, %{ auth: false, cost: 2, method: :get, path: "/market/history-index-candles" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/option/open-interest-volume-strike" }, %{ auth: false, cost: 2, method: :get, path: "/public/mark-price" }, %{ auth: false, cost: 1, method: :get, path: "/public/opt-summary" }, %{ auth: false, cost: 1, method: :get, path: "/market/block-tickers" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-subpositions-history" }, %{ auth: false, cost: 10, method: :get, path: "/public/discount-rate-interest-free-quota" }, %{ auth: false, cost: 10, method: :get, path: "/public/vip-interest-rate-loan-quota" }, %{ auth: false, cost: 1, method: :get, path: "/public/price-limit" }, %{ auth: false, cost: 1, method: :get, path: "/public/premium-history" }, %{ auth: false, cost: 1, method: :get, path: "/market/ticker" }, %{ auth: false, cost: 1, method: :get, path: "/market/sprd-history-candles" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-config" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/margin/loan-ratio" }, %{ auth: false, cost: 50, method: :get, path: "/market/open-oracle" }, %{ auth: false, cost: 10, method: :get, path: "/market/books-sbe" }, %{ auth: false, cost: 1, method: :get, path: "/market/call-auction-detail" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-current-subpositions" }, %{ auth: false, cost: 4, method: :get, path: "/copytrading/public-copy-traders" }, %{ auth: false, cost: 4, method: :get, path: "/public/instrument-tick-bands" }, %{ auth: false, cost: 2, method: :get, path: "/public/funding-rate-history" }, %{ auth: false, cost: 1, method: :get, path: "/market/index-components" }, %{ auth: false, cost: 1, method: :get, path: "/public/block-trades" }, %{ auth: false, cost: 2, method: :get, path: "/public/convert-contract-coin" }, %{ auth: false, cost: 2, method: :get, path: "/market/history-trades" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/ticker" }, %{ auth: false, cost: 0.5, method: :get, path: "/public/delivery-exercise-history" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/public-trades" }, %{ auth: false, cost: 1, method: :get, path: "/tradingBot/public/rsi-back-testing" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/savings/lending-rate-history" }, %{ auth: false, cost: 1, method: :get, path: "/market/history-candles" }, %{ auth: false, cost: 0.5, method: :get, path: "/market/books" }, %{ auth: false, cost: 1, method: :get, path: "/public/underlying" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/contracts/open-interest-volume" }, %{ auth: false, cost: 3.3333333333333335, method: :get, path: "/finance/fixed-loan/pending-lending-volume" }, %{ auth: false, cost: 1, method: :get, path: "/market/index-tickers" }, %{ auth: false, cost: 4, method: :get, path: "/public/market-data-history" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/spreads" }, %{ auth: false, cost: 4, method: :get, path: "/tradingBot/grid/grid-quantity" }, %{ auth: false, cost: 2, method: :get, path: "/public/position-tiers" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/option/open-interest-volume-ratio" }, %{ auth: false, cost: 1, method: :get, path: "/sprd/books" }, %{ auth: false, cost: 1.6666666666666667, method: :get, path: "/finance/staking-defi/sol/apy-history" }, %{ auth: false, cost: 0.5, method: :get, path: "/market/candles" }, %{ auth: false, cost: 4, method: :get, path: "/rubik/stat/contracts/long-short-account-ratio" }, %{ auth: false, cost: 1, method: :post, path: "/tradingBot/grid/min-investment" } ] }, required_credentials: %{ api_key: true, password: true, secret: true, uid: false }, requires_eddsa: false, response_error: %{ code_field: "code", field: "code", message_field: "msg", success_values: [ "0" ], type: :success_code }, signing: %{ api_key_header: "OK-ACCESS-KEY", confidence: :high, has_passphrase: true, passphrase_header: "OK-ACCESS-PASSPHRASE", pattern: :hmac_sha256_iso_passphrase, signature_encoding: :base64, signature_header: "OK-ACCESS-SIGN", timestamp_format: :iso8601, timestamp_header: "OK-ACCESS-TIMESTAMP" }, spec_format_version: 2, 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: 100, expiry: 1773388800000, expiry_datetime: "2026-03-13T08:00:00.000Z", id: "BTC-USD-260313", inverse: true, limits: %{ "amount" => %{ "min" => 0.1 }, "cost" => %{}, "leverage" => %{ "max" => 20, "min" => 1 }, "price" => %{} }, linear: false, maker: 0.0002, precision: %{ "amount" => 0.1, "price" => 0.1 }, quote: "USD", quote_id: "USD", separator: "-", settle: "BTC", settle_id: "BTC", symbol: "BTC/USD:BTC-260313", taker: 0.0005 }, option: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 1, expiry: 1773216000000, expiry_datetime: "2026-03-11T08:00:00.000Z", id: "BTC-USD-260311-56000-C", inverse: true, limits: %{ "amount" => %{ "min" => 1 }, "cost" => %{}, "leverage" => %{ "max" => 1, "min" => 1 }, "price" => %{} }, linear: false, maker: 0.001, precision: %{ "amount" => 1, "price" => 0.0001 }, quote: "USD", quote_id: "USD", separator: "-", settle: "BTC", settle_id: "BTC", symbol: "BTC/USD:BTC-260311-56000-C", taker: 0.0015 }, precision_mode: 4, sample_limits: %{ "amount" => %{ "min" => 1 }, "cost" => %{ "max" => 1000000 }, "price" => %{} }, sample_precision: %{ "amount" => 0.001, "price" => 0.0001 }, spot: %{ base: "USDT", base_id: "USDT", case: :upper, contract: false, id: "USDT-SGD", limits: %{ "amount" => %{ "min" => 1 }, "cost" => %{ "max" => 1000000 }, "leverage" => %{ "max" => 1, "min" => 1 }, "price" => %{} }, maker: 0.001, precision: %{ "amount" => 0.001, "price" => 0.0001 }, quote: "SGD", quote_id: "SGD", separator: "-", symbol: "USDT/SGD", taker: 0.0015 }, swap: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 100, id: "BTC-USD-SWAP", inverse: true, limits: %{ "amount" => %{ "min" => 0.1 }, "cost" => %{}, "leverage" => %{ "max" => 100, "min" => 1 }, "price" => %{} }, linear: false, maker: 0.0002, precision: %{ "amount" => 0.1, "price" => 0.1 }, quote: "USD", quote_id: "USD", separator: "-", settle: "BTC", settle_id: "BTC", symbol: "BTC/USD:BTC", taker: 0.0005 } }, symbol_patterns: %{ future: %{ case: :upper, component_order: [ :base, :quote, :date ], date_format: :yymmdd, pattern: :future_yymmdd, prefix: nil, separator: "-", suffix: nil }, option: %{ case: :upper, component_order: [ :base, :date, :strike, :type ], date_format: :yymmdd, pattern: :option_yymmdd, prefix: nil, separator: "-", suffix: nil }, spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :dash_upper, prefix: nil, separator: "-", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :suffix_swap, prefix: nil, separator: "-", suffix: "-SWAP" } }, timeframes: %{ "12h" => "12H", "15m" => "15m", "1M" => "1M", "1d" => "1D", "1h" => "1H", "1m" => "1m", "1w" => "1W", "2h" => "2H", "30m" => "30m", "3M" => "3M", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6H" }, url_strategy: %{ detected_from: "sign_method", pattern: :api_version_slash, prefix: "/api/v5/" }, urls: %{ api: "https://us.okx.com", api_sections: %{ "rest" => "https://us.okx.com" }, doc: "https://app.okx.com/docs-v5/en/#overview", other: nil, sandbox: %{ "rest" => "https://us.okx.com" }, www: "https://app.okx.com" }, version: "v5", ws: %{ has: %{ watch_balance: true, watch_bids_asks: true, watch_funding_rate: true, watch_funding_rates: true, watch_liquidations: "emulated", watch_liquidations_for_symbols: true, watch_mark_price: true, watch_mark_prices: true, watch_my_liquidations: "emulated", 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: nil, watch_position: nil, watch_positions: true, watch_status: nil, watch_ticker: true, watch_tickers: true, watch_trades: true, watch_trades_for_symbols: true }, hostname: "us.okx.com", message_patterns: [ %{ args_field: "args", format: :op, keys: [ "args", "op" ], kind_field: "op", kind_value: "login", sources: [ :send, :watch ] }, %{ args_field: "args", format: :op, keys: [ "args", "op" ], kind_field: "op", kind_value: "subscribe", sources: [ :send, :watch, :watch_multiple ] }, %{ format: :string, sources: [ :ping ] } ], options: %{ "createOrderWs" => %{ "op" => "batch-orders" }, "editOrderWs" => %{ "op" => "amend-order" }, "watchBalance" => "spot", "watchMyTrades" => %{ "type" => "ANY" }, "watchOrderBook" => %{ "checksum" => true, "depth" => "books" }, "watchOrders" => %{ "type" => "ANY" }, "watchTicker" => %{ "channel" => "tickers" }, "watchTickers" => %{ "channel" => "tickers" }, "ws" => %{} }, streaming: %{ keep_alive: 18000 }, subscription_pattern: :custom, test_urls: %{ "business" => "wss://wsuspap.okx.com:8443/ws/v5/business", "private" => "wss://wsuspap.okx.com:8443/ws/v5/private", "public" => "wss://wsuspap.okx.com:8443/ws/v5/public" }, urls: %{ "business" => "wss://wsus.okx.com:8443/ws/v5/business", "private" => "wss://wsus.okx.com:8443/ws/v5/private", "public" => "wss://wsus.okx.com:8443/ws/v5/public" } } }