# Bybit Exchange Specification # # Auto-generated by: mix ccxt.extract bybit # CCXT version: 4.5.34 # Spec format version: 1 # # Review before use: # - signing: Detected from sign() method, verify with testnet # - endpoints: Raw paths extracted, map to unified API as needed # - exceptions: Extracted (exact, broad, HTTP status codes) # - features/options: Extracted from describe() # - classification: Set to :supported initially, promote after validation # %{ api_param_requirements: %{ "uses_account_type" => true, "uses_category" => true }, certified: true, classification: :certified_pro, comment: nil, countries: [ "VG" ], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 87, "coveragePercent" => 100, "enabledMethods" => 91, "excluded" => [ %{ "method" => "fetchBidsAsks", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchDepositWithdrawFee", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchFundingRate", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchPositionHistory", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 4, "extractableMethods" => 87, "failures" => [] }, endpoints: [ %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :post, name: :borrow_cross_margin, param_mappings: %{ "code" => "coin" }, params: [ :code, :amount ], path: "/v5/account/borrow", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 50, default_params: %{ "category" => "spot" }, market_type: :spot, method: :post, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/v5/order/cancel-all", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "product" => "DERIVATIVES", "timeWindow" => 1 }, market_type: :spot, method: :post, name: :cancel_all_orders_after, param_mappings: %{}, params: [ :timeout ], path: "/v5/order/disconnected-cancel-all", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "spot", "orderFilter" => "Order" }, market_type: :spot, method: :post, name: :cancel_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/v5/order/cancel", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "request" => [ %{ "orderId" => "test-order-id", "symbol" => "BTCUSDT" } ] }, market_type: :spot, method: :post, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/v5/order/cancel-batch", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "request" => [ %{ "orderId" => "test-order-id", "symbol" => "BTCUSDT" } ] }, market_type: :spot, method: :post, name: :cancel_orders_for_symbols, param_mappings: %{}, params: [ :orders ], path: "/v5/order/cancel-batch", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :create_convert_trade, param_mappings: %{ "id" => "quoteTxId" }, params: [ :id, :fromCode, :toCode, :amount ], path: "/v5/asset/exchange/convert-execute", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "spot", "orderType" => "Limit" }, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "qty" }, params: [ :symbol, :side, :amount, :price ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "spot", "orderType" => "Market", "side" => "Buy" }, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{ "cost" => "qty" }, params: [ :symbol, :cost ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "spot", "marketUnit" => "baseCoin", "orderType" => "Market" }, market_type: :spot, method: :post, name: :create_market_order, param_mappings: %{ "amount" => "qty" }, params: [ :symbol, :side, :amount, :price ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "spot", "marketUnit" => "quoteCoin", "orderType" => "Market", "side" => "Sell" }, market_type: :spot, method: :post, name: :create_market_sell_order_with_cost, param_mappings: %{ "cost" => "qty" }, params: [ :symbol, :cost ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "qty", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear" }, market_type: :swap, method: :post, name: :create_order_with_take_profit_and_stop_loss, param_mappings: %{ "amount" => "qty", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfit, :stopLoss ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "request" => [ %{ "orderType" => "Limit", "price" => "50000", "qty" => "0.001", "side" => "Buy", "symbol" => "BTCUSDT" } ] }, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/v5/order/create-batch", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "spot", "timeInForce" => "PostOnly" }, market_type: :spot, method: :post, name: :create_post_only_order, param_mappings: %{ "amount" => "qty", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear", "reduceOnly" => true }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "qty", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear", "orderType" => "Limit", "triggerDirection" => 2 }, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "qty" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear", "reduceOnly" => true, "triggerDirection" => "below" }, market_type: :swap, method: :post, name: :create_stop_loss_order, param_mappings: %{ "amount" => "qty", "stopLossPrice" => "triggerPrice", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :stopLossPrice ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear", "orderType" => "Market", "triggerDirection" => 2 }, market_type: :swap, method: :post, name: :create_stop_market_order, param_mappings: %{ "amount" => "qty" }, params: [ :symbol, :side, :amount, :triggerPrice ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear", "triggerDirection" => 2 }, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "qty", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear", "reduceOnly" => true, "triggerDirection" => "above" }, market_type: :swap, method: :post, name: :create_take_profit_order, param_mappings: %{ "amount" => "qty", "takeProfitPrice" => "triggerPrice", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfitPrice ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear" }, market_type: :swap, method: :post, name: :create_trailing_amount_order, param_mappings: %{ "trailingAmount" => "trailingStop", "trailingTriggerPrice" => "activePrice" }, params: [ :symbol, :type, :side, :amount, :price, :trailingAmount, :trailingTriggerPrice ], path: "/v5/position/trading-stop", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "category" => "linear", "triggerDirection" => 2 }, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "qty", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/v5/order/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :post, name: :edit_order, param_mappings: %{ "amount" => "qty", "id" => "orderId" }, params: [ :id, :symbol, :type, :side, :amount, :price ], path: "/v5/order/amend", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot", "request" => [ %{ "orderId" => "test-order-id", "price" => "50000", "qty" => "0.001", "symbol" => "BTCUSDT" } ] }, market_type: :spot, method: :post, name: :edit_orders, param_mappings: %{}, params: [ :orders ], path: "/v5/order/amend-batch", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "baseCoin" => "BTC", "category" => "option" }, market_type: :option, method: :get, name: :fetch_all_greeks, param_mappings: %{}, params: [ :symbols ], path: "/v5/market/tickers", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "accountType" => "UNIFIED" }, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/v5/account/wallet-balance", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_canceled_and_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/order/history", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot", "orderStatus" => "Cancelled" }, market_type: :spot, method: :get, name: :fetch_canceled_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/order/history", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot", "orderStatus" => "Filled" }, market_type: :spot, method: :get, name: :fetch_closed_order, param_mappings: %{ "arg0" => "orderId", "arg1" => "symbol" }, params: [], path: "/v5/order/history", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot", "orderStatus" => "Filled" }, market_type: :spot, method: :get, name: :fetch_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/order/history", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.5, default_params: %{ "accountType" => "unified" }, market_type: :spot, method: :get, name: :fetch_convert_currencies, param_mappings: %{}, params: [], path: "/v5/asset/exchange/query-coin-list", response_transformer: {:extract_path, ["result", "coins"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "accountType" => "unified" }, market_type: :spot, method: :post, name: :fetch_convert_quote, param_mappings: %{ "amount" => "requestAmount", "toCode" => "toCoin" }, params: [ :fromCode, :toCode, :amount ], path: "/v5/asset/exchange/quote-apply", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.5, default_params: %{ "accountType" => "unified" }, market_type: :spot, method: :get, name: :fetch_convert_trade, param_mappings: %{ "id" => "quoteTxId" }, params: [ :id, :code ], path: "/v5/asset/exchange/convert-result-query", response_transformer: {:extract_path, ["result", "result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 0.5, market_type: :spot, method: :get, name: :fetch_convert_trade_history, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/v5/asset/exchange/query-convert-history", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_cross_borrow_rate, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/v5/spot-cross-margin-trade/loan-info", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 28, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/v5/asset/coin/query-info", response_transformer: {:extract_path, ["result", "rows"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/v5/asset/deposit/query-address", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, market_type: :spot, method: :get, name: :fetch_deposit_addresses_by_network, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/v5/asset/deposit/query-address", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 28, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fees, param_mappings: %{}, params: [ :codes ], path: "/v5/asset/coin/query-info", response_transformer: {:extract_path, ["result", "rows"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, market_type: :spot, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/v5/asset/deposit/query-record", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "execType" => "Funding", "size" => 100 }, market_type: :swap, method: :get, name: :fetch_funding_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/execution/list", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "limit" => 200, "settleCoin" => "USDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/market/funding/history", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "settleCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/v5/market/tickers", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "option" }, market_type: :option, method: :get, name: :fetch_greeks, param_mappings: %{}, params: [ :symbol ], path: "/v5/market/tickers", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "interval" => "1", "limit" => 200 }, market_type: :swap, method: :get, name: :fetch_index_ohlcv, param_mappings: %{ "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v5/market/index-price-kline", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "spot", "limit" => 50 }, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/v5/market/orderbook", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "accountType" => "UNIFIED" }, market_type: :spot, method: :get, name: :fetch_ledger, param_mappings: %{ "code" => "currency" }, params: [ :code, :since, :limit ], path: "/v5/account/transaction-log", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear" }, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{}, params: [ :symbol ], path: "/v5/position/list", response_transformer: {:extract_path_unwrap, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear" }, market_type: :swap, method: :get, name: :fetch_leverage_tiers, param_mappings: %{}, params: [ :symbols ], path: "/v5/market/risk-limit", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "period" => "1d" }, market_type: :swap, method: :get, name: :fetch_long_short_ratio_history, param_mappings: %{ "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v5/market/account-ratio", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "interval" => "1", "limit" => 200 }, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, param_mappings: %{ "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v5/market/mark-price-kline", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear" }, market_type: :swap, method: :get, name: :fetch_market_leverage_tiers, param_mappings: %{}, params: [ :symbol ], path: "/v5/market/risk-limit", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/v5/market/instruments-info", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "execType" => "BustTrade" }, market_type: :swap, method: :get, name: :fetch_my_liquidations, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/execution/list", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_my_settlement_history, param_mappings: %{}, params: [], path: "/v5/asset/delivery-record", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot", "execType" => "Trade" }, market_type: :spot, method: :get, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/execution/list", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "spot", "interval" => "60" }, market_type: :spot, method: :get, name: :fetch_ohlcv, param_mappings: %{ "since" => "start", "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v5/market/kline", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "intervalTime" => "1h", "settleCoin" => "USDT" }, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{}, params: [ :symbol ], path: "/v5/market/open-interest", response_transformer: {:extract_path_unwrap, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "intervalTime" => "1h", "settleCoin" => "USDT" }, market_type: :swap, method: :get, name: :fetch_open_interest_history, param_mappings: %{}, params: [ :symbol, :timeframe, :since, :limit ], path: "/v5/market/open-interest", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_open_order, param_mappings: %{ "arg0" => "orderId", "arg1" => "symbol" }, params: [], path: "/v5/order/realtime", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/order/realtime", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "option" }, market_type: :option, method: :get, name: :fetch_option, param_mappings: %{}, params: [ :symbol ], path: "/v5/market/tickers", response_transformer: {:extract_path_unwrap, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "option" }, market_type: :option, method: :get, name: :fetch_option_chain, param_mappings: %{ "code" => "baseCoin" }, params: [ :code ], path: "/v5/market/tickers", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/v5/order/realtime", response_transformer: {:extract_path_unwrap, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/v5/market/orderbook", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "spot", "execType" => "Trade" }, market_type: :spot, method: :get, name: :fetch_order_trades, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol, :since, :limit ], path: "/v5/execution/list", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "settleCoin" => "USDT" }, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/v5/position/list", response_transformer: {:extract_path_unwrap, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "limit" => 200, "settleCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/v5/position/list", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_positions_history, param_mappings: %{}, params: [ :symbols, :since, :limit ], path: "/v5/position/closed-pnl", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "interval" => "1", "limit" => 200 }, market_type: :swap, method: :get, name: :fetch_premium_index_ohlcv, param_mappings: %{ "timeframe" => "interval" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v5/market/premium-index-price-kline", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "linear", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_settlement_history, param_mappings: %{}, params: [], path: "/v5/market/delivery-price", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/v5/market/tickers", response_transformer: {:extract_path_unwrap, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/v5/market/tickers", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/v5/market/time", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v5/market/recent-trade", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, default_params: %{ "category" => "spot" }, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{}, params: [ :symbol ], path: "/v5/account/fee-rate", response_transformer: {:extract_path_unwrap, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, market_type: :spot, method: :get, name: :fetch_trading_fees, param_mappings: %{}, params: [], path: "/v5/account/fee-rate", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 50, market_type: :spot, method: :get, name: :fetch_transfers, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/v5/asset/transfer/query-inter-transfer-list", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "category" => "option" }, market_type: :option, method: :get, name: :fetch_volatility_history, param_mappings: %{ "arg0" => "baseCoin" }, params: [], path: "/v5/market/historical-volatility", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, market_type: :spot, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/v5/asset/withdraw/query-record", response_transformer: {:extract_path, ["result", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :post, name: :repay_cross_margin, param_mappings: %{ "code" => "coin" }, params: [ :code, :amount ], path: "/v5/account/no-convert-repay", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear" }, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/v5/position/set-leverage", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "setMarginMode" => "ISOLATED_MARGIN" }, market_type: :swap, method: :post, name: :set_margin_mode, param_mappings: %{}, params: [ :marginMode, :symbol ], path: "/v5/account/set-margin-mode", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "category" => "linear", "mode" => 3 }, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/v5/position/switch-mode", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 50, default_params: %{ "toAccountType" => "CONTRACT", "transferId" => "" }, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "code" => "coin", "fromAccount" => "fromAccountType" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/v5/asset/transfer/inter-transfer", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 50, default_params: %{ "accountType" => "unified", "timestamp" => "" }, market_type: :spot, method: :post, name: :withdraw, param_mappings: %{ "code" => "coin" }, params: [ :code, :amount, :address, :tag ], path: "/v5/asset/withdraw/create", response_transformer: {:extract_path, ["result"]}, source: :intercepted } ], error_code_details: %{ -10009 => %{ description: "{\"ret_code\":-10009,\"ret_msg\":\"Invalid period!\",\"result\":null,\"token\":null}", type: :invalid_parameters }, -1004 => %{ description: "{\"ret_code\":-1004,\"ret_msg\":\"Missing required parameter \\u0027symbol\\u0027\",\"ext_code\":null,\"ext_info\":null,\"result\":null}", type: :invalid_parameters }, -1021 => %{ description: "{\"ret_code\":-1021,\"ret_msg\":\"Timestamp for this request is outside of the recvWindow.\",\"ext_code\":null,\"ext_info\":null,\"result\":null}", type: :invalid_parameters }, -1103 => %{ description: "An unknown parameter was sent.", type: :invalid_parameters }, -1140 => %{ description: "{\"ret_code\":-1140,\"ret_msg\":\"Transaction amount lower than the minimum.\",\"result\":{},\"ext_code\":\"\",\"ext_info\":null,\"time_now\":\"1659204910.248576\"}", type: :invalid_order }, -1197 => %{ description: "{\"ret_code\":-1197,\"ret_msg\":\"Your order quantity to buy is too large. The filled price may deviate significantly from the market price. Please try again\",\"result\":{},\"ext_code\":\"\",\"ext_info\":null,\"time_now\":\"1659204531.979680\"}", type: :invalid_order }, -2013 => %{ description: "{\"ret_code\":-2013,\"ret_msg\":\"Order does not exist.\",\"ext_code\":null,\"ext_info\":null,\"result\":null}", type: :invalid_order }, -2015 => %{ description: "Invalid API-key, IP, or permissions for action.", type: :invalid_credentials }, -6017 => %{ description: "Repayment amount has exceeded the total liability", type: :invalid_parameters }, -6025 => %{ description: "Amount to borrow cannot be lower than the min. amount to borrow (per transaction)", type: :invalid_parameters }, -6029 => %{ description: "Amount to borrow has exceeded the user's estimated max amount to borrow", type: :invalid_parameters }, 10001 => %{ description: "parameter error", type: :invalid_parameters }, 10002 => %{ description: "request expired, check your timestamp and recv_window", type: :invalid_credentials }, 100028 => %{ description: "The API cannot be accessed by unified account users.", type: :access_restricted }, 10003 => %{ description: "Invalid apikey", type: :invalid_credentials }, 10004 => %{ description: "invalid sign", type: :invalid_credentials }, 10005 => %{ description: "permission denied for current apikey", type: :access_restricted }, 10006 => %{ description: "too many requests", type: :rate_limited }, 10007 => %{ description: "api_key not found in your request parameters", type: :invalid_credentials }, 10008 => %{ description: "User had been banned", type: :access_restricted }, 10009 => %{ description: "IP had been banned", type: :invalid_credentials }, 10010 => %{ description: "request ip mismatch", type: :access_restricted }, 10014 => %{ description: "Request is duplicate", type: :invalid_parameters }, 10016 => %{ description: "{\"retCode\":10016,\"retMsg\":\"System error. Please try again later.\"}", type: :exchange_error }, 10017 => %{ description: "request path not found or request method is invalid", type: :invalid_parameters }, 10018 => %{ description: "exceed ip rate limit", type: :rate_limited }, 10020 => %{ description: "{\"retCode\":10020,\"retMsg\":\"your account is not a unified margin account, please update your account\",\"result\":null,\"retExtInfo\":null,\"time\":1664783731123}", type: :access_restricted }, 10024 => %{ description: "Compliance rules triggered", type: :access_restricted }, 10027 => %{ description: "Trading Banned", type: :access_restricted }, 10028 => %{ description: "The API can only be accessed by unified account users.", type: :access_restricted }, 10029 => %{ description: "The requested symbol is invalid, please check symbol whitelist", type: :access_restricted }, 110001 => %{ description: "Order does not exist", type: :order_not_found }, 110003 => %{ description: "Order price is out of permissible range", type: :invalid_order }, 110004 => %{ description: "Insufficient wallet balance", type: :insufficient_balance }, 110005 => %{ description: "position status", type: :invalid_order }, 110006 => %{ description: "cannot afford estimated position_margin", type: :insufficient_balance }, 110007 => %{ description: "{\"retCode\":110007,\"retMsg\":\"ab not enough for new order\",\"result\":{},\"retExtInfo\":{},\"time\":1668838414793}", type: :insufficient_balance }, 110008 => %{ description: "Order has been finished or canceled", type: :invalid_order }, 110009 => %{ description: "The number of stop orders exceeds maximum limit allowed", type: :invalid_order }, 110010 => %{ description: "Order already cancelled", type: :invalid_order }, 110011 => %{ description: "Any adjustments made will trigger immediate liquidation", type: :invalid_order }, 110012 => %{ description: "Available balance not enough", type: :insufficient_balance }, 110013 => %{ description: "Due to risk limit, cannot set leverage", type: :invalid_parameters }, 110014 => %{ description: "Available balance not enough to add margin", type: :insufficient_balance }, 110015 => %{ description: "the position is in cross_margin", type: :invalid_parameters }, 110016 => %{ description: "Requested quantity of contracts exceeds risk limit, please adjust your risk limit level before trying again", type: :invalid_order }, 110017 => %{ description: "Reduce-only rule not satisfied", type: :invalid_order }, 110018 => %{ description: "userId illegal", type: :invalid_parameters }, 110019 => %{ description: "orderId illegal", type: :invalid_order }, 110020 => %{ description: "number of active orders greater than 500", type: :invalid_order }, 110021 => %{ description: "Open Interest exceeded", type: :invalid_order }, 110022 => %{ description: "qty has been limited, cannot modify the order to add qty", type: :invalid_order }, 110023 => %{ description: "This contract only supports position reduction operation, please contact customer service for details", type: :invalid_order }, 110024 => %{ description: "You have an existing position, so position mode cannot be switched", type: :invalid_parameters }, 110025 => %{ description: "Position mode is not modified", type: :exchange_error }, 110026 => %{ description: "Cross/isolated margin mode is not modified", type: :exchange_error }, 110027 => %{ description: "Margin is not modified", type: :exchange_error }, 110028 => %{ description: "Open orders exist, so you cannot change position mode", type: :invalid_parameters }, 110029 => %{ description: "Hedge mode is not available for this symbol", type: :invalid_parameters }, 110030 => %{ description: "Duplicate orderId", type: :invalid_order }, 110031 => %{ description: "risk limit info does not exists", type: :invalid_order }, 110032 => %{ description: "Illegal order", type: :invalid_order }, 110033 => %{ description: "Margin cannot be set without open position", type: :invalid_order }, 110034 => %{ description: "There is no net position", type: :invalid_order }, 110035 => %{ description: "Cancel order is not completed before liquidation", type: :invalid_order }, 110036 => %{ description: "Cross margin mode is not allowed to change leverage", type: :invalid_order }, 110037 => %{ description: "User setting list does not have this symbol", type: :invalid_order }, 110038 => %{ description: "Portfolio margin mode is not allowed to change leverage", type: :invalid_order }, 110039 => %{ description: "Maintain margin rate is too high, which may trigger liquidation", type: :invalid_order }, 110040 => %{ description: "Order will trigger forced liquidation, please resubmit the order", type: :invalid_order }, 110041 => %{ description: "Skip liquidation is not allowed when a position or maker order exists", type: :invalid_order }, 110042 => %{ description: "Pre-delivery status can only reduce positions", type: :invalid_order }, 110043 => %{ description: "Set leverage not modified", type: :invalid_parameters }, 110044 => %{ description: "Insufficient available margin", type: :insufficient_balance }, 110045 => %{ description: "Insufficient wallet balance", type: :insufficient_balance }, 110046 => %{ description: "Any adjustments made will trigger immediate liquidation", type: :invalid_parameters }, 110047 => %{ description: "Risk limit cannot be adjusted due to insufficient available margin", type: :invalid_parameters }, 110048 => %{ description: "Risk limit cannot be adjusted as the current/expected position value held exceeds the revised risk limit", type: :invalid_parameters }, 110049 => %{ description: "Tick notes can only be numbers", type: :invalid_parameters }, 110050 => %{ description: "Coin is not in the range of selected", type: :invalid_parameters }, 110051 => %{ description: "The user's available balance cannot cover the lowest price of the current market", type: :insufficient_balance }, 110052 => %{ description: "User's available balance is insufficient to set a price", type: :insufficient_balance }, 110053 => %{ description: "The user's available balance cannot cover the current market price and upper limit price", type: :insufficient_balance }, 110054 => %{ description: "This position has at least one take profit link order, so the take profit and stop loss mode cannot be switched", type: :invalid_order }, 110055 => %{ description: "This position has at least one stop loss link order, so the take profit and stop loss mode cannot be switched", type: :invalid_order }, 110056 => %{ description: "This position has at least one trailing stop link order, so the take profit and stop loss mode cannot be switched", type: :invalid_order }, 110057 => %{ description: "Conditional order or limit order contains TP/SL related params", type: :invalid_order }, 110058 => %{ description: "Insufficient number of remaining position size to set take profit and stop loss", type: :invalid_order }, 110059 => %{ description: "In the case of partial filled of the open order, it is not allowed to modify the take profit and stop loss settings of the open order", type: :invalid_order }, 110060 => %{ description: "Under full TP/SL mode, it is not allowed to modify TP/SL", type: :invalid_parameters }, 110061 => %{ description: "Under partial TP/SL mode, TP/SL set more than 20", type: :invalid_parameters }, 110062 => %{ description: "Institution MMP profile not found.", type: :invalid_parameters }, 110063 => %{ description: "Settlement in progress! xxx not available for trades.", type: :exchange_error }, 110064 => %{ description: "The number of contracts modified cannot be less than or equal to the filled quantity", type: :invalid_order }, 110065 => %{ description: "MMP hasn't yet been enabled for your account. Please contact your BD manager.", type: :access_restricted }, 110066 => %{ description: "No trading is allowed at the current time", type: :exchange_error }, 110067 => %{ description: "unified account is not support", type: :access_restricted }, 110068 => %{ description: "Leveraged user trading is not allowed", type: :access_restricted }, 110069 => %{ description: "Do not allow OTC lending users to trade", type: :access_restricted }, 110070 => %{ description: "ETP symbols are not allowed to be traded", type: :invalid_order }, 110071 => %{ description: "Sorry, we're revamping the Unified Margin Account! Currently, new upgrades are not supported. If you have any questions, please contact our 24/7 customer support.", type: :exchange_error }, 110072 => %{ description: "OrderLinkedID is duplicate", type: :invalid_order }, 110073 => %{ description: "Set margin mode failed", type: :exchange_error }, 110092 => %{ description: "expect Rising, but trigger_price[XXXXX] <= current[XXXXX]", type: :invalid_order }, 110093 => %{ description: "expect Falling, but trigger_price[XXXXX] >= current[XXXXX]", type: :invalid_order }, 110094 => %{ description: "Order notional value below the lower limit", type: :invalid_order }, 12137 => %{ description: "{\"retCode\":12137,\"retMsg\":\"Order quantity has too many decimals.\",\"result\":{},\"retExtInfo\":{},\"time\":1695900943033}", type: :invalid_order }, 12141 => %{ description: "\"retCode\":12141,\"retMsg\":\"Duplicate clientOrderId.\",\"result\":{},\"retExtInfo\":{},\"time\":1686134298989}", type: :invalid_parameters }, 12201 => %{ description: "{\"retCode\":12201,\"retMsg\":\"Invalid orderCategory parameter.\",\"result\":{},\"retExtInfo\":null,\"time\":1666699391220}", type: :invalid_parameters }, 130006 => %{ description: "{\"ret_code\":130006,\"ret_msg\":\"The number of contracts exceeds maximum limit allowed: too large\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1658397095.099030\",\"rate_limit_status\":99,\"rate_limit_reset_ms\":1658397095097,\"rate_limit\":100}", type: :invalid_order }, 130021 => %{ description: "{\"ret_code\":130021,\"ret_msg\":\"orderfix price failed for CannotAffordOrderCost.\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1644588250.204878\",\"rate_limit_status\":98,\"rate_limit_reset_ms\":1644588250200,\"rate_limit\":100} | {\"ret_code\":130021,\"ret_msg\":\"oc_diff[1707966351], new_oc[1707966351] with ob[....]+AB[....]\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1658395300.872766\",\"rate_limit_status\":99,\"rate_limit_reset_ms\":1658395300855,\"rate_limit\":100} caused issues/9149#issuecomment-1146559498", type: :insufficient_balance }, 130074 => %{ description: "{\"ret_code\":130074,\"ret_msg\":\"expect Rising, but trigger_price[190000000] \\u003c= current[211280000]??LastPrice\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1655386638.067076\",\"rate_limit_status\":97,\"rate_limit_reset_ms\":1655386638065,\"rate_limit\":100}", type: :invalid_order }, 131001 => %{ description: "{\"retCode\":131001,\"retMsg\":\"the available balance is not sufficient to cover the handling fee\",\"result\":{},\"retExtInfo\":{},\"time\":1666892821245}", type: :insufficient_balance }, 131002 => %{ description: "Parameter error", type: :invalid_parameters }, 131003 => %{ description: "Interal error", type: :exchange_error }, 131004 => %{ description: "KYC needed", type: :invalid_credentials }, 131084 => %{ description: "Withdraw failed because of Uta Upgrading", type: :exchange_error }, 131085 => %{ description: "Withdrawal amount is greater than your availale balance (the deplayed withdrawal is triggered)", type: :insufficient_balance }, 131086 => %{ description: "Withdrawal amount exceeds risk limit (the risk limit of margin trade is triggered)", type: :invalid_parameters }, 131088 => %{ description: "The withdrawal amount exceeds the remaining withdrawal limit of your identity verification level. The current available amount for withdrawal : %s", type: :invalid_parameters }, 131089 => %{ description: "User sensitive operation, withdrawal is prohibited within 24 hours", type: :invalid_parameters }, 131090 => %{ description: "User withdraw has been banned", type: :exchange_error }, 131091 => %{ description: "Blocked login status does not allow withdrawals", type: :exchange_error }, 131092 => %{ description: "User status is abnormal", type: :exchange_error }, 131093 => %{ description: "The withdrawal address is not in the whitelist", type: :exchange_error }, 131094 => %{ description: "UserId is not in the whitelist", type: :invalid_parameters }, 131095 => %{ description: "Withdrawl amount exceeds the 24 hour platform limit", type: :invalid_parameters }, 131096 => %{ description: "Withdraw amount does not satify the lower limit or upper limit", type: :invalid_parameters }, 131097 => %{ description: "Withdrawal of this currency has been closed", type: :exchange_error }, 131098 => %{ description: "Withdrawal currently is not availble from new address", type: :exchange_error }, 131099 => %{ description: "Hot wallet status can cancel the withdraw", type: :exchange_error }, 131200 => %{ description: "Service error", type: :exchange_error }, 131201 => %{ description: "Internal error", type: :exchange_error }, 131202 => %{ description: "Invalid memberId", type: :invalid_parameters }, 131203 => %{ description: "Request parameter error", type: :invalid_parameters }, 131204 => %{ description: "Account info error", type: :invalid_parameters }, 131205 => %{ description: "Query transfer error", type: :invalid_parameters }, 131206 => %{ description: "Fail to transfer", type: :exchange_error }, 131207 => %{ description: "Account not exist", type: :invalid_parameters }, 131208 => %{ description: "Forbid transfer", type: :exchange_error }, 131209 => %{ description: "Get subMember relation error", type: :invalid_parameters }, 131210 => %{ description: "Amount accuracy error", type: :invalid_parameters }, 131211 => %{ description: "fromAccountType can't be the same as toAccountType", type: :invalid_parameters }, 131212 => %{ description: "Insufficient balance", type: :insufficient_balance }, 131213 => %{ description: "TransferLTV check error", type: :invalid_parameters }, 131214 => %{ description: "TransferId exist", type: :invalid_parameters }, 131215 => %{ description: "Amount error", type: :invalid_parameters }, 131216 => %{ description: "Query balance error", type: :exchange_error }, 131217 => %{ description: "Risk check error", type: :exchange_error }, 131231 => %{ description: "Transfers into this account are not supported", type: :exchange_error }, 131232 => %{ description: "Transfers out this account are not supported", type: :exchange_error }, 140001 => %{ description: "Order does not exist", type: :order_not_found }, 140003 => %{ description: "Order price is out of permissible range", type: :invalid_order }, 140004 => %{ description: "Insufficient wallet balance", type: :insufficient_balance }, 140005 => %{ description: "position status", type: :invalid_order }, 140006 => %{ description: "cannot afford estimated position_margin", type: :insufficient_balance }, 140007 => %{ description: "Insufficient available balance", type: :insufficient_balance }, 140008 => %{ description: "Order has been finished or canceled", type: :invalid_order }, 140009 => %{ description: "The number of stop orders exceeds maximum limit allowed", type: :invalid_order }, 140010 => %{ description: "Order already cancelled", type: :invalid_order }, 140011 => %{ description: "Any adjustments made will trigger immediate liquidation", type: :invalid_order }, 140012 => %{ description: "Available balance not enough", type: :insufficient_balance }, 140013 => %{ description: "Due to risk limit, cannot set leverage", type: :invalid_parameters }, 140014 => %{ description: "Available balance not enough to add margin", type: :insufficient_balance }, 140015 => %{ description: "the position is in cross_margin", type: :invalid_order }, 140016 => %{ description: "Requested quantity of contracts exceeds risk limit, please adjust your risk limit level before trying again", type: :invalid_order }, 140017 => %{ description: "Reduce-only rule not satisfied", type: :invalid_order }, 140018 => %{ description: "userId illegal", type: :invalid_parameters }, 140019 => %{ description: "orderId illegal", type: :invalid_order }, 140020 => %{ description: "number of active orders greater than 500", type: :invalid_order }, 140021 => %{ description: "Open Interest exceeded", type: :invalid_order }, 140022 => %{ description: "qty has been limited, cannot modify the order to add qty", type: :invalid_order }, 140023 => %{ description: "This contract only supports position reduction operation, please contact customer service for details", type: :invalid_order }, 140024 => %{ description: "You have an existing position, so position mode cannot be switched", type: :invalid_parameters }, 140025 => %{ description: "Position mode is not modified", type: :invalid_parameters }, 140026 => %{ description: "Cross/isolated margin mode is not modified", type: :invalid_parameters }, 140027 => %{ description: "Margin is not modified", type: :invalid_parameters }, 140028 => %{ description: "Open orders exist, so you cannot change position mode", type: :invalid_order }, 140029 => %{ description: "Hedge mode is not available for this symbol", type: :invalid_parameters }, 140030 => %{ description: "Duplicate orderId", type: :invalid_order }, 140031 => %{ description: "risk limit info does not exists", type: :invalid_parameters }, 140032 => %{ description: "Illegal order", type: :invalid_order }, 140033 => %{ description: "Margin cannot be set without open position", type: :invalid_order }, 140034 => %{ description: "There is no net position", type: :invalid_order }, 140035 => %{ description: "Cancel order is not completed before liquidation", type: :invalid_order }, 140036 => %{ description: "Cross margin mode is not allowed to change leverage", type: :invalid_parameters }, 140037 => %{ description: "User setting list does not have this symbol", type: :invalid_order }, 140038 => %{ description: "Portfolio margin mode is not allowed to change leverage", type: :invalid_parameters }, 140039 => %{ description: "Maintain margin rate is too high, which may trigger liquidation", type: :invalid_parameters }, 140040 => %{ description: "Order will trigger forced liquidation, please resubmit the order", type: :invalid_order }, 140041 => %{ description: "Skip liquidation is not allowed when a position or maker order exists", type: :invalid_order }, 140042 => %{ description: "Pre-delivery status can only reduce positions", type: :invalid_order }, 140043 => %{ description: "Set leverage not modified", type: :invalid_parameters }, 140044 => %{ description: "Insufficient available margin", type: :insufficient_balance }, 140045 => %{ description: "Insufficient wallet balance", type: :insufficient_balance }, 140046 => %{ description: "Any adjustments made will trigger immediate liquidation", type: :invalid_parameters }, 140047 => %{ description: "Risk limit cannot be adjusted due to insufficient available margin", type: :invalid_parameters }, 140048 => %{ description: "Risk limit cannot be adjusted as the current/expected position value held exceeds the revised risk limit", type: :invalid_parameters }, 140049 => %{ description: "Tick notes can only be numbers", type: :invalid_parameters }, 140050 => %{ description: "Coin is not in the range of selected", type: :invalid_order }, 140051 => %{ description: "The user's available balance cannot cover the lowest price of the current market", type: :insufficient_balance }, 140052 => %{ description: "User's available balance is insufficient to set a price", type: :insufficient_balance }, 140053 => %{ description: "The user's available balance cannot cover the current market price and upper limit price", type: :insufficient_balance }, 140054 => %{ description: "This position has at least one take profit link order, so the take profit and stop loss mode cannot be switched", type: :invalid_order }, 140055 => %{ description: "This position has at least one stop loss link order, so the take profit and stop loss mode cannot be switched", type: :invalid_order }, 140056 => %{ description: "This position has at least one trailing stop link order, so the take profit and stop loss mode cannot be switched", type: :invalid_order }, 140057 => %{ description: "Conditional order or limit order contains TP/SL related params", type: :invalid_order }, 140058 => %{ description: "Insufficient number of remaining position size to set take profit and stop loss", type: :invalid_order }, 140059 => %{ description: "In the case of partial filled of the open order, it is not allowed to modify the take profit and stop loss settings of the open order", type: :invalid_order }, 140060 => %{ description: "Under full TP/SL mode, it is not allowed to modify TP/SL", type: :invalid_parameters }, 140061 => %{ description: "Under partial TP/SL mode, TP/SL set more than 20", type: :invalid_parameters }, 140062 => %{ description: "Institution MMP profile not found.", type: :invalid_parameters }, 140063 => %{ description: "Settlement in progress! xxx not available for trades.", type: :exchange_error }, 140064 => %{ description: "The number of contracts modified cannot be less than or equal to the filled quantity", type: :invalid_order }, 140065 => %{ description: "MMP hasn't yet been enabled for your account. Please contact your BD manager.", type: :access_restricted }, 140066 => %{ description: "No trading is allowed at the current time", type: :exchange_error }, 140067 => %{ description: "unified account is not support", type: :access_restricted }, 140068 => %{ description: "Leveraged user trading is not allowed", type: :access_restricted }, 140069 => %{ description: "Do not allow OTC lending users to trade", type: :access_restricted }, 140070 => %{ description: "ETP symbols are not allowed to be traded", type: :invalid_order }, 170001 => %{ description: "Internal error.", type: :exchange_error }, 170005 => %{ description: "Too many new orders; current limit is %s orders per %s.", type: :invalid_order }, 170007 => %{ description: "Timeout waiting for response from backend server.", type: :network_error }, 170010 => %{ description: "Purchase failed: Exceed the maximum position limit of leveraged tokens, the current available limit is %s USDT", type: :invalid_order }, 170011 => %{ description: "\"Purchase failed: Exceed the maximum position limit of innovation tokens,", type: :invalid_order }, 170019 => %{ description: "the current available limit is replaceKey0 USDT\"", type: :invalid_order }, 170031 => %{ description: "The feature has been suspended", type: :exchange_error }, 170032 => %{ description: "Network error. Please try again later", type: :exchange_error }, 170033 => %{ description: "margin Insufficient account balance", type: :insufficient_balance }, 170034 => %{ description: "Liability over flow in spot leverage trade!", type: :insufficient_balance }, 170035 => %{ description: "Submitted to the system for processing!", type: :invalid_parameters }, 170036 => %{ description: "You haven't enabled Cross Margin Trading yet. To do so, please head to the PC trading site or the Bybit app", type: :invalid_parameters }, 170037 => %{ description: "Cross Margin Trading not yet supported by the selected coin", type: :invalid_parameters }, 170105 => %{ description: "Parameter '%s' was empty.", type: :invalid_parameters }, 170115 => %{ description: "Invalid timeInForce.", type: :invalid_order }, 170116 => %{ description: "Invalid orderType.", type: :invalid_order }, 170117 => %{ description: "Invalid side.", type: :invalid_order }, 170121 => %{ description: "Invalid symbol.", type: :invalid_order }, 170124 => %{ description: "Order amount too large.", type: :invalid_order }, 170130 => %{ description: "Data sent for paramter '%s' is not valid.", type: :invalid_parameters }, 170131 => %{ description: "Balance insufficient", type: :insufficient_balance }, 170132 => %{ description: "Order price too high.", type: :invalid_order }, 170133 => %{ description: "Order price lower than the minimum.", type: :invalid_order }, 170134 => %{ description: "Order price decimal too long.", type: :invalid_order }, 170135 => %{ description: "Order quantity too large.", type: :invalid_order }, 170136 => %{ description: "Order quantity lower than the minimum.", type: :invalid_order }, 170137 => %{ description: "Order volume decimal too long", type: :invalid_order }, 170139 => %{ description: "Order has been filled.", type: :invalid_order }, 170140 => %{ description: "Transaction amount lower than the minimum.", type: :invalid_order }, 170141 => %{ description: "Duplicate clientOrderId", type: :invalid_order }, 170142 => %{ description: "Order has been canceled", type: :invalid_order }, 170143 => %{ description: "Cannot be found on order book", type: :invalid_order }, 170144 => %{ description: "Order has been locked", type: :invalid_order }, 170145 => %{ description: "This order type does not support cancellation", type: :invalid_order }, 170146 => %{ description: "Order creation timeout", type: :invalid_order }, 170147 => %{ description: "Order cancellation timeout", type: :invalid_order }, 170148 => %{ description: "Market order amount decimal too long", type: :invalid_order }, 170149 => %{ description: "Create order failed", type: :exchange_error }, 170150 => %{ description: "Cancel order failed", type: :exchange_error }, 170151 => %{ description: "The trading pair is not open yet", type: :invalid_order }, 170157 => %{ description: "The trading pair is not available for api trading", type: :invalid_order }, 170159 => %{ description: "Market Order is not supported within the first %s minutes of newly launched pairs due to risk control.", type: :invalid_order }, 170190 => %{ description: "Cancel order has been finished", type: :invalid_order }, 170191 => %{ description: "Can not cancel order, please try again later", type: :invalid_order }, 170192 => %{ description: "Order price cannot be higher than %s .", type: :invalid_order }, 170193 => %{ description: "Buy order price cannot be higher than %s.", type: :invalid_order }, 170194 => %{ description: "Sell order price cannot be lower than %s.", type: :invalid_order }, 170195 => %{ description: "Please note that your order may not be filled", type: :invalid_order }, 170196 => %{ description: "Please note that your order may not be filled", type: :invalid_order }, 170197 => %{ description: "Your order quantity to buy is too large. The filled price may deviate significantly from the market price. Please try again", type: :invalid_order }, 170198 => %{ description: "Your order quantity to sell is too large. The filled price may deviate significantly from the market price. Please try again", type: :invalid_order }, 170199 => %{ description: "Your order quantity to buy is too large. The filled price may deviate significantly from the nav. Please try again.", type: :invalid_order }, 170200 => %{ description: "Your order quantity to sell is too large. The filled price may deviate significantly from the nav. Please try again.", type: :invalid_order }, 170201 => %{ description: "Your account has been restricted for trades. If you have any questions, please email us at support@bybit.com", type: :access_restricted }, 170202 => %{ description: "Invalid orderFilter parameter.", type: :invalid_order }, 170203 => %{ description: "Please enter the TP/SL price.", type: :invalid_order }, 170204 => %{ description: "trigger price cannot be higher than 110% price.", type: :invalid_order }, 170206 => %{ description: "trigger price cannot be lower than 90% of qty.", type: :invalid_order }, 170209 => %{ description: "{\"retCode\":170209,\"retMsg\":\"This trading pair is only available to the Brunei,Kampuchea (Cambodia ],Indonesia,Laos,Malaysia,Burma,Philippines,Thailand,Timor-Leste,Vietnam region.\",\"result\":{},\"retExtInfo\":{},\"time\":1769526868171}", type: :access_restricted }, 170210 => %{ description: "New order rejected.", type: :invalid_order }, 170213 => %{ description: "Order does not exist.", type: :order_not_found }, 170217 => %{ description: "Only LIMIT-MAKER order is supported for the current pair.", type: :invalid_order }, 170218 => %{ description: "The LIMIT-MAKER order is rejected due to invalid price.", type: :invalid_order }, 170221 => %{ description: "This coin does not exist.", type: :invalid_parameters }, 170222 => %{ description: "Too many requests in this time frame.", type: :rate_limited }, 170223 => %{ description: "Your Spot Account with Institutional Lending triggers an alert or liquidation.", type: :insufficient_balance }, 170224 => %{ description: "You're not a user of the Innovation Zone.", type: :access_restricted }, 170226 => %{ description: "Your Spot Account for Margin Trading is being liquidated.", type: :insufficient_balance }, 170227 => %{ description: "This feature is not supported.", type: :exchange_error }, 170228 => %{ description: "The purchase amount of each order exceeds the estimated maximum purchase amount.", type: :invalid_order }, 170229 => %{ description: "The sell quantity per order exceeds the estimated maximum sell quantity.", type: :invalid_order }, 170234 => %{ description: "System Error", type: :exchange_error }, 170241 => %{ description: "To proceed with trading, users must read through and confirm that they fully understand the project's risk disclosure document.", type: :exchange_error }, 170371 => %{ description: "{\"retCode\":170371,\"retMsg\":\"Order price cannot be lower than 0.0025, the price limitation.\",\"result\":{},\"retExtInfo\":{},\"time\":1766500057720}", type: :invalid_order }, 170372 => %{ description: "{\"retCode\":170372,\"retMsg\":\"Order price cannot be higher than 24.2175, the price limitation\",\"result\":{},\"retExtInfo\":{},\"time\":1766500129105}", type: :invalid_order }, 175000 => %{ description: "The serialNum is already in use.", type: :invalid_order }, 175001 => %{ description: "Daily purchase limit has been exceeded. Please try again later.", type: :invalid_order }, 175002 => %{ description: "There's a large number of purchase orders. Please try again later.", type: :invalid_order }, 175003 => %{ description: "Insufficient available balance. Please make a deposit and try again.", type: :insufficient_balance }, 175004 => %{ description: "Daily redemption limit has been exceeded. Please try again later.", type: :invalid_order }, 175005 => %{ description: "There's a large number of redemption orders. Please try again later.", type: :invalid_order }, 175006 => %{ description: "Insufficient available balance. Please make a deposit and try again.", type: :insufficient_balance }, 175007 => %{ description: "Order not found.", type: :invalid_order }, 175008 => %{ description: "Purchase period hasn't started yet.", type: :invalid_order }, 175009 => %{ description: "Purchase amount has exceeded the upper limit.", type: :invalid_order }, 175010 => %{ description: "You haven't passed the quiz yet! To purchase and/or redeem an LT, please complete the quiz first.", type: :access_restricted }, 175012 => %{ description: "Redemption period hasn't started yet.", type: :invalid_order }, 175013 => %{ description: "Redemption amount has exceeded the upper limit.", type: :invalid_order }, 175014 => %{ description: "Purchase of the LT has been temporarily suspended.", type: :invalid_order }, 175015 => %{ description: "Redemption of the LT has been temporarily suspended.", type: :invalid_order }, 175016 => %{ description: "Invalid format. Please check the length and numeric precision.", type: :invalid_order }, 175017 => %{ description: "Failed to place order:Exceed the maximum position limit of leveraged tokens, the current available limit is XXXX USDT", type: :invalid_order }, 175027 => %{ description: "Subscriptions and redemptions are temporarily unavailable while account upgrade is in progress", type: :exchange_error }, 176002 => %{ description: "Query user account info error", type: :invalid_parameters }, 176003 => %{ description: "Query user loan history error", type: :invalid_parameters }, 176004 => %{ description: "Query order history start time exceeds end time", type: :invalid_parameters }, 176005 => %{ description: "Failed to borrow", type: :invalid_parameters }, 176006 => %{ description: "Repayment Failed", type: :invalid_parameters }, 176007 => %{ description: "User not found", type: :invalid_parameters }, 176008 => %{ description: "You haven't enabled Cross Margin Trading yet. To do so", type: :invalid_parameters }, 176009 => %{ description: "You haven't enabled Cross Margin Trading yet. To do so", type: :invalid_parameters }, 176010 => %{ description: "Failed to locate the coins to borrow", type: :invalid_parameters }, 176011 => %{ description: "Cross Margin Trading not yet supported by the selected coin", type: :invalid_parameters }, 176012 => %{ description: "Pair not available", type: :invalid_parameters }, 176013 => %{ description: "Cross Margin Trading not yet supported by the selected pair", type: :invalid_parameters }, 176014 => %{ description: "Repeated repayment requests", type: :invalid_parameters }, 176015 => %{ description: "Insufficient available balance", type: :insufficient_balance }, 176016 => %{ description: "No repayment required", type: :invalid_parameters }, 176017 => %{ description: "Repayment amount has exceeded the total liability", type: :invalid_parameters }, 176018 => %{ description: "Settlement in progress", type: :invalid_parameters }, 176019 => %{ description: "Liquidation in progress", type: :invalid_parameters }, 176020 => %{ description: "Failed to locate repayment history", type: :invalid_parameters }, 176021 => %{ description: "Repeated borrowing requests", type: :invalid_parameters }, 176022 => %{ description: "Coins to borrow not generally available yet", type: :invalid_parameters }, 176023 => %{ description: "Pair to borrow not generally available yet", type: :invalid_parameters }, 176024 => %{ description: "Invalid user status", type: :invalid_parameters }, 176025 => %{ description: "Amount to borrow cannot be lower than the min. amount to borrow (per transaction)", type: :invalid_parameters }, 176026 => %{ description: "Amount to borrow cannot be larger than the max. amount to borrow (per transaction)", type: :invalid_parameters }, 176027 => %{ description: "Amount to borrow cannot be higher than the max. amount to borrow per user", type: :invalid_parameters }, 176028 => %{ description: "Amount to borrow has exceeded Bybit's max. amount to borrow", type: :invalid_parameters }, 176029 => %{ description: "Amount to borrow has exceeded the user's estimated max. amount to borrow", type: :invalid_parameters }, 176030 => %{ description: "Query user loan info error", type: :invalid_parameters }, 176031 => %{ description: "Number of decimals has exceeded the maximum precision", type: :invalid_parameters }, 176034 => %{ description: "The leverage ratio is out of range", type: :invalid_parameters }, 176035 => %{ description: "Failed to close the leverage switch during liquidation", type: :access_restricted }, 176036 => %{ description: "Failed to adjust leverage switch during forced liquidation", type: :access_restricted }, 176037 => %{ description: "For non-unified transaction users, the operation failed", type: :access_restricted }, 176038 => %{ description: "The spot leverage is closed and the current operation is not allowed", type: :invalid_parameters }, 176039 => %{ description: "Borrowing, current operation is not allowed", type: :invalid_parameters }, 176040 => %{ description: "There is a spot leverage order, and the adjustment of the leverage switch failed!", type: :invalid_parameters }, 181000 => %{ description: "category is null", type: :invalid_parameters }, 181001 => %{ description: "category only support linear or option or spot.", type: :invalid_parameters }, 181002 => %{ description: "symbol is null.", type: :invalid_order }, 181003 => %{ description: "side is null.", type: :invalid_order }, 181004 => %{ description: "side only support Buy or Sell.", type: :invalid_order }, 181017 => %{ description: "OrderStatus must be final status", type: :invalid_parameters }, 182000 => %{ description: "symbol related quote price is null", type: :invalid_order }, 20001 => %{ description: "Order not exists", type: :order_not_found }, 20003 => %{ description: "missing parameter side", type: :invalid_order }, 20004 => %{ description: "invalid parameter side", type: :invalid_order }, 20005 => %{ description: "missing parameter symbol", type: :invalid_order }, 20006 => %{ description: "invalid parameter symbol", type: :invalid_order }, 20007 => %{ description: "missing parameter order_type", type: :invalid_order }, 20008 => %{ description: "invalid parameter order_type", type: :invalid_order }, 20009 => %{ description: "missing parameter qty", type: :invalid_order }, 20010 => %{ description: "qty must be greater than 0", type: :invalid_order }, 20011 => %{ description: "qty must be an integer", type: :invalid_order }, 20012 => %{ description: "qty must be greater than zero and less than 1 million", type: :invalid_order }, 20013 => %{ description: "missing parameter price", type: :invalid_order }, 20014 => %{ description: "price must be greater than 0", type: :invalid_order }, 20015 => %{ description: "missing parameter time_in_force", type: :invalid_order }, 20016 => %{ description: "invalid value for parameter time_in_force", type: :invalid_order }, 20017 => %{ description: "missing parameter order_id", type: :invalid_order }, 20018 => %{ description: "invalid date format", type: :invalid_order }, 20019 => %{ description: "missing parameter stop_px", type: :invalid_order }, 20020 => %{ description: "missing parameter base_price", type: :invalid_order }, 20021 => %{ description: "missing parameter stop_order_id", type: :invalid_order }, 20022 => %{ description: "missing parameter leverage", type: :invalid_parameters }, 20023 => %{ description: "leverage must be a number", type: :invalid_parameters }, 20031 => %{ description: "leverage must be greater than zero", type: :invalid_parameters }, 20070 => %{ description: "missing parameter margin", type: :invalid_parameters }, 20071 => %{ description: "margin must be greater than zero", type: :invalid_parameters }, 20084 => %{ description: "order_id or order_link_id is required", type: :invalid_parameters }, 30001 => %{ description: "order_link_id is repeated", type: :invalid_parameters }, 30003 => %{ description: "qty must be more than the minimum allowed", type: :invalid_order }, 30004 => %{ description: "qty must be less than the maximum allowed", type: :invalid_order }, 30005 => %{ description: "price exceeds maximum allowed", type: :invalid_order }, 30007 => %{ description: "price exceeds minimum allowed", type: :invalid_order }, 30008 => %{ description: "invalid order_type", type: :invalid_order }, 30009 => %{ description: "no position found", type: :exchange_error }, 30010 => %{ description: "insufficient wallet balance", type: :insufficient_balance }, 30011 => %{ description: "operation not allowed as position is undergoing liquidation", type: :access_restricted }, 30012 => %{ description: "operation not allowed as position is undergoing ADL", type: :access_restricted }, 30013 => %{ description: "position is in liq or adl status", type: :access_restricted }, 30014 => %{ description: "invalid closing order, qty should not greater than size", type: :invalid_order }, 30015 => %{ description: "invalid closing order, side should be opposite", type: :invalid_order }, 30016 => %{ description: "TS and SL must be cancelled first while closing position", type: :exchange_error }, 30017 => %{ description: "estimated fill price cannot be lower than current Buy liq_price", type: :invalid_order }, 30018 => %{ description: "estimated fill price cannot be higher than current Sell liq_price", type: :invalid_order }, 30019 => %{ description: "cannot attach TP/SL params for non-zero position when placing non-opening position order", type: :invalid_order }, 30020 => %{ description: "position already has TP/SL params", type: :invalid_order }, 30021 => %{ description: "cannot afford estimated position_margin", type: :invalid_order }, 30022 => %{ description: "estimated buy liq_price cannot be higher than current mark_price", type: :invalid_order }, 30023 => %{ description: "estimated sell liq_price cannot be lower than current mark_price", type: :invalid_order }, 30024 => %{ description: "cannot set TP/SL/TS for zero-position", type: :invalid_order }, 30025 => %{ description: "trigger price should bigger than 10% of last price", type: :invalid_order }, 30026 => %{ description: "price too high", type: :invalid_order }, 30027 => %{ description: "price set for Take profit should be higher than Last Traded Price", type: :invalid_order }, 30028 => %{ description: "price set for Stop loss should be between Liquidation price and Last Traded Price", type: :invalid_order }, 30029 => %{ description: "price set for Stop loss should be between Last Traded Price and Liquidation price", type: :invalid_order }, 30030 => %{ description: "price set for Take profit should be lower than Last Traded Price", type: :invalid_order }, 30031 => %{ description: "insufficient available balance for order cost", type: :insufficient_balance }, 30032 => %{ description: "order has been filled or cancelled", type: :invalid_order }, 30033 => %{ description: "The number of stop orders exceeds maximum limit allowed", type: :rate_limited }, 30034 => %{ description: "no order found", type: :order_not_found }, 30035 => %{ description: "too fast to cancel", type: :rate_limited }, 30036 => %{ description: "the expected position value after order execution exceeds the current risk limit", type: :exchange_error }, 30037 => %{ description: "order already cancelled", type: :invalid_order }, 30041 => %{ description: "no position found", type: :exchange_error }, 30042 => %{ description: "insufficient wallet balance", type: :insufficient_balance }, 30043 => %{ description: "operation not allowed as position is undergoing liquidation", type: :invalid_order }, 30044 => %{ description: "operation not allowed as position is undergoing AD", type: :invalid_order }, 30045 => %{ description: "operation not allowed as position is not normal status", type: :invalid_order }, 30049 => %{ description: "insufficient available balance", type: :insufficient_balance }, 30050 => %{ description: "any adjustments made will trigger immediate liquidation", type: :exchange_error }, 30051 => %{ description: "due to risk limit, cannot adjust leverage", type: :exchange_error }, 30052 => %{ description: "leverage can not less than 1", type: :exchange_error }, 30054 => %{ description: "position margin is invalid", type: :exchange_error }, 30057 => %{ description: "requested quantity of contracts exceeds risk limit", type: :exchange_error }, 30063 => %{ description: "reduce-only rule not satisfied", type: :exchange_error }, 30067 => %{ description: "insufficient available balance", type: :insufficient_balance }, 30068 => %{ description: "exit value must be positive", type: :exchange_error }, 30074 => %{ description: "can't create the stop order, because you expect the order will be triggered when the LastPrice(or IndexPrice、 MarkPrice, determined by trigger_by) is raising to stop_px, but the LastPrice(or IndexPrice、 MarkPrice) is already equal to or greater than stop_px, please adjust base_price or stop_px", type: :invalid_order }, 30075 => %{ description: "can't create the stop order, because you expect the order will be triggered when the LastPrice(or IndexPrice、 MarkPrice, determined by trigger_by) is falling to stop_px, but the LastPrice(or IndexPrice、 MarkPrice) is already equal to or less than stop_px, please adjust base_price or stop_px", type: :invalid_order }, 30078 => %{ description: "{\"ret_code\":30078,\"ret_msg\":\"\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1644853040.916000\",\"rate_limit_status\":73,\"rate_limit_reset_ms\":1644853040912,\"rate_limit\":75}", type: :exchange_error }, 3100116 => %{ description: "{\"retCode\":3100116,\"retMsg\":\"Order quantity below the lower limit 0.01.\",\"result\":null,\"retExtMap\":{\"key0\":\"0.01\"}}", type: :invalid_parameters }, 3100198 => %{ description: "{\"retCode\":3100198,\"retMsg\":\"orderLinkId can not be empty.\",\"result\":null,\"retExtMap\":{}}", type: :invalid_parameters }, 3200300 => %{ description: "{\"retCode\":3200300,\"retMsg\":\"Insufficient margin balance.\",\"result\":null,\"retExtMap\":{}}", type: :insufficient_balance }, 33004 => %{ description: "apikey already expired", type: :invalid_credentials }, 3400045 => %{ description: "Set margin mode failed", type: :exchange_error }, 340099 => %{ description: "Server error", type: :exchange_error }, 34026 => %{ description: "the limit is no change", type: :exchange_error }, 34036 => %{ description: "{\"ret_code\":34036,\"ret_msg\":\"leverage not modified\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1652376449.258918\",\"rate_limit_status\":74,\"rate_limit_reset_ms\":1652376449255,\"rate_limit\":75}", type: :invalid_parameters }, 35015 => %{ description: "{\"ret_code\":35015,\"ret_msg\":\"Qty not in range\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1652277215.821362\",\"rate_limit_status\":99,\"rate_limit_reset_ms\":1652277215819,\"rate_limit\":100}", type: :invalid_parameters }, 5004 => %{ description: "{\"retCode\":5004,\"retMsg\":\"Server Timeout\",\"result\":null,\"retExtInfo\":{},\"time\":1667577060106}", type: :exchange_error }, 7001 => %{ description: "{\"retCode\":7001,\"retMsg\":\"request params type error\"}", type: :invalid_parameters }, "Not supported symbols" => %{ description: "{\"retCode\":10001,\"retMsg\":\"Not supported symbols\",\"result\":{},\"retExtInfo\":{},\"time\":1726147060461}", type: :invalid_order }, "Request timeout" => %{ description: "{\"retCode\":10016,\"retMsg\":\"Request timeout, please try again later\",\"result\":{},\"retExtInfo\":{},\"time\":1675307914985}", type: :network_error }, "invalid api_key" => %{ description: "{\"ret_code\":10003,\"ret_msg\":\"invalid api_key\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1599547085.415797\"}", type: :invalid_credentials }, "new_oc" => %{ description: nil, type: :insufficient_balance }, "oc_diff" => %{ description: nil, type: :insufficient_balance }, "openapi sign params error!" => %{ description: "{\"retCode\":10001,\"retMsg\":\"empty value: apiTimestamp[] apiKey[] apiSignature[xxxxxxxxxxxxxxxxxxxxxxx]: openapi sign params error!\",\"result\":null,\"retExtInfo\":null,\"time\":1664789597123}", type: :invalid_credentials }, "unknown orderInfo" => %{ description: "{\"ret_code\":-1,\"ret_msg\":\"unknown orderInfo\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1584030414.005545\",\"rate_limit_status\":99,\"rate_limit_reset_ms\":1584030414003,\"rate_limit\":100}", type: :order_not_found } }, error_codes: %{ -10009 => :invalid_parameters, -1004 => :invalid_parameters, -1021 => :invalid_parameters, -1103 => :invalid_parameters, -1140 => :invalid_order, -1197 => :invalid_order, -2013 => :invalid_order, -2015 => :invalid_credentials, -6017 => :invalid_parameters, -6025 => :invalid_parameters, -6029 => :invalid_parameters, 10001 => :invalid_parameters, 10002 => :invalid_credentials, 100028 => :access_restricted, 10003 => :invalid_credentials, 10004 => :invalid_credentials, 10005 => :access_restricted, 10006 => :rate_limited, 10007 => :invalid_credentials, 10008 => :access_restricted, 10009 => :invalid_credentials, 10010 => :access_restricted, 10014 => :invalid_parameters, 10016 => :exchange_error, 10017 => :invalid_parameters, 10018 => :rate_limited, 10020 => :access_restricted, 10024 => :access_restricted, 10027 => :access_restricted, 10028 => :access_restricted, 10029 => :access_restricted, 110001 => :order_not_found, 110003 => :invalid_order, 110004 => :insufficient_balance, 110005 => :invalid_order, 110006 => :insufficient_balance, 110007 => :insufficient_balance, 110008 => :invalid_order, 110009 => :invalid_order, 110010 => :invalid_order, 110011 => :invalid_order, 110012 => :insufficient_balance, 110013 => :invalid_parameters, 110014 => :insufficient_balance, 110015 => :invalid_parameters, 110016 => :invalid_order, 110017 => :invalid_order, 110018 => :invalid_parameters, 110019 => :invalid_order, 110020 => :invalid_order, 110021 => :invalid_order, 110022 => :invalid_order, 110023 => :invalid_order, 110024 => :invalid_parameters, 110025 => :exchange_error, 110026 => :exchange_error, 110027 => :exchange_error, 110028 => :invalid_parameters, 110029 => :invalid_parameters, 110030 => :invalid_order, 110031 => :invalid_order, 110032 => :invalid_order, 110033 => :invalid_order, 110034 => :invalid_order, 110035 => :invalid_order, 110036 => :invalid_order, 110037 => :invalid_order, 110038 => :invalid_order, 110039 => :invalid_order, 110040 => :invalid_order, 110041 => :invalid_order, 110042 => :invalid_order, 110043 => :invalid_parameters, 110044 => :insufficient_balance, 110045 => :insufficient_balance, 110046 => :invalid_parameters, 110047 => :invalid_parameters, 110048 => :invalid_parameters, 110049 => :invalid_parameters, 110050 => :invalid_parameters, 110051 => :insufficient_balance, 110052 => :insufficient_balance, 110053 => :insufficient_balance, 110054 => :invalid_order, 110055 => :invalid_order, 110056 => :invalid_order, 110057 => :invalid_order, 110058 => :invalid_order, 110059 => :invalid_order, 110060 => :invalid_parameters, 110061 => :invalid_parameters, 110062 => :invalid_parameters, 110063 => :exchange_error, 110064 => :invalid_order, 110065 => :access_restricted, 110066 => :exchange_error, 110067 => :access_restricted, 110068 => :access_restricted, 110069 => :access_restricted, 110070 => :invalid_order, 110071 => :exchange_error, 110072 => :invalid_order, 110073 => :exchange_error, 110092 => :invalid_order, 110093 => :invalid_order, 110094 => :invalid_order, 12137 => :invalid_order, 12141 => :invalid_parameters, 12201 => :invalid_parameters, 130006 => :invalid_order, 130021 => :insufficient_balance, 130074 => :invalid_order, 131001 => :insufficient_balance, 131002 => :invalid_parameters, 131003 => :exchange_error, 131004 => :invalid_credentials, 131084 => :exchange_error, 131085 => :insufficient_balance, 131086 => :invalid_parameters, 131088 => :invalid_parameters, 131089 => :invalid_parameters, 131090 => :exchange_error, 131091 => :exchange_error, 131092 => :exchange_error, 131093 => :exchange_error, 131094 => :invalid_parameters, 131095 => :invalid_parameters, 131096 => :invalid_parameters, 131097 => :exchange_error, 131098 => :exchange_error, 131099 => :exchange_error, 131200 => :exchange_error, 131201 => :exchange_error, 131202 => :invalid_parameters, 131203 => :invalid_parameters, 131204 => :invalid_parameters, 131205 => :invalid_parameters, 131206 => :exchange_error, 131207 => :invalid_parameters, 131208 => :exchange_error, 131209 => :invalid_parameters, 131210 => :invalid_parameters, 131211 => :invalid_parameters, 131212 => :insufficient_balance, 131213 => :invalid_parameters, 131214 => :invalid_parameters, 131215 => :invalid_parameters, 131216 => :exchange_error, 131217 => :exchange_error, 131231 => :exchange_error, 131232 => :exchange_error, 140001 => :order_not_found, 140003 => :invalid_order, 140004 => :insufficient_balance, 140005 => :invalid_order, 140006 => :insufficient_balance, 140007 => :insufficient_balance, 140008 => :invalid_order, 140009 => :invalid_order, 140010 => :invalid_order, 140011 => :invalid_order, 140012 => :insufficient_balance, 140013 => :invalid_parameters, 140014 => :insufficient_balance, 140015 => :invalid_order, 140016 => :invalid_order, 140017 => :invalid_order, 140018 => :invalid_parameters, 140019 => :invalid_order, 140020 => :invalid_order, 140021 => :invalid_order, 140022 => :invalid_order, 140023 => :invalid_order, 140024 => :invalid_parameters, 140025 => :invalid_parameters, 140026 => :invalid_parameters, 140027 => :invalid_parameters, 140028 => :invalid_order, 140029 => :invalid_parameters, 140030 => :invalid_order, 140031 => :invalid_parameters, 140032 => :invalid_order, 140033 => :invalid_order, 140034 => :invalid_order, 140035 => :invalid_order, 140036 => :invalid_parameters, 140037 => :invalid_order, 140038 => :invalid_parameters, 140039 => :invalid_parameters, 140040 => :invalid_order, 140041 => :invalid_order, 140042 => :invalid_order, 140043 => :invalid_parameters, 140044 => :insufficient_balance, 140045 => :insufficient_balance, 140046 => :invalid_parameters, 140047 => :invalid_parameters, 140048 => :invalid_parameters, 140049 => :invalid_parameters, 140050 => :invalid_order, 140051 => :insufficient_balance, 140052 => :insufficient_balance, 140053 => :insufficient_balance, 140054 => :invalid_order, 140055 => :invalid_order, 140056 => :invalid_order, 140057 => :invalid_order, 140058 => :invalid_order, 140059 => :invalid_order, 140060 => :invalid_parameters, 140061 => :invalid_parameters, 140062 => :invalid_parameters, 140063 => :exchange_error, 140064 => :invalid_order, 140065 => :access_restricted, 140066 => :exchange_error, 140067 => :access_restricted, 140068 => :access_restricted, 140069 => :access_restricted, 140070 => :invalid_order, 170001 => :exchange_error, 170005 => :invalid_order, 170007 => :network_error, 170010 => :invalid_order, 170011 => :invalid_order, 170019 => :invalid_order, 170031 => :exchange_error, 170032 => :exchange_error, 170033 => :insufficient_balance, 170034 => :insufficient_balance, 170035 => :invalid_parameters, 170036 => :invalid_parameters, 170037 => :invalid_parameters, 170105 => :invalid_parameters, 170115 => :invalid_order, 170116 => :invalid_order, 170117 => :invalid_order, 170121 => :invalid_order, 170124 => :invalid_order, 170130 => :invalid_parameters, 170131 => :insufficient_balance, 170132 => :invalid_order, 170133 => :invalid_order, 170134 => :invalid_order, 170135 => :invalid_order, 170136 => :invalid_order, 170137 => :invalid_order, 170139 => :invalid_order, 170140 => :invalid_order, 170141 => :invalid_order, 170142 => :invalid_order, 170143 => :invalid_order, 170144 => :invalid_order, 170145 => :invalid_order, 170146 => :invalid_order, 170147 => :invalid_order, 170148 => :invalid_order, 170149 => :exchange_error, 170150 => :exchange_error, 170151 => :invalid_order, 170157 => :invalid_order, 170159 => :invalid_order, 170190 => :invalid_order, 170191 => :invalid_order, 170192 => :invalid_order, 170193 => :invalid_order, 170194 => :invalid_order, 170195 => :invalid_order, 170196 => :invalid_order, 170197 => :invalid_order, 170198 => :invalid_order, 170199 => :invalid_order, 170200 => :invalid_order, 170201 => :access_restricted, 170202 => :invalid_order, 170203 => :invalid_order, 170204 => :invalid_order, 170206 => :invalid_order, 170209 => :access_restricted, 170210 => :invalid_order, 170213 => :order_not_found, 170217 => :invalid_order, 170218 => :invalid_order, 170221 => :invalid_parameters, 170222 => :rate_limited, 170223 => :insufficient_balance, 170224 => :access_restricted, 170226 => :insufficient_balance, 170227 => :exchange_error, 170228 => :invalid_order, 170229 => :invalid_order, 170234 => :exchange_error, 170241 => :exchange_error, 170371 => :invalid_order, 170372 => :invalid_order, 175000 => :invalid_order, 175001 => :invalid_order, 175002 => :invalid_order, 175003 => :insufficient_balance, 175004 => :invalid_order, 175005 => :invalid_order, 175006 => :insufficient_balance, 175007 => :invalid_order, 175008 => :invalid_order, 175009 => :invalid_order, 175010 => :access_restricted, 175012 => :invalid_order, 175013 => :invalid_order, 175014 => :invalid_order, 175015 => :invalid_order, 175016 => :invalid_order, 175017 => :invalid_order, 175027 => :exchange_error, 176002 => :invalid_parameters, 176003 => :invalid_parameters, 176004 => :invalid_parameters, 176005 => :invalid_parameters, 176006 => :invalid_parameters, 176007 => :invalid_parameters, 176008 => :invalid_parameters, 176009 => :invalid_parameters, 176010 => :invalid_parameters, 176011 => :invalid_parameters, 176012 => :invalid_parameters, 176013 => :invalid_parameters, 176014 => :invalid_parameters, 176015 => :insufficient_balance, 176016 => :invalid_parameters, 176017 => :invalid_parameters, 176018 => :invalid_parameters, 176019 => :invalid_parameters, 176020 => :invalid_parameters, 176021 => :invalid_parameters, 176022 => :invalid_parameters, 176023 => :invalid_parameters, 176024 => :invalid_parameters, 176025 => :invalid_parameters, 176026 => :invalid_parameters, 176027 => :invalid_parameters, 176028 => :invalid_parameters, 176029 => :invalid_parameters, 176030 => :invalid_parameters, 176031 => :invalid_parameters, 176034 => :invalid_parameters, 176035 => :access_restricted, 176036 => :access_restricted, 176037 => :access_restricted, 176038 => :invalid_parameters, 176039 => :invalid_parameters, 176040 => :invalid_parameters, 181000 => :invalid_parameters, 181001 => :invalid_parameters, 181002 => :invalid_order, 181003 => :invalid_order, 181004 => :invalid_order, 181017 => :invalid_parameters, 182000 => :invalid_order, 20001 => :order_not_found, 20003 => :invalid_order, 20004 => :invalid_order, 20005 => :invalid_order, 20006 => :invalid_order, 20007 => :invalid_order, 20008 => :invalid_order, 20009 => :invalid_order, 20010 => :invalid_order, 20011 => :invalid_order, 20012 => :invalid_order, 20013 => :invalid_order, 20014 => :invalid_order, 20015 => :invalid_order, 20016 => :invalid_order, 20017 => :invalid_order, 20018 => :invalid_order, 20019 => :invalid_order, 20020 => :invalid_order, 20021 => :invalid_order, 20022 => :invalid_parameters, 20023 => :invalid_parameters, 20031 => :invalid_parameters, 20070 => :invalid_parameters, 20071 => :invalid_parameters, 20084 => :invalid_parameters, 30001 => :invalid_parameters, 30003 => :invalid_order, 30004 => :invalid_order, 30005 => :invalid_order, 30007 => :invalid_order, 30008 => :invalid_order, 30009 => :exchange_error, 30010 => :insufficient_balance, 30011 => :access_restricted, 30012 => :access_restricted, 30013 => :access_restricted, 30014 => :invalid_order, 30015 => :invalid_order, 30016 => :exchange_error, 30017 => :invalid_order, 30018 => :invalid_order, 30019 => :invalid_order, 30020 => :invalid_order, 30021 => :invalid_order, 30022 => :invalid_order, 30023 => :invalid_order, 30024 => :invalid_order, 30025 => :invalid_order, 30026 => :invalid_order, 30027 => :invalid_order, 30028 => :invalid_order, 30029 => :invalid_order, 30030 => :invalid_order, 30031 => :insufficient_balance, 30032 => :invalid_order, 30033 => :rate_limited, 30034 => :order_not_found, 30035 => :rate_limited, 30036 => :exchange_error, 30037 => :invalid_order, 30041 => :exchange_error, 30042 => :insufficient_balance, 30043 => :invalid_order, 30044 => :invalid_order, 30045 => :invalid_order, 30049 => :insufficient_balance, 30050 => :exchange_error, 30051 => :exchange_error, 30052 => :exchange_error, 30054 => :exchange_error, 30057 => :exchange_error, 30063 => :exchange_error, 30067 => :insufficient_balance, 30068 => :exchange_error, 30074 => :invalid_order, 30075 => :invalid_order, 30078 => :exchange_error, 3100116 => :invalid_parameters, 3100198 => :invalid_parameters, 3200300 => :insufficient_balance, 33004 => :invalid_credentials, 3400045 => :exchange_error, 340099 => :exchange_error, 34026 => :exchange_error, 34036 => :invalid_parameters, 35015 => :invalid_parameters, 5004 => :exchange_error, 7001 => :invalid_parameters, "Not supported symbols" => :invalid_order, "Request timeout" => :network_error, "invalid api_key" => :invalid_credentials, "new_oc" => :insufficient_balance, "oc_diff" => :insufficient_balance, "openapi sign params error!" => :invalid_credentials, "unknown orderInfo" => :order_not_found }, exceptions: %{ broad: %{ "Not supported symbols" => :bad_symbol, "Request timeout" => :request_timeout, "invalid api_key" => :authentication_error, "new_oc" => :insufficient_funds, "oc_diff" => :insufficient_funds, "openapi sign params error!" => :authentication_error, "unknown orderInfo" => :order_not_found }, exact: %{ "-10009" => :bad_request, "-1004" => :bad_request, "-1021" => :bad_request, "-1103" => :bad_request, "-1140" => :invalid_order, "-1197" => :invalid_order, "-2013" => :invalid_order, "-2015" => :authentication_error, "-6017" => :bad_request, "-6025" => :bad_request, "-6029" => :bad_request, "10001" => :bad_request, "10002" => :invalid_nonce, "100028" => :permission_denied, "10003" => :authentication_error, "10004" => :authentication_error, "10005" => :permission_denied, "10006" => :rate_limit_exceeded, "10007" => :authentication_error, "10008" => :account_suspended, "10009" => :authentication_error, "10010" => :permission_denied, "10014" => :bad_request, "10016" => :exchange_error, "10017" => :bad_request, "10018" => :rate_limit_exceeded, "10020" => :permission_denied, "10024" => :permission_denied, "10027" => :permission_denied, "10028" => :permission_denied, "10029" => :permission_denied, "110001" => :order_not_found, "110003" => :invalid_order, "110004" => :insufficient_funds, "110005" => :invalid_order, "110006" => :insufficient_funds, "110007" => :insufficient_funds, "110008" => :invalid_order, "110009" => :invalid_order, "110010" => :invalid_order, "110011" => :invalid_order, "110012" => :insufficient_funds, "110013" => :bad_request, "110014" => :insufficient_funds, "110015" => :bad_request, "110016" => :invalid_order, "110017" => :invalid_order, "110018" => :bad_request, "110019" => :invalid_order, "110020" => :invalid_order, "110021" => :invalid_order, "110022" => :invalid_order, "110023" => :invalid_order, "110024" => :bad_request, "110025" => :no_change, "110026" => :margin_mode_already_set, "110027" => :no_change, "110028" => :bad_request, "110029" => :bad_request, "110030" => :invalid_order, "110031" => :invalid_order, "110032" => :invalid_order, "110033" => :invalid_order, "110034" => :invalid_order, "110035" => :invalid_order, "110036" => :invalid_order, "110037" => :invalid_order, "110038" => :invalid_order, "110039" => :invalid_order, "110040" => :invalid_order, "110041" => :invalid_order, "110042" => :invalid_order, "110043" => :bad_request, "110044" => :insufficient_funds, "110045" => :insufficient_funds, "110046" => :bad_request, "110047" => :bad_request, "110048" => :bad_request, "110049" => :bad_request, "110050" => :bad_request, "110051" => :insufficient_funds, "110052" => :insufficient_funds, "110053" => :insufficient_funds, "110054" => :invalid_order, "110055" => :invalid_order, "110056" => :invalid_order, "110057" => :invalid_order, "110058" => :invalid_order, "110059" => :invalid_order, "110060" => :bad_request, "110061" => :bad_request, "110062" => :bad_request, "110063" => :exchange_error, "110064" => :invalid_order, "110065" => :permission_denied, "110066" => :exchange_error, "110067" => :permission_denied, "110068" => :permission_denied, "110069" => :permission_denied, "110070" => :invalid_order, "110071" => :exchange_error, "110072" => :invalid_order, "110073" => :exchange_error, "110092" => :invalid_order, "110093" => :invalid_order, "110094" => :invalid_order, "12137" => :invalid_order, "12141" => :bad_request, "12201" => :bad_request, "130006" => :invalid_order, "130021" => :insufficient_funds, "130074" => :invalid_order, "131001" => :insufficient_funds, "131002" => :bad_request, "131003" => :exchange_error, "131004" => :authentication_error, "131084" => :exchange_error, "131085" => :insufficient_funds, "131086" => :bad_request, "131088" => :bad_request, "131089" => :bad_request, "131090" => :exchange_error, "131091" => :exchange_error, "131092" => :exchange_error, "131093" => :exchange_error, "131094" => :bad_request, "131095" => :bad_request, "131096" => :bad_request, "131097" => :exchange_error, "131098" => :exchange_error, "131099" => :exchange_error, "131200" => :exchange_error, "131201" => :exchange_error, "131202" => :bad_request, "131203" => :bad_request, "131204" => :bad_request, "131205" => :bad_request, "131206" => :exchange_error, "131207" => :bad_request, "131208" => :exchange_error, "131209" => :bad_request, "131210" => :bad_request, "131211" => :bad_request, "131212" => :insufficient_funds, "131213" => :bad_request, "131214" => :bad_request, "131215" => :bad_request, "131216" => :exchange_error, "131217" => :exchange_error, "131231" => :not_supported, "131232" => :not_supported, "140001" => :order_not_found, "140003" => :invalid_order, "140004" => :insufficient_funds, "140005" => :invalid_order, "140006" => :insufficient_funds, "140007" => :insufficient_funds, "140008" => :invalid_order, "140009" => :invalid_order, "140010" => :invalid_order, "140011" => :invalid_order, "140012" => :insufficient_funds, "140013" => :bad_request, "140014" => :insufficient_funds, "140015" => :invalid_order, "140016" => :invalid_order, "140017" => :invalid_order, "140018" => :bad_request, "140019" => :invalid_order, "140020" => :invalid_order, "140021" => :invalid_order, "140022" => :invalid_order, "140023" => :invalid_order, "140024" => :bad_request, "140025" => :bad_request, "140026" => :bad_request, "140027" => :bad_request, "140028" => :invalid_order, "140029" => :bad_request, "140030" => :invalid_order, "140031" => :bad_request, "140032" => :invalid_order, "140033" => :invalid_order, "140034" => :invalid_order, "140035" => :invalid_order, "140036" => :bad_request, "140037" => :invalid_order, "140038" => :bad_request, "140039" => :bad_request, "140040" => :invalid_order, "140041" => :invalid_order, "140042" => :invalid_order, "140043" => :bad_request, "140044" => :insufficient_funds, "140045" => :insufficient_funds, "140046" => :bad_request, "140047" => :bad_request, "140048" => :bad_request, "140049" => :bad_request, "140050" => :invalid_order, "140051" => :insufficient_funds, "140052" => :insufficient_funds, "140053" => :insufficient_funds, "140054" => :invalid_order, "140055" => :invalid_order, "140056" => :invalid_order, "140057" => :invalid_order, "140058" => :invalid_order, "140059" => :invalid_order, "140060" => :bad_request, "140061" => :bad_request, "140062" => :bad_request, "140063" => :exchange_error, "140064" => :invalid_order, "140065" => :permission_denied, "140066" => :exchange_error, "140067" => :permission_denied, "140068" => :permission_denied, "140069" => :permission_denied, "140070" => :invalid_order, "170001" => :exchange_error, "170005" => :invalid_order, "170007" => :request_timeout, "170010" => :invalid_order, "170011" => :invalid_order, "170019" => :invalid_order, "170031" => :exchange_error, "170032" => :exchange_error, "170033" => :insufficient_funds, "170034" => :insufficient_funds, "170035" => :bad_request, "170036" => :bad_request, "170037" => :bad_request, "170105" => :bad_request, "170115" => :invalid_order, "170116" => :invalid_order, "170117" => :invalid_order, "170121" => :invalid_order, "170124" => :invalid_order, "170130" => :bad_request, "170131" => :insufficient_funds, "170132" => :invalid_order, "170133" => :invalid_order, "170134" => :invalid_order, "170135" => :invalid_order, "170136" => :invalid_order, "170137" => :invalid_order, "170139" => :invalid_order, "170140" => :invalid_order, "170141" => :invalid_order, "170142" => :invalid_order, "170143" => :invalid_order, "170144" => :invalid_order, "170145" => :invalid_order, "170146" => :invalid_order, "170147" => :invalid_order, "170148" => :invalid_order, "170149" => :exchange_error, "170150" => :exchange_error, "170151" => :invalid_order, "170157" => :invalid_order, "170159" => :invalid_order, "170190" => :invalid_order, "170191" => :invalid_order, "170192" => :invalid_order, "170193" => :invalid_order, "170194" => :invalid_order, "170195" => :invalid_order, "170196" => :invalid_order, "170197" => :invalid_order, "170198" => :invalid_order, "170199" => :invalid_order, "170200" => :invalid_order, "170201" => :permission_denied, "170202" => :invalid_order, "170203" => :invalid_order, "170204" => :invalid_order, "170206" => :invalid_order, "170210" => :invalid_order, "170213" => :order_not_found, "170217" => :invalid_order, "170218" => :invalid_order, "170221" => :bad_request, "170222" => :rate_limit_exceeded, "170223" => :insufficient_funds, "170224" => :permission_denied, "170226" => :insufficient_funds, "170227" => :exchange_error, "170228" => :invalid_order, "170229" => :invalid_order, "170234" => :exchange_error, "170241" => :manual_interaction_needed, "170371" => :invalid_order, "170372" => :invalid_order, "175000" => :invalid_order, "175001" => :invalid_order, "175002" => :invalid_order, "175003" => :insufficient_funds, "175004" => :invalid_order, "175005" => :invalid_order, "175006" => :insufficient_funds, "175007" => :invalid_order, "175008" => :invalid_order, "175009" => :invalid_order, "175010" => :permission_denied, "175012" => :invalid_order, "175013" => :invalid_order, "175014" => :invalid_order, "175015" => :invalid_order, "175016" => :invalid_order, "175017" => :invalid_order, "175027" => :exchange_error, "176002" => :bad_request, "176003" => :bad_request, "176004" => :bad_request, "176005" => :bad_request, "176006" => :bad_request, "176007" => :bad_request, "176008" => :bad_request, "176009" => :bad_request, "176010" => :bad_request, "176011" => :bad_request, "176012" => :bad_request, "176013" => :bad_request, "176014" => :bad_request, "176015" => :insufficient_funds, "176016" => :bad_request, "176017" => :bad_request, "176018" => :bad_request, "176019" => :bad_request, "176020" => :bad_request, "176021" => :bad_request, "176022" => :bad_request, "176023" => :bad_request, "176024" => :bad_request, "176025" => :bad_request, "176026" => :bad_request, "176027" => :bad_request, "176028" => :bad_request, "176029" => :bad_request, "176030" => :bad_request, "176031" => :bad_request, "176034" => :bad_request, "176035" => :permission_denied, "176036" => :permission_denied, "176037" => :permission_denied, "176038" => :bad_request, "176039" => :bad_request, "176040" => :bad_request, "181000" => :bad_request, "181001" => :bad_request, "181002" => :invalid_order, "181003" => :invalid_order, "181004" => :invalid_order, "181017" => :bad_request, "182000" => :invalid_order, "20001" => :order_not_found, "20003" => :invalid_order, "20004" => :invalid_order, "20005" => :invalid_order, "20006" => :invalid_order, "20007" => :invalid_order, "20008" => :invalid_order, "20009" => :invalid_order, "20010" => :invalid_order, "20011" => :invalid_order, "20012" => :invalid_order, "20013" => :invalid_order, "20014" => :invalid_order, "20015" => :invalid_order, "20016" => :invalid_order, "20017" => :invalid_order, "20018" => :invalid_order, "20019" => :invalid_order, "20020" => :invalid_order, "20021" => :invalid_order, "20022" => :bad_request, "20023" => :bad_request, "20031" => :bad_request, "20070" => :bad_request, "20071" => :bad_request, "20084" => :bad_request, "30001" => :bad_request, "30003" => :invalid_order, "30004" => :invalid_order, "30005" => :invalid_order, "30007" => :invalid_order, "30008" => :invalid_order, "30009" => :exchange_error, "30010" => :insufficient_funds, "30011" => :permission_denied, "30012" => :permission_denied, "30013" => :permission_denied, "30014" => :invalid_order, "30015" => :invalid_order, "30016" => :exchange_error, "30017" => :invalid_order, "30018" => :invalid_order, "30019" => :invalid_order, "30020" => :invalid_order, "30021" => :invalid_order, "30022" => :invalid_order, "30023" => :invalid_order, "30024" => :invalid_order, "30025" => :invalid_order, "30026" => :invalid_order, "30027" => :invalid_order, "30028" => :invalid_order, "30029" => :invalid_order, "30030" => :invalid_order, "30031" => :insufficient_funds, "30032" => :invalid_order, "30033" => :rate_limit_exceeded, "30034" => :order_not_found, "30035" => :rate_limit_exceeded, "30036" => :exchange_error, "30037" => :invalid_order, "30041" => :exchange_error, "30042" => :insufficient_funds, "30043" => :invalid_order, "30044" => :invalid_order, "30045" => :invalid_order, "30049" => :insufficient_funds, "30050" => :exchange_error, "30051" => :exchange_error, "30052" => :exchange_error, "30054" => :exchange_error, "30057" => :exchange_error, "30063" => :exchange_error, "30067" => :insufficient_funds, "30068" => :exchange_error, "30074" => :invalid_order, "30075" => :invalid_order, "30078" => :exchange_error, "3100116" => :bad_request, "3100198" => :bad_request, "3200300" => :insufficient_funds, "33004" => :authentication_error, "3400045" => :exchange_error, "340099" => :exchange_error, "34026" => :exchange_error, "34036" => :bad_request, "35015" => :bad_request, "5004" => :exchange_error, "7001" => :bad_request } }, exchange_options: %{ "accountsById" => %{ "CONTRACT" => "contract", "FUND" => "fund", "INVESTMENT" => "investment", "MARGIN" => "spot", "OPTION" => "option", "SPOT" => "spot", "UNIFIED" => "unified" }, "accountsByType" => %{ "contract" => "CONTRACT", "fund" => "FUND", "funding" => "FUND", "future" => "CONTRACT", "investment" => "INVESTMENT", "margin" => "SPOT", "option" => "OPTION", "spot" => "SPOT", "swap" => "CONTRACT", "unified" => "UNIFIED" }, "adjustForTimeDifference" => false, "brokerId" => "CCXT", "code" => "BTC", "createMarketBuyOrderRequiresPrice" => false, "createUnifiedMarginAccount" => false, "defaultNetwork" => "ERC20", "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "defaultNetworks" => %{ "USDT" => "TRC20" }, "defaultSettle" => "USDT", "defaultSubType" => "linear", "defaultType" => "swap", "enableDemoTrading" => false, "enableUnifiedAccount" => nil, "enableUnifiedMargin" => nil, "fetchMarkets" => %{ "options" => [ "BTC", "ETH", "SOL", "XRP", "MNT", "DOGE" ], "types" => [ "spot", "linear", "inverse", "option" ] }, "intervals" => %{ "15m" => "15min", "1d" => "1d", "1h" => "1h", "30m" => "30min", "4h" => "4h", "5m" => "5min" }, "loadAllOptions" => false, "loadExpiredOptions" => false, "networks" => %{ "ACA" => "ACA", "ADA" => "ADA", "ALGO" => "ALGO", "APT" => "APTOS", "AR" => "AR", "ARBONE" => "ARBI", "ATOM" => "ATOM", "AVAXC" => "CAVAX", "AVAXX" => "XAVAX", "BCH" => "BCH", "BEP2" => "BNB", "BEP20" => "BSC", "CHZ" => "CHZ", "DCR" => "DCR", "DGB" => "DGB", "DOGE" => "DOGE", "DOT" => "DOT", "EGLD" => "EGLD", "EOS" => "EOS", "ERC20" => "ETH", "ETC" => "ETC", "ETHF" => "ETHF", "ETHW" => "ETHW", "FIL" => "FIL", "FLOW" => "FLOW", "FTM" => "FTM", "GLMR" => "GLMR", "HBAR" => "HBAR", "HNT" => "HNT", "ICP" => "ICP", "ICX" => "ICX", "KDA" => "KDA", "KLAY" => "KLAY", "KMA" => "KMA", "KSM" => "KSM", "LTC" => "LTC", "MATIC" => "MATIC", "MINA" => "MINA", "MOVR" => "MOVR", "NEAR" => "NEAR", "NEM" => "NEM", "OASIS" => "ROSE", "OASYS" => "OAS", "OMNI" => "OMNI", "ONE" => "ONE", "OPTIMISM" => "OP", "POKT" => "POKT", "QTUM" => "QTUM", "RVN" => "RVN", "SC" => "SC", "SCRT" => "SCRT", "SOL" => "SOL", "STEP" => "FITFI", "STX" => "STX", "THETA" => "THETA", "TON" => "TON", "TRC20" => "TRX", "WAVES" => "WAVES", "WAX" => "WAXP", "XDC" => "XDC", "XEC" => "XEC", "XLM" => "XLM", "XRP" => "XRP", "XTZ" => "XTZ", "XYM" => "XYM", "ZEN" => "ZEN", "ZIL" => "ZIL", "ZKSYNC" => "ZKSYNC" }, "networksById" => %{ "ACA" => "ACA", "ADA" => "ADA", "ALGO" => "ALGO", "APTOS" => "APT", "AR" => "AR", "ARBI" => "ARBONE", "ATOM" => "ATOM", "BCH" => "BCH", "BNB" => "BEP2", "BSC" => "BEP20", "CAVAX" => "AVAXC", "CHZ" => "CHZ", "DCR" => "DCR", "DGB" => "DGB", "DOGE" => "DOGE", "DOT" => "DOT", "EGLD" => "EGLD", "EOS" => "EOS", "ETC" => "ETC", "ETH" => "ERC20", "ETHF" => "ETHF", "ETHW" => "ETHW", "FIL" => "FIL", "FITFI" => "STEP", "FLOW" => "FLOW", "FTM" => "FTM", "GLMR" => "GLMR", "HBAR" => "HBAR", "HNT" => "HNT", "ICP" => "ICP", "ICX" => "ICX", "KDA" => "KDA", "KLAY" => "KLAY", "KMA" => "KMA", "KSM" => "KSM", "LTC" => "LTC", "MATIC" => "MATIC", "MINA" => "MINA", "MOVR" => "MOVR", "NEAR" => "NEAR", "NEM" => "NEM", "OAS" => "OASYS", "OMNI" => "OMNI", "ONE" => "ONE", "OP" => "OPTIMISM", "POKT" => "POKT", "QTUM" => "QTUM", "ROSE" => "OASIS", "RVN" => "RVN", "SC" => "SC", "SCRT" => "SCRT", "SOL" => "SOL", "SPL" => "SOL", "STX" => "STX", "THETA" => "THETA", "TON" => "TON", "TRX" => "TRC20", "WAVES" => "WAVES", "WAXP" => "WAX", "XAVAX" => "AVAXX", "XDC" => "XDC", "XEC" => "XEC", "XLM" => "XLM", "XRP" => "XRP", "XTZ" => "XTZ", "XYM" => "XYM", "ZEN" => "ZEN", "ZIL" => "ZIL", "ZKSYNC" => "ZKSYNC" }, "recvWindow" => 5000, "timeDifference" => 0, "unifiedMarginStatus" => nil, "useMarkPriceForPositionCollateral" => false, "usePrivateInstrumentsInfo" => false }, extended_metadata: %{ fees_url: "https://help.bybit.com/hc/en-us/articles/360039261154", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed", referral_url: "https://www.bybit.com/invite?ref=XDK12WP" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ default: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: true, trigger_price_type: %{ index: true, last: true, mark: true } }, hedged: true, iceberg: false, leverage: false, margin_mode: false, market_buy_by_cost: true, market_buy_requires_price: false, self_trade_prevention: true, stop_loss_price: true, take_profit_price: true, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: true, trigger_direction: true, trigger_price: true, trigger_price_type: %{ index: true, last: true, mark: true } }, create_orders: %{ max: 10 }, edit_orders: %{ max: 10 }, fetch_closed_orders: %{ days_back: 730, days_back_canceled: 1, limit: 50, margin_mode: false, symbol_required: false, trailing: false, trigger: true, until_days: 7 }, fetch_my_trades: %{ days_back: 730, limit: 100, margin_mode: false, symbol_required: false, until_days: 7 }, fetch_ohlcv: %{ limit: 1000 }, fetch_open_orders: %{ limit: 50, margin_mode: false, symbol_required: false, trailing: false, trigger: true }, fetch_order: %{ margin_mode: false, symbol_required: true, trailing: false, trigger: true }, sandbox: true }, future: %{ inverse: %{ extends: "default" }, linear: %{ extends: "default" } }, spot: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: true }, market_buy_requires_price: true, trigger_direction: false }, extends: "default", fetch_currencies: %{ private: true } }, swap: %{ inverse: %{ extends: "default" }, linear: %{ extends: "default" } } }, fees: %{ funding: %{ percentage: false, tier_based: false }, trading: %{ fee_side: "get", maker: 0.0001, percentage: true, taker: 7.5e-4, tier_based: true } }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (!response) {\n return undefined; // fallback to default error handler\n }\n //\n // {\n // \"ret_code\": 10001,\n // \"ret_msg\": \"ReadMapCB: expect { or n, but found \\u0000, error \" +\n // \"found in #0 byte of ...||..., bigger context \" +\n // \"...||...\",\n // \"ext_code\": '',\n // \"ext_info\": '',\n // \"result\": null,\n // \"time_now\": \"1583934106.590436\"\n // }\n //\n // {\n // \"retCode\":10001,\n // \"retMsg\":\"symbol params err\",\n // \"result\":{\"symbol\":\"\",\"bid\":\"\",\"bidIv\":\"\",\"bidSize\":\"\",\"ask\":\"\",\"askIv\":\"\",\"askSize\":\"\",\"lastPrice\":\"\",\"openInterest\":\"\",\"indexPrice\":\"\",\"markPrice\":\"\",\"markPriceIv\":\"\",\"change24h\":\"\",\"high24h\":\"\",\"low24h\":\"\",\"volume24h\":\"\",\"turnover24h\":\"\",\"totalVolume\":\"\",\"totalTurnover\":\"\",\"fundingRate\":\"\",\"predictedFundingRate\":\"\",\"nextFundingTime\":\"\",\"countdownHour\":\"0\",\"predictedDeliveryPrice\":\"\",\"underlyingPrice\":\"\",\"delta\":\"\",\"gamma\":\"\",\"vega\":\"\",\"theta\":\"\"}\n // }\n //\n const errorCode = this.safeString2(response, 'ret_code', 'retCode');\n if (errorCode !== '0') {\n if (errorCode === '30084') {\n // not an error\n // https://github.com/ccxt/ccxt/issues/11268\n // https://github.com/ccxt/ccxt/pull/11624\n // POST https://api.bybit.com/v2/private/position/switch-isolated 200 OK\n // {\"ret_code\":30084,\"ret_msg\":\"Isolated not modified\",\"ext_code\":\"\",\"ext_info\":\"\",\"result\":null,\"time_now\":\"1642005219.937988\",\"rate_limit_status\":73,\"rate_limit_reset_ms\":1642005219894,\"rate_limit\":75}\n return undefined;\n }\n let feedback = undefined;\n if (errorCode === '10005' && url.indexOf('order') < 0) {\n feedback = this.id + ' private api uses /user/v3/private/query-api to check if you have a unified account. The API key of user id must own one of permissions: \"Account Transfer\", \"Subaccount Transfer\", \"Withdrawal\" ' + body;\n }\n else {\n feedback = this.id + ' ' + body;\n }\n if (body.indexOf('Withdraw address chain or destination tag are not equal') > -1) {\n feedback = feedback + '; You might also need to ensure the address is whitelisted';\n }\n this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }", has: %{ add_margin: false, borrow_cross_margin: true, borrow_isolated_margin: false, borrow_margin: false, c_o_r_s: true, cancel_all_orders: true, cancel_all_orders_after: true, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: true, cancel_orders_for_symbols: true, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, close_all_positions: false, close_position: false, create_convert_trade: true, create_deposit_address: false, create_limit_buy_order: 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: true, create_trailing_amount_order_ws: false, create_trailing_percent_order: false, create_trailing_percent_order_ws: false, create_trigger_order: true, create_trigger_order_ws: false, deposit: false, edit_order: true, edit_order_with_client_order_id: false, edit_order_ws: false, edit_orders: true, fetch_accounts: false, fetch_all_greeks: true, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: true, fetch_borrow_interest: false, fetch_borrow_rate: false, fetch_borrow_rate_histories: false, fetch_borrow_rate_history: false, fetch_borrow_rates: false, fetch_borrow_rates_per_symbol: false, fetch_canceled_and_closed_orders: true, fetch_canceled_orders: true, fetch_closed_order: true, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: true, fetch_convert_quote: true, fetch_convert_trade: true, fetch_convert_trade_history: true, fetch_cross_borrow_rate: true, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: false, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: 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: false, 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: true, fetch_leverages: false, fetch_liquidations: false, fetch_long_short_ratio: false, fetch_long_short_ratio_history: true, fetch_margin_adjustment_history: false, fetch_margin_mode: false, fetch_margin_modes: false, fetch_mark_ohlcv: true, fetch_mark_prices: false, fetch_market_leverage_tiers: true, fetch_markets: true, fetch_markets_ws: false, fetch_my_liquidations: true, fetch_my_settlement_history: true, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: true, fetch_open_interest_history: true, fetch_open_interests: false, fetch_open_order: true, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: true, fetch_option_chain: 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_history: true, fetch_position_mode: false, fetch_position_ws: false, fetch_positions: true, fetch_positions_for_symbol: false, fetch_positions_for_symbol_ws: false, fetch_positions_history: true, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: true, fetch_settlement_history: true, fetch_status: false, fetch_ticker: true, fetch_ticker_ws: false, fetch_tickers: true, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: true, fetch_trading_fees: true, fetch_trading_fees_ws: false, fetch_trading_limits: false, fetch_transaction_fee: false, fetch_transaction_fees: false, fetch_transactions: false, fetch_transfer: false, fetch_transfers: true, fetch_underlying_assets: false, fetch_volatility_history: true, fetch_withdraw_addresses: false, fetch_withdrawal: false, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: true, margin: true, option: true, private_api: true, public_api: true, reduce_margin: false, 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: true, transfer: true, un_watch_my_trades: false, un_watch_ohlcv: false, un_watch_ohlcv_for_symbols: false, un_watch_order_book: false, un_watch_order_book_for_symbols: false, un_watch_orders: false, un_watch_positions: false, un_watch_ticker: false, un_watch_tickers: false, un_watch_trades: false, un_watch_trades_for_symbols: false, watch_balance: true, watch_bids_asks: true, watch_liquidations: true, watch_liquidations_for_symbols: false, watch_my_liquidations: false, watch_my_liquidations_for_symbols: false, 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: "bybit", markets: nil, name: "Bybit", ohlcv_timestamp_resolution: :milliseconds, options: %{ accounts_by_id: %{ "CONTRACT" => "contract", "FUND" => "fund", "INVESTMENT" => "investment", "MARGIN" => "spot", "OPTION" => "option", "SPOT" => "spot", "UNIFIED" => "unified" }, accounts_by_type: %{ "contract" => "CONTRACT", "fund" => "FUND", "funding" => "FUND", "future" => "CONTRACT", "investment" => "INVESTMENT", "margin" => "SPOT", "option" => "OPTION", "spot" => "SPOT", "swap" => "CONTRACT", "unified" => "UNIFIED" }, adjust_for_time_difference: false, broker_id: "CCXT", code: "BTC", create_market_buy_order_requires_price: false, create_unified_margin_account: false, default_account_type: "unified", default_network: "ERC20", default_networks: %{ "USDT" => "TRC20" }, default_settle: "USDT", default_sub_type: "linear", default_type: "swap", enable_demo_trading: false, enable_unified_account: nil, enable_unified_margin: nil, fetch_markets: %{ "options" => [ "BTC", "ETH", "SOL", "XRP", "MNT", "DOGE" ], "types" => [ "spot", "linear", "inverse", "option" ] }, intervals: %{ "15m" => "15min", "1d" => "1d", "1h" => "1h", "30m" => "30min", "4h" => "4h", "5m" => "5min" }, load_all_options: false, load_expired_options: false, networks: %{ "ACA" => "ACA", "ADA" => "ADA", "ALGO" => "ALGO", "APT" => "APTOS", "AR" => "AR", "ARBONE" => "ARBI", "ATOM" => "ATOM", "AVAXC" => "CAVAX", "AVAXX" => "XAVAX", "BCH" => "BCH", "BEP2" => "BNB", "BEP20" => "BSC", "CHZ" => "CHZ", "DCR" => "DCR", "DGB" => "DGB", "DOGE" => "DOGE", "DOT" => "DOT", "EGLD" => "EGLD", "EOS" => "EOS", "ERC20" => "ETH", "ETC" => "ETC", "ETHF" => "ETHF", "ETHW" => "ETHW", "FIL" => "FIL", "FLOW" => "FLOW", "FTM" => "FTM", "GLMR" => "GLMR", "HBAR" => "HBAR", "HNT" => "HNT", "ICP" => "ICP", "ICX" => "ICX", "KDA" => "KDA", "KLAY" => "KLAY", "KMA" => "KMA", "KSM" => "KSM", "LTC" => "LTC", "MATIC" => "MATIC", "MINA" => "MINA", "MOVR" => "MOVR", "NEAR" => "NEAR", "NEM" => "NEM", "OASIS" => "ROSE", "OASYS" => "OAS", "OMNI" => "OMNI", "ONE" => "ONE", "OPTIMISM" => "OP", "POKT" => "POKT", "QTUM" => "QTUM", "RVN" => "RVN", "SC" => "SC", "SCRT" => "SCRT", "SOL" => "SOL", "STEP" => "FITFI", "STX" => "STX", "THETA" => "THETA", "TON" => "TON", "TRC20" => "TRX", "WAVES" => "WAVES", "WAX" => "WAXP", "XDC" => "XDC", "XEC" => "XEC", "XLM" => "XLM", "XRP" => "XRP", "XTZ" => "XTZ", "XYM" => "XYM", "ZEN" => "ZEN", "ZIL" => "ZIL", "ZKSYNC" => "ZKSYNC" }, networks_by_id: %{ "BSC" => "BEP20", "ETH" => "ERC20", "OMNI" => "OMNI", "SPL" => "SOL", "TRX" => "TRC20" }, recv_window: 5000, time_difference: 0, unified_margin_status: nil, use_mark_price_for_position_collateral: false, use_private_instruments_info: false, uses_account_type_param: true, uses_category_param: true }, order_mappings: %{ side_format: :capitalize, side_key: "side", type_format: :capitalize, type_key: "orderType" }, param_mappings: %{ "amount" => "requestAmount", "arg0" => "baseCoin", "arg1" => "symbol", "code" => "coin", "cost" => "qty", "fromAccount" => "fromAccountType", "id" => "orderId", "since" => "start", "stopLossPrice" => "triggerPrice", "takeProfitPrice" => "triggerPrice", "timeframe" => "interval", "toCode" => "toCoin", "trailingAmount" => "trailingStop", "trailingTriggerPrice" => "activePrice", "type" => "orderType" }, parse_methods: [ %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"leverage\": \"\",\n \"autoAddMargin\": 0,\n \"avgPrice\": \"177489.6\",\n \"liqPrice\": \"\",\n \"riskLimitValue\": \"\",\n \"takeProfit\": \"\",\n \"positionValue\": \"1774.896\",\n \"isReduceOnly\": false,\n \"positionIMByMp\": \"\",\n \"tpslMode\": \"Full\",\n \"riskId\": 0,\n \"trailingStop\": \"0\",\n \"unrealisedPnl\": \"-3.016\",\n \"markPrice\": \"177188\",\n \"adlRankIndicator\": 2,\n \"cumRealisedPnl\": \"-9782.391468\",\n \"positionMM\": \"\",\n \"createdTime\": \"1699928551230\",\n \"positionIdx\": 0,\n \"positionIM\": \"\",\n \"positionMMByMp\": \"\",\n \"seq\": 9558506126,\n \"updatedTime\": \"1767085496112\",\n \"side\": \"Buy\",\n \"bustPrice\": \"\",\n \"positionBalance\": \"\",\n \"leverageSysUpdatedTime\": \"\",\n \"curRealisedPnl\": \"-0.9761928\",\n \"size\": \"0.01\",\n \"positionStatus\": \"Normal\",\n \"mmrSysUpdatedTime\": \"\",\n \"stopLoss\": \"\",\n \"tradeMode\": 0,\n \"sessionAvgPrice\": \"\"\n }" ], "line_end" => 9603, "line_start" => 9550, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'contract')" }, %{ "comment" => nil, "key" => "rank", "value" => "this.safeInteger (info, 'adlRankIndicator')" }, %{ "comment" => nil, "key" => "rating", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseADLRank", "signature" => "parseADLRank (info: Dict, market: Market = undefined): ADL", "source" => "parseADLRank (info: Dict, market: Market = undefined): ADL {\n //\n // fetchPositionsADLRank\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"leverage\": \"\",\n // \"autoAddMargin\": 0,\n // \"avgPrice\": \"177489.6\",\n // \"liqPrice\": \"\",\n // \"riskLimitValue\": \"\",\n // \"takeProfit\": \"\",\n // \"positionValue\": \"1774.896\",\n // \"isReduceOnly\": false,\n // \"positionIMByMp\": \"\",\n // \"tpslMode\": \"Full\",\n // \"riskId\": 0,\n // \"trailingStop\": \"0\",\n // \"unrealisedPnl\": \"-3.016\",\n // \"markPrice\": \"177188\",\n // \"adlRankIndicator\": 2,\n // \"cumRealisedPnl\": \"-9782.391468\",\n // \"positionMM\": \"\",\n // \"createdTime\": \"1699928551230\",\n // \"positionIdx\": 0,\n // \"positionIM\": \"\",\n // \"positionMMByMp\": \"\",\n // \"seq\": 9558506126,\n // \"updatedTime\": \"1767085496112\",\n // \"side\": \"Buy\",\n // \"bustPrice\": \"\",\n // \"positionBalance\": \"\",\n // \"leverageSysUpdatedTime\": \"\",\n // \"curRealisedPnl\": \"-0.9761928\",\n // \"size\": \"0.01\",\n // \"positionStatus\": \"Normal\",\n // \"mmrSysUpdatedTime\": \"\",\n // \"stopLoss\": \"\",\n // \"tradeMode\": 0,\n // \"sessionAvgPrice\": \"\"\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n const timestamp = this.safeInteger (info, 'updatedTime');\n return {\n 'info': info,\n 'symbol': this.safeSymbol (marketId, market, undefined, 'contract'),\n 'rank': this.safeInteger (info, 'adlRankIndicator'),\n 'rating': undefined,\n 'percentage': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n } as ADL;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"retCode\": 0,\n \"retMsg\": \"success\",\n \"result\": {\n \"acctBalanceSum\": \"0.122995614474732872\",\n \"debtBalanceSum\": \"0.011734191124529754\",\n \"loanAccountList\": [\n {\n \"free\": \"0.001143855\",\n \"interest\": \"0\",\n \"loan\": \"0\",\n \"locked\": \"0\",\n \"tokenId\": \"BTC\",\n \"total\": \"0.001143855\"\n },\n {\n \"free\": \"200.00005568\",\n \"interest\": \"0.0008391\",\n \"loan\": \"200\",\n \"locked\": \"0\",\n \"tokenId\": \"USDT\",\n \"total\": \"200.00005568\"\n },\n ],\n \"riskRate\": \"0.0954\",\n \"status\": 1\n },\n \"retExtInfo\": {},\n \"time\": 1669843584123\n }", "{\n \"retCode\": 0,\n \"retMsg\": \"success\",\n \"result\": {\n \"memberId\": \"533285\",\n \"accountType\": \"FUND\",\n \"balance\": [\n {\n \"coin\": \"USDT\",\n \"transferBalance\": \"1010\",\n \"walletBalance\": \"1010\",\n \"bonus\": \"\"\n },\n {\n \"coin\": \"USDC\",\n \"transferBalance\": \"0\",\n \"walletBalance\": \"0\",\n \"bonus\": \"\"\n }\n ]\n },\n \"retExtInfo\": {},\n \"time\": 1675865290069\n }", "{\n \"retCode\": 0,\n \"retMsg\": \"OK\",\n \"result\": {\n \"list\": [\n {\n \"totalEquity\": \"18070.32797922\",\n \"accountIMRate\": \"0.0101\",\n \"totalMarginBalance\": \"18070.32797922\",\n \"totalInitialMargin\": \"182.60183684\",\n \"accountType\": \"UNIFIED\",\n \"totalAvailableBalance\": \"17887.72614237\",\n \"accountMMRate\": \"0\",\n \"totalPerpUPL\": \"-0.11001349\",\n \"totalWalletBalance\": \"18070.43799271\",\n \"accountLTV\": \"0.017\",\n \"totalMaintenanceMargin\": \"0.38106773\",\n \"coin\": [\n {\n \"availableToBorrow\": \"2.5\",\n \"bonus\": \"0\",\n \"accruedInterest\": \"0\",\n \"availableToWithdraw\": \"0.805994\",\n \"totalOrderIM\": \"0\",\n \"equity\": \"0.805994\",\n \"totalPositionMM\": \"0\",\n \"usdValue\": \"12920.95352538\",\n \"unrealisedPnl\": \"0\",\n \"borrowAmount\": \"0\",\n \"totalPositionIM\": \"0\",\n \"walletBalance\": \"0.805994\",\n \"cumRealisedPnl\": \"0\",\n \"coin\": \"BTC\"\n }\n ]\n }\n ]\n },\n \"retExtInfo\": {},\n \"time\": 1672125441042\n }", "account['used'] = this.safeString (coinEntry, 'locked');" ], "line_end" => 3516, "line_start" => 3350, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "response" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseBalance", "signature" => "parseBalance (response): Balances", "source" => "parseBalance (response): Balances {\n //\n // cross\n // {\n // \"retCode\": 0,\n // \"retMsg\": \"success\",\n // \"result\": {\n // \"acctBalanceSum\": \"0.122995614474732872\",\n // \"debtBalanceSum\": \"0.011734191124529754\",\n // \"loanAccountList\": [\n // {\n // \"free\": \"0.001143855\",\n // \"interest\": \"0\",\n // \"loan\": \"0\",\n // \"locked\": \"0\",\n // \"tokenId\": \"BTC\",\n // \"total\": \"0.001143855\"\n // },\n // {\n // \"free\": \"200.00005568\",\n // \"interest\": \"0.0008391\",\n // \"loan\": \"200\",\n // \"locked\": \"0\",\n // \"tokenId\": \"USDT\",\n // \"total\": \"200.00005568\"\n // },\n // ],\n // \"riskRate\": \"0.0954\",\n // \"status\": 1\n // },\n // \"retExtInfo\": {},\n // \"time\": 1669843584123\n // }\n //\n // funding\n // {\n // \"retCode\": 0,\n // \"retMsg\": \"success\",\n // \"result\": {\n // \"memberId\": \"533285\",\n // \"accountType\": \"FUND\",\n // \"balance\": [\n // {\n // \"coin\": \"USDT\",\n // \"transferBalance\": \"1010\",\n // \"walletBalance\": \"1010\",\n // \"bonus\": \"\"\n // },\n // {\n // \"coin\": \"USDC\",\n // \"transferBalance\": \"0\",\n // \"walletBalance\": \"0\",\n // \"bonus\": \"\"\n // }\n // ]\n // },\n // \"retExtInfo\": {},\n // \"time\": 1675865290069\n // }\n //\n // spot & swap\n // {\n // \"retCode\": 0,\n // \"retMsg\": \"OK\",\n // \"result\": {\n // \"list\": [\n // {\n // \"totalEquity\": \"18070.32797922\",\n // \"accountIMRate\": \"0.0101\",\n // \"totalMarginBalance\": \"18070.32797922\",\n // \"totalInitialMargin\": \"182.60183684\",\n // \"accountType\": \"UNIFIED\",\n // \"totalAvailableBalance\": \"17887.72614237\",\n // \"accountMMRate\": \"0\",\n // \"totalPerpUPL\": \"-0.11001349\",\n // \"totalWalletBalance\": \"18070.43799271\",\n // \"accountLTV\": \"0.017\",\n // \"totalMaintenanceMargin\": \"0.38106773\",\n // \"coin\": [\n // {\n // \"availableToBorrow\": \"2.5\",\n // \"bonus\": \"0\",\n // \"accruedInterest\": \"0\",\n // \"availableToWithdraw\": \"0.805994\",\n // \"totalOrderIM\": \"0\",\n // \"equity\": \"0.805994\",\n // \"totalPositionMM\": \"0\",\n // \"usdValue\": \"12920.95352538\",\n // \"unrealisedPnl\": \"0\",\n // \"borrowAmount\": \"0\",\n // \"totalPositionIM\": \"0\",\n // \"walletBalance\": \"0.805994\",\n // \"cumRealisedPnl\": \"0\",\n // \"coin\": \"BTC\"\n // }\n // ]\n // }\n // ]\n // },\n // \"retExtInfo\": {},\n // \"time\": 1672125441042\n // }\n //\n const timestamp = this.safeInteger (response, 'time');\n const result: Dict = {\n 'info': response,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n const responseResult = this.safeDict (response, 'result', {});\n const currencyList = this.safeListN (responseResult, [ 'loanAccountList', 'list', 'balance' ]);\n if (currencyList === undefined) {\n // usdc wallet\n const code = 'USDC';\n const account = this.account ();\n account['free'] = this.safeString (responseResult, 'availableBalance');\n account['total'] = this.safeString (responseResult, 'walletBalance');\n result[code] = account;\n } else {\n for (let i = 0; i < currencyList.length; i++) {\n const entry = currencyList[i];\n const accountType = this.safeString (entry, 'accountType');\n if (accountType === 'UNIFIED' || accountType === 'CONTRACT' || accountType === 'SPOT') {\n const coins = this.safeList (entry, 'coin');\n for (let j = 0; j < coins.length; j++) {\n const account = this.account ();\n const coinEntry = coins[j];\n const loan = this.safeString (coinEntry, 'borrowAmount');\n const interest = this.safeString (coinEntry, 'accruedInterest');\n if ((loan !== undefined) && (interest !== undefined)) {\n account['debt'] = Precise.stringAdd (loan, interest);\n }\n account['total'] = this.safeString (coinEntry, 'walletBalance');\n const free = this.safeString2 (coinEntry, 'availableToWithdraw', 'free');\n if (free !== undefined) {\n account['free'] = free;\n } else {\n const locked = this.safeString (coinEntry, 'locked', '0');\n const totalPositionIm = this.safeString (coinEntry, 'totalPositionIM', '0');\n const totalOrderIm = this.safeString (coinEntry, 'totalOrderIM', '0');\n let totalUsed = Precise.stringAdd (locked, totalPositionIm);\n totalUsed = Precise.stringAdd (totalUsed, totalOrderIm);\n account['used'] = totalUsed;\n }\n // account['used'] = this.safeString (coinEntry, 'locked');\n const currencyId = this.safeString (coinEntry, 'coin');\n const code = this.safeCurrencyCode (currencyId);\n result[code] = account;\n }\n } else {\n const account = this.account ();\n const loan = this.safeString (entry, 'loan');\n const interest = this.safeString (entry, 'interest');\n if ((loan !== undefined) && (interest !== undefined)) {\n account['debt'] = Precise.stringAdd (loan, interest);\n }\n account['total'] = this.safeString2 (entry, 'total', 'walletBalance');\n account['free'] = this.safeStringN (entry, [ 'free', 'availableBalanceWithoutConvert', 'availableBalance', 'transferBalance' ]);\n account['used'] = this.safeString (entry, 'locked');\n const currencyId = this.safeStringN (entry, [ 'tokenId', 'coin', 'currencyCoin' ]);\n const code = this.safeCurrencyCode (currencyId);\n result[code] = account;\n }\n }\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"tokenId\": \"BTC\",\n \"total\": \"0.00048621\",\n \"locked\": \"0\",\n \"loan\": \"0\",\n \"interest\": \"0\",\n \"free\": \"0.00048621\"\n }," ], "line_end" => 7440, "line_start" => 7418, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "undefined" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (this.safeString (info, 'tokenId'))" }, %{ "comment" => nil, "key" => "interest", "value" => "this.safeNumber (info, 'interest')" }, %{ "comment" => nil, "key" => "interestRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "amountBorrowed", "value" => "this.safeNumber (info, 'loan')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'cross'" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" } ], "name" => "parseBorrowInterest", "signature" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest", "source" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest {\n //\n // {\n // \"tokenId\": \"BTC\",\n // \"total\": \"0.00048621\",\n // \"locked\": \"0\",\n // \"loan\": \"0\",\n // \"interest\": \"0\",\n // \"free\": \"0.00048621\"\n // },\n //\n return {\n 'info': info,\n 'symbol': undefined,\n 'currency': this.safeCurrencyCode (this.safeString (info, 'tokenId')),\n 'interest': this.safeNumber (info, 'interest'),\n 'interestRate': undefined,\n 'amountBorrowed': this.safeNumber (info, 'loan'),\n 'marginMode': 'cross',\n 'timestamp': undefined,\n 'datetime': undefined,\n } as BorrowInterest;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"USDT\",\n \"interestRate\": \"0.000107000000\",\n \"loanAbleAmount\": \"\",\n \"maxLoanAmount\": \"79999.999\",\n \"timestamp\": 1666734490778\n }", "{\n \"timestamp\": 1721469600000,\n \"currency\": \"USDC\",\n \"hourlyBorrowRate\": \"0.000014621596\",\n \"vipLevel\": \"No VIP\"\n }" ], "line_end" => 7317, "line_start" => 7287, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "rate", "value" => "this.safeNumber (info, 'interestRate', hourlyBorrowRate)" }, %{ "comment" => nil, "key" => "period", "value" => "period" }, %{ "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 // \"coin\": \"USDT\",\n // \"interestRate\": \"0.000107000000\",\n // \"loanAbleAmount\": \"\",\n // \"maxLoanAmount\": \"79999.999\",\n // \"timestamp\": 1666734490778\n // }\n //\n // fetchBorrowRateHistory\n // {\n // \"timestamp\": 1721469600000,\n // \"currency\": \"USDC\",\n // \"hourlyBorrowRate\": \"0.000014621596\",\n // \"vipLevel\": \"No VIP\"\n // }\n //\n const timestamp = this.safeInteger (info, 'timestamp');\n const currencyId = this.safeString2 (info, 'coin', 'currency');\n const hourlyBorrowRate = this.safeNumber (info, 'hourlyBorrowRate');\n const period = (hourlyBorrowRate !== undefined) ? 3600000 : 86400000; // 1h or 1d\n return {\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'rate': this.safeNumber (info, 'interestRate', hourlyBorrowRate),\n 'period': period, // Daily\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"quoteTxId\": \"1010020692439481682687668224\",\n \"exchangeRate\": \"0.000015330836780000\",\n \"fromCoin\": \"USDT\",\n \"fromCoinType\": \"crypto\",\n \"toCoin\": \"BTC\",\n \"toCoinType\": \"crypto\",\n \"fromAmount\": \"10\",\n \"toAmount\": \"0.000153308367800000\",\n \"expiredTime\": \"1727257413353\",\n \"requestId\": \"\"\n }", "{\n \"exchangeStatus\": \"processing\",\n \"quoteTxId\": \"1010020692439483803499737088\"\n }", "{\n \"accountType\": \"eb_convert_uta\",\n \"exchangeTxId\": \"1010020692439483803499737088\",\n \"userId\": \"100406395\",\n \"fromCoin\": \"USDT\",\n \"fromCoinType\": \"crypto\",\n \"fromAmount\": \"10\",\n \"toCoin\": \"BTC\",\n \"toCoinType\": \"crypto\",\n \"toAmount\": \"0.00015344889\",\n \"exchangeStatus\": \"success\",\n \"extInfo\": {},\n \"convertRate\": \"0.000015344889\",\n \"createdAt\": \"1727257904726\"\n }" ], "line_end" => 9390, "line_start" => 9331, "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.safeString2 (conversion, 'quoteTxId', 'exchangeTxId')" }, %{ "comment" => nil, "key" => "fromCurrency", "value" => "fromCode" }, %{ "comment" => nil, "key" => "fromAmount", "value" => "this.safeNumber (conversion, 'fromAmount')" }, %{ "comment" => nil, "key" => "toCurrency", "value" => "toCode" }, %{ "comment" => nil, "key" => "toAmount", "value" => "this.safeNumber (conversion, 'toAmount')" }, %{ "comment" => nil, "key" => "price", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" } ], "name" => "parseConversion", "signature" => "parseConversion (conversion: Dict, fromCurrency: Currency = undefined, toCurrency: Currency = undefined): Conversion", "source" => "parseConversion (conversion: Dict, fromCurrency: Currency = undefined, toCurrency: Currency = undefined): Conversion {\n //\n // fetchConvertQuote\n //\n // {\n // \"quoteTxId\": \"1010020692439481682687668224\",\n // \"exchangeRate\": \"0.000015330836780000\",\n // \"fromCoin\": \"USDT\",\n // \"fromCoinType\": \"crypto\",\n // \"toCoin\": \"BTC\",\n // \"toCoinType\": \"crypto\",\n // \"fromAmount\": \"10\",\n // \"toAmount\": \"0.000153308367800000\",\n // \"expiredTime\": \"1727257413353\",\n // \"requestId\": \"\"\n // }\n //\n // createConvertTrade\n //\n // {\n // \"exchangeStatus\": \"processing\",\n // \"quoteTxId\": \"1010020692439483803499737088\"\n // }\n //\n // fetchConvertTrade, fetchConvertTradeHistory\n //\n // {\n // \"accountType\": \"eb_convert_uta\",\n // \"exchangeTxId\": \"1010020692439483803499737088\",\n // \"userId\": \"100406395\",\n // \"fromCoin\": \"USDT\",\n // \"fromCoinType\": \"crypto\",\n // \"fromAmount\": \"10\",\n // \"toCoin\": \"BTC\",\n // \"toCoinType\": \"crypto\",\n // \"toAmount\": \"0.00015344889\",\n // \"exchangeStatus\": \"success\",\n // \"extInfo\": {},\n // \"convertRate\": \"0.000015344889\",\n // \"createdAt\": \"1727257904726\"\n // }\n //\n const timestamp = this.safeInteger2 (conversion, 'expiredTime', 'createdAt');\n const fromCoin = this.safeString (conversion, 'fromCoin');\n const fromCode = this.safeCurrencyCode (fromCoin, fromCurrency);\n const to = this.safeString (conversion, 'toCoin');\n const toCode = this.safeCurrencyCode (to, toCurrency);\n return {\n 'info': conversion,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': this.safeString2 (conversion, 'quoteTxId', 'exchangeTxId'),\n 'fromCurrency': fromCode,\n 'fromAmount': this.safeNumber (conversion, 'fromAmount'),\n 'toCurrency': toCode,\n 'toAmount': this.safeNumber (conversion, 'toAmount'),\n 'price': undefined,\n 'fee': undefined,\n } as Conversion;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"chainType\": \"ERC20\",\n \"addressDeposit\": \"0xf56297c6717c1d1c42c30324468ed50a9b7402ee\",\n \"tagDeposit\": '',\n \"chain\": \"ETH\"\n }" ], "line_end" => 5764, "line_start" => 5744, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "depositAddress" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (this.safeString (depositAddress, 'chain'), code)" }, %{ "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 // \"chainType\": \"ERC20\",\n // \"addressDeposit\": \"0xf56297c6717c1d1c42c30324468ed50a9b7402ee\",\n // \"tagDeposit\": '',\n // \"chain\": \"ETH\"\n // }\n //\n const address = this.safeString (depositAddress, 'addressDeposit');\n const tag = this.safeString (depositAddress, 'tagDeposit');\n const code = this.safeString (currency, 'code');\n this.checkAddress (address);\n return {\n 'info': depositAddress,\n 'currency': code,\n 'network': this.networkIdToCode (this.safeString (depositAddress, 'chain'), code),\n 'address': address,\n 'tag': tag,\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"name\": \"BTC\",\n \"coin\": \"BTC\",\n \"remainAmount\": \"150\",\n \"chains\": [\n {\n \"chainType\": \"BTC\",\n \"confirmation\": \"10000\",\n \"withdrawFee\": \"0.0005\",\n \"depositMin\": \"0.0005\",\n \"withdrawMin\": \"0.001\",\n \"chain\": \"BTC\",\n \"chainDeposit\": \"1\",\n \"chainWithdraw\": \"1\",\n \"minAccuracy\": \"8\"\n }\n ]\n }" ], "line_end" => 7923, "line_start" => 7871, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "withdraw", "value" => "{\n 'fee': undefined,\n 'percentage': undefined,\n }" }, %{ "comment" => nil, "key" => "deposit", "value" => "{\n 'fee': undefined,\n 'percentage': undefined,\n }" }, %{ "comment" => nil, "key" => "networks", "value" => "{}" }, %{ "comment" => nil, "key" => "deposit", "value" => "{ 'fee': undefined, 'percentage': undefined }" }, %{ "comment" => nil, "key" => "withdraw", "value" => "{ 'fee': this.safeNumber (chain, 'withdrawFee'), 'percentage': false }" } ], "name" => "parseDepositWithdrawFee", "signature" => "parseDepositWithdrawFee (fee, currency: Currency = undefined): any", "source" => "parseDepositWithdrawFee (fee, currency: Currency = undefined): any {\n //\n // {\n // \"name\": \"BTC\",\n // \"coin\": \"BTC\",\n // \"remainAmount\": \"150\",\n // \"chains\": [\n // {\n // \"chainType\": \"BTC\",\n // \"confirmation\": \"10000\",\n // \"withdrawFee\": \"0.0005\",\n // \"depositMin\": \"0.0005\",\n // \"withdrawMin\": \"0.001\",\n // \"chain\": \"BTC\",\n // \"chainDeposit\": \"1\",\n // \"chainWithdraw\": \"1\",\n // \"minAccuracy\": \"8\"\n // }\n // ]\n // }\n //\n const chains = this.safeList (fee, 'chains', []);\n const chainsLength = chains.length;\n const result: Dict = {\n 'info': fee,\n 'withdraw': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n 'deposit': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n 'networks': {},\n };\n if (chainsLength !== 0) {\n for (let i = 0; i < chainsLength; i++) {\n const chain = chains[i];\n const networkId = this.safeString (chain, 'chain');\n const currencyCode = this.safeString (currency, 'code');\n const networkCode = this.networkIdToCode (networkId, currencyCode);\n result['networks'][networkCode] = {\n 'deposit': { 'fee': undefined, 'percentage': undefined },\n 'withdraw': { 'fee': this.safeNumber (chain, 'withdrawFee'), 'percentage': false },\n };\n if (chainsLength === 1) {\n result['withdraw']['fee'] = this.safeNumber (chain, 'withdrawFee');\n result['withdraw']['percentage'] = false;\n }\n }\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"bidPrice\": \"19255\",\n \"askPrice\": \"19255.5\",\n \"lastPrice\": \"19255.50\",\n \"lastTickDirection\": \"ZeroPlusTick\",\n \"prevPrice24h\": \"18634.50\",\n \"price24hPcnt\": \"0.033325\",\n \"highPrice24h\": \"19675.00\",\n \"lowPrice24h\": \"18610.00\",\n \"prevPrice1h\": \"19278.00\",\n \"markPrice\": \"19255.00\",\n \"indexPrice\": \"19260.68\",\n \"openInterest\": \"48069.549\",\n \"turnover24h\": \"4686694853.047006\",\n \"volume24h\": \"243730.252\",\n \"fundingRate\": \"0.0001\",\n \"nextFundingTime\": \"1663689600000\",\n \"predictedDeliveryPrice\": \"\",\n \"basisRate\": \"\",\n \"deliveryFeeRate\": \"\",\n \"deliveryTime\": \"0\"\n }" ], "line_end" => 2809, "line_start" => 2748, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "ticker" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "markPrice", "value" => "markPrice" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "indexPrice" }, %{ "comment" => nil, "key" => "interestRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "fundingRate" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "fundingTimestamp" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "this.iso8601 (fundingTimestamp)" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "interval", "value" => "intervalString" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (ticker, market: Market = undefined): FundingRate", "source" => "parseFundingRate (ticker, market: Market = undefined): FundingRate {\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"bidPrice\": \"19255\",\n // \"askPrice\": \"19255.5\",\n // \"lastPrice\": \"19255.50\",\n // \"lastTickDirection\": \"ZeroPlusTick\",\n // \"prevPrice24h\": \"18634.50\",\n // \"price24hPcnt\": \"0.033325\",\n // \"highPrice24h\": \"19675.00\",\n // \"lowPrice24h\": \"18610.00\",\n // \"prevPrice1h\": \"19278.00\",\n // \"markPrice\": \"19255.00\",\n // \"indexPrice\": \"19260.68\",\n // \"openInterest\": \"48069.549\",\n // \"turnover24h\": \"4686694853.047006\",\n // \"volume24h\": \"243730.252\",\n // \"fundingRate\": \"0.0001\",\n // \"nextFundingTime\": \"1663689600000\",\n // \"predictedDeliveryPrice\": \"\",\n // \"basisRate\": \"\",\n // \"deliveryFeeRate\": \"\",\n // \"deliveryTime\": \"0\"\n // }\n //\n const timestamp = this.safeInteger (ticker, 'timestamp'); // added artificially to avoid changing the signature\n ticker = this.omit (ticker, 'timestamp');\n const marketId = this.safeString (ticker, 'symbol');\n const symbol = this.safeSymbol (marketId, market, undefined, 'swap');\n const fundingRate = this.safeNumber (ticker, 'fundingRate');\n const fundingTimestamp = this.safeInteger (ticker, 'nextFundingTime');\n const markPrice = this.safeNumber (ticker, 'markPrice');\n const indexPrice = this.safeNumber (ticker, 'indexPrice');\n const info = this.safeDict (this.safeMarket (marketId, market, undefined, 'swap'), 'info');\n const fundingInterval = this.safeInteger (info, 'fundingInterval');\n let intervalString = undefined;\n if (fundingInterval !== undefined) {\n const interval = this.parseToInt (fundingInterval / 60);\n intervalString = interval.toString () + 'h';\n }\n return {\n 'info': ticker,\n 'symbol': symbol,\n 'markPrice': markPrice,\n 'indexPrice': indexPrice,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fundingRate': fundingRate,\n 'fundingTimestamp': fundingTimestamp,\n 'fundingDatetime': this.iso8601 (fundingTimestamp),\n 'nextFundingRate': undefined,\n 'nextFundingTimestamp': undefined,\n 'nextFundingDatetime': undefined,\n 'previousFundingRate': undefined,\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n 'interval': intervalString,\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC-26JAN24-39000-C\",\n \"bid1Price\": \"3205\",\n \"bid1Size\": \"7.1\",\n \"bid1Iv\": \"0.5478\",\n \"ask1Price\": \"3315\",\n \"ask1Size\": \"1.98\",\n \"ask1Iv\": \"0.5638\",\n \"lastPrice\": \"3230\",\n \"highPrice24h\": \"3255\",\n \"lowPrice24h\": \"3200\",\n \"markPrice\": \"3273.02263032\",\n \"indexPrice\": \"36790.96\",\n \"markIv\": \"0.5577\",\n \"underlyingPrice\": \"37649.67254894\",\n \"openInterest\": \"19.67\",\n \"turnover24h\": \"170140.33875912\",\n \"volume24h\": \"4.56\",\n \"totalVolume\": \"22\",\n \"totalTurnover\": \"789305\",\n \"delta\": \"0.49640971\",\n \"gamma\": \"0.00004131\",\n \"vega\": \"69.08651675\",\n \"theta\": \"-24.9443226\",\n \"predictedDeliveryPrice\": \"0\",\n \"change24h\": \"0.18532111\"\n }" ], "line_end" => 8410, "line_start" => 8357, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "delta", "value" => "this.safeNumber (greeks, 'delta')" }, %{ "comment" => nil, "key" => "gamma", "value" => "this.safeNumber (greeks, 'gamma')" }, %{ "comment" => nil, "key" => "theta", "value" => "this.safeNumber (greeks, 'theta')" }, %{ "comment" => nil, "key" => "vega", "value" => "this.safeNumber (greeks, 'vega')" }, %{ "comment" => nil, "key" => "rho", "value" => "undefined" }, %{ "comment" => nil, "key" => "bidSize", "value" => "this.safeNumber (greeks, 'bid1Size')" }, %{ "comment" => nil, "key" => "askSize", "value" => "this.safeNumber (greeks, 'ask1Size')" }, %{ "comment" => nil, "key" => "bidImpliedVolatility", "value" => "this.safeNumber (greeks, 'bid1Iv')" }, %{ "comment" => nil, "key" => "askImpliedVolatility", "value" => "this.safeNumber (greeks, 'ask1Iv')" }, %{ "comment" => nil, "key" => "markImpliedVolatility", "value" => "this.safeNumber (greeks, 'markIv')" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "this.safeNumber (greeks, 'bid1Price')" }, %{ "comment" => nil, "key" => "askPrice", "value" => "this.safeNumber (greeks, 'ask1Price')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (greeks, 'markPrice')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber (greeks, 'lastPrice')" }, %{ "comment" => nil, "key" => "underlyingPrice", "value" => "this.safeNumber (greeks, 'underlyingPrice')" }, %{ "comment" => nil, "key" => "info", "value" => "greeks" } ], "name" => "parseGreeks", "signature" => "parseGreeks (greeks: Dict, market: Market = undefined): Greeks", "source" => "parseGreeks (greeks: Dict, market: Market = undefined): Greeks {\n //\n // {\n // \"symbol\": \"BTC-26JAN24-39000-C\",\n // \"bid1Price\": \"3205\",\n // \"bid1Size\": \"7.1\",\n // \"bid1Iv\": \"0.5478\",\n // \"ask1Price\": \"3315\",\n // \"ask1Size\": \"1.98\",\n // \"ask1Iv\": \"0.5638\",\n // \"lastPrice\": \"3230\",\n // \"highPrice24h\": \"3255\",\n // \"lowPrice24h\": \"3200\",\n // \"markPrice\": \"3273.02263032\",\n // \"indexPrice\": \"36790.96\",\n // \"markIv\": \"0.5577\",\n // \"underlyingPrice\": \"37649.67254894\",\n // \"openInterest\": \"19.67\",\n // \"turnover24h\": \"170140.33875912\",\n // \"volume24h\": \"4.56\",\n // \"totalVolume\": \"22\",\n // \"totalTurnover\": \"789305\",\n // \"delta\": \"0.49640971\",\n // \"gamma\": \"0.00004131\",\n // \"vega\": \"69.08651675\",\n // \"theta\": \"-24.9443226\",\n // \"predictedDeliveryPrice\": \"0\",\n // \"change24h\": \"0.18532111\"\n // }\n //\n const marketId = this.safeString (greeks, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n return {\n 'symbol': symbol,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'delta': this.safeNumber (greeks, 'delta'),\n 'gamma': this.safeNumber (greeks, 'gamma'),\n 'theta': this.safeNumber (greeks, 'theta'),\n 'vega': this.safeNumber (greeks, 'vega'),\n 'rho': undefined,\n 'bidSize': this.safeNumber (greeks, 'bid1Size'),\n 'askSize': this.safeNumber (greeks, 'ask1Size'),\n 'bidImpliedVolatility': this.safeNumber (greeks, 'bid1Iv'),\n 'askImpliedVolatility': this.safeNumber (greeks, 'ask1Iv'),\n 'markImpliedVolatility': this.safeNumber (greeks, 'markIv'),\n 'bidPrice': this.safeNumber (greeks, 'bid1Price'),\n 'askPrice': this.safeNumber (greeks, 'ask1Price'),\n 'markPrice': this.safeNumber (greeks, 'markPrice'),\n 'lastPrice': this.safeNumber (greeks, 'lastPrice'),\n 'underlyingPrice': this.safeNumber (greeks, 'underlyingPrice'),\n 'info': greeks,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"XMRUSDT\",\n \"orderType\": \"UNKNOWN\",\n \"underlyingPrice\": \"\",\n \"orderLinkId\": \"\",\n \"orderId\": \"a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d\",\n \"stopOrderType\": \"UNKNOWN\",\n \"execTime\": \"1710950400000\",\n \"feeCurrency\": \"\",\n \"createType\": \"\",\n \"feeRate\": \"-0.000761\",\n \"tradeIv\": \"\",\n \"blockTradeId\": \"\",\n \"markPrice\": \"136.79\",\n \"execPrice\": \"137.11\",\n \"markIv\": \"\",\n \"orderQty\": \"0\",\n \"orderPrice\": \"0\",\n \"execValue\": \"134.3678\",\n \"closedSize\": \"0\",\n \"execType\": \"Funding\",\n \"seq\": \"28097658790\",\n \"side\": \"Sell\",\n \"indexPrice\": \"\",\n \"leavesQty\": \"0\",\n \"isMaker\": false,\n \"execFee\": \"-0.10232512\",\n \"execId\": \"8d1ef156-4ec6-4445-9a6c-1c0c24dbd046\",\n \"marketUnit\": \"\",\n \"execQty\": \"0.98\",\n \"nextPageCursor\": \"5774437%3A0%2C5771289%3A0\"\n }" ], "line_end" => 8771, "line_start" => 8719, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "income" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, '-', 'swap')" }, %{ "comment" => nil, "key" => "code", "value" => "code" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (income, 'execId')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (income, 'execFee')" }, %{ "comment" => nil, "key" => "rate", "value" => "this.safeNumber (income, 'feeRate')" } ], "name" => "parseIncome", "signature" => "parseIncome (income, market: Market = undefined): object", "source" => "parseIncome (income, market: Market = undefined): object {\n //\n // {\n // \"symbol\": \"XMRUSDT\",\n // \"orderType\": \"UNKNOWN\",\n // \"underlyingPrice\": \"\",\n // \"orderLinkId\": \"\",\n // \"orderId\": \"a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d\",\n // \"stopOrderType\": \"UNKNOWN\",\n // \"execTime\": \"1710950400000\",\n // \"feeCurrency\": \"\",\n // \"createType\": \"\",\n // \"feeRate\": \"-0.000761\",\n // \"tradeIv\": \"\",\n // \"blockTradeId\": \"\",\n // \"markPrice\": \"136.79\",\n // \"execPrice\": \"137.11\",\n // \"markIv\": \"\",\n // \"orderQty\": \"0\",\n // \"orderPrice\": \"0\",\n // \"execValue\": \"134.3678\",\n // \"closedSize\": \"0\",\n // \"execType\": \"Funding\",\n // \"seq\": \"28097658790\",\n // \"side\": \"Sell\",\n // \"indexPrice\": \"\",\n // \"leavesQty\": \"0\",\n // \"isMaker\": false,\n // \"execFee\": \"-0.10232512\",\n // \"execId\": \"8d1ef156-4ec6-4445-9a6c-1c0c24dbd046\",\n // \"marketUnit\": \"\",\n // \"execQty\": \"0.98\",\n // \"nextPageCursor\": \"5774437%3A0%2C5771289%3A0\"\n // }\n //\n const marketId = this.safeString (income, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'contract');\n let code = 'USDT';\n if (market['inverse']) {\n code = market['quote'];\n }\n const timestamp = this.safeInteger (income, 'execTime');\n return {\n 'info': income,\n 'symbol': this.safeSymbol (marketId, market, '-', 'swap'),\n 'code': code,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': this.safeString (income, 'execId'),\n 'amount': this.safeNumber (income, 'execFee'),\n 'rate': this.safeNumber (income, 'feeRate'),\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": 234467,\n \"user_id\": 1,\n \"coin\": \"BTC\",\n \"wallet_id\": 27913,\n \"type\": \"Realized P&L\",\n \"amount\": \"-0.00000006\",\n \"tx_id\": \"\",\n \"address\": \"BTCUSD\",\n \"wallet_balance\": \"0.03000330\",\n \"exec_time\": \"2019-12-09T00:00:25.000Z\",\n \"cross_seq\": 0\n }", "{\n \"symbol\": \"XRPUSDT\",\n \"side\": \"Buy\",\n \"funding\": \"\",\n \"orderLinkId\": \"linear-order\",\n \"orderId\": \"592b7e41-78fd-42e2-9aa3-91e1835ef3e1\",\n \"fee\": \"0.00260280\",\n \"change\": \"-0.0026028\",\n \"cashFlow\": \"0\",\n \"transactionTime\": \"1672121182224\",\n \"type\": \"TRADE\",\n \"feeRate\": \"0.0006\",\n \"size\": \"12\",\n \"qty\": \"12\",\n \"cashBalance\": \"5086.58101322\",\n \"currency\": \"USDT\",\n \"category\": \"linear\",\n \"tradePrice\": \"0.3615\",\n \"tradeId\": \"8569c10f-5061-5891-81c4-a54929847eb3\"\n }" ], "line_end" => 6344, "line_start" => 6268, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (item, 'id')" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "account", "value" => "this.safeString (item, 'wallet_id')" }, %{ "comment" => nil, "key" => "referenceId", "value" => "this.safeString (item, 'tx_id')" }, %{ "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" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "before", "value" => "before" }, %{ "comment" => nil, "key" => "after", "value" => "after" }, %{ "comment" => nil, "key" => "status", "value" => "'ok'" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': code,\n 'cost': this.safeNumber (item, 'fee'),\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeNumber (item, 'fee')" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // {\n // \"id\": 234467,\n // \"user_id\": 1,\n // \"coin\": \"BTC\",\n // \"wallet_id\": 27913,\n // \"type\": \"Realized P&L\",\n // \"amount\": \"-0.00000006\",\n // \"tx_id\": \"\",\n // \"address\": \"BTCUSD\",\n // \"wallet_balance\": \"0.03000330\",\n // \"exec_time\": \"2019-12-09T00:00:25.000Z\",\n // \"cross_seq\": 0\n // }\n //\n // {\n // \"symbol\": \"XRPUSDT\",\n // \"side\": \"Buy\",\n // \"funding\": \"\",\n // \"orderLinkId\": \"linear-order\",\n // \"orderId\": \"592b7e41-78fd-42e2-9aa3-91e1835ef3e1\",\n // \"fee\": \"0.00260280\",\n // \"change\": \"-0.0026028\",\n // \"cashFlow\": \"0\",\n // \"transactionTime\": \"1672121182224\",\n // \"type\": \"TRADE\",\n // \"feeRate\": \"0.0006\",\n // \"size\": \"12\",\n // \"qty\": \"12\",\n // \"cashBalance\": \"5086.58101322\",\n // \"currency\": \"USDT\",\n // \"category\": \"linear\",\n // \"tradePrice\": \"0.3615\",\n // \"tradeId\": \"8569c10f-5061-5891-81c4-a54929847eb3\"\n // }\n //\n const currencyId = this.safeString2 (item, 'coin', 'currency');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const amountString = this.safeString2 (item, 'amount', 'change');\n const afterString = this.safeString2 (item, 'wallet_balance', 'cashBalance');\n const direction = Precise.stringLt (amountString, '0') ? 'out' : 'in';\n let before = undefined;\n let after = undefined;\n let amount = undefined;\n if (afterString !== undefined && amountString !== undefined) {\n const difference = (direction === 'out') ? amountString : Precise.stringNeg (amountString);\n before = this.parseToNumeric (Precise.stringAdd (afterString, difference));\n after = this.parseToNumeric (afterString);\n amount = this.parseToNumeric (Precise.stringAbs (amountString));\n }\n let timestamp = this.parse8601 (this.safeString (item, 'exec_time'));\n if (timestamp === undefined) {\n timestamp = this.safeInteger (item, 'transactionTime');\n }\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': this.safeString (item, 'id'),\n 'direction': direction,\n 'account': this.safeString (item, 'wallet_id'),\n 'referenceId': this.safeString (item, 'tx_id'),\n 'referenceAccount': undefined,\n 'type': this.parseLedgerEntryType (this.safeString (item, 'type')),\n 'currency': code,\n 'amount': amount,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'before': before,\n 'after': after,\n 'status': 'ok',\n 'fee': {\n 'currency': code,\n 'cost': this.safeNumber (item, 'fee'),\n },\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 6370, "line_start" => 6346, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const types: Dict = {\n 'Deposit': 'transaction',\n 'Withdraw': 'transaction',\n 'RealisedPNL': 'trade',\n 'Commission': 'fee',\n 'Refund': 'cashback',\n 'Prize': 'prize', // ?\n 'ExchangeOrderWithdraw': 'transaction',\n 'ExchangeOrderDeposit': 'transaction',\n // v5\n 'TRANSFER_IN': 'transaction',\n 'TRANSFER_OUT': 'transaction',\n 'TRADE': 'trade',\n 'SETTLEMENT': 'trade',\n 'DELIVERY': 'trade',\n 'LIQUIDATION': 'trade',\n 'BONUS': 'Prize',\n 'FEE_REFUND': 'cashback',\n 'INTEREST': 'transaction',\n 'CURRENCY_BUY': 'trade',\n 'CURRENCY_SELL': 'trade',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 6885, "line_start" => 6875, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "this.safeStringLower (leverage, 'marginMode')" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "leverageValue" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "leverageValue" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage", "source" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage {\n const marketId = this.safeString (leverage, 'symbol');\n const leverageValue = this.safeInteger (leverage, 'leverage');\n return {\n 'info': leverage,\n 'symbol': this.safeSymbol (marketId, market),\n 'marginMode': this.safeStringLower (leverage, 'marginMode'),\n 'longLeverage': leverageValue,\n 'shortLeverage': leverageValue,\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"id\": 1,\n \"symbol\": \"BTCUSD\",\n \"riskLimitValue\": \"150\",\n \"maintenanceMargin\": \"0.5\",\n \"initialMargin\": \"1\",\n \"isLowestRisk\": 1,\n \"maxLeverage\": \"100.00\"\n }\n ]" ], "line_end" => 8633, "line_start" => 8602, "mappings" => [], "name" => "parseLeverageTiers", "signature" => "parseLeverageTiers (response, symbols: Strings = undefined, marketIdKey = undefined): LeverageTiers", "source" => "parseLeverageTiers (response, symbols: Strings = undefined, marketIdKey = undefined): LeverageTiers {\n //\n // [\n // {\n // \"id\": 1,\n // \"symbol\": \"BTCUSD\",\n // \"riskLimitValue\": \"150\",\n // \"maintenanceMargin\": \"0.5\",\n // \"initialMargin\": \"1\",\n // \"isLowestRisk\": 1,\n // \"maxLeverage\": \"100.00\"\n // }\n // ]\n //\n const tiers: Dict = {};\n const marketIds = this.marketIds (symbols);\n const filteredResults = this.filterByArray (response, marketIdKey, marketIds, false);\n const grouped = this.groupBy (filteredResults, marketIdKey);\n const keys = Object.keys (grouped);\n for (let i = 0; i < keys.length; i++) {\n const marketId = keys[i];\n const entry = grouped[marketId];\n for (let j = 0; j < entry.length; j++) {\n const id = this.safeInteger (entry[j], 'id');\n entry[j]['id'] = id;\n }\n const market = this.safeMarket (marketId, undefined, undefined, 'contract');\n const symbol = market['symbol'];\n tiers[symbol] = this.parseMarketLeverageTiers (this.sortBy (entry, 'id'), market);\n }\n return tiers as LeverageTiers;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ETHPERP\",\n \"orderType\": \"Market\",\n \"underlyingPrice\": \"\",\n \"orderLinkId\": \"\",\n \"side\": \"Buy\",\n \"indexPrice\": \"\",\n \"orderId\": \"8c065341-7b52-4ca9-ac2c-37e31ac55c94\",\n \"stopOrderType\": \"UNKNOWN\",\n \"leavesQty\": \"0\",\n \"execTime\": \"1672282722429\",\n \"isMaker\": false,\n \"execFee\": \"0.071409\",\n \"feeRate\": \"0.0006\",\n \"execId\": \"e0cbe81d-0f18-5866-9415-cf319b5dab3b\",\n \"tradeIv\": \"\",\n \"blockTradeId\": \"\",\n \"markPrice\": \"1183.54\",\n \"execPrice\": \"1190.15\",\n \"markIv\": \"\",\n \"orderQty\": \"0.1\",\n \"orderPrice\": \"1236.9\",\n \"execValue\": \"119.015\",\n \"execType\": \"Trade\",\n \"execQty\": \"0.1\"\n }" ], "line_end" => 8543, "line_start" => 8496, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "liquidation" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'contract')" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (contractsString)" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.parseNumber (contractSizeString)" }, %{ "comment" => nil, "key" => "price", "value" => "this.parseNumber (priceString)" }, %{ "comment" => nil, "key" => "baseValue", "value" => "this.parseNumber (baseValueString)" }, %{ "comment" => nil, "key" => "quoteValue", "value" => "this.parseNumber (quoteValueString)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseLiquidation", "signature" => "parseLiquidation (liquidation, market: Market = undefined): Liquidation", "source" => "parseLiquidation (liquidation, market: Market = undefined): Liquidation {\n //\n // {\n // \"symbol\": \"ETHPERP\",\n // \"orderType\": \"Market\",\n // \"underlyingPrice\": \"\",\n // \"orderLinkId\": \"\",\n // \"side\": \"Buy\",\n // \"indexPrice\": \"\",\n // \"orderId\": \"8c065341-7b52-4ca9-ac2c-37e31ac55c94\",\n // \"stopOrderType\": \"UNKNOWN\",\n // \"leavesQty\": \"0\",\n // \"execTime\": \"1672282722429\",\n // \"isMaker\": false,\n // \"execFee\": \"0.071409\",\n // \"feeRate\": \"0.0006\",\n // \"execId\": \"e0cbe81d-0f18-5866-9415-cf319b5dab3b\",\n // \"tradeIv\": \"\",\n // \"blockTradeId\": \"\",\n // \"markPrice\": \"1183.54\",\n // \"execPrice\": \"1190.15\",\n // \"markIv\": \"\",\n // \"orderQty\": \"0.1\",\n // \"orderPrice\": \"1236.9\",\n // \"execValue\": \"119.015\",\n // \"execType\": \"Trade\",\n // \"execQty\": \"0.1\"\n // }\n //\n const marketId = this.safeString (liquidation, 'symbol');\n const timestamp = this.safeInteger (liquidation, 'execTime');\n const contractsString = this.safeString (liquidation, 'execQty');\n const contractSizeString = this.safeString (market, 'contractSize');\n const priceString = this.safeString (liquidation, 'execPrice');\n const baseValueString = Precise.stringMul (contractsString, contractSizeString);\n const quoteValueString = Precise.stringMul (baseValueString, priceString);\n return this.safeLiquidation ({\n 'info': liquidation,\n 'symbol': this.safeSymbol (marketId, market, undefined, 'contract'),\n 'contracts': this.parseNumber (contractsString),\n 'contractSize': this.parseNumber (contractSizeString),\n 'price': this.parseNumber (priceString),\n 'baseValue': this.parseNumber (baseValueString),\n 'quoteValue': this.parseNumber (quoteValueString),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"buyRatio\": \"0.5707\",\n \"sellRatio\": \"0.4293\",\n \"timestamp\": \"1729123200000\"\n }" ], "line_end" => 9468, "line_start" => 9447, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'contract')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "timeframe", "value" => "undefined" }, %{ "comment" => nil, "key" => "longShortRatio", "value" => "this.parseToNumeric (Precise.stringDiv (longString, shortString))" } ], "name" => "parseLongShortRatio", "signature" => "parseLongShortRatio (info: Dict, market: Market = undefined): LongShortRatio", "source" => "parseLongShortRatio (info: Dict, market: Market = undefined): LongShortRatio {\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"buyRatio\": \"0.5707\",\n // \"sellRatio\": \"0.4293\",\n // \"timestamp\": \"1729123200000\"\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n const timestamp = this.safeIntegerOmitZero (info, 'timestamp');\n const longString = this.safeString (info, 'buyRatio');\n const shortString = this.safeString (info, 'sellRatio');\n return {\n 'info': info,\n 'symbol': this.safeSymbol (marketId, market, undefined, 'contract'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'timeframe': undefined,\n 'longShortRatio': this.parseToNumeric (Precise.stringDiv (longString, shortString)),\n } as LongShortRatio;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"BTC\",\n \"amount\": \"0.001\"\n }", "{\n \"resultStatus\": \"SU\"\n }" ], "line_end" => 7651, "line_start" => 7626, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeString (info, 'amount')" }, %{ "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): Dict", "source" => "parseMarginLoan (info, currency: Currency = undefined): Dict {\n //\n // borrowCrossMargin\n //\n // {\n // \"coin\": \"BTC\",\n // \"amount\": \"0.001\"\n // }\n //\n // repayCrossMargin\n //\n // {\n // \"resultStatus\": \"SU\"\n // }\n //\n const currencyId = this.safeString (info, 'coin');\n return {\n 'id': undefined,\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'amount': this.safeString (info, 'amount'),\n 'symbol': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 9645, "line_start" => 9638, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "marginMode" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (undefined, market)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "this.parseMarginModeType (marginType)" } ], "name" => "parseMarginMode", "signature" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode", "source" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode {\n const marginType = this.safeString (marginMode, 'marginMode');\n return {\n 'info': marginMode,\n 'symbol': this.safeSymbol (undefined, market),\n 'marginMode': this.parseMarginModeType (marginType),\n } as MarginMode;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 9654, "line_start" => 9647, "mappings" => [], "name" => "parseMarginModeType", "signature" => "parseMarginModeType (marginMode: Str): Str", "source" => "parseMarginModeType (marginMode: Str): Str {\n const marginModes: Dict = {\n 'ISOLATED_MARGIN': 'isolated',\n 'REGULAR_MARGIN': 'cross',\n 'PORTFOLIO_MARGIN': 'portfolio',\n };\n return this.safeString (marginModes, marginMode, marginMode);\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"id\": 1,\n \"symbol\": \"BTCUSD\",\n \"riskLimitValue\": \"150\",\n \"maintenanceMargin\": \"0.5\",\n \"initialMargin\": \"1\",\n \"isLowestRisk\": 1,\n \"maxLeverage\": \"100.00\"\n }\n ]" ], "line_end" => 8670, "line_start" => 8635, "mappings" => [ %{ "comment" => nil, "key" => "tier", "value" => "this.safeInteger (tier, 'id')" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "currency", "value" => "market['settle']" }, %{ "comment" => nil, "key" => "minNotional", "value" => "minNotional" }, %{ "comment" => nil, "key" => "maxNotional", "value" => "this.safeNumber (tier, 'riskLimitValue')" }, %{ "comment" => nil, "key" => "maintenanceMarginRate", "value" => "this.safeNumber (tier, 'maintenanceMargin')" }, %{ "comment" => nil, "key" => "maxLeverage", "value" => "this.safeNumber (tier, 'maxLeverage')" }, %{ "comment" => nil, "key" => "info", "value" => "tier" } ], "name" => "parseMarketLeverageTiers", "signature" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[]", "source" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[] {\n //\n // [\n // {\n // \"id\": 1,\n // \"symbol\": \"BTCUSD\",\n // \"riskLimitValue\": \"150\",\n // \"maintenanceMargin\": \"0.5\",\n // \"initialMargin\": \"1\",\n // \"isLowestRisk\": 1,\n // \"maxLeverage\": \"100.00\"\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 (info, 'symbol');\n market = this.safeMarket (marketId);\n let minNotional = this.parseNumber ('0');\n if (i !== 0) {\n minNotional = this.safeNumber (info[i - 1], 'riskLimitValue');\n }\n tiers.push ({\n 'tier': this.safeInteger (tier, 'id'),\n 'symbol': this.safeSymbol (marketId, market),\n 'currency': market['settle'],\n 'minNotional': minNotional,\n 'maxNotional': this.safeNumber (tier, 'riskLimitValue'),\n 'maintenanceMarginRate': this.safeNumber (tier, 'maintenanceMargin'),\n 'maxLeverage': this.safeNumber (tier, 'maxLeverage'),\n 'info': tier,\n });\n }\n return tiers as LeverageTier[];\n }" }, %{ "comment" => nil, "examples" => [ "[\n \"1621162800\",\n \"49592.43\",\n \"49644.91\",\n \"49342.37\",\n \"49349.42\",\n \"1451.59\",\n \"2.4343353100000003\"\n ]" ], "line_end" => 2634, "line_start" => 2613, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // [\n // \"1621162800\",\n // \"49592.43\",\n // \"49644.91\",\n // \"49342.37\",\n // \"49349.42\",\n // \"1451.59\",\n // \"2.4343353100000003\"\n // ]\n //\n const volumeIndex = (market['inverse']) ? 6 : 5;\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 \"openInterest\": 64757.62400000,\n \"timestamp\": 1665784800000,\n }" ], "line_end" => 7249, "line_start" => 7229, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "openInterestAmount", "value" => "amount" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "value" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "interest" } ], "name" => "parseOpenInterest", "signature" => "parseOpenInterest (interest, market: Market = undefined)", "source" => "parseOpenInterest (interest, market: Market = undefined) {\n //\n // {\n // \"openInterest\": 64757.62400000,\n // \"timestamp\": 1665784800000,\n // }\n //\n const timestamp = this.safeInteger (interest, 'timestamp');\n const openInterest = this.safeNumber2 (interest, 'open_interest', 'openInterest');\n // the openInterest is in the base asset for linear and quote asset for inverse\n const amount = market['linear'] ? openInterest : undefined;\n const value = market['inverse'] ? openInterest : undefined;\n return this.safeOpenInterest ({\n 'symbol': market['symbol'],\n 'openInterestAmount': amount,\n 'openInterestValue': value,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC-27DEC24-55000-P\",\n \"bid1Price\": \"0\",\n \"bid1Size\": \"0\",\n \"bid1Iv\": \"0\",\n \"ask1Price\": \"0\",\n \"ask1Size\": \"0\",\n \"ask1Iv\": \"0\",\n \"lastPrice\": \"10980\",\n \"highPrice24h\": \"0\",\n \"lowPrice24h\": \"0\",\n \"markPrice\": \"11814.66756236\",\n \"indexPrice\": \"63838.92\",\n \"markIv\": \"0.8866\",\n \"underlyingPrice\": \"71690.55303594\",\n \"openInterest\": \"0.01\",\n \"turnover24h\": \"0\",\n \"volume24h\": \"0\",\n \"totalVolume\": \"2\",\n \"totalTurnover\": \"78719\",\n \"delta\": \"-0.23284954\",\n \"gamma\": \"0.0000055\",\n \"vega\": \"191.70757975\",\n \"theta\": \"-30.43617927\",\n \"predictedDeliveryPrice\": \"0\",\n \"change24h\": \"0\"\n }" ], "line_end" => 8949, "line_start" => 8898, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "chain" }, %{ "comment" => nil, "key" => "currency", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "impliedVolatility", "value" => "this.safeNumber (chain, 'markIv')" }, %{ "comment" => nil, "key" => "openInterest", "value" => "this.safeNumber (chain, 'openInterest')" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "this.safeNumber (chain, 'bid1Price')" }, %{ "comment" => nil, "key" => "askPrice", "value" => "this.safeNumber (chain, 'ask1Price')" }, %{ "comment" => nil, "key" => "midPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (chain, 'markPrice')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber (chain, 'lastPrice')" }, %{ "comment" => nil, "key" => "underlyingPrice", "value" => "this.safeNumber (chain, 'underlyingPrice')" }, %{ "comment" => nil, "key" => "change", "value" => "this.safeNumber (chain, 'change24h')" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeNumber (chain, 'totalVolume')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "undefined" } ], "name" => "parseOption", "signature" => "parseOption (chain: Dict, currency: Currency = undefined, market: Market = undefined): Option", "source" => "parseOption (chain: Dict, currency: Currency = undefined, market: Market = undefined): Option {\n //\n // {\n // \"symbol\": \"BTC-27DEC24-55000-P\",\n // \"bid1Price\": \"0\",\n // \"bid1Size\": \"0\",\n // \"bid1Iv\": \"0\",\n // \"ask1Price\": \"0\",\n // \"ask1Size\": \"0\",\n // \"ask1Iv\": \"0\",\n // \"lastPrice\": \"10980\",\n // \"highPrice24h\": \"0\",\n // \"lowPrice24h\": \"0\",\n // \"markPrice\": \"11814.66756236\",\n // \"indexPrice\": \"63838.92\",\n // \"markIv\": \"0.8866\",\n // \"underlyingPrice\": \"71690.55303594\",\n // \"openInterest\": \"0.01\",\n // \"turnover24h\": \"0\",\n // \"volume24h\": \"0\",\n // \"totalVolume\": \"2\",\n // \"totalTurnover\": \"78719\",\n // \"delta\": \"-0.23284954\",\n // \"gamma\": \"0.0000055\",\n // \"vega\": \"191.70757975\",\n // \"theta\": \"-30.43617927\",\n // \"predictedDeliveryPrice\": \"0\",\n // \"change24h\": \"0\"\n // }\n //\n const marketId = this.safeString (chain, 'symbol');\n market = this.safeMarket (marketId, market);\n return {\n 'info': chain,\n 'currency': undefined,\n 'symbol': market['symbol'],\n 'timestamp': undefined,\n 'datetime': undefined,\n 'impliedVolatility': this.safeNumber (chain, 'markIv'),\n 'openInterest': this.safeNumber (chain, 'openInterest'),\n 'bidPrice': this.safeNumber (chain, 'bid1Price'),\n 'askPrice': this.safeNumber (chain, 'ask1Price'),\n 'midPrice': undefined,\n 'markPrice': this.safeNumber (chain, 'markPrice'),\n 'lastPrice': this.safeNumber (chain, 'lastPrice'),\n 'underlyingPrice': this.safeNumber (chain, 'underlyingPrice'),\n 'change': this.safeNumber (chain, 'change24h'),\n 'percentage': undefined,\n 'baseVolume': this.safeNumber (chain, 'totalVolume'),\n 'quoteVolume': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCPERP\",\n \"orderType\": \"Market\",\n \"orderLinkId\": \"\",\n \"orderId\": \"36190ad3-de08-4b83-9ad3-56942f684b79\",\n \"cancelType\": \"UNKNOWN\",\n \"stopOrderType\": \"UNKNOWN\",\n \"orderStatus\": \"Filled\",\n \"updateTimeStamp\": \"1692769133267\",\n \"takeProfit\": \"0.0000\",\n \"cumExecValue\": \"259.6830\",\n \"createdAt\": \"1692769133261\",\n \"blockTradeId\": \"\",\n \"orderPnl\": \"\",\n \"price\": \"24674.7\",\n \"tpTriggerBy\": \"UNKNOWN\",\n \"timeInForce\": \"ImmediateOrCancel\",\n \"updatedAt\": \"1692769133267\",\n \"basePrice\": \"0.0\",\n \"realisedPnl\": \"0.0000\",\n \"side\": \"Sell\",\n \"triggerPrice\": \"0.0\",\n \"cumExecFee\": \"0.1429\",\n \"leavesQty\": \"0.000\",\n \"cashFlow\": \"\",\n \"slTriggerBy\": \"UNKNOWN\",\n \"iv\": \"\",\n \"closeOnTrigger\": \"UNKNOWN\",\n \"cumExecQty\": \"0.010\",\n \"reduceOnly\": 0,\n \"qty\": \"0.010\",\n \"stopLoss\": \"0.0000\",\n \"triggerBy\": \"UNKNOWN\",\n \"orderIM\": \"\"\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"orderType\": \"Market\",\n \"orderLinkId\": \"\",\n \"slLimitPrice\": \"0\",\n \"orderId\": \"f5f2d355-9a11-4af3-9b83-aa1d6ab6ddfe\",\n \"cancelType\": \"UNKNOWN\",\n \"avgPrice\": \"122529.9\",\n \"stopOrderType\": \"\",\n \"lastPriceOnCreated\": \"123747.9\",\n \"orderStatus\": \"Filled\",\n \"createType\": \"CreateByUser\",\n \"takeProfit\": \"\",\n \"cumExecValue\": \"122.5299\",\n \"tpslMode\": \"\",\n \"smpType\": \"None\",\n \"triggerDirection\": 0,\n \"blockTradeId\": \"\",\n \"cumFeeDetail\": {\n \"USDT\": \"0.06739145\"\n },\n \"rejectReason\": \"EC_NoError\",\n \"isLeverage\": \"\",\n \"price\": \"120518\",\n \"orderIv\": \"\",\n \"createdTime\": \"1757837618905\",\n \"tpTriggerBy\": \"\",\n \"positionIdx\": 0,\n \"timeInForce\": \"IOC\",\n \"leavesValue\": \"0\",\n \"updatedTime\": \"1757837618909\",\n \"side\": \"Sell\",\n \"smpGroup\": 0,\n \"triggerPrice\": \"\",\n \"tpLimitPrice\": \"0\",\n \"cumExecFee\": \"0.06739145\",\n \"slTriggerBy\": \"\",\n \"leavesQty\": \"0\",\n \"closeOnTrigger\": false,\n \"slippageToleranceType\": \"UNKNOWN\",\n \"placeType\": \"\",\n \"cumExecQty\": \"0.001\",\n \"reduceOnly\": true,\n \"qty\": \"0.001\",\n \"stopLoss\": \"\",\n \"smpOrderId\": \"\",\n \"slippageTolerance\": \"0\",\n \"triggerBy\": \"\",\n \"extraFees\": \"\"\n }", "{\n \"category\": \"linear\",\n \"symbol\": \"LTCUSDT\",\n \"orderId\": '',\n \"orderLinkId\": '',\n \"createAt\": '',\n \"code\": \"10001\",\n \"msg\": \"The number of contracts exceeds maximum limit allowed: too large\"\n }" ], "line_end" => 3942, "line_start" => 3724, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "status", "value" => "'rejected'" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (order, 'orderId')" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString (order, 'orderLinkId')" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (this.safeString (order, 'symbol'), undefined, undefined, inferredMarketType)" }, %{ "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" => "lastTradeTimestamp" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "timeInForce" }, %{ "comment" => nil, "key" => "postOnly", "value" => "undefined" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "this.safeBool (order, 'reduceOnly')" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "triggerPrice" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "takeProfitPrice" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "stopLossPrice" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "average", "value" => "avgPrice" }, %{ "comment" => nil, "key" => "filled", "value" => "filled" }, %{ "comment" => nil, "key" => "remaining", "value" => "remaining" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // v1 for usdc normal account\n // {\n // \"symbol\": \"BTCPERP\",\n // \"orderType\": \"Market\",\n // \"orderLinkId\": \"\",\n // \"orderId\": \"36190ad3-de08-4b83-9ad3-56942f684b79\",\n // \"cancelType\": \"UNKNOWN\",\n // \"stopOrderType\": \"UNKNOWN\",\n // \"orderStatus\": \"Filled\",\n // \"updateTimeStamp\": \"1692769133267\",\n // \"takeProfit\": \"0.0000\",\n // \"cumExecValue\": \"259.6830\",\n // \"createdAt\": \"1692769133261\",\n // \"blockTradeId\": \"\",\n // \"orderPnl\": \"\",\n // \"price\": \"24674.7\",\n // \"tpTriggerBy\": \"UNKNOWN\",\n // \"timeInForce\": \"ImmediateOrCancel\",\n // \"updatedAt\": \"1692769133267\",\n // \"basePrice\": \"0.0\",\n // \"realisedPnl\": \"0.0000\",\n // \"side\": \"Sell\",\n // \"triggerPrice\": \"0.0\",\n // \"cumExecFee\": \"0.1429\",\n // \"leavesQty\": \"0.000\",\n // \"cashFlow\": \"\",\n // \"slTriggerBy\": \"UNKNOWN\",\n // \"iv\": \"\",\n // \"closeOnTrigger\": \"UNKNOWN\",\n // \"cumExecQty\": \"0.010\",\n // \"reduceOnly\": 0,\n // \"qty\": \"0.010\",\n // \"stopLoss\": \"0.0000\",\n // \"triggerBy\": \"UNKNOWN\",\n // \"orderIM\": \"\"\n // }\n //\n // v5\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"orderType\": \"Market\",\n // \"orderLinkId\": \"\",\n // \"slLimitPrice\": \"0\",\n // \"orderId\": \"f5f2d355-9a11-4af3-9b83-aa1d6ab6ddfe\",\n // \"cancelType\": \"UNKNOWN\",\n // \"avgPrice\": \"122529.9\",\n // \"stopOrderType\": \"\",\n // \"lastPriceOnCreated\": \"123747.9\",\n // \"orderStatus\": \"Filled\",\n // \"createType\": \"CreateByUser\",\n // \"takeProfit\": \"\",\n // \"cumExecValue\": \"122.5299\",\n // \"tpslMode\": \"\",\n // \"smpType\": \"None\",\n // \"triggerDirection\": 0,\n // \"blockTradeId\": \"\",\n // \"cumFeeDetail\": {\n // \"USDT\": \"0.06739145\"\n // },\n // \"rejectReason\": \"EC_NoError\",\n // \"isLeverage\": \"\",\n // \"price\": \"120518\",\n // \"orderIv\": \"\",\n // \"createdTime\": \"1757837618905\",\n // \"tpTriggerBy\": \"\",\n // \"positionIdx\": 0,\n // \"timeInForce\": \"IOC\",\n // \"leavesValue\": \"0\",\n // \"updatedTime\": \"1757837618909\",\n // \"side\": \"Sell\",\n // \"smpGroup\": 0,\n // \"triggerPrice\": \"\",\n // \"tpLimitPrice\": \"0\",\n // \"cumExecFee\": \"0.06739145\",\n // \"slTriggerBy\": \"\",\n // \"leavesQty\": \"0\",\n // \"closeOnTrigger\": false,\n // \"slippageToleranceType\": \"UNKNOWN\",\n // \"placeType\": \"\",\n // \"cumExecQty\": \"0.001\",\n // \"reduceOnly\": true,\n // \"qty\": \"0.001\",\n // \"stopLoss\": \"\",\n // \"smpOrderId\": \"\",\n // \"slippageTolerance\": \"0\",\n // \"triggerBy\": \"\",\n // \"extraFees\": \"\"\n // }\n //\n // createOrders failed order\n // {\n // \"category\": \"linear\",\n // \"symbol\": \"LTCUSDT\",\n // \"orderId\": '',\n // \"orderLinkId\": '',\n // \"createAt\": '',\n // \"code\": \"10001\",\n // \"msg\": \"The number of contracts exceeds maximum limit allowed: too large\"\n // }\n //\n const code = this.safeString (order, 'code');\n if (code !== undefined) {\n if (code !== '0') {\n const category = this.safeString (order, 'category');\n const inferredMarketType = (category === 'spot') ? 'spot' : 'contract';\n return this.safeOrder ({\n 'info': order,\n 'status': 'rejected',\n 'id': this.safeString (order, 'orderId'),\n 'clientOrderId': this.safeString (order, 'orderLinkId'),\n 'symbol': this.safeSymbol (this.safeString (order, 'symbol'), undefined, undefined, inferredMarketType),\n });\n }\n }\n const marketId = this.safeString (order, 'symbol');\n const isContract = ('tpslMode' in order);\n let marketType = undefined;\n if (market !== undefined) {\n marketType = market['type'];\n } else {\n marketType = isContract ? 'contract' : 'spot';\n }\n market = this.safeMarket (marketId, market, undefined, marketType);\n const symbol = market['symbol'];\n const timestamp = this.safeInteger2 (order, 'createdTime', 'createdAt');\n const marketUnit = this.safeString (order, 'marketUnit', 'baseCoin');\n const id = this.safeString (order, 'orderId');\n const type = this.safeStringLower (order, 'orderType');\n const price = this.safeString (order, 'price');\n let amount: Str = undefined;\n let cost: Str = undefined;\n if (marketUnit === 'baseCoin') {\n amount = this.safeString (order, 'qty');\n cost = this.safeString (order, 'cumExecValue');\n } else {\n cost = this.safeString (order, 'cumExecValue');\n }\n const filled = this.safeString (order, 'cumExecQty');\n const remaining = this.safeString (order, 'leavesQty');\n const lastTradeTimestamp = this.safeInteger2 (order, 'updatedTime', 'updatedAt');\n const rawStatus = this.safeString (order, 'orderStatus');\n const status = this.parseOrderStatus (rawStatus);\n const side = this.safeStringLower (order, 'side');\n let fee = undefined;\n const cumFeeDetail = this.safeDict (order, 'cumFeeDetail', {});\n const feeCoins = Object.keys (cumFeeDetail);\n const feeCoinId = this.safeString (feeCoins, 0);\n if (feeCoinId !== undefined) {\n fee = {\n 'cost': this.safeNumber (cumFeeDetail, feeCoinId),\n 'currency': feeCoinId,\n };\n }\n let clientOrderId = this.safeString (order, 'orderLinkId');\n if ((clientOrderId !== undefined) && (clientOrderId.length < 1)) {\n clientOrderId = undefined;\n }\n const avgPrice = this.omitZero (this.safeString (order, 'avgPrice'));\n const rawTimeInForce = this.safeString (order, 'timeInForce');\n const timeInForce = this.parseTimeInForce (rawTimeInForce);\n const triggerPrice = this.omitZero (this.safeString (order, 'triggerPrice'));\n const reduceOnly = this.safeBool (order, 'reduceOnly');\n let takeProfitPrice = this.omitZero (this.safeString (order, 'takeProfit'));\n let stopLossPrice = this.omitZero (this.safeString (order, 'stopLoss'));\n const triggerDirection = this.safeString (order, 'triggerDirection');\n const isAscending = (triggerDirection === '1');\n const isStopOrderType2 = (triggerPrice !== undefined) && reduceOnly;\n if ((stopLossPrice === undefined) && isStopOrderType2) {\n // check if order is stop order type 2 - stopLossPrice\n if (isAscending && (side === 'buy')) {\n // stopLoss order against short position\n stopLossPrice = triggerPrice;\n }\n if (!isAscending && (side === 'sell')) {\n // stopLoss order against a long position\n stopLossPrice = triggerPrice;\n }\n }\n if ((takeProfitPrice === undefined) && isStopOrderType2) {\n // check if order is stop order type 2 - takeProfitPrice\n if (isAscending && (side === 'sell')) {\n // takeprofit order against a long position\n takeProfitPrice = triggerPrice;\n }\n if (!isAscending && (side === 'buy')) {\n // takeprofit order against a short position\n takeProfitPrice = triggerPrice;\n }\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': lastTradeTimestamp,\n 'symbol': symbol,\n 'type': type,\n 'timeInForce': timeInForce,\n 'postOnly': undefined,\n 'reduceOnly': this.safeBool (order, 'reduceOnly'),\n 'side': side,\n 'price': price,\n 'triggerPrice': triggerPrice,\n 'takeProfitPrice': takeProfitPrice,\n 'stopLossPrice': stopLossPrice,\n 'amount': amount,\n 'cost': cost,\n 'average': avgPrice,\n 'filled': filled,\n 'remaining': remaining,\n 'status': status,\n 'fee': fee,\n 'trades': undefined,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3712, "line_start" => 3685, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n // v3 spot\n 'NEW': 'open',\n 'PARTIALLY_FILLED': 'open',\n 'FILLED': 'closed',\n 'CANCELED': 'canceled',\n 'PENDING_CANCEL': 'open',\n 'PENDING_NEW': 'open',\n 'REJECTED': 'rejected',\n 'PARTIALLY_FILLED_CANCELLED': 'closed', // context: https://github.com/ccxt/ccxt/issues/18685\n // v3 contract / unified margin / unified account\n 'Created': 'open',\n 'New': 'open',\n 'Rejected': 'rejected', // order is triggered but failed upon being placed\n 'PartiallyFilled': 'open',\n 'PartiallyFilledCanceled': 'closed', // context: https://github.com/ccxt/ccxt/issues/18685\n 'Filled': 'closed',\n 'PendingCancel': 'open',\n 'Cancelled': 'canceled',\n // below this line the status only pertains to conditional orders\n 'Untriggered': 'open',\n 'Deactivated': 'canceled',\n 'Triggered': 'open',\n 'Active': 'open',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"positionIdx\": 0,\n \"riskId\": \"11\",\n \"symbol\": \"ETHUSDT\",\n \"side\": \"Buy\",\n \"size\": \"0.10\",\n \"positionValue\": \"119.845\",\n \"entryPrice\": \"1198.45\",\n \"tradeMode\": 1,\n \"autoAddMargin\": 0,\n \"leverage\": \"4.2\",\n \"positionBalance\": \"28.58931118\",\n \"liqPrice\": \"919.10\",\n \"bustPrice\": \"913.15\",\n \"takeProfit\": \"0.00\",\n \"stopLoss\": \"0.00\",\n \"trailingStop\": \"0.00\",\n \"unrealisedPnl\": \"0.083\",\n \"createdTime\": \"1669097244192\",\n \"updatedTime\": \"1669413126190\",\n \"tpSlMode\": \"Full\",\n \"riskLimitValue\": \"900000\",\n \"activePrice\": \"0.00\"\n }", "{\n \"symbol\":\"BTCPERP\",\n \"leverage\":\"1.00\",\n \"occClosingFee\":\"0.0000\",\n \"liqPrice\":\"\",\n \"positionValue\":\"30.8100\",\n \"takeProfit\":\"0.0\",\n \"riskId\":\"10001\",\n \"trailingStop\":\"0.0000\",\n \"unrealisedPnl\":\"0.0000\",\n \"createdAt\":\"1652451795305\",\n \"markPrice\":\"30809.41\",\n \"cumRealisedPnl\":\"0.0000\",\n \"positionMM\":\"0.1541\",\n \"positionIM\":\"30.8100\",\n \"updatedAt\":\"1652451795305\",\n \"tpSLMode\":\"UNKNOWN\",\n \"side\":\"Buy\",\n \"bustPrice\":\"\",\n \"deleverageIndicator\":\"0\",\n \"entryPrice\":\"30810.0\",\n \"size\":\"0.001\",\n \"sessionRPL\":\"0.0000\",\n \"positionStatus\":\"NORMAL\",\n \"sessionUPL\":\"-0.0006\",\n \"stopLoss\":\"0.0\",\n \"orderMargin\":\"0.0000\",\n \"sessionAvgPrice\":\"30810.0\"\n }", "{\n \"symbol\": \"ETHUSDT\",\n \"leverage\": \"10\",\n \"updatedTime\": 1657711949945,\n \"side\": \"Buy\",\n \"positionValue\": \"536.92500000\",\n \"takeProfit\": \"\",\n \"tpslMode\": \"Full\",\n \"riskId\": 11,\n \"trailingStop\": \"\",\n \"entryPrice\": \"1073.85000000\",\n \"unrealisedPnl\": \"\",\n \"markPrice\": \"1080.65000000\",\n \"size\": \"0.5000\",\n \"positionStatus\": \"normal\",\n \"stopLoss\": \"\",\n \"cumRealisedPnl\": \"-0.32215500\",\n \"positionMM\": \"2.97456450\",\n \"createdTime\": 1657711949928,\n \"positionIdx\": 0,\n \"positionIM\": \"53.98243950\"\n }", "{\n \"symbol\": \"XRPUSDT\",\n \"leverage\": \"10\",\n \"avgPrice\": \"0.3615\",\n \"liqPrice\": \"0.0001\",\n \"riskLimitValue\": \"200000\",\n \"takeProfit\": \"\",\n \"positionValue\": \"36.15\",\n \"tpslMode\": \"Full\",\n \"riskId\": 41,\n \"trailingStop\": \"0\",\n \"unrealisedPnl\": \"-1.83\",\n \"markPrice\": \"0.3432\",\n \"cumRealisedPnl\": \"0.48805876\",\n \"positionMM\": \"0.381021\",\n \"createdTime\": \"1672121182216\",\n \"positionIdx\": 0,\n \"positionIM\": \"3.634521\",\n \"updatedTime\": \"1672279322668\",\n \"side\": \"Buy\",\n \"bustPrice\": \"\",\n \"size\": \"100\",\n \"positionStatus\": \"Normal\",\n \"stopLoss\": \"\",\n \"tradeMode\": 0\n }", "{\n symbol: 'XRPUSDT',\n orderType: 'Market',\n leverage: '10',\n updatedTime: '1712717265572',\n side: 'Sell',\n orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',\n closedPnl: '-0.00049568',\n avgEntryPrice: '0.6045',\n qty: '3',\n cumEntryValue: '1.8135',\n createdTime: '1712717265566',\n orderPrice: '0.5744',\n closedSize: '3',\n avgExitPrice: '0.605',\n execType: 'Trade',\n fillCount: '1',\n cumExitValue: '1.815'\n }" ], "line_end" => 6857, "line_start" => 6613, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "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" => "lastUpdateTimestamp", "value" => "lastUpdateTimestamp" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "this.parseNumber (initialMarginString)" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "this.parseNumber (Precise.stringDiv (initialMarginString, notional))" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "this.parseNumber (maintenanceMarginString)" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "this.parseNumber (maintenanceMarginPercentage)" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.parseNumber (entryPrice)" }, %{ "comment" => nil, "key" => "notional", "value" => "this.parseNumber (notional)" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.parseNumber (leverage)" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.parseNumber (unrealisedPnl)" }, %{ "comment" => nil, "key" => "realizedPnl", "value" => "this.safeNumber2 (position, 'curRealisedPnl', 'closedPnl')" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (size)" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "this.parseNumber (marginRatio)" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "this.parseNumber (liquidationPrice)" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.parseNumber (markPrice)" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber (position, 'avgExitPrice')" }, %{ "comment" => nil, "key" => "collateral", "value" => "this.parseNumber (collateralString)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "this.safeNumber2 (position, 'stop_loss', 'stopLoss')" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "this.safeNumber2 (position, 'take_profit', 'takeProfit')" }, %{ "comment" => nil, "key" => "hedged", "value" => "hedged" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined): Position", "source" => "parsePosition (position: Dict, market: Market = undefined): Position {\n //\n // linear swap\n //\n // {\n // \"positionIdx\": 0,\n // \"riskId\": \"11\",\n // \"symbol\": \"ETHUSDT\",\n // \"side\": \"Buy\",\n // \"size\": \"0.10\",\n // \"positionValue\": \"119.845\",\n // \"entryPrice\": \"1198.45\",\n // \"tradeMode\": 1,\n // \"autoAddMargin\": 0,\n // \"leverage\": \"4.2\",\n // \"positionBalance\": \"28.58931118\",\n // \"liqPrice\": \"919.10\",\n // \"bustPrice\": \"913.15\",\n // \"takeProfit\": \"0.00\",\n // \"stopLoss\": \"0.00\",\n // \"trailingStop\": \"0.00\",\n // \"unrealisedPnl\": \"0.083\",\n // \"createdTime\": \"1669097244192\",\n // \"updatedTime\": \"1669413126190\",\n // \"tpSlMode\": \"Full\",\n // \"riskLimitValue\": \"900000\",\n // \"activePrice\": \"0.00\"\n // }\n //\n // usdc\n // {\n // \"symbol\":\"BTCPERP\",\n // \"leverage\":\"1.00\",\n // \"occClosingFee\":\"0.0000\",\n // \"liqPrice\":\"\",\n // \"positionValue\":\"30.8100\",\n // \"takeProfit\":\"0.0\",\n // \"riskId\":\"10001\",\n // \"trailingStop\":\"0.0000\",\n // \"unrealisedPnl\":\"0.0000\",\n // \"createdAt\":\"1652451795305\",\n // \"markPrice\":\"30809.41\",\n // \"cumRealisedPnl\":\"0.0000\",\n // \"positionMM\":\"0.1541\",\n // \"positionIM\":\"30.8100\",\n // \"updatedAt\":\"1652451795305\",\n // \"tpSLMode\":\"UNKNOWN\",\n // \"side\":\"Buy\",\n // \"bustPrice\":\"\",\n // \"deleverageIndicator\":\"0\",\n // \"entryPrice\":\"30810.0\",\n // \"size\":\"0.001\",\n // \"sessionRPL\":\"0.0000\",\n // \"positionStatus\":\"NORMAL\",\n // \"sessionUPL\":\"-0.0006\",\n // \"stopLoss\":\"0.0\",\n // \"orderMargin\":\"0.0000\",\n // \"sessionAvgPrice\":\"30810.0\"\n // }\n //\n // unified margin\n //\n // {\n // \"symbol\": \"ETHUSDT\",\n // \"leverage\": \"10\",\n // \"updatedTime\": 1657711949945,\n // \"side\": \"Buy\",\n // \"positionValue\": \"536.92500000\",\n // \"takeProfit\": \"\",\n // \"tpslMode\": \"Full\",\n // \"riskId\": 11,\n // \"trailingStop\": \"\",\n // \"entryPrice\": \"1073.85000000\",\n // \"unrealisedPnl\": \"\",\n // \"markPrice\": \"1080.65000000\",\n // \"size\": \"0.5000\",\n // \"positionStatus\": \"normal\",\n // \"stopLoss\": \"\",\n // \"cumRealisedPnl\": \"-0.32215500\",\n // \"positionMM\": \"2.97456450\",\n // \"createdTime\": 1657711949928,\n // \"positionIdx\": 0,\n // \"positionIM\": \"53.98243950\"\n // }\n //\n // unified account\n //\n // {\n // \"symbol\": \"XRPUSDT\",\n // \"leverage\": \"10\",\n // \"avgPrice\": \"0.3615\",\n // \"liqPrice\": \"0.0001\",\n // \"riskLimitValue\": \"200000\",\n // \"takeProfit\": \"\",\n // \"positionValue\": \"36.15\",\n // \"tpslMode\": \"Full\",\n // \"riskId\": 41,\n // \"trailingStop\": \"0\",\n // \"unrealisedPnl\": \"-1.83\",\n // \"markPrice\": \"0.3432\",\n // \"cumRealisedPnl\": \"0.48805876\",\n // \"positionMM\": \"0.381021\",\n // \"createdTime\": \"1672121182216\",\n // \"positionIdx\": 0,\n // \"positionIM\": \"3.634521\",\n // \"updatedTime\": \"1672279322668\",\n // \"side\": \"Buy\",\n // \"bustPrice\": \"\",\n // \"size\": \"100\",\n // \"positionStatus\": \"Normal\",\n // \"stopLoss\": \"\",\n // \"tradeMode\": 0\n // }\n //\n // fetchPositionsHistory\n //\n // {\n // symbol: 'XRPUSDT',\n // orderType: 'Market',\n // leverage: '10',\n // updatedTime: '1712717265572',\n // side: 'Sell',\n // orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',\n // closedPnl: '-0.00049568',\n // avgEntryPrice: '0.6045',\n // qty: '3',\n // cumEntryValue: '1.8135',\n // createdTime: '1712717265566',\n // orderPrice: '0.5744',\n // closedSize: '3',\n // avgExitPrice: '0.605',\n // execType: 'Trade',\n // fillCount: '1',\n // cumExitValue: '1.815'\n // }\n //\n const closedSize = this.safeString (position, 'closedSize');\n const isHistory = (closedSize !== undefined);\n const contract = this.safeString (position, 'symbol');\n market = this.safeMarket (contract, market, undefined, 'contract');\n const size = Precise.stringAbs (this.safeString2 (position, 'size', 'qty'));\n let side = this.safeString (position, 'side');\n const positionIdx = this.safeString (position, 'positionIdx');\n let hedged = undefined;\n if (positionIdx !== undefined) {\n hedged = (positionIdx !== '0');\n }\n if ((hedged !== undefined) && hedged) {\n side = (positionIdx === '1') ? 'long' : 'short';\n } else if (side !== undefined) {\n if (side === 'Buy') {\n side = isHistory ? 'short' : 'long';\n } else if (side === 'Sell') {\n side = isHistory ? 'long' : 'short';\n } else {\n side = undefined;\n }\n }\n let notional = undefined;\n const contractSize = this.safeString (market, 'contractSize');\n const markPrice = this.safeString (position, 'markPrice');\n if (market['inverse']) {\n notional = Precise.stringDiv (Precise.stringMul (size, contractSize), markPrice);\n } else {\n notional = this.safeString2 (position, 'positionValue', 'cumExitValue');\n }\n const unrealisedPnl = this.omitZero (this.safeString (position, 'unrealisedPnl'));\n let initialMarginString = this.safeString2 (position, 'positionIM', 'cumEntryValue');\n let maintenanceMarginString = this.safeString (position, 'positionMM');\n const timestamp = this.safeIntegerN (position, [ 'createdTime', 'createdAt' ]);\n let lastUpdateTimestamp = this.parse8601 (this.safeString (position, 'updated_at'));\n if (lastUpdateTimestamp === undefined) {\n lastUpdateTimestamp = this.safeIntegerN (position, [ 'updatedTime', 'updatedAt', 'updatedTime' ]);\n }\n let collateralString = this.safeString (position, 'positionBalance');\n const entryPrice = this.omitZero (this.safeStringN (position, [ 'entryPrice', 'avgPrice', 'avgEntryPrice' ]));\n const liquidationPrice = this.omitZero (this.safeString (position, 'liqPrice'));\n const leverage = this.safeString (position, 'leverage');\n if (liquidationPrice !== undefined) {\n if (market['settle'] === 'USDC') {\n // (Entry price - Liq price) * Contracts + Maintenance Margin + (unrealised pnl) = Collateral\n const price = this.safeBool (this.options, 'useMarkPriceForPositionCollateral', false) ? markPrice : entryPrice;\n const difference = Precise.stringAbs (Precise.stringSub (price, liquidationPrice));\n collateralString = Precise.stringAdd (Precise.stringAdd (Precise.stringMul (difference, size), maintenanceMarginString), unrealisedPnl);\n } else {\n const bustPrice = this.safeString (position, 'bustPrice');\n if (market['linear']) {\n // derived from the following formulas\n // (Entry price - Bust price) * Contracts = Collateral\n // (Entry price - Liq price) * Contracts = Collateral - Maintenance Margin\n // Maintenance Margin = (Bust price - Liq price) x Contracts\n const maintenanceMarginPriceDifference = Precise.stringAbs (Precise.stringSub (liquidationPrice, bustPrice));\n maintenanceMarginString = Precise.stringMul (maintenanceMarginPriceDifference, size);\n // Initial Margin = Contracts x Entry Price / Leverage\n if ((entryPrice !== undefined) && (initialMarginString === undefined)) {\n initialMarginString = Precise.stringDiv (Precise.stringMul (size, entryPrice), leverage);\n }\n } else {\n // Contracts * (1 / Entry price - 1 / Bust price) = Collateral\n // Contracts * (1 / Entry price - 1 / Liq price) = Collateral - Maintenance Margin\n // Maintenance Margin = Contracts * (1 / Liq price - 1 / Bust price)\n // Maintenance Margin = Contracts * (Bust price - Liq price) / (Liq price x Bust price)\n const difference = Precise.stringAbs (Precise.stringSub (bustPrice, liquidationPrice));\n const multiply = Precise.stringMul (bustPrice, liquidationPrice);\n maintenanceMarginString = Precise.stringDiv (Precise.stringMul (size, difference), multiply);\n // Initial Margin = Leverage x Contracts / EntryPrice\n if ((entryPrice !== undefined) && (initialMarginString === undefined)) {\n initialMarginString = Precise.stringDiv (size, Precise.stringMul (entryPrice, leverage));\n }\n }\n }\n }\n const maintenanceMarginPercentage = Precise.stringDiv (maintenanceMarginString, notional);\n const marginRatio = Precise.stringDiv (maintenanceMarginString, collateralString, 4);\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': market['symbol'],\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastUpdateTimestamp': lastUpdateTimestamp,\n 'initialMargin': this.parseNumber (initialMarginString),\n 'initialMarginPercentage': this.parseNumber (Precise.stringDiv (initialMarginString, notional)),\n 'maintenanceMargin': this.parseNumber (maintenanceMarginString),\n 'maintenanceMarginPercentage': this.parseNumber (maintenanceMarginPercentage),\n 'entryPrice': this.parseNumber (entryPrice),\n 'notional': this.parseNumber (notional),\n 'leverage': this.parseNumber (leverage),\n 'unrealizedPnl': this.parseNumber (unrealisedPnl),\n 'realizedPnl': this.safeNumber2 (position, 'curRealisedPnl', 'closedPnl'),\n 'contracts': this.parseNumber (size), // in USD for inverse swaps\n 'contractSize': this.safeNumber (market, 'contractSize'),\n 'marginRatio': this.parseNumber (marginRatio),\n 'liquidationPrice': this.parseNumber (liquidationPrice),\n 'markPrice': this.parseNumber (markPrice),\n 'lastPrice': this.safeNumber (position, 'avgExitPrice'),\n 'collateral': this.parseNumber (collateralString),\n 'marginMode': undefined, // tradeMode was deprecated\n 'side': side,\n 'percentage': undefined,\n 'stopLossPrice': this.safeNumber2 (position, 'stop_loss', 'stopLoss'),\n 'takeProfitPrice': this.safeNumber2 (position, 'take_profit', 'takeProfit'),\n 'hedged': hedged,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"SOL-27JUN23-20-C\",\n \"deliveryPrice\": \"16.62258889\",\n \"deliveryTime\": \"1687852800000\"\n }", "{\n \"symbol\": \"SOL-27JUN23-20-C\",\n \"deliveryPrice\": \"16.62258889\",\n \"deliveryTime\": \"1687852800000\",\n \"side\": \"Buy\",\n \"strike\": \"20\",\n \"fee\": \"0.00000000\",\n \"position\": \"0.01\",\n \"deliveryRpl\": \"3.5\"\n }" ], "line_end" => 8124, "line_start" => 8092, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "settlement" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (settlement, 'deliveryPrice')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseSettlement", "signature" => "parseSettlement (settlement, market)", "source" => "parseSettlement (settlement, market) {\n //\n // fetchSettlementHistory\n //\n // {\n // \"symbol\": \"SOL-27JUN23-20-C\",\n // \"deliveryPrice\": \"16.62258889\",\n // \"deliveryTime\": \"1687852800000\"\n // }\n //\n // fetchMySettlementHistory\n //\n // {\n // \"symbol\": \"SOL-27JUN23-20-C\",\n // \"deliveryPrice\": \"16.62258889\",\n // \"deliveryTime\": \"1687852800000\",\n // \"side\": \"Buy\",\n // \"strike\": \"20\",\n // \"fee\": \"0.00000000\",\n // \"position\": \"0.01\",\n // \"deliveryRpl\": \"3.5\"\n // }\n //\n const timestamp = this.safeInteger (settlement, 'deliveryTime');\n const marketId = this.safeString (settlement, 'symbol');\n return {\n 'info': settlement,\n 'symbol': this.safeSymbol (marketId, market),\n 'price': this.safeNumber (settlement, 'deliveryPrice'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }" }, %{ "comment" => nil, "examples" => [ "[\n {\n \"symbol\": \"SOL-27JUN23-20-C\",\n \"deliveryPrice\": \"16.62258889\",\n \"deliveryTime\": \"1687852800000\"\n }\n ]", "[\n {\n \"symbol\": \"SOL-27JUN23-20-C\",\n \"deliveryPrice\": \"16.62258889\",\n \"deliveryTime\": \"1687852800000\",\n \"side\": \"Buy\",\n \"strike\": \"20\",\n \"fee\": \"0.00000000\",\n \"position\": \"0.01\",\n \"deliveryRpl\": \"3.5\"\n }\n ]" ], "line_end" => 8158, "line_start" => 8126, "mappings" => [], "name" => "parseSettlements", "signature" => "parseSettlements (settlements, market)", "source" => "parseSettlements (settlements, market) {\n //\n // fetchSettlementHistory\n //\n // [\n // {\n // \"symbol\": \"SOL-27JUN23-20-C\",\n // \"deliveryPrice\": \"16.62258889\",\n // \"deliveryTime\": \"1687852800000\"\n // }\n // ]\n //\n // fetchMySettlementHistory\n //\n // [\n // {\n // \"symbol\": \"SOL-27JUN23-20-C\",\n // \"deliveryPrice\": \"16.62258889\",\n // \"deliveryTime\": \"1687852800000\",\n // \"side\": \"Buy\",\n // \"strike\": \"20\",\n // \"fee\": \"0.00000000\",\n // \"position\": \"0.01\",\n // \"deliveryRpl\": \"3.5\"\n // }\n // ]\n //\n const result = [];\n for (let i = 0; i < settlements.length; i++) {\n result.push (this.parseSettlement (settlements[i], market));\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"bid1Price\": \"20517.96\",\n \"bid1Size\": \"2\",\n \"ask1Price\": \"20527.77\",\n \"ask1Size\": \"1.862172\",\n \"lastPrice\": \"20533.13\",\n \"prevPrice24h\": \"20393.48\",\n \"price24hPcnt\": \"0.0068\",\n \"highPrice24h\": \"21128.12\",\n \"lowPrice24h\": \"20318.89\",\n \"turnover24h\": \"243765620.65899866\",\n \"volume24h\": \"11801.27771\",\n \"usdIndexPrice\": \"20784.12009279\"\n }", "{\n \"symbol\": \"BTCUSD\",\n \"lastPrice\": \"16597.00\",\n \"indexPrice\": \"16598.54\",\n \"markPrice\": \"16596.00\",\n \"prevPrice24h\": \"16464.50\",\n \"price24hPcnt\": \"0.008047\",\n \"highPrice24h\": \"30912.50\",\n \"lowPrice24h\": \"15700.00\",\n \"prevPrice1h\": \"16595.50\",\n \"openInterest\": \"373504107\",\n \"openInterestValue\": \"22505.67\",\n \"turnover24h\": \"2352.94950046\",\n \"volume24h\": \"49337318\",\n \"fundingRate\": \"-0.001034\",\n \"nextFundingTime\": \"1672387200000\",\n \"predictedDeliveryPrice\": \"\",\n \"basisRate\": \"\",\n \"deliveryFeeRate\": \"\",\n \"deliveryTime\": \"0\",\n \"ask1Size\": \"1\",\n \"bid1Price\": \"16596.00\",\n \"ask1Price\": \"16597.50\",\n \"bid1Size\": \"1\"\n }", "{\n \"symbol\": \"BTC-30DEC22-18000-C\",\n \"bid1Price\": \"0\",\n \"bid1Size\": \"0\",\n \"bid1Iv\": \"0\",\n \"ask1Price\": \"435\",\n \"ask1Size\": \"0.66\",\n \"ask1Iv\": \"5\",\n \"lastPrice\": \"435\",\n \"highPrice24h\": \"435\",\n \"lowPrice24h\": \"165\",\n \"markPrice\": \"0.00000009\",\n \"indexPrice\": \"16600.55\",\n \"markIv\": \"0.7567\",\n \"underlyingPrice\": \"16590.42\",\n \"openInterest\": \"6.3\",\n \"turnover24h\": \"2482.73\",\n \"volume24h\": \"0.15\",\n \"totalVolume\": \"99\",\n \"totalTurnover\": \"1967653\",\n \"delta\": \"0.00000001\",\n \"gamma\": \"0.00000001\",\n \"vega\": \"0.00000004\",\n \"theta\": \"-0.00000152\",\n \"predictedDeliveryPrice\": \"0\",\n \"change24h\": \"86\"\n }" ], "line_end" => 2420, "line_start" => 2302, "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" => "bid" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "this.safeString2 (ticker, 'bidSize', 'bid1Size')" }, %{ "comment" => nil, "key" => "ask", "value" => "ask" }, %{ "comment" => nil, "key" => "askVolume", "value" => "this.safeString2 (ticker, 'askSize', 'ask1Size')" }, %{ "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" => "percentage" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "baseVolume" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "quoteVolume" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeString (ticker, 'markPrice')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeString (ticker, 'indexPrice')" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker", "source" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker {\n //\n // spot\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"bid1Price\": \"20517.96\",\n // \"bid1Size\": \"2\",\n // \"ask1Price\": \"20527.77\",\n // \"ask1Size\": \"1.862172\",\n // \"lastPrice\": \"20533.13\",\n // \"prevPrice24h\": \"20393.48\",\n // \"price24hPcnt\": \"0.0068\",\n // \"highPrice24h\": \"21128.12\",\n // \"lowPrice24h\": \"20318.89\",\n // \"turnover24h\": \"243765620.65899866\",\n // \"volume24h\": \"11801.27771\",\n // \"usdIndexPrice\": \"20784.12009279\"\n // }\n //\n // linear/inverse\n //\n // {\n // \"symbol\": \"BTCUSD\",\n // \"lastPrice\": \"16597.00\",\n // \"indexPrice\": \"16598.54\",\n // \"markPrice\": \"16596.00\",\n // \"prevPrice24h\": \"16464.50\",\n // \"price24hPcnt\": \"0.008047\",\n // \"highPrice24h\": \"30912.50\",\n // \"lowPrice24h\": \"15700.00\",\n // \"prevPrice1h\": \"16595.50\",\n // \"openInterest\": \"373504107\",\n // \"openInterestValue\": \"22505.67\",\n // \"turnover24h\": \"2352.94950046\",\n // \"volume24h\": \"49337318\",\n // \"fundingRate\": \"-0.001034\",\n // \"nextFundingTime\": \"1672387200000\",\n // \"predictedDeliveryPrice\": \"\",\n // \"basisRate\": \"\",\n // \"deliveryFeeRate\": \"\",\n // \"deliveryTime\": \"0\",\n // \"ask1Size\": \"1\",\n // \"bid1Price\": \"16596.00\",\n // \"ask1Price\": \"16597.50\",\n // \"bid1Size\": \"1\"\n // }\n //\n // option\n //\n // {\n // \"symbol\": \"BTC-30DEC22-18000-C\",\n // \"bid1Price\": \"0\",\n // \"bid1Size\": \"0\",\n // \"bid1Iv\": \"0\",\n // \"ask1Price\": \"435\",\n // \"ask1Size\": \"0.66\",\n // \"ask1Iv\": \"5\",\n // \"lastPrice\": \"435\",\n // \"highPrice24h\": \"435\",\n // \"lowPrice24h\": \"165\",\n // \"markPrice\": \"0.00000009\",\n // \"indexPrice\": \"16600.55\",\n // \"markIv\": \"0.7567\",\n // \"underlyingPrice\": \"16590.42\",\n // \"openInterest\": \"6.3\",\n // \"turnover24h\": \"2482.73\",\n // \"volume24h\": \"0.15\",\n // \"totalVolume\": \"99\",\n // \"totalTurnover\": \"1967653\",\n // \"delta\": \"0.00000001\",\n // \"gamma\": \"0.00000001\",\n // \"vega\": \"0.00000004\",\n // \"theta\": \"-0.00000152\",\n // \"predictedDeliveryPrice\": \"0\",\n // \"change24h\": \"86\"\n // }\n //\n const isSpot = this.safeString (ticker, 'openInterestValue') === undefined;\n const timestamp = this.safeInteger (ticker, 'time');\n const marketId = this.safeString (ticker, 'symbol');\n const type = isSpot ? 'spot' : 'contract';\n market = this.safeMarket (marketId, market, undefined, type);\n const symbol = this.safeSymbol (marketId, market, undefined, type);\n const last = this.safeString (ticker, 'lastPrice');\n const open = this.safeString (ticker, 'prevPrice24h');\n let percentage = this.safeString (ticker, 'price24hPcnt');\n percentage = Precise.stringMul (percentage, '100');\n const quoteVolume = this.safeString (ticker, 'turnover24h');\n const baseVolume = this.safeString (ticker, 'volume24h');\n const bid = this.safeString (ticker, 'bid1Price');\n const ask = this.safeString (ticker, 'ask1Price');\n const high = this.safeString (ticker, 'highPrice24h');\n const low = this.safeString (ticker, 'lowPrice24h');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': high,\n 'low': low,\n 'bid': bid,\n 'bidVolume': this.safeString2 (ticker, 'bidSize', 'bid1Size'),\n 'ask': ask,\n 'askVolume': this.safeString2 (ticker, 'askSize', 'ask1Size'),\n 'vwap': undefined,\n 'open': open,\n 'close': last,\n 'last': last,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': percentage,\n 'average': undefined,\n 'baseVolume': baseVolume,\n 'quoteVolume': quoteVolume,\n 'markPrice': this.safeString (ticker, 'markPrice'),\n 'indexPrice': this.safeString (ticker, 'indexPrice'),\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3722, "line_start" => 3714, "mappings" => [], "name" => "parseTimeInForce", "signature" => "parseTimeInForce (timeInForce: Str)", "source" => "parseTimeInForce (timeInForce: Str) {\n const timeInForces: Dict = {\n 'GoodTillCancel': 'GTC',\n 'ImmediateOrCancel': 'IOC',\n 'FillOrKill': 'FOK',\n 'PostOnly': 'PO',\n };\n return this.safeString (timeInForces, timeInForce, timeInForce);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"execId\": \"666042b4-50c6-58f3-bd9c-89b2088663ff\",\n \"symbol\": \"ETHUSD\",\n \"price\": \"1162.95\",\n \"size\": \"1\",\n \"side\": \"Sell\",\n \"time\": \"1669191277315\",\n \"isBlockTrade\": false\n }", "{\n \"symbol\": \"QNTUSDT\",\n \"orderId\": \"1538686353240339712\",\n \"orderLinkId\": \"\",\n \"side\": \"Sell\",\n \"orderPrice\": \"\",\n \"orderQty\": \"\",\n \"leavesQty\": \"\",\n \"orderType\": \"Limit\",\n \"stopOrderType\": \"\",\n \"execFee\": \"0.040919\",\n \"execId\": \"2210000000097330907\",\n \"execPrice\": \"98.6\",\n \"execQty\": \"0.415\",\n \"execType\": \"\",\n \"execValue\": \"\",\n \"execTime\": \"1698161716634\",\n \"isMaker\": true,\n \"feeRate\": \"\",\n \"tradeIv\": \"\",\n \"markIv\": \"\",\n \"markPrice\": \"\",\n \"indexPrice\": \"\",\n \"underlyingPrice\": \"\",\n \"blockTradeId\": \"\"\n }", "{\n \"symbol\": \"QNTUSDT\",\n \"orderType\": \"Limit\",\n \"underlyingPrice\": \"\",\n \"orderLinkId\": \"1549452573428424449\",\n \"orderId\": \"1549452573428424448\",\n \"stopOrderType\": \"\",\n \"execTime\": \"1699445151998\",\n \"feeRate\": \"0.00025\",\n \"tradeIv\": \"\",\n \"blockTradeId\": \"\",\n \"markPrice\": \"\",\n \"execPrice\": \"102.8\",\n \"markIv\": \"\",\n \"orderQty\": \"3.652\",\n \"orderPrice\": \"102.8\",\n \"execValue\": \"1.028\",\n \"closedSize\": \"\",\n \"execType\": \"Trade\",\n \"seq\": \"19157444346\",\n \"side\": \"Buy\",\n \"indexPrice\": \"\",\n \"leavesQty\": \"3.642\",\n \"isMaker\": true,\n \"execFee\": \"0.0000025\",\n \"execId\": \"2210000000101610464\",\n \"execQty\": \"0.01\",\n \"nextPageCursor\": \"267951%3A0%2C38567%3A0\"\n },", "{\n \"symbol\": \"ETHPERP\",\n \"orderLinkId\": \"\",\n \"side\": \"Buy\",\n \"orderId\": \"aad0ee44-ce12-4112-aeee-b7829f6c3a26\",\n \"execFee\": \"0.0210\",\n \"feeRate\": \"0.000600\",\n \"blockTradeId\": \"\",\n \"tradeTime\": \"1669196417930\",\n \"execPrice\": \"1162.15\",\n \"lastLiquidityInd\": \"TAKER\",\n \"execValue\": \"34.8645\",\n \"execType\": \"Trade\",\n \"execQty\": \"0.030\",\n \"tradeId\": \"0e94eaf5-b08e-5505-b43f-7f1f30b1ca80\"\n }", "{\n \"category\": \"linear\",\n \"symbol\": \"ICPUSDT\",\n \"execId\": \"3510f361-0add-5c7b-a2e7-9679810944fc\",\n \"execPrice\": \"12.015\",\n \"execQty\": \"3000\",\n \"orderId\": \"443d63fa-b4c3-4297-b7b1-23bca88b04dc\",\n \"isMaker\": false,\n \"orderLinkId\": \"test-00001\",\n \"side\": \"Sell\",\n \"execTime\": \"1716800399334\",\n \"seq\": 34771365464\n }" ], "line_end" => 3220, "line_start" => 2985, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "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" => "order", "value" => "this.safeString (trade, 'orderId')" }, %{ "comment" => nil, "key" => "type", "value" => "orderType" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "price", "value" => "priceString" }, %{ "comment" => nil, "key" => "amount", "value" => "amountString" }, %{ "comment" => nil, "key" => "cost", "value" => "costString" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // public https://bybit-exchange.github.io/docs/v5/market/recent-trade\n //\n // {\n // \"execId\": \"666042b4-50c6-58f3-bd9c-89b2088663ff\",\n // \"symbol\": \"ETHUSD\",\n // \"price\": \"1162.95\",\n // \"size\": \"1\",\n // \"side\": \"Sell\",\n // \"time\": \"1669191277315\",\n // \"isBlockTrade\": false\n // }\n //\n // private trades classic spot https://bybit-exchange.github.io/docs/v5/position/execution\n //\n // {\n // \"symbol\": \"QNTUSDT\",\n // \"orderId\": \"1538686353240339712\",\n // \"orderLinkId\": \"\",\n // \"side\": \"Sell\",\n // \"orderPrice\": \"\",\n // \"orderQty\": \"\",\n // \"leavesQty\": \"\",\n // \"orderType\": \"Limit\",\n // \"stopOrderType\": \"\",\n // \"execFee\": \"0.040919\",\n // \"execId\": \"2210000000097330907\",\n // \"execPrice\": \"98.6\",\n // \"execQty\": \"0.415\",\n // \"execType\": \"\",\n // \"execValue\": \"\",\n // \"execTime\": \"1698161716634\",\n // \"isMaker\": true,\n // \"feeRate\": \"\",\n // \"tradeIv\": \"\",\n // \"markIv\": \"\",\n // \"markPrice\": \"\",\n // \"indexPrice\": \"\",\n // \"underlyingPrice\": \"\",\n // \"blockTradeId\": \"\"\n // }\n //\n // private trades unified https://bybit-exchange.github.io/docs/v5/position/execution\n //\n // {\n // \"symbol\": \"QNTUSDT\",\n // \"orderType\": \"Limit\",\n // \"underlyingPrice\": \"\",\n // \"orderLinkId\": \"1549452573428424449\",\n // \"orderId\": \"1549452573428424448\",\n // \"stopOrderType\": \"\",\n // \"execTime\": \"1699445151998\",\n // \"feeRate\": \"0.00025\",\n // \"tradeIv\": \"\",\n // \"blockTradeId\": \"\",\n // \"markPrice\": \"\",\n // \"execPrice\": \"102.8\",\n // \"markIv\": \"\",\n // \"orderQty\": \"3.652\",\n // \"orderPrice\": \"102.8\",\n // \"execValue\": \"1.028\",\n // \"closedSize\": \"\",\n // \"execType\": \"Trade\",\n // \"seq\": \"19157444346\",\n // \"side\": \"Buy\",\n // \"indexPrice\": \"\",\n // \"leavesQty\": \"3.642\",\n // \"isMaker\": true,\n // \"execFee\": \"0.0000025\",\n // \"execId\": \"2210000000101610464\",\n // \"execQty\": \"0.01\",\n // \"nextPageCursor\": \"267951%3A0%2C38567%3A0\"\n // },\n //\n // private USDC settled trades\n //\n // {\n // \"symbol\": \"ETHPERP\",\n // \"orderLinkId\": \"\",\n // \"side\": \"Buy\",\n // \"orderId\": \"aad0ee44-ce12-4112-aeee-b7829f6c3a26\",\n // \"execFee\": \"0.0210\",\n // \"feeRate\": \"0.000600\",\n // \"blockTradeId\": \"\",\n // \"tradeTime\": \"1669196417930\",\n // \"execPrice\": \"1162.15\",\n // \"lastLiquidityInd\": \"TAKER\",\n // \"execValue\": \"34.8645\",\n // \"execType\": \"Trade\",\n // \"execQty\": \"0.030\",\n // \"tradeId\": \"0e94eaf5-b08e-5505-b43f-7f1f30b1ca80\"\n // }\n //\n // watchMyTrades execution.fast\n //\n // {\n // \"category\": \"linear\",\n // \"symbol\": \"ICPUSDT\",\n // \"execId\": \"3510f361-0add-5c7b-a2e7-9679810944fc\",\n // \"execPrice\": \"12.015\",\n // \"execQty\": \"3000\",\n // \"orderId\": \"443d63fa-b4c3-4297-b7b1-23bca88b04dc\",\n // \"isMaker\": false,\n // \"orderLinkId\": \"test-00001\",\n // \"side\": \"Sell\",\n // \"execTime\": \"1716800399334\",\n // \"seq\": 34771365464\n // }\n //\n // watchMyTrades execution\n //\n // {\n // \"category\": \"linear\",\n // \"symbol\": \"BTCUSDT\",\n // \"closedSize\": \"0\",\n // \"execFee\": \"0.0679239\",\n // \"execId\": \"135dbae5-cbed-5275-9290-3956bb2ed907\",\n // \"execPrice\": \"123498\",\n // \"execQty\": \"0.001\",\n // \"execType\": \"Trade\",\n // \"execValue\": \"123.498\",\n // \"feeRate\": \"0.00055\",\n // \"tradeIv\": \"\",\n // \"markIv\": \"\",\n // \"blockTradeId\": \"\",\n // \"markPrice\": \"122392\",\n // \"indexPrice\": \"\",\n // \"underlyingPrice\": \"\",\n // \"leavesQty\": \"0\",\n // \"orderId\": \"aee7453a-a100-465f-857a-3db780e9329a\",\n // \"orderLinkId\": \"\",\n // \"orderPrice\": \"123615.9\",\n // \"orderQty\": \"0.001\",\n // \"orderType\": \"Market\",\n // \"stopOrderType\": \"UNKNOWN\",\n // \"side\": \"Buy\",\n // \"execTime\": \"1757837580469\",\n // \"isLeverage\": \"0\",\n // \"isMaker\": false,\n // \"seq\": 9517074055,\n // \"marketUnit\": \"\",\n // \"execPnl\": \"0\",\n // \"createType\": \"CreateByUser\",\n // \"extraFees\": [],\n // \"feeCoin\": \"USDT\"\n // }\n //\n const id = this.safeStringN (trade, [ 'execId', 'id', 'tradeId' ]);\n const marketId = this.safeString (trade, 'symbol');\n let marketType = ('createType' in trade) ? 'contract' : 'spot';\n const category = this.safeString (trade, 'category');\n if (category !== undefined) {\n marketType = (category === 'spot') ? 'spot' : 'contract';\n }\n if (market !== undefined) {\n marketType = market['type'];\n }\n market = this.safeMarket (marketId, market, undefined, marketType);\n const symbol = market['symbol'];\n const amountString = this.safeStringN (trade, [ 'execQty', 'orderQty', 'size' ]);\n const priceString = this.safeStringN (trade, [ 'execPrice', 'orderPrice', 'price' ]);\n const costString = this.safeString (trade, 'execValue');\n const timestamp = this.safeIntegerN (trade, [ 'time', 'execTime', 'tradeTime' ]);\n let side = this.safeStringLower (trade, 'side');\n if (side === undefined) {\n const isBuyer = this.safeInteger (trade, 'isBuyer');\n if (isBuyer !== undefined) {\n side = isBuyer ? 'buy' : 'sell';\n }\n }\n const isMaker = this.safeBool (trade, 'isMaker');\n let takerOrMaker = undefined;\n if (isMaker !== undefined) {\n takerOrMaker = isMaker ? 'maker' : 'taker';\n } else {\n let lastLiquidityInd = this.safeString (trade, 'lastLiquidityInd');\n if (lastLiquidityInd === 'UNKNOWN') {\n lastLiquidityInd = undefined;\n }\n if (lastLiquidityInd !== undefined) {\n if ((lastLiquidityInd === 'TAKER') || (lastLiquidityInd === 'MAKER')) {\n takerOrMaker = lastLiquidityInd.toLowerCase ();\n } else {\n takerOrMaker = (lastLiquidityInd === 'AddedLiquidity') ? 'maker' : 'taker';\n }\n }\n }\n let orderType = this.safeStringLower (trade, 'orderType');\n if (orderType === 'unknown') {\n orderType = undefined;\n }\n const feeCostString = this.safeString (trade, 'execFee');\n let fee = undefined;\n if (feeCostString !== undefined) {\n const feeRateString = this.safeString (trade, 'feeRate');\n let feeCurrencyCode = undefined;\n if (market['spot']) {\n if (Precise.stringGt (feeCostString, '0')) {\n if (side === 'buy') {\n feeCurrencyCode = market['base'];\n } else {\n feeCurrencyCode = market['quote'];\n }\n } else {\n if (side === 'buy') {\n feeCurrencyCode = market['quote'];\n } else {\n feeCurrencyCode = market['base'];\n }\n }\n } else {\n feeCurrencyCode = market['inverse'] ? market['base'] : market['settle'];\n }\n fee = {\n 'cost': feeCostString,\n 'currency': this.safeString (trade, 'feeCoin', feeCurrencyCode),\n 'rate': feeRateString,\n };\n }\n return this.safeTrade ({\n 'id': id,\n 'info': trade,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'order': this.safeString (trade, 'orderId'),\n 'type': orderType,\n 'side': side,\n 'takerOrMaker': takerOrMaker,\n 'price': priceString,\n 'amount': amountString,\n 'cost': costString,\n 'fee': fee,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ETHUSDT\",\n \"makerFeeRate\": 0.001,\n \"takerFeeRate\": 0.001\n }" ], "line_end" => 7782, "line_start" => 7763, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (fee, 'makerFeeRate')" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (fee, 'takerFeeRate')" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "tierBased", "value" => "undefined" } ], "name" => "parseTradingFee", "signature" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface", "source" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface {\n //\n // {\n // \"symbol\": \"ETHUSDT\",\n // \"makerFeeRate\": 0.001,\n // \"takerFeeRate\": 0.001\n // }\n //\n const marketId = this.safeString (fee, 'symbol');\n const defaultType = (market !== undefined) ? market['type'] : 'contract';\n const symbol = this.safeSymbol (marketId, market, undefined, defaultType);\n return {\n 'info': fee,\n 'symbol': symbol,\n 'maker': this.safeNumber (fee, 'makerFeeRate'),\n 'taker': this.safeNumber (fee, 'takerFeeRate'),\n 'percentage': undefined,\n 'tierBased': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"USDT\",\n \"chain\": \"TRX\",\n \"amount\": \"12.34\",\n \"txID\": \"de5ea0a2f2e59dc9a714837dd3ddc6d5e151b56ec5d786d351c4f52336f80d3c\",\n \"status\": \"success\",\n \"toAddress\": \"TQdmFKUoe1Lk2iwZuwRJEHJreTUBoN3BAw\",\n \"tag\": \"\",\n \"withdrawFee\": \"0.5\",\n \"createTime\": \"1665144183000\",\n \"updateTime\": \"1665144256000\",\n \"withdrawId\": \"8839035\"\n }", "{\n \"coin\": \"USDT\",\n \"chain\": \"TRX\",\n \"amount\": \"44\",\n \"txID\": \"0b038ea12fa1575e2d66693db3c346b700d4b28347afc39f80321cf089acc960\",\n \"status\": \"3\",\n \"toAddress\": \"TC6NCAC5WSVCCiaD3kWZXyW91ZKKhLm53b\",\n \"tag\": \"\",\n \"depositFee\": \"\",\n \"successAt\": \"1665142507000\",\n \"confirmations\": \"100\",\n \"txIndex\": \"0\",\n \"blockHash\": \"0000000002ac3b1064aee94bca1bd0b58c4c09c65813b084b87a2063d961129e\"\n }", "{\n \"id\": \"9377266\"\n }" ], "line_end" => 6086, "line_start" => 6008, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (transaction, 'id', 'withdrawId')" }, %{ "comment" => nil, "key" => "txid", "value" => "this.safeString (transaction, 'txID')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (this.safeString (transaction, 'chain'))" }, %{ "comment" => nil, "key" => "address", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressTo", "value" => "toAddress" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tag", "value" => "this.safeString (transaction, 'tag')" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (transaction, 'amount')" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "updated", "value" => "updated" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // fetchWithdrawals\n //\n // {\n // \"coin\": \"USDT\",\n // \"chain\": \"TRX\",\n // \"amount\": \"12.34\",\n // \"txID\": \"de5ea0a2f2e59dc9a714837dd3ddc6d5e151b56ec5d786d351c4f52336f80d3c\",\n // \"status\": \"success\",\n // \"toAddress\": \"TQdmFKUoe1Lk2iwZuwRJEHJreTUBoN3BAw\",\n // \"tag\": \"\",\n // \"withdrawFee\": \"0.5\",\n // \"createTime\": \"1665144183000\",\n // \"updateTime\": \"1665144256000\",\n // \"withdrawId\": \"8839035\"\n // }\n //\n // fetchDeposits\n //\n // {\n // \"coin\": \"USDT\",\n // \"chain\": \"TRX\",\n // \"amount\": \"44\",\n // \"txID\": \"0b038ea12fa1575e2d66693db3c346b700d4b28347afc39f80321cf089acc960\",\n // \"status\": \"3\",\n // \"toAddress\": \"TC6NCAC5WSVCCiaD3kWZXyW91ZKKhLm53b\",\n // \"tag\": \"\",\n // \"depositFee\": \"\",\n // \"successAt\": \"1665142507000\",\n // \"confirmations\": \"100\",\n // \"txIndex\": \"0\",\n // \"blockHash\": \"0000000002ac3b1064aee94bca1bd0b58c4c09c65813b084b87a2063d961129e\"\n // }\n //\n // withdraw\n //\n // {\n // \"id\": \"9377266\"\n // }\n //\n const currencyId = this.safeString (transaction, 'coin');\n const code = this.safeCurrencyCode (currencyId, currency);\n const timestamp = this.safeInteger2 (transaction, 'createTime', 'successAt');\n const updated = this.safeInteger (transaction, 'updateTime');\n const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));\n const feeCost = this.safeNumber2 (transaction, 'depositFee', 'withdrawFee');\n const type = ('depositFee' in transaction) ? 'deposit' : 'withdrawal';\n let fee = undefined;\n if (feeCost !== undefined) {\n fee = {\n 'cost': feeCost,\n 'currency': code,\n };\n }\n const toAddress = this.safeString (transaction, 'toAddress');\n return {\n 'info': transaction,\n 'id': this.safeString2 (transaction, 'id', 'withdrawId'),\n 'txid': this.safeString (transaction, 'txID'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'network': this.networkIdToCode (this.safeString (transaction, 'chain')),\n 'address': undefined,\n 'addressTo': toAddress,\n 'addressFrom': undefined,\n 'tag': this.safeString (transaction, 'tag'),\n 'tagTo': undefined,\n 'tagFrom': undefined,\n 'type': type,\n 'amount': this.safeNumber (transaction, 'amount'),\n 'currency': code,\n 'status': status,\n 'updated': updated,\n 'fee': fee,\n 'internal': undefined,\n 'comment': undefined,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 6006, "line_start" => 5988, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: Str)", "source" => "parseTransactionStatus (status: Str) {\n const statuses: Dict = {\n // v3 deposit status\n '0': 'unknown',\n '1': 'pending',\n '2': 'processing',\n '3': 'ok',\n '4': 'fail',\n // v3 withdrawal status\n 'SecurityCheck': 'pending',\n 'Pending': 'pending',\n 'success': 'ok',\n 'CancelByUser': 'canceled',\n 'Reject': 'rejected',\n 'Fail': 'failed',\n 'BlockchainConfirmed': 'ok',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"transferId\": \"22c2bc11-ed5b-49a4-8647-c4e0f5f6f2b2\"\n }", "{\n \"transferId\": \"e9c421c4-b010-4b16-abd6-106179f27702\",\n \"coin\": \"USDT\",\n \"amount\": \"8\",\n \"fromAccountType\": \"FUND\",\n \"toAccountType\": \"SPOT\",\n \"timestamp\": \"1666879426000\",\n \"status\": \"SUCCESS\"\n }" ], "line_end" => 7700, "line_start" => 7662, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transfer" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (transfer, 'transferId')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (transfer, 'amount')" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "fromAccount" }, %{ "comment" => nil, "key" => "toAccount", "value" => "toAccount" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransferStatus (this.safeString (transfer, 'status'))" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry", "source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n //\n // transfer\n //\n // {\n // \"transferId\": \"22c2bc11-ed5b-49a4-8647-c4e0f5f6f2b2\"\n // }\n //\n // fetchTransfers\n //\n // {\n // \"transferId\": \"e9c421c4-b010-4b16-abd6-106179f27702\",\n // \"coin\": \"USDT\",\n // \"amount\": \"8\",\n // \"fromAccountType\": \"FUND\",\n // \"toAccountType\": \"SPOT\",\n // \"timestamp\": \"1666879426000\",\n // \"status\": \"SUCCESS\"\n // }\n //\n const currencyId = this.safeString (transfer, 'coin');\n const timestamp = this.safeInteger (transfer, 'timestamp');\n const fromAccountId = this.safeString (transfer, 'fromAccountType');\n const toAccountId = this.safeString (transfer, 'toAccountType');\n const accountIds = this.safeDict (this.options, 'accountsById', {});\n const fromAccount = this.safeString (accountIds, fromAccountId, fromAccountId);\n const toAccount = this.safeString (accountIds, toAccountId, toAccountId);\n return {\n 'info': transfer,\n 'id': this.safeString (transfer, 'transferId'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'amount': this.safeNumber (transfer, 'amount'),\n 'fromAccount': fromAccount,\n 'toAccount': toAccount,\n 'status': this.parseTransferStatus (this.safeString (transfer, 'status')),\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 7660, "line_start" => 7653, "mappings" => [], "name" => "parseTransferStatus", "signature" => "parseTransferStatus (status: Str): Str", "source" => "parseTransferStatus (status: Str): Str {\n const statuses: Dict = {\n '0': 'ok',\n 'OK': 'ok',\n 'SUCCESS': 'ok',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"period\": 7,\n \"value\": \"0.23854072\",\n \"time\": \"1690574400000\"\n }" ], "line_end" => 8216, "line_start" => 8196, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "volatility" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "volatility", "value" => "this.safeNumber (entry, 'value')" } ], "name" => "parseVolatilityHistory", "signature" => "parseVolatilityHistory (volatility)", "source" => "parseVolatilityHistory (volatility) {\n //\n // {\n // \"period\": 7,\n // \"value\": \"0.23854072\",\n // \"time\": \"1690574400000\"\n // }\n //\n const result = [];\n for (let i = 0; i < volatility.length; i++) {\n const entry = volatility[i];\n const timestamp = this.safeInteger (entry, 'time');\n result.push ({\n 'info': volatility,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'volatility': this.safeNumber (entry, 'value'),\n });\n }\n return result;\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 20, period: 1000, requests: 50, rolling_window_size: 60000 }, raw_endpoints: %{ private: [ %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/order/list" }, %{ auth: false, cost: 0.5, method: :get, path: "/v5/asset/exchange/query-coin-list" }, %{ auth: false, cost: 50, method: :get, path: "/asset/v3/private/transfer/asset-info/query" }, %{ auth: false, cost: 5, method: :get, path: "/v5/account/mmp-state" }, %{ auth: false, cost: 5, method: :get, path: "/v5/fiat/balance-query" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/settlement-record" }, %{ auth: false, cost: 10, method: :get, path: "/v5/asset/deposit/query-sub-member-record" }, %{ auth: false, cost: 50, method: :get, path: "/asset/v3/private/transfer/sub-member/list/query" }, %{ auth: false, cost: 10, method: :get, path: "/asset/v3/private/deposit/record/query" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/execution/list" }, %{ auth: false, cost: 25, method: :get, path: "/v5/asset/transfer/query-universal-transfer-list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/user/get-member-type" }, %{ auth: false, cost: 0.5, method: :get, path: "/v5/asset/exchange/convert-result-query" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/withdraw/withdrawable-amount" }, %{ auth: false, cost: 5, method: :get, path: "/v5/earn/position" }, %{ auth: false, cost: 25, method: :get, path: "/asset/v3/private/transfer/account-coins/balance/query" }, %{ auth: false, cost: 10, method: :get, path: "/v5/broker/asset/query-sub-member-deposit-record" }, %{ auth: false, cost: 5, method: :get, path: "/v5/broker/earning-record" }, %{ auth: false, cost: 5, method: :get, path: "/v5/pre-upgrade/account/transaction-log" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/order/unfilled-orders" }, %{ auth: false, cost: 10, method: :get, path: "/v5/asset/withdraw/query-address" }, %{ auth: false, cost: 1, method: :get, path: "/v5/spot-cross-margin-trade/loan-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/order/history" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/order/unfilled-orders" }, %{ auth: false, cost: 5, method: :get, path: "/v5/user/submembers" }, %{ auth: false, cost: 50, method: :get, path: "/v5/asset/transfer/query-asset-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/pre-upgrade/position/closed-pnl" }, %{ auth: false, cost: 2.5, method: :get, path: "/spot/v3/private/order" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/execution/list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/state" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/order/list" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/position/list" }, %{ auth: false, cost: 0.5, method: :get, path: "/v5/asset/exchange/query-convert-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/position/closed-pnl" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/borrowable-collateralisable-number" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-fixed/renew-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/deposit/query-allowed-list" }, %{ auth: false, cost: 1, method: :get, path: "/v5/spot-cross-margin-trade/account" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-flexible/ongoing-coin" }, %{ auth: false, cost: 25, method: :get, path: "/v2/private/wallet/fund/records" }, %{ auth: false, cost: 5, method: :get, path: "/v5/fiat/query-trade-history" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/position/closed-pnl" }, %{ auth: false, cost: 5, method: :get, path: "/v5/broker/account-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/broker/earnings-info" }, %{ auth: false, cost: 1, method: :get, path: "/v5/account/contract-transaction-log" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/interest-rate-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/fiat/reference-price" }, %{ auth: false, cost: 40, method: :get, path: "/contract/v3/private/copytrading/position/list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/position/move-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/get-auto-repay-mode" }, %{ auth: false, cost: 50, method: :get, path: "/asset/v3/private/transfer/inter-transfer/list/query" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-common/position" }, %{ auth: false, cost: 1, method: :get, path: "/v5/account/instruments-info" }, %{ auth: false, cost: 10, method: :get, path: "/spot/v3/private/margin-ltv" }, %{ auth: false, cost: 1, method: :get, path: "/v5/spot-cross-margin-trade/repay-history" }, %{ auth: false, cost: 10, method: :get, path: "/user/v3/private/frozen-sub-member" }, %{ auth: false, cost: 5, method: :get, path: "/v5/pre-upgrade/execution/list" }, %{ auth: false, cost: 25, method: :get, path: "/asset/v3/private/transfer/universal-transfer/list/query" }, %{ auth: false, cost: 5, method: :get, path: "/v5/order/realtime" }, %{ auth: false, cost: 5, method: :get, path: "/v5/user/aff-customer-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/account/withdrawal" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/adjustment-history" }, %{ auth: false, cost: 28, method: :get, path: "/v5/asset/coin/query-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/withdraw/vasp/list" }, %{ auth: false, cost: 1, method: :get, path: "/user/v3/private/get-member-type" }, %{ auth: false, cost: 2.5, method: :get, path: "/spot/v3/private/my-trades" }, %{ auth: false, cost: 50, method: :get, path: "/v5/asset/transfer/query-transfer-coin-list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/ins-loan/product-infos" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/delivery-record" }, %{ auth: false, cost: 1, method: :get, path: "/v5/account/collateral-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/position/list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/fiat/trade-query" }, %{ auth: false, cost: 10, method: :get, path: "/v5/account/fee-rate" }, %{ auth: false, cost: 5, method: :get, path: "/v5/fiat/query-coin-list" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-fixed/borrow-order-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/coinstate" }, %{ auth: false, cost: 10, method: :get, path: "/spot/v3/private/cross-margin-orders" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/ongoing-orders" }, %{ auth: false, cost: 50, method: :get, path: "/v5/asset/transfer/query-sub-member-list" }, %{ auth: false, cost: 0.17, method: :get, path: "/asset/v3/public/deposit/allowed-deposit-list/query" }, %{ auth: false, cost: 5, method: :get, path: "/v5/earn/yield" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/convert/small-balance-list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/max-borrowable" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/repayment-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/user/query-sub-members" }, %{ auth: false, cost: 25, method: :get, path: "/contract/v3/private/copytrading/wallet/balance" }, %{ auth: false, cost: 10, method: :get, path: "/v5/asset/withdraw/query-record" }, %{ auth: false, cost: 5, method: :get, path: "/user/v3/private/query-api" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/convert/small-balance-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/ins-loan/ensure-tokens-convert" }, %{ auth: false, cost: 10, method: :get, path: "/spot/v3/private/margin-loan-infos" }, %{ auth: false, cost: 1, method: :get, path: "/v5/account/transaction-log" }, %{ auth: false, cost: 5, method: :get, path: "/v5/account/info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/delivery-record" }, %{ auth: false, cost: 50, method: :get, path: "/asset/v3/private/transfer/transfer-coin/list/query" }, %{ auth: false, cost: 5, method: :get, path: "/v5/lending/history-order" }, %{ auth: false, cost: 5, method: :get, path: "/v5/pre-upgrade/asset/delivery-record" }, %{ auth: false, cost: 1, method: :get, path: "/v5/spot-cross-margin-trade/orders" }, %{ auth: false, cost: 1, method: :get, path: "/v5/account/smp-group" }, %{ auth: false, cost: 10, method: :get, path: "/v5/asset/deposit/query-sub-member-address" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/account/fee-rate" }, %{ auth: false, cost: 10, method: :get, path: "/spot/v3/private/cross-margin-repay-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/max-collateral-amount" }, %{ auth: false, cost: 1, method: :get, path: "/v5/account/borrow-history" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/account/wallet/balance" }, %{ auth: false, cost: 2.5, method: :get, path: "/spot/v3/private/open-orders" }, %{ auth: false, cost: 10, method: :get, path: "/asset/v3/private/withdraw/record/query" }, %{ auth: false, cost: 10, method: :get, path: "/spot/v3/private/margin-repaid-infos" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/repayment-available-amount" }, %{ auth: false, cost: 5, method: :get, path: "/v5/ins-loan/ltv-convert" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/position/list" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-fixed/supply-order-info" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/account/borrow-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/instruments-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/earn/order" }, %{ auth: false, cost: 10, method: :get, path: "/asset/v3/private/deposit/address/query" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/account/borrow-rate" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-flexible/repayment-history" }, %{ auth: false, cost: 25, method: :get, path: "/contract/v3/private/position/limit-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/pre-upgrade/order/history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/settlement-record" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/exchange/order-record" }, %{ auth: false, cost: 2.5, method: :get, path: "/spot/v3/private/history-orders" }, %{ auth: false, cost: 25, method: :get, path: "/asset/v3/private/coin-info/query" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/position-tiers" }, %{ auth: false, cost: 1, method: :get, path: "/v5/asset/coin-greeks" }, %{ auth: false, cost: 2.5, method: :get, path: "/spot/v3/private/account" }, %{ auth: false, cost: 5, method: :get, path: "/v5/asset/deposit/query-internal-record" }, %{ auth: false, cost: 50, method: :get, path: "/v5/asset/transfer/query-inter-transfer-list" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-fixed/borrow-contract-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/user/del-submember" }, %{ auth: false, cost: 50, method: :get, path: "/asset/v3/private/transfer/sub-member-transfer/list/query" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/account/info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/affiliate/aff-user-list" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/account/wallet/balance" }, %{ auth: false, cost: 5, method: :get, path: "/v5/user/query-api" }, %{ auth: false, cost: 2.5, method: :get, path: "/spot/v3/private/reference" }, %{ auth: false, cost: 10, method: :get, path: "/v5/asset/deposit/query-record" }, %{ auth: false, cost: 5, method: :get, path: "/v5/earn/product" }, %{ auth: false, cost: 50, method: :get, path: "/v5/asset/transfer/query-account-coin-balance" }, %{ auth: false, cost: 10, method: :get, path: "/spot/v3/private/cross-margin-account" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-fixed/repayment-history" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-common/adjustment-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/borrow-history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/ins-loan/repaid-history" }, %{ auth: false, cost: 2.5, method: :get, path: "/spot/v3/private/record" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-fixed/supply-contract-info" }, %{ auth: false, cost: 5, method: :get, path: "/user/v3/private/query-sub-members" }, %{ auth: false, cost: 1, method: :get, path: "/unified/v3/private/account/transaction-log" }, %{ auth: false, cost: 5, method: :get, path: "/v5/earn/hourly-yield" }, %{ auth: false, cost: 5, method: :get, path: "/v5/user/sub-apikeys" }, %{ auth: false, cost: 1, method: :get, path: "/v5/order/spot-borrow-check" }, %{ auth: false, cost: 5, method: :get, path: "/v5/ins-loan/loan-order" }, %{ auth: false, cost: 1, method: :get, path: "/v5/spot-lever-token/order-record" }, %{ auth: false, cost: 50, method: :get, path: "/asset/v3/private/transfer/account-coin/balance/query" }, %{ auth: false, cost: 30, method: :get, path: "/contract/v3/private/copytrading/order/list" }, %{ auth: false, cost: 10, method: :get, path: "/spot/v3/private/cross-margin-loan-info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/lending/account" }, %{ auth: false, cost: 5, method: :get, path: "/v5/execution/list" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-common/max-collateral-amount" }, %{ auth: false, cost: 25, method: :get, path: "/v5/asset/transfer/query-account-coins-balance" }, %{ auth: false, cost: 5, method: :get, path: "/v5/pre-upgrade/asset/settlement-record" }, %{ auth: false, cost: 10, method: :get, path: "/v5/asset/deposit/query-address" }, %{ auth: false, cost: 1, method: :get, path: "/v5/account/wallet-balance" }, %{ auth: false, cost: 5, method: :get, path: "/v5/lending/info" }, %{ auth: false, cost: 10, method: :get, path: "/v5/crypto-loan-flexible/borrow-history" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/private/account/wallet/fund-records" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-fixed/borrow" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/position/set-leverage" }, %{ auth: false, cost: 5, method: :post, path: "/v5/broker/award/distribution-record" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/demo-apply-money" }, %{ auth: false, cost: 2.5, method: :post, path: "/v5/spot-cross-margin-trade/switch" }, %{ auth: false, cost: 40, method: :post, path: "/contract/v3/private/copytrading/position/set-leverage" }, %{ auth: false, cost: 150, method: :post, path: "/asset/v3/private/transfer/sub-member-transfer" }, %{ auth: false, cost: 5, method: :post, path: "/v5/broker/award/info" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/position/switch-isolated" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/set-leverage" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/switch-isolated" }, %{ auth: false, cost: 5, method: :post, path: "/v5/ins-loan/association-uid" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-flexible/borrow" }, %{ auth: false, cost: 5, method: :post, path: "/v5/crypto-loan/borrow" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-fixed/fully-repay" }, %{ auth: false, cost: 10, method: :post, path: "/spot/v3/private/cross-margin-repay" }, %{ auth: false, cost: 2.5, method: :post, path: "/spot/v3/private/order" }, %{ auth: false, cost: 5, method: :post, path: "/v5/broker/award/distribute-award" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-flexible/repay-collateral" }, %{ auth: false, cost: 10, method: :post, path: "/v5/user/create-sub-api" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/no-convert-repay" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-fixed/supply" }, %{ auth: false, cost: 2.5, method: :post, path: "/spot/v3/private/cancel-orders" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/mmp-reset" }, %{ auth: false, cost: 30, method: :post, path: "/contract/v3/private/copytrading/order/create" }, %{ auth: false, cost: 2.5, method: :post, path: "/unified/v3/private/account/setMarginMode" }, %{ auth: false, cost: 10, method: :post, path: "/v5/user/create-sub-member" }, %{ auth: false, cost: 5, method: :post, path: "/v5/spot-margin-trade/switch-mode" }, %{ auth: false, cost: 2.5, method: :post, path: "/unified/v3/private/position/set-leverage" }, %{ auth: false, cost: 2.5, method: :post, path: "/v5/spot-lever-token/redeem" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/position/trading-stop" }, %{ auth: false, cost: 10, method: :post, path: "/user/v3/private/update-api" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/trading-stop" }, %{ auth: false, cost: 50, method: :post, path: "/asset/v3/private/withdraw/cancel" }, %{ auth: false, cost: 50, method: :post, path: "/fht/compliance/tax/v3/private/status" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/position/set-risk-limit" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/order/cancel-all" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/move-positions" }, %{ auth: false, cost: 2.5, method: :post, path: "/unified/v3/private/position/set-risk-limit" }, %{ auth: false, cost: 5, method: :post, path: "/v5/crypto-loan/adjust-ltv" }, %{ auth: false, cost: 5, method: :post, path: "/v5/spot-margin-trade/set-leverage" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/set-tpsl-mode" }, %{ auth: false, cost: 30, method: :post, path: "/unified/v3/private/order/replace-batch" }, %{ auth: false, cost: 50, method: :post, path: "/v5/order/cancel-all" }, %{ auth: false, cost: 10, method: :post, path: "/v5/fiat/trade-execute" }, %{ auth: false, cost: 1, method: :post, path: "/v5/asset/exchange/convert-execute" }, %{ auth: false, cost: 30, method: :post, path: "/unified/v3/private/order/cancel-batch" }, %{ auth: false, cost: 30, method: :post, path: "/unified/v3/private/order/create-batch" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/set-margin-mode" }, %{ auth: false, cost: 10, method: :post, path: "/asset/v3/private/transfer/universal-transfer" }, %{ auth: false, cost: 5, method: :post, path: "/v5/ins-loan/repay-loan" }, %{ auth: false, cost: 2.5, method: :post, path: "/spot/v3/private/cancel-order" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/borrow" }, %{ auth: false, cost: 5, method: :post, path: "/v5/lending/purchase" }, %{ auth: false, cost: 2.5, method: :post, path: "/v5/order/create" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/switch-mode" }, %{ auth: false, cost: 5, method: :post, path: "/v5/order/amend" }, %{ auth: false, cost: 5, method: :post, path: "/v5/asset/deposit/deposit-to-account" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/position/switch-tpsl-mode" }, %{ auth: false, cost: 5, method: :post, path: "/v5/earn/place-order" }, %{ auth: false, cost: 10, method: :post, path: "/v5/crypto-loan-common/max-loan" }, %{ auth: false, cost: 10, method: :post, path: "/user/v3/private/create-sub-api" }, %{ auth: false, cost: 10, method: :post, path: "/v5/asset/transfer/universal-transfer" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-common/adjust-ltv" }, %{ auth: false, cost: 10, method: :post, path: "/v5/user/update-api" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/upgrade-to-uta" }, %{ auth: false, cost: 5, method: :post, path: "/v5/order/disconnected-cancel-all" }, %{ auth: false, cost: 2.5, method: :post, path: "/v5/spot-cross-margin-trade/repay" }, %{ auth: false, cost: 2.5, method: :post, path: "/unified/v3/private/position/trading-stop" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/order/replace" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/order/cancel" }, %{ auth: false, cost: 10, method: :post, path: "/v5/asset/covert/small-balance-execute" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/v3/private/copytrading/order/trading-stop" }, %{ auth: false, cost: 50, method: :post, path: "/v5/asset/transfer/inter-transfer" }, %{ auth: false, cost: 30, method: :post, path: "/unified/v3/private/order/cancel" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-fixed/borrow-order-cancel" }, %{ auth: false, cost: 5, method: :post, path: "/v5/spot-margin-trade/set-auto-repay-mode" }, %{ auth: false, cost: 5, method: :post, path: "/v5/crypto-loan/repay" }, %{ auth: false, cost: 5, method: :post, path: "/v5/order/create-batch" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-fixed/supply-order-cancel" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/repay" }, %{ auth: false, cost: 2.5, method: :post, path: "/unified/v3/private/position/tpsl/switch-mode" }, %{ auth: false, cost: 10, method: :post, path: "/user/v3/private/create-sub-member" }, %{ auth: false, cost: 30, method: :post, path: "/contract/v3/private/copytrading/order/cancel" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/set-collateral-switch-batch" }, %{ auth: false, cost: 2.5, method: :post, path: "/spot/v3/private/redeem" }, %{ auth: false, cost: 300, method: :post, path: "/asset/v3/private/withdraw/create" }, %{ auth: false, cost: 2.5, method: :post, path: "/spot/v3/private/cancel-orders-by-ids" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-fixed/renew" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/mmp-modify" }, %{ auth: false, cost: 2.5, method: :post, path: "/v5/order/cancel" }, %{ auth: false, cost: 10, method: :post, path: "/v5/user/delete-api" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-fixed/repay-collateral" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/set-collateral-switch" }, %{ auth: false, cost: 150, method: :post, path: "/asset/v3/private/transfer/transfer-sub-member-save" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/set-auto-add-margin" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/add-margin" }, %{ auth: false, cost: 1, method: :post, path: "/v5/asset/exchange/quote-apply" }, %{ auth: false, cost: 10, method: :post, path: "/v5/user/frozen-sub-member" }, %{ auth: false, cost: 5, method: :post, path: "/v5/lending/redeem-cancel" }, %{ auth: false, cost: 2.5, method: :post, path: "/v5/spot-lever-token/purchase" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/account/setMarginMode" }, %{ auth: false, cost: 40, method: :post, path: "/contract/v3/private/copytrading/position/close" }, %{ auth: false, cost: 10, method: :post, path: "/user/v3/private/delete-api" }, %{ auth: false, cost: 2.5, method: :post, path: "/v5/spot-cross-margin-trade/loan" }, %{ auth: false, cost: 5, method: :post, path: "/v5/order/amend-batch" }, %{ auth: false, cost: 30, method: :post, path: "/unified/v3/private/order/cancel-all" }, %{ auth: false, cost: 50, method: :post, path: "/v5/asset/withdraw/create" }, %{ auth: false, cost: 10, method: :post, path: "/user/v3/private/update-sub-api" }, %{ auth: false, cost: 150, method: :post, path: "/asset/v3/private/transfer/inter-transfer" }, %{ auth: false, cost: 50, method: :post, path: "/fht/compliance/tax/v3/private/registertime" }, %{ auth: false, cost: 150, method: :post, path: "/v5/asset/transfer/save-transfer-sub-member" }, %{ auth: false, cost: 30, method: :post, path: "/contract/v3/private/copytrading/order/close" }, %{ auth: false, cost: 10, method: :post, path: "/v5/fiat/quote-apply" }, %{ auth: false, cost: 10, method: :post, path: "/v5/asset/covert/get-quote" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/quick-repayment" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/order/create" }, %{ auth: false, cost: 30, method: :post, path: "/unified/v3/private/order/replace" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/position/switch-mode" }, %{ auth: false, cost: 50, method: :post, path: "/fht/compliance/tax/v3/private/url" }, %{ auth: false, cost: 2.5, method: :post, path: "/unified/v3/private/account/upgrade-unified-account" }, %{ auth: false, cost: 10, method: :post, path: "/v5/user/update-sub-api" }, %{ auth: false, cost: 50, method: :post, path: "/v5/crypto-loan-flexible/repay" }, %{ auth: false, cost: 10, method: :post, path: "/v5/user/delete-sub-api" }, %{ auth: false, cost: 5, method: :post, path: "/v5/order/cancel-batch" }, %{ auth: false, cost: 25, method: :post, path: "/contract/v3/private/copytrading/wallet/transfer" }, %{ auth: false, cost: 1, method: :post, path: "/contract/v3/private/position/set-auto-add-margin" }, %{ auth: false, cost: 50, method: :post, path: "/fht/compliance/tax/v3/private/create" }, %{ auth: false, cost: 30, method: :post, path: "/unified/v3/private/order/create" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/set-risk-limit" }, %{ auth: false, cost: 2.5, method: :post, path: "/spot/v3/private/purchase" }, %{ auth: false, cost: 5, method: :post, path: "/v5/account/set-hedging-mode" }, %{ auth: false, cost: 50, method: :post, path: "/v5/asset/withdraw/cancel" }, %{ auth: false, cost: 10, method: :post, path: "/spot/v3/private/cross-margin-loan" }, %{ auth: false, cost: 5, method: :post, path: "/v5/lending/redeem" }, %{ auth: false, cost: 5, method: :post, path: "/v5/position/confirm-pending-mmr" }, %{ auth: false, cost: 10, method: :post, path: "/user/v3/private/delete-sub-api" } ], public: [ %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/order-book/L2" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/account-ratio" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/time" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/server-time" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/risk-limit" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-cross-margin-trade/data" }, %{ auth: false, cost: 1, method: :get, path: "/contract/v3/public/copytrading/symbol/list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-lever-token/reference" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/orderbook" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/risk-limit/list" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/insurance" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/recent-trade" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/loanable-data" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/data" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/tickers" }, %{ auth: false, cost: 5, method: :get, path: "/v5/ins-loan/product-infos" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan-common/loanable-data" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/historical-volatility" }, %{ auth: false, cost: 5, method: :get, path: "/v5/announcements/index" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/kline" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-cross-margin-trade/pledge-token" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/mark-price-kline" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/funding/history-funding-rate" }, %{ auth: false, cost: 5, method: :get, path: "/v5/ins-loan/ensure-tokens-convert" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/tickers" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/quote/ticker/price" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/quote/kline" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/symbols" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-lever-token/info" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/funding/history" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/open-interest" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/premium-index-price-kline" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan/collateral-data" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-margin-trade/collateral" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/margin-product-infos" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/quote/ticker/24hr" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/infos" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/instruments-info" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/open-interest" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan-common/collateral-data" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/index-price-kline" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/margin-ensure-tokens" }, %{ auth: false, cost: 1, method: :get, path: "/v3/public/time" }, %{ auth: false, cost: 5, method: :get, path: "/v5/spot-cross-margin-trade/borrow-token" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan-fixed/supply-order-quote" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/delivery-price" }, %{ auth: false, cost: 5, method: :get, path: "/v5/crypto-loan-fixed/borrow-order-quote" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/mark-price-kline" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/quote/ticker/bookTicker" }, %{ auth: false, cost: 5, method: :get, path: "/v5/earn/product" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/quote/trades" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/insurance" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/index-price-kline" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/quote/depth/merged" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/recent-trade" }, %{ auth: false, cost: 5, method: :get, path: "/v5/market/kline" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/delivery-price" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v3/public/quote/depth" }, %{ auth: false, cost: 1, method: :get, path: "/derivatives/v3/public/instruments-info" } ] }, required_credentials: %{ api_key: true, password: false, secret: true, uid: false }, requires_eddsa: false, response_error: %{ code_field: "retCode", field: "retCode", message_field: "retMsg", success_values: [ "0" ], type: :success_code }, signing: %{ api_key_header: "X-BAPI-API-KEY", broker_config: %{ header: "Referer", option_key: "brokerId" }, confidence: :high, pattern: :hmac_sha256_headers, recv_window: 5000, recv_window_header: "X-BAPI-RECV-WINDOW", signature_encoding: :hex, signature_header: "X-BAPI-SIGN", timestamp_header: "X-BAPI-TIMESTAMP", uses_recv_window: true }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ future: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 1, expiry: 1772784000000, expiry_datetime: "2026-03-06T08:00:00.000Z", id: "BTCUSDT-06MAR26", inverse: false, limits: %{ "amount" => %{ "max" => 10, "min" => 0.001 }, "cost" => %{}, "leverage" => %{ "max" => 50, "min" => 1 }, "price" => %{ "max" => 1999999.8, "min" => 0.1 } }, linear: true, maker: 0.0001, precision: %{ "amount" => 0.001, "price" => 0.1 }, quote: "USDT", quote_id: "USDT", separator: "-", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT-260306", taker: 0.0006 }, option: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 1, expiry: 1798185600000, expiry_datetime: "2026-12-25T08:00:00.000Z", id: "BTC-25DEC26-67000-P-USDT", inverse: false, limits: %{ "amount" => %{ "max" => 500, "min" => 0.01 }, "cost" => %{}, "leverage" => %{}, "price" => %{ "max" => 1110000, "min" => 5 } }, linear: true, maker: 0.0001, precision: %{ "amount" => 0.01, "price" => 5 }, quote: "USDT", quote_id: "USDT", separator: "-", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT-261225-67000-P", taker: 0.0006 }, precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 230, "min" => 1.0e-6 }, "cost" => %{ "max" => 8000000, "min" => 5 }, "price" => %{} }, sample_precision: %{ "amount" => 1.0e-6, "price" => 0.1 }, spot: %{ base: "BTC", base_id: "BTC", case: :upper, contract: false, id: "BTCUSDT", limits: %{ "amount" => %{ "max" => 230, "min" => 1.0e-6 }, "cost" => %{ "max" => 8000000, "min" => 5 }, "leverage" => %{ "min" => 1 }, "price" => %{} }, maker: 0.001, precision: %{ "amount" => 1.0e-6, "price" => 0.1 }, quote: "USDT", quote_id: "USDT", separator: "", symbol: "BTC/USDT", taker: 0.001 }, swap: %{ base: "0G", base_id: "0G", case: :upper, contract: true, contract_size: 1, id: "0GUSDT", inverse: false, limits: %{ "amount" => %{ "max" => 350000, "min" => 0.1 }, "cost" => %{}, "leverage" => %{ "max" => 50, "min" => 1 }, "price" => %{ "max" => 1999.9998, "min" => 0.0001 } }, linear: true, maker: 0.0001, precision: %{ "amount" => 0.1, "price" => 0.0001 }, quote: "USDT", quote_id: "USDT", separator: "", settle: "USDT", settle_id: "USDT", symbol: "0G/USDT:USDT", taker: 0.0006 } }, symbol_patterns: %{ future: %{ case: :upper, component_order: [ :base, :quote, :date ], date_format: :ddmmmyy, pattern: :future_ddmmmyy, separator: "-", suffix: nil }, option: %{ case: :upper, component_order: [ :base, :date, :strike, :type ], date_format: :ddmmmyy, pattern: :option_with_settle, separator: "-", suffix: "-USDT" }, spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :no_separator_upper, separator: "", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, separator: "", suffix: nil } }, timeframes: %{ "12h" => "720", "15m" => "15", "1M" => "M", "1d" => "D", "1h" => "60", "1m" => "1", "1w" => "W", "2h" => "120", "30m" => "30", "3m" => "3", "4h" => "240", "5m" => "5", "6h" => "360" }, url_strategy: %{ detected_from: "api_structure", note: "paths_already_versioned", pattern: :version_in_path, prefix: nil }, urls: %{ api: "https://api.bybit.com", api_sections: %{ "futures" => "https://api.bybit.com", "private" => "https://api.bybit.com", "public" => "https://api.bybit.com", "spot" => "https://api.bybit.com", "v2" => "https://api.bybit.com" }, doc: [ "https://bybit-exchange.github.io/docs/inverse/", "https://bybit-exchange.github.io/docs/linear/", "https://github.com/bybit-exchange" ], other: nil, sandbox: %{ "futures" => "https://api-testnet.bybit.com", "private" => "https://api-testnet.bybit.com", "public" => "https://api-testnet.bybit.com", "spot" => "https://api-testnet.bybit.com", "v2" => "https://api-testnet.bybit.com" }, www: "https://www.bybit.com" }, version: "v5", ws: %{ auth: %{ algorithm: :sha256, encoding: :hex, expires_offset_ms: 10000, market_specific: false, message_format: :op_args, op_field: "op", op_value: "auth", pattern: :direct_hmac_expiry, payload_format: "GET/realtime{expires}", requires_passphrase: false, timestamp_unit: :milliseconds }, channel_templates: %{ watch_balance: %{ auth_required: true, market_id_format: :native, params: [], pattern: :topic_based, separator: ".", topic_dict: %{ "spot" => "outboundAccountInfo", "unified" => "wallet" }, url_patterns: [ %{ account_type: "spot", pattern: "spot" }, %{ account_type: "unified", pattern: "v5/private" }, %{ account_type: "usdc", pattern: nil } ], url_routed: true }, watch_bids_asks: %{ channel_name: "orderbook", market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_liquidations: %{ channel_name: "allLiquidation", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_my_trades: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: ".", topic_dict: %{ "spot" => "ticketInfo", "unified" => "execution", "usdc" => "user.openapi.perp.trade" }, url_patterns: [ %{ account_type: "spot", pattern: "spot" }, %{ account_type: "unified", pattern: "v5/private" }, %{ account_type: "usdc", pattern: nil } ], url_routed: true }, watch_ohlcv: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_ohlcv_for_symbols: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book: %{ channel_name: "orderbook", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book_for_symbols: %{ channel_name: "orderbook", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_orders: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: ".", topic_dict: %{ "spot" => [ "order", "stopOrder" ], "unified" => [ "order" ], "usdc" => [ "user.openapi.perp.order" ] }, url_patterns: [ %{ account_type: "spot", pattern: "spot" }, %{ account_type: "unified", pattern: "v5/private" }, %{ account_type: "usdc", pattern: nil } ], url_routed: true }, watch_positions: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_ticker: %{ channel_name: "tickers", market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_tickers: %{ channel_name: "tickers", market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_topics: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_trades: %{ channel_name: "publicTrade", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_trades_for_symbols: %{ channel_name: "publicTrade", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." } }, demo_urls: %{ "private" => %{ "contract" => "wss://stream-demo.{hostname}/v5/private", "spot" => %{ "nonUnified" => "wss://stream-demo.{hostname}/spot/private/v3", "unified" => "wss://stream-demo.{hostname}/v5/private" }, "trade" => "wss://stream-demo.bybit.com/v5/trade", "usdc" => "wss://stream-demo.{hostname}/trade/option/usdc/private/v1" }, "public" => %{ "inverse" => "wss://stream.{hostname}/v5/public/inverse", "linear" => "wss://stream.{hostname}/v5/public/linear", "option" => "wss://stream.{hostname}/v5/public/option", "spot" => "wss://stream.{hostname}/v5/public/spot" } }, has: %{ watch_balance: true, watch_bids_asks: true, watch_liquidations: true, watch_liquidations_for_symbols: false, watch_my_liquidations: false, watch_my_liquidations_for_symbols: false, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: 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: "bybit.com", message_patterns: [ %{ args_field: "args", format: :op, keys: [ "args", "op" ], kind_field: "op", kind_value: "auth", sources: [ :send, :watch ] }, %{ format: :op, id_field: "req_id", keys: [ "op", "req_id" ], kind_field: "op", kind_value: "ping", sources: [ :ping ] }, %{ args_field: "args", format: :op, id_field: "req_id", keys: [ "args", "callerMethodName", "op", "req_id" ], kind_field: "op", kind_value: "subscribe", sources: [ :send, :watch_multiple ] }, %{ args_field: "args", format: :op, id_field: "req_id", keys: [ "args", "op", "req_id" ], kind_field: "op", kind_value: "subscribe", sources: [ :send, :watch_multiple ] }, %{ args_field: "args", format: :op, id_field: "req_id", keys: [ "args", "callerMethodName", "op", "req_id" ], kind_field: "op", kind_value: "unsubscribe", sources: [ :send, :watch_multiple ] }, %{ args_field: "args", format: :op, id_field: "req_id", keys: [ "args", "op", "req_id" ], kind_field: "op", kind_value: "unsubscribe", sources: [ :send, :watch_multiple ] } ], options: %{ "watchMyTrades" => %{ "filterExecTypes" => [ "Trade", "AdlTrade", "BustTrade", "Settle" ] }, "watchPositions" => %{ "awaitPositionsSnapshot" => true, "fetchPositionsSnapshot" => true }, "watchTicker" => %{ "name" => "tickers" } }, streaming: %{ keep_alive: 18000 }, subscription_config: %{ args_field: "args", args_format: :string_list, market_id_format: :native, op_field: "op", separator: "." }, subscription_pattern: :op_subscribe, test_urls: %{ "private" => %{ "contract" => "wss://stream-testnet.{hostname}/v5/private", "spot" => %{ "nonUnified" => "wss://stream-testnet.{hostname}/spot/private/v3", "unified" => "wss://stream-testnet.{hostname}/v5/private" }, "trade" => "wss://stream-testnet.bybit.com/v5/trade", "usdc" => "wss://stream-testnet.{hostname}/trade/option/usdc/private/v1" }, "public" => %{ "inverse" => "wss://stream-testnet.{hostname}/v5/public/inverse", "linear" => "wss://stream-testnet.{hostname}/v5/public/linear", "option" => "wss://stream-testnet.{hostname}/v5/public/option", "spot" => "wss://stream-testnet.{hostname}/v5/public/spot" } }, urls: %{ "private" => %{ "contract" => "wss://stream.{hostname}/v5/private", "spot" => %{ "nonUnified" => "wss://stream.{hostname}/spot/private/v3", "unified" => "wss://stream.{hostname}/v5/private" }, "trade" => "wss://stream.bybit.com/v5/trade", "usdc" => "wss://stream.{hostname}/trade/option/usdc/private/v1" }, "public" => %{ "inverse" => "wss://stream.{hostname}/v5/public/inverse", "linear" => "wss://stream.{hostname}/v5/public/linear", "option" => "wss://stream.{hostname}/v5/public/option", "spot" => "wss://stream.{hostname}/v5/public/spot" } }, watch_methods: [ "watchBalance", "watchBidsAsks", "watchLiquidations", "watchMyTrades", "watchOHLCV", "watchOHLCVForSymbols", "watchOrderBook", "watchOrderBookForSymbols", "watchOrders", "watchPositions", "watchTicker", "watchTickers", "watchTopics", "watchTrades", "watchTradesForSymbols" ] } }