# Bitget Exchange Specification # # Auto-generated by: mix ccxt.extract bitget # CCXT version: 4.5.42 # Spec format version: 2 # # Review before use: # - signing: Detected from sign() method, verify with testnet # - endpoints: Raw paths extracted, map to unified API as needed # - exceptions: Extracted (exact, broad, HTTP status codes) # - features/options: Extracted from describe() # - classification: Set to :supported initially, promote after validation # %{ api_param_requirements: nil, certified: true, classification: :certified_pro, comment: nil, countries: [ "SG" ], currencies: %{}, currency_aliases: %{ "APX" => "AstroPepeX", "BCHSV" => "BSV", "DEGEN" => "DegenReborn", "EVA" => "Evadore", "JADE" => "Jade Protocol", "OMNI" => "omni", "TONCOIN" => "TON", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 70, "coveragePercent" => 100, "enabledMethods" => 78, "excluded" => [ %{ "method" => "fetchDepositWithdrawFee", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchPositionHistory", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 2, "extractableMethods" => 76, "failures" => [ %{ "error" => "bitget createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument", "method" => "createMarketOrder" }, %{ "error" => "bitget createOrder() bitget stopLoss or takeProfit orders must be market orders", "method" => "createStopLossOrder" }, %{ "error" => "bitget createOrder() bitget stopLoss or takeProfit orders must be market orders", "method" => "createTakeProfitOrder" }, %{ "error" => "bitget createOrder() bitget trailing orders must be market orders", "method" => "createTrailingPercentOrder" }, %{ "error" => "bitget fetchMyLiquidations() supports spot margin markets only", "method" => "fetchMyLiquidations" }, %{ "error" => "bitget createConvertTrade() requires a price parameter", "method" => "createConvertTrade" } ] }, endpoints: [ %{ api_section: "private/margin", auth: true, cost: 2, expects: :single, market_type: :spot, method: :post, name: :borrow_cross_margin, param_mappings: %{ "amount" => "borrowAmount", "code" => "coin" }, params: [ :code, :amount ], path: "/v2/margin/crossed/account/borrow", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/margin", auth: true, cost: 2, expects: :single, market_type: :spot, method: :post, name: :borrow_isolated_margin, param_mappings: %{ "amount" => "borrowAmount", "code" => "coin" }, params: [ :symbol, :code, :amount ], path: "/v2/margin/isolated/account/borrow", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 4, expects: :list, market_type: :spot, method: :post, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/v2/spot/trade/cancel-symbol-order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, expects: :single, market_type: :spot, method: :post, name: :cancel_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/v2/spot/trade/cancel-order", response_transformer: {:extract_path_unwrap, ["data", "successList"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "orderIdList" => [ %{ "orderId" => "test-order-id" } ], "productType" => "USDT-FUTURES" }, expects: :list, market_type: :spot, method: :post, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/v2/mix/order/batch-cancel-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "force" => "GTC", "orderType" => "limit" }, expects: :single, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :side, :amount, :price ], path: "/v2/spot/trade/place-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "force" => "GTC", "orderType" => "market", "side" => "buy" }, expects: :single, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{ "cost" => "size" }, params: [ :symbol, :cost ], path: "/v2/spot/trade/place-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "force" => "GTC" }, expects: :single, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "size", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/v2/spot/trade/place-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "force" => "GTC", "marginCoin" => "USDT", "marginMode" => "crossed", "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :post, name: :create_order_with_take_profit_and_stop_loss, param_mappings: %{ "amount" => "size", "stopLoss" => "presetStopLossPrice", "takeProfit" => "presetStopSurplusPrice", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfit, :stopLoss ], path: "/v2/mix/order/place-order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 20, default_params: %{ "marginCoin" => "USDT", "marginMode" => "crossed", "orderList" => [ %{ "force" => "GTC", "marginCoin" => "USDT", "marginMode" => "crossed", "orderType" => "limit", "price" => "50000", "productType" => "USDT-FUTURES", "side" => "buy", "size" => "0.001", "symbol" => "BTCUSDT" } ], "productType" => "USDT-FUTURES", "symbol" => "BTCUSDT" }, expects: :list, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/v2/mix/order/batch-place-order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "force" => "post_only" }, expects: :single, market_type: :spot, method: :post, name: :create_post_only_order, param_mappings: %{ "amount" => "size", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/v2/spot/trade/place-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "force" => "GTC", "marginCoin" => "USDT", "marginMode" => "crossed", "orderType" => "limit", "planType" => "normal_plan", "productType" => "USDT-FUTURES", "triggerDirection" => "below", "triggerType" => "mark_price" }, expects: :single, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/v2/mix/order/place-plan-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "force" => "GTC", "marginCoin" => "USDT", "marginMode" => "crossed", "orderType" => "market", "planType" => "normal_plan", "productType" => "USDT-FUTURES", "triggerDirection" => "below", "triggerType" => "mark_price" }, expects: :single, market_type: :swap, method: :post, name: :create_stop_market_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :side, :amount, :triggerPrice ], path: "/v2/mix/order/place-plan-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "force" => "GTC", "marginCoin" => "USDT", "marginMode" => "crossed", "planType" => "normal_plan", "productType" => "USDT-FUTURES", "triggerDirection" => "below", "triggerType" => "mark_price" }, expects: :single, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "size", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/v2/mix/order/place-plan-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "force" => "GTC", "marginCoin" => "USDT", "marginMode" => "crossed", "planType" => "normal_plan", "productType" => "USDT-FUTURES", "triggerDirection" => "below", "triggerType" => "mark_price" }, expects: :single, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "size", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/v2/mix/order/place-plan-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, expects: :single, market_type: :spot, method: :post, name: :edit_order, param_mappings: %{ "amount" => "size", "id" => "orderId", "type" => "orderType" }, params: [ :id, :symbol, :type, :side, :amount, :price ], path: "/v2/spot/trade/cancel-replace-order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ _by_market_type: %{ spot: %{}, swap: %{ "productType" => "USDT-FUTURES" } } }, expects: :single, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/v2/spot/account/assets", response_transformer: {:extract_path_unwrap, ["data", "assets"]}, source: :intercepted }, %{ api_section: "private/margin", auth: true, cost: 2, expects: :list, market_type: :spot, method: :get, name: :fetch_borrow_interest, pagination: %{ cursor_received: "minId", cursor_sent: "idLessThan", style: :cursor }, param_mappings: %{ "code" => "coin", "since" => "startTime" }, params: [ :code, :symbol, :since, :limit ], path: "/v2/margin/crossed/interest-history", response_transformer: {:extract_path, ["data", "resultList"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 1, default_params: %{ _by_market_type: %{ spot: %{}, swap: %{ "productType" => "USDT-FUTURES" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_canceled_and_closed_orders, pagination: %{ cursor_received: "cursor", cursor_sent: "cursor", style: :cursor }, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v2/spot/trade/history-orders", response_transformer: {:extract_path, ["data", "list"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 1, default_params: %{ _by_market_type: %{ spot: %{}, swap: %{ "productType" => "USDT-FUTURES" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_canceled_orders, pagination: %{ style: :cursor }, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v2/spot/trade/history-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 1, default_params: %{ _by_market_type: %{ spot: %{}, swap: %{ "productType" => "USDT-FUTURES" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_closed_orders, pagination: %{ style: :cursor }, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v2/spot/trade/history-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/convert", auth: true, cost: 2, expects: :list, market_type: :spot, method: :get, name: :fetch_convert_currencies, param_mappings: %{}, params: [], path: "/v2/convert/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/convert", auth: true, cost: 2, expects: :single, market_type: :spot, method: :get, name: :fetch_convert_quote, param_mappings: %{ "amount" => "fromCoinSize", "fromCode" => "fromCoin", "toCode" => "toCoin" }, params: [ :fromCode, :toCode, :amount ], path: "/v2/convert/quoted-price", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/convert", auth: true, cost: 2, default_params: %{ "endTime" => "" }, expects: :list, market_type: :spot, method: :get, name: :fetch_convert_trade_history, param_mappings: %{ "since" => "startTime" }, params: [ :code, :since, :limit ], path: "/v2/convert/convert-record", response_transformer: {:extract_path, ["data", "dataList"]}, source: :intercepted }, %{ api_section: "private/margin", auth: true, cost: 2, expects: :single, market_type: :spot, method: :get, name: :fetch_cross_borrow_rate, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/v2/margin/crossed/interest-rate-and-limit", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 6.6667, expects: :list, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/v2/spot/public/coins", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, expects: :single, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "coin" }, params: [ :code ], path: "/v2/spot/wallet/deposit-address", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 6.6667, expects: :list, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fees, param_mappings: %{}, params: [ :codes ], path: "/v2/spot/public/coins", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "endTime" => "" }, expects: :list, market_type: :spot, method: :get, name: :fetch_deposits, pagination: %{ cursor_received: "idLessThan", cursor_sent: "idLessThan", style: :cursor }, param_mappings: %{ "code" => "coin", "since" => "startTime" }, params: [ :code, :since, :limit ], path: "/v2/spot/wallet/deposit-records", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "businessType" => "contract_settle_fee", "marginCoin" => "USDT", "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :get, name: :fetch_funding_history, pagination: %{ cursor_received: "endId", cursor_sent: "idLessThan", style: :cursor }, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v2/mix/account/bill", response_transformer: {:extract_path, ["data", "bills"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :get, name: :fetch_funding_interval, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/market/funding-time", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "productType" => "SPOT" }, expects: :list, market_type: :spot, method: :get, name: :fetch_funding_intervals, param_mappings: %{}, params: [ :symbols ], path: "/v2/mix/market/current-fund-rate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "category" => "linear", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/market/current-fund-rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "category" => "linear", "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :get, name: :fetch_funding_rate_history, pagination: %{ page_key: "pageNo", style: :page }, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v2/mix/market/history-fund-rate", response_transformer: {:extract_path, ["data", "resultList"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "category" => "linear", "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/v2/mix/market/tickers", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "granularity" => "1m", "kLineType" => "index", "limit" => 1000, "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :get, name: :fetch_index_ohlcv, pagination: %{ style: :time_window }, param_mappings: %{ "timeframe" => "granularity" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v2/mix/market/candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/margin", auth: true, cost: 2, expects: :single, market_type: :spot, method: :get, name: :fetch_isolated_borrow_rate, param_mappings: %{}, params: [ :symbol ], path: "/v2/margin/isolated/interest-rate-and-limit", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 1, expects: :single, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/v2/spot/market/orderbook", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ _by_market_type: %{ spot: %{}, swap: %{ "productType" => "USDT-FUTURES" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_ledger, pagination: %{ style: :cursor }, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/v2/spot/account/bills", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/account/account", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 20, expects: :list, market_type: :swap, method: :get, name: :fetch_long_short_ratio_history, param_mappings: %{}, params: [ :symbol, :timeframe, :since, :limit ], path: "/v2/mix/market/account-long-short", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :get, name: :fetch_margin_mode, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/account/account", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "granularity" => "1m", "kLineType" => "mark", "limit" => 1000, "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, pagination: %{ style: :time_window }, param_mappings: %{ "timeframe" => "granularity" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v2/mix/market/candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :get, name: :fetch_mark_price, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/market/symbol-price", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 2, default_params: %{ "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :get, name: :fetch_market_leverage_tiers, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/market/query-position-lever", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 1, expects: :list, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/v2/spot/public/symbols", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, expects: :list, market_type: :spot, method: :get, name: :fetch_my_trades, pagination: %{ style: :cursor }, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v2/spot/trade/fills", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 1, default_params: %{ "endTime" => "" }, expects: :list, market_type: :spot, method: :get, name: :fetch_ohlcv, pagination: %{ style: :time_window }, param_mappings: %{ "since" => "startTime", "timeframe" => "granularity" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/v2/spot/market/history-candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public/mix", auth: false, cost: 1, default_params: %{ "category" => "linear", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/market/open-interest", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 1, expects: :list, market_type: :spot, method: :get, name: :fetch_open_orders, pagination: %{ style: :cursor }, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/v2/spot/trade/unfilled-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 1, expects: :single, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/v2/spot/trade/orderInfo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 1, expects: :single, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/v2/spot/market/orderbook", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 2, default_params: %{ "category" => "linear", "marginCoin" => "USDT", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/v2/mix/position/single-position", response_transformer: {:extract_path_unwrap, ["data", "list"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 4, default_params: %{ "category" => "linear", "marginCoin" => "USDT", "productType" => "USDT-FUTURES" }, expects: :list, market_type: :swap, method: :get, name: :fetch_positions, pagination: %{ cursor_received: "endId", cursor_sent: "idLessThan", style: :cursor }, param_mappings: %{}, params: [ :symbols ], path: "/v2/mix/position/all-position", response_transformer: {:extract_path, ["data", "list"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, expects: :list, market_type: :swap, method: :get, name: :fetch_positions_history, param_mappings: %{}, params: [ :symbols, :since, :limit ], path: "/v2/mix/position/history-position", response_transformer: {:extract_path, ["data", "list"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 1, expects: :single, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/v2/spot/market/tickers", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 1, default_params: %{ _by_market_type: %{ spot: %{}, swap: %{ "productType" => "SPOT" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/v2/spot/market/tickers", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public/common", auth: false, cost: 1, expects: :single, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/v2/public/time", response_transformer: {:extract_path_unwrap, ["data", "serverTime"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 2, expects: :list, market_type: :spot, method: :get, name: :fetch_trades, pagination: %{ cursor_received: "idLessThan", cursor_sent: "idLessThan", style: :cursor }, param_mappings: %{ "since" => "startTime" }, params: [ :symbol, :since, :limit ], path: "/v2/spot/market/fills-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/common", auth: true, cost: 2, default_params: %{ "businessType" => "spot" }, expects: :single, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{}, params: [ :symbol ], path: "/v2/common/trade-rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public/spot", auth: false, cost: 1, default_params: %{ _by_market_type: %{ spot: %{}, swap: %{ "productType" => "USDT-FUTURES" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_trading_fees, param_mappings: %{}, params: [], path: "/v2/spot/public/symbols", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 1, default_params: %{ _by_market_type: %{ spot: %{ "fromType" => "spot" }, swap: %{ "fromType" => "usdt_futures" } } }, expects: :list, market_type: :spot, method: :get, name: :fetch_transfers, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/v2/spot/account/transferRecords", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "endTime" => "" }, expects: :list, market_type: :spot, method: :get, name: :fetch_withdrawals, pagination: %{ cursor_received: "idLessThan", cursor_sent: "idLessThan", style: :cursor }, param_mappings: %{ "code" => "coin", "since" => "startTime" }, params: [ :code, :since, :limit ], path: "/v2/spot/wallet/withdrawal-records", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private/margin", auth: true, cost: 2, expects: :single, market_type: :spot, method: :post, name: :repay_cross_margin, param_mappings: %{ "amount" => "repayAmount", "code" => "coin" }, params: [ :code, :amount ], path: "/v2/margin/crossed/account/repay", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/margin", auth: true, cost: 2, expects: :single, market_type: :spot, method: :post, name: :repay_isolated_margin, param_mappings: %{ "amount" => "repayAmount", "code" => "coin" }, params: [ :symbol, :code, :amount ], path: "/v2/margin/isolated/account/repay", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 4, default_params: %{ "marginCoin" => "USDT", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/v2/mix/account/set-leverage", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 4, default_params: %{ "marginCoin" => "USDT", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :post, name: :set_margin_mode, param_mappings: %{}, params: [ :marginMode, :symbol ], path: "/v2/mix/account/set-margin-mode", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/mix", auth: true, cost: 4, default_params: %{ "posMode" => "hedge_mode", "productType" => "USDT-FUTURES" }, expects: :single, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/v2/mix/account/set-position-mode", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "toType" => "coin_futures" }, expects: :single, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "code" => "coin", "fromAccount" => "fromType", "toAccount" => "toType" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/v2/spot/wallet/transfer", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private/spot", auth: true, cost: 2, default_params: %{ "chain" => "TRC20", "transferType" => "on_chain" }, expects: :single, market_type: :spot, method: :post, name: :withdraw, param_mappings: %{ "amount" => "size", "code" => "coin" }, params: [ :code, :amount, :address, :tag ], path: "/v2/spot/wallet/withdrawal", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted } ], error_code_details: %{ 1 => %{ description: "System error", type: :exchange_error }, 1001 => %{ description: "The request is too frequent and has been throttled", type: :rate_limited }, 1002 => %{ description: "{0} verifications within 24 hours", type: :exchange_error }, 1003 => %{ description: "You failed more than {0} times today, the current operation is locked, please try again in 24 hours", type: :exchange_error }, 20003 => %{ description: "operation failed, {\"status\":\"error\",\"ts\":1595730308979,\"err_code\":\"bad-request\",\"err_msg\":\"20003\"}", type: :exchange_error }, 21009 => %{ description: "Funds cannot be transferred out within 30 minutes after swap settlement(Funds cannot be transferred out within 30 minutes after swap settlement)", type: :exchange_error }, 30001 => %{ description: "{ \"code\": 30001, \"message\": 'request header \"OK_ACCESS_KEY\" cannot be blank'}", type: :invalid_credentials }, 30002 => %{ description: "{ \"code\": 30002, \"message\": 'request header \"OK_ACCESS_SIGN\" cannot be blank'}", type: :invalid_credentials }, 30003 => %{ description: "{ \"code\": 30003, \"message\": 'request header \"OK_ACCESS_TIMESTAMP\" cannot be blank'}", type: :invalid_credentials }, 30004 => %{ description: "{ \"code\": 30004, \"message\": 'request header \"OK_ACCESS_PASSPHRASE\" cannot be blank'}", type: :invalid_credentials }, 30005 => %{ description: "invalid OK_ACCESS_TIMESTAMP", type: :invalid_credentials }, 30006 => %{ description: "invalid OK_ACCESS_KEY", type: :invalid_credentials }, 30007 => %{ description: "{ \"code\": 30007, \"message\": 'invalid Content_Type, please use \"application/json\" format'}", type: :invalid_parameters }, 30008 => %{ description: "timestamp request expired", type: :network_error }, 30009 => %{ description: "system error", type: :exchange_error }, 30010 => %{ description: "API validation failed", type: :invalid_credentials }, 30011 => %{ description: "invalid IP", type: :access_restricted }, 30012 => %{ description: "invalid authorization", type: :invalid_credentials }, 30013 => %{ description: "invalid sign", type: :invalid_credentials }, 30014 => %{ description: "request too frequent", type: :rate_limited }, 30015 => %{ description: "{ \"code\": 30015, \"message\": 'request header \"OK_ACCESS_PASSPHRASE\" incorrect'}", type: :invalid_credentials }, 30016 => %{ description: "you are using v1 apiKey, please use v1 endpoint. If you would like to use v3 endpoint, please subscribe to v3 apiKey", type: :exchange_error }, 30017 => %{ description: "apikey's broker id does not match", type: :exchange_error }, 30018 => %{ description: "apikey's domain does not match", type: :exchange_error }, 30019 => %{ description: "Api is offline or unavailable", type: :network_error }, 30020 => %{ description: "body cannot be blank", type: :invalid_parameters }, 30021 => %{ description: "{ \"code\": 30021, \"message\": \"Json data format error\" }, { \"code\": 30021, \"message\": \"json data format error\" }", type: :invalid_parameters }, 30022 => %{ description: "Api has been frozen", type: :access_restricted }, 30023 => %{ description: "{0} parameter cannot be blank", type: :invalid_parameters }, 30024 => %{ description: "\"instrument_id\" is an invalid parameter", type: :invalid_order }, 30025 => %{ description: "{0} parameter category error", type: :invalid_parameters }, 30026 => %{ description: "requested too frequent", type: :rate_limited }, 30027 => %{ description: "login failure", type: :invalid_credentials }, 30028 => %{ description: "unauthorized execution", type: :access_restricted }, 30029 => %{ description: "account suspended", type: :access_restricted }, 30030 => %{ description: "endpoint request failed. Please try again", type: :exchange_error }, 30031 => %{ description: "token does not exist", type: :invalid_parameters }, 30032 => %{ description: "pair does not exist", type: :invalid_order }, 30033 => %{ description: "exchange domain does not exist", type: :invalid_parameters }, 30034 => %{ description: "exchange ID does not exist", type: :exchange_error }, 30035 => %{ description: "trading is not supported in this website", type: :exchange_error }, 30036 => %{ description: "no relevant data", type: :exchange_error }, 30037 => %{ description: "endpoint is offline or unavailable", type: :network_error }, 30038 => %{ description: "Matching engine is being upgraded. Please try in about 1 minute.", type: :network_error }, 32001 => %{ description: "futures account suspended", type: :access_restricted }, 32002 => %{ description: "futures account does not exist", type: :access_restricted }, 32003 => %{ description: "canceling, please wait", type: :exchange_error }, 32004 => %{ description: "you have no unfilled orders", type: :exchange_error }, 32005 => %{ description: "max order quantity", type: :invalid_order }, 32006 => %{ description: "the order price or trigger price exceeds USD 1 million", type: :invalid_order }, 32007 => %{ description: "leverage level must be the same for orders on the same side of the contract", type: :invalid_order }, 32008 => %{ description: "Max. positions to open (cross margin)", type: :invalid_order }, 32009 => %{ description: "Max. positions to open (fixed margin)", type: :invalid_order }, 32010 => %{ description: "leverage cannot be changed with open positions", type: :exchange_error }, 32011 => %{ description: "futures status error", type: :exchange_error }, 32012 => %{ description: "futures order update error", type: :exchange_error }, 32013 => %{ description: "token type is blank", type: :exchange_error }, 32014 => %{ description: "your number of contracts closing is larger than the number of contracts available", type: :exchange_error }, 32015 => %{ description: "margin ratio is lower than 100% before opening positions", type: :exchange_error }, 32016 => %{ description: "margin ratio is lower than 100% after opening position", type: :exchange_error }, 32017 => %{ description: "no BBO", type: :exchange_error }, 32018 => %{ description: "the order quantity is less than 1, please try again", type: :exchange_error }, 32019 => %{ description: "the order price deviates from the price of the previous minute by more than 3%", type: :exchange_error }, 32020 => %{ description: "the price is not in the range of the price limit", type: :exchange_error }, 32021 => %{ description: "leverage error", type: :exchange_error }, 32022 => %{ description: "this function is not supported in your country or region according to the regulations", type: :exchange_error }, 32023 => %{ description: "this account has outstanding loan", type: :exchange_error }, 32024 => %{ description: "order cannot be placed during delivery", type: :exchange_error }, 32025 => %{ description: "order cannot be placed during settlement", type: :exchange_error }, 32026 => %{ description: "your account is restricted from opening positions", type: :exchange_error }, 32027 => %{ description: "cancelled over 20 orders", type: :exchange_error }, 32028 => %{ description: "account is suspended and liquidated", type: :access_restricted }, 32029 => %{ description: "order info does not exist", type: :exchange_error }, 32030 => %{ description: "The order cannot be cancelled", type: :invalid_order }, 32031 => %{ description: "client_oid or order_id is required.", type: :invalid_parameters }, 32038 => %{ description: "User does not exist", type: :invalid_credentials }, 32040 => %{ description: "User have open contract orders or position", type: :exchange_error }, 32044 => %{ description: "The margin ratio after submitting this order is lower than the minimum requirement ({0}) for your tier.", type: :exchange_error }, 32045 => %{ description: "String of commission over 1 million", type: :exchange_error }, 32046 => %{ description: "Each user can hold up to 10 trade plans at the same time", type: :exchange_error }, 32047 => %{ description: "system error", type: :exchange_error }, 32048 => %{ description: "Order strategy track range error", type: :invalid_order }, 32049 => %{ description: "Each user can hold up to 10 track plans at the same time", type: :exchange_error }, 32050 => %{ description: "Order strategy rang error", type: :invalid_order }, 32051 => %{ description: "Order strategy ice depth error", type: :invalid_order }, 32052 => %{ description: "String of commission over 100 thousand", type: :exchange_error }, 32053 => %{ description: "Each user can hold up to 6 ice plans at the same time", type: :exchange_error }, 32054 => %{ description: "Trade not allow", type: :exchange_error }, 32055 => %{ description: "cancel order error", type: :invalid_order }, 32056 => %{ description: "iceberg per order average should between {0}-{1} contracts", type: :exchange_error }, 32057 => %{ description: "The order price is zero. Market-close-all function cannot be executed", type: :exchange_error }, 32058 => %{ description: "Each user can hold up to 6 initiative plans at the same time", type: :exchange_error }, 32059 => %{ description: "Total amount should exceed per order amount", type: :invalid_order }, 32060 => %{ description: "Order strategy type error", type: :invalid_order }, 32061 => %{ description: "Order strategy initiative limit error", type: :invalid_order }, 32062 => %{ description: "Order strategy initiative range error", type: :invalid_order }, 32063 => %{ description: "Order strategy initiative rate error", type: :invalid_order }, 32064 => %{ description: "Time Stringerval of orders should set between 5-120s", type: :exchange_error }, 32065 => %{ description: "Close amount exceeds the limit of Market-close-all (999 for BTC, and 9999 for the rest tokens)", type: :exchange_error }, 32066 => %{ description: "You have open orders. Please cancel all open orders before changing your leverage level.", type: :exchange_error }, 32067 => %{ description: "Account equity < required margin in this setting. Please adjust your leverage level again.", type: :exchange_error }, 32068 => %{ description: "The margin for this position will fall short of the required margin in this setting. Please adjust your leverage level or increase your margin to proceed.", type: :exchange_error }, 32069 => %{ description: "Target leverage level too low. Your account balance is insufficient to cover the margin required. Please adjust the leverage level again.", type: :exchange_error }, 32070 => %{ description: "Please check open position or unfilled order", type: :exchange_error }, 32071 => %{ description: "Your current liquidation mode does not support this action.", type: :exchange_error }, 32072 => %{ description: "The highest available margin for your order’s tier is {0}. Please edit your margin and place a new order.", type: :exchange_error }, 32073 => %{ description: "The action does not apply to the token", type: :exchange_error }, 32074 => %{ description: "The number of contracts of your position, open orders, and the current order has exceeded the maximum order limit of this asset.", type: :exchange_error }, 32075 => %{ description: "Account risk rate breach", type: :exchange_error }, 32076 => %{ description: "Liquidation of the holding position(s) at market price will require cancellation of all pending close orders of the contracts.", type: :exchange_error }, 32077 => %{ description: "Your margin for this asset in futures account is insufficient and the position has been taken over for liquidation. (You will not be able to place orders, close positions, transfer funds, or add margin during this period of time. Your account will be restored after the liquidation is complete.)", type: :exchange_error }, 32078 => %{ description: "Please cancel all open orders before switching the liquidation mode(Please cancel all open orders before switching the liquidation mode)", type: :exchange_error }, 32079 => %{ description: "Your open positions are at high risk.(Please add margin or reduce positions before switching the mode)", type: :exchange_error }, 32080 => %{ description: "Funds cannot be transferred out within 30 minutes after futures settlement", type: :exchange_error }, 32083 => %{ description: "The number of contracts should be a positive multiple of %%. Please place your order again", type: :exchange_error }, 33001 => %{ description: "margin account for this pair is not enabled yet", type: :access_restricted }, 33002 => %{ description: "margin account for this pair is suspended", type: :access_restricted }, 33003 => %{ description: "no loan balance", type: :insufficient_balance }, 33004 => %{ description: "loan amount cannot be smaller than the minimum limit", type: :exchange_error }, 33005 => %{ description: "repayment amount must exceed 0", type: :exchange_error }, 33006 => %{ description: "loan order not found", type: :exchange_error }, 33007 => %{ description: "status not found", type: :exchange_error }, 33008 => %{ description: "loan amount cannot exceed the maximum limit", type: :insufficient_balance }, 33009 => %{ description: "user ID is blank", type: :exchange_error }, 33010 => %{ description: "you cannot cancel an order during session 2 of call auction", type: :exchange_error }, 33011 => %{ description: "no new market data", type: :exchange_error }, 33012 => %{ description: "order cancellation failed", type: :exchange_error }, 33013 => %{ description: "order placement failed", type: :invalid_order }, 33014 => %{ description: "order does not exist", type: :order_not_found }, 33015 => %{ description: "exceeded maximum limit", type: :invalid_order }, 33016 => %{ description: "margin trading is not open for this token", type: :exchange_error }, 33017 => %{ description: "insufficient balance", type: :insufficient_balance }, 33018 => %{ description: "this parameter must be smaller than 1", type: :exchange_error }, 33020 => %{ description: "request not supported", type: :exchange_error }, 33021 => %{ description: "token and the pair do not match", type: :invalid_parameters }, 33022 => %{ description: "pair and the order do not match", type: :invalid_order }, 33023 => %{ description: "you can only place market orders during call auction", type: :exchange_error }, 33024 => %{ description: "trading amount too small", type: :invalid_order }, 33025 => %{ description: "base token amount is blank", type: :invalid_order }, 33026 => %{ description: "transaction completed", type: :exchange_error }, 33027 => %{ description: "cancelled order or order cancelling", type: :invalid_order }, 33028 => %{ description: "the decimal places of the trading price exceeded the limit", type: :invalid_order }, 33029 => %{ description: "the decimal places of the trading size exceeded the limit", type: :invalid_order }, 33034 => %{ description: "You can only place limit order after Call Auction has started", type: :exchange_error }, 33035 => %{ description: "This type of order cannot be canceled(This type of order cannot be canceled)", type: :exchange_error }, 33036 => %{ description: "Exceeding the limit of entrust order", type: :exchange_error }, 33037 => %{ description: "The buy order price should be lower than 130% of the trigger price", type: :exchange_error }, 33038 => %{ description: "The sell order price should be higher than 70% of the trigger price", type: :exchange_error }, 33039 => %{ description: "The limit of callback rate is 0 < x <= 5%", type: :exchange_error }, 33040 => %{ description: "The trigger price of a buy order should be lower than the latest transaction price", type: :exchange_error }, 33041 => %{ description: "The trigger price of a sell order should be higher than the latest transaction price", type: :exchange_error }, 33042 => %{ description: "The limit of price variance is 0 < x <= 1%", type: :exchange_error }, 33043 => %{ description: "The total amount must be larger than 0", type: :exchange_error }, 33044 => %{ description: "The average amount should be 1/1000 * total amount <= x <= total amount", type: :exchange_error }, 33045 => %{ description: "The price should not be 0, including trigger price, order price, and price limit", type: :exchange_error }, 33046 => %{ description: "Price variance should be 0 < x <= 1%", type: :exchange_error }, 33047 => %{ description: "Sweep ratio should be 0 < x <= 100%", type: :exchange_error }, 33048 => %{ description: "Per order limit: Total amount/1000 < x <= Total amount", type: :exchange_error }, 33049 => %{ description: "Total amount should be X > 0", type: :exchange_error }, 33050 => %{ description: "Time interval should be 5 <= x <= 120s", type: :exchange_error }, 33051 => %{ description: "cancel order number not higher limit: plan and track entrust no more than 10, ice and time entrust no more than 6", type: :exchange_error }, 33059 => %{ description: "client_oid or order_id is required", type: :invalid_parameters }, 33060 => %{ description: "Only fill in either parameter client_oid or order_id", type: :invalid_parameters }, 33061 => %{ description: "Value of a single market price order cannot exceed 100,000 USD", type: :exchange_error }, 33062 => %{ description: "The leverage ratio is too high. The borrowed position has exceeded the maximum position of this leverage ratio. Please readjust the leverage ratio", type: :exchange_error }, 33063 => %{ description: "Leverage multiple is too low, there is insufficient margin in the account, please readjust the leverage ratio", type: :exchange_error }, 33064 => %{ description: "The setting of the leverage ratio cannot be less than 2, please readjust the leverage ratio", type: :exchange_error }, 33065 => %{ description: "Leverage ratio exceeds maximum leverage ratio, please readjust leverage ratio", type: :exchange_error }, 34001 => %{ description: "withdrawal suspended", type: :access_restricted }, 34002 => %{ description: "please add a withdrawal address", type: :invalid_parameters }, 34003 => %{ description: "sorry, this token cannot be withdrawn to xx at the moment", type: :exchange_error }, 34004 => %{ description: "withdrawal fee is smaller than minimum limit", type: :exchange_error }, 34005 => %{ description: "withdrawal fee exceeds the maximum limit", type: :exchange_error }, 34006 => %{ description: "withdrawal amount is lower than the minimum limit", type: :exchange_error }, 34007 => %{ description: "withdrawal amount exceeds the maximum limit", type: :exchange_error }, 34008 => %{ description: "insufficient balance", type: :insufficient_balance }, 34009 => %{ description: "your withdrawal amount exceeds the daily limit", type: :exchange_error }, 34010 => %{ description: "transfer amount must be larger than 0", type: :exchange_error }, 34011 => %{ description: "conditions not met", type: :exchange_error }, 34012 => %{ description: "the minimum withdrawal amount for NEO is 1, and the amount must be an integer", type: :exchange_error }, 34013 => %{ description: "please transfer", type: :exchange_error }, 34014 => %{ description: "transfer limited", type: :exchange_error }, 34015 => %{ description: "subaccount does not exist", type: :exchange_error }, 34016 => %{ description: "transfer suspended", type: :access_restricted }, 34017 => %{ description: "account suspended", type: :access_restricted }, 34018 => %{ description: "incorrect trades password", type: :invalid_credentials }, 34019 => %{ description: "please bind your email before withdrawal", type: :access_restricted }, 34020 => %{ description: "please bind your funds password before withdrawal", type: :access_restricted }, 34021 => %{ description: "Not verified address", type: :invalid_parameters }, 34022 => %{ description: "Withdrawals are not available for sub accounts", type: :exchange_error }, 34023 => %{ description: "Please enable futures trading before transferring your funds", type: :access_restricted }, 34026 => %{ description: "transfer too frequently(transfer too frequently)", type: :exchange_error }, 34036 => %{ description: "Parameter is incorrect, please refer to API documentation", type: :exchange_error }, 34037 => %{ description: "Get the sub-account balance interface, account type is not supported", type: :exchange_error }, 34038 => %{ description: "Since your C2C transaction is unusual, you are restricted from fund transfer. Please contact our customer support to cancel the restriction", type: :exchange_error }, 34039 => %{ description: "You are now restricted from transferring out your funds due to abnormal trades on C2C Market. Please transfer your fund on our website or app instead to verify your identity", type: :exchange_error }, 35001 => %{ description: "Contract does not exist", type: :exchange_error }, 35002 => %{ description: "Contract settling", type: :exchange_error }, 35003 => %{ description: "Contract paused", type: :exchange_error }, 35004 => %{ description: "Contract pending settlement", type: :exchange_error }, 35005 => %{ description: "User does not exist", type: :invalid_credentials }, 35008 => %{ description: "Risk ratio too high", type: :invalid_order }, 35010 => %{ description: "Position closing too large", type: :invalid_order }, 35012 => %{ description: "Incorrect order size", type: :invalid_order }, 35014 => %{ description: "Order price is not within limit", type: :invalid_order }, 35015 => %{ description: "Invalid leverage level", type: :invalid_order }, 35017 => %{ description: "Open orders exist", type: :exchange_error }, 35019 => %{ description: "Order size too large", type: :invalid_order }, 35020 => %{ description: "Order price too high", type: :invalid_order }, 35021 => %{ description: "Order size exceeded current tier limit", type: :invalid_order }, 35022 => %{ description: "Contract status error", type: :exchange_error }, 35024 => %{ description: "Contract not initialized", type: :exchange_error }, 35025 => %{ description: "No account balance", type: :insufficient_balance }, 35026 => %{ description: "Contract settings not initialized", type: :exchange_error }, 35029 => %{ description: "Order does not exist", type: :order_not_found }, 35030 => %{ description: "Order size too large", type: :invalid_order }, 35031 => %{ description: "Cancel order size too large", type: :invalid_order }, 35032 => %{ description: "Invalid user status", type: :exchange_error }, 35037 => %{ description: "No last traded price in cache", type: :exchange_error }, 35039 => %{ description: "Open order quantity exceeds limit", type: :exchange_error }, 35040 => %{ description: "{\"error_message\":\"Invalid order type\",\"result\":\"true\",\"error_code\":\"35040\",\"order_id\":\"-1\"}", type: :invalid_order }, 35044 => %{ description: "Invalid order status", type: :exchange_error }, 35046 => %{ description: "Negative account balance", type: :insufficient_balance }, 35047 => %{ description: "Insufficient account balance", type: :insufficient_balance }, 35048 => %{ description: "User contract is frozen and liquidating", type: :exchange_error }, 35049 => %{ description: "Invalid order type", type: :invalid_order }, 35050 => %{ description: "Position settings are blank", type: :invalid_order }, 35052 => %{ description: "Insufficient cross margin", type: :insufficient_balance }, 35053 => %{ description: "Account risk too high", type: :exchange_error }, 35055 => %{ description: "Insufficient account balance", type: :insufficient_balance }, 35057 => %{ description: "No last traded price", type: :exchange_error }, 35058 => %{ description: "No limit", type: :exchange_error }, 35059 => %{ description: "client_oid or order_id is required", type: :invalid_parameters }, 35060 => %{ description: "Only fill in either parameter client_oid or order_id", type: :invalid_parameters }, 35061 => %{ description: "Invalid instrument_id", type: :invalid_parameters }, 35062 => %{ description: "Invalid match_price", type: :invalid_order }, 35063 => %{ description: "Invalid order_size", type: :invalid_order }, 35064 => %{ description: "Invalid client_oid", type: :invalid_order }, 35066 => %{ description: "Order interval error", type: :invalid_order }, 35067 => %{ description: "Time-weighted order ratio error", type: :invalid_order }, 35068 => %{ description: "Time-weighted order range error", type: :invalid_order }, 35069 => %{ description: "Time-weighted single transaction limit error", type: :invalid_order }, 35070 => %{ description: "Algo order type error", type: :invalid_order }, 35071 => %{ description: "Order total must be larger than single order limit", type: :invalid_order }, 35072 => %{ description: "Maximum 6 unfulfilled time-weighted orders can be held at the same time", type: :invalid_order }, 35073 => %{ description: "Order price is 0. Market-close-all not available", type: :invalid_order }, 35074 => %{ description: "Iceberg order single transaction average error", type: :invalid_order }, 35075 => %{ description: "Failed to cancel order", type: :invalid_order }, 35076 => %{ description: "LTC 20x leverage. Not allowed to open position", type: :invalid_order }, 35077 => %{ description: "Maximum 6 unfulfilled iceberg orders can be held at the same time", type: :invalid_order }, 35078 => %{ description: "Order amount exceeded 100,000", type: :invalid_order }, 35079 => %{ description: "Iceberg order price variance error", type: :invalid_order }, 35080 => %{ description: "Callback rate error", type: :invalid_order }, 35081 => %{ description: "Maximum 10 unfulfilled trail orders can be held at the same time", type: :invalid_order }, 35082 => %{ description: "Trail order callback rate error", type: :invalid_order }, 35083 => %{ description: "Each user can only hold a maximum of 10 unfulfilled stop-limit orders at the same time", type: :invalid_order }, 35084 => %{ description: "Order amount exceeded 1 million", type: :invalid_order }, 35085 => %{ description: "Order amount is not in the correct range", type: :invalid_order }, 35086 => %{ description: "Price exceeds 100 thousand", type: :invalid_order }, 35087 => %{ description: "Price exceeds 100 thousand", type: :invalid_order }, 35088 => %{ description: "Average amount error", type: :invalid_order }, 35089 => %{ description: "Price exceeds 100 thousand", type: :invalid_order }, 35090 => %{ description: "No stop-limit orders available for cancelation", type: :exchange_error }, 35091 => %{ description: "No trail orders available for cancellation", type: :exchange_error }, 35092 => %{ description: "No iceberg orders available for cancellation", type: :exchange_error }, 35093 => %{ description: "No trail orders available for cancellation", type: :exchange_error }, 35094 => %{ description: "Stop-limit order last traded price error", type: :exchange_error }, 35095 => %{ description: "Instrument_id error", type: :invalid_parameters }, 35096 => %{ description: "Algo order status error", type: :exchange_error }, 35097 => %{ description: "Order status and order ID cannot exist at the same time", type: :exchange_error }, 35098 => %{ description: "An order status or order ID must exist", type: :exchange_error }, 35099 => %{ description: "Algo order ID error", type: :exchange_error }, 36001 => %{ description: "Invalid underlying index.", type: :invalid_parameters }, 36002 => %{ description: "Instrument does not exist.", type: :invalid_parameters }, 36005 => %{ description: "Instrument status is invalid.", type: :exchange_error }, 36101 => %{ description: "Account does not exist.", type: :invalid_credentials }, 36102 => %{ description: "Account status is invalid.", type: :access_restricted }, 36103 => %{ description: "Account is suspended due to ongoing liquidation.", type: :access_restricted }, 36104 => %{ description: "Account is not enabled for options trading.", type: :access_restricted }, 36105 => %{ description: "Please enable the account for option contract.", type: :access_restricted }, 36106 => %{ description: "Funds cannot be transferred in or out, as account is suspended.", type: :access_restricted }, 36107 => %{ description: "Funds cannot be transferred out within 30 minutes after option exercising or settlement.", type: :access_restricted }, 36108 => %{ description: "Funds cannot be transferred in or out, as equity of the account is less than zero.", type: :insufficient_balance }, 36109 => %{ description: "Funds cannot be transferred in or out during option exercising or settlement.", type: :access_restricted }, 36201 => %{ description: "New order function is blocked.", type: :access_restricted }, 36202 => %{ description: "Account does not have permission to short option.", type: :access_restricted }, 36203 => %{ description: "Invalid format for client_oid.", type: :invalid_order }, 36204 => %{ description: "Invalid format for request_id.", type: :exchange_error }, 36205 => %{ description: "Instrument id does not match underlying index.", type: :invalid_parameters }, 36206 => %{ description: "Order_id and client_oid can not be used at the same time.", type: :invalid_parameters }, 36207 => %{ description: "Either order price or fartouch price must be present.", type: :invalid_order }, 36208 => %{ description: "Either order price or size must be present.", type: :invalid_order }, 36209 => %{ description: "Either order_id or client_oid must be present.", type: :invalid_order }, 36210 => %{ description: "Either order_ids or client_oids must be present.", type: :invalid_order }, 36211 => %{ description: "Exceeding max batch size for order submission.", type: :invalid_order }, 36212 => %{ description: "Exceeding max batch size for oder cancellation.", type: :invalid_order }, 36213 => %{ description: "Exceeding max batch size for order amendment.", type: :invalid_order }, 36214 => %{ description: "Instrument does not have valid bid/ask quote.", type: :exchange_error }, 36216 => %{ description: "Order does not exist.", type: :order_not_found }, 36217 => %{ description: "Order submission failed.", type: :invalid_order }, 36218 => %{ description: "Order cancellation failed.", type: :invalid_order }, 36219 => %{ description: "Order amendment failed.", type: :invalid_order }, 36220 => %{ description: "Order is pending cancel.", type: :invalid_order }, 36221 => %{ description: "Order qty is not valid multiple of lot size.", type: :invalid_order }, 36222 => %{ description: "Order price is breaching highest buy limit.", type: :invalid_order }, 36223 => %{ description: "Order price is breaching lowest sell limit.", type: :invalid_order }, 36224 => %{ description: "Exceeding max order size.", type: :invalid_order }, 36225 => %{ description: "Exceeding max open order count for instrument.", type: :invalid_order }, 36226 => %{ description: "Exceeding max open order count for underlying.", type: :invalid_order }, 36227 => %{ description: "Exceeding max open size across all orders for underlying", type: :invalid_order }, 36228 => %{ description: "Exceeding max available qty for instrument.", type: :invalid_order }, 36229 => %{ description: "Exceeding max available qty for underlying.", type: :invalid_order }, 36230 => %{ description: "Exceeding max position limit for underlying.", type: :invalid_order }, 400 => %{ description: "Bad Request", type: :invalid_parameters }, 40001 => %{ description: "ACCESS_KEY cannot be empty", type: :invalid_credentials }, 40002 => %{ description: "SECRET_KEY cannot be empty", type: :invalid_credentials }, 40003 => %{ description: "Signature cannot be empty", type: :invalid_credentials }, 40004 => %{ description: "Request timestamp expired", type: :invalid_credentials }, 40005 => %{ description: "Invalid ACCESS_TIMESTAMP", type: :invalid_credentials }, 40006 => %{ description: "Invalid ACCESS_KEY", type: :invalid_credentials }, 40007 => %{ description: "Invalid Content_Type", type: :invalid_parameters }, 40008 => %{ description: "Request timestamp expired", type: :invalid_credentials }, 40009 => %{ description: "sign signature error", type: :invalid_credentials }, 4001 => %{ description: "no data received in 30s", type: :exchange_error }, 40010 => %{ description: "sign signature error", type: :invalid_credentials }, 40011 => %{ description: "ACCESS_PASSPHRASE cannot be empty", type: :invalid_credentials }, 40012 => %{ description: "apikey/password is incorrect", type: :invalid_credentials }, 40013 => %{ description: "User status is abnormal", type: :exchange_error }, 40014 => %{ description: "Incorrect permissions", type: :access_restricted }, 40015 => %{ description: "System is abnormal, please try again later", type: :exchange_error }, 40016 => %{ description: "The user must bind the phone or Google", type: :access_restricted }, 40017 => %{ description: "Parameter verification failed", type: :exchange_error }, 40018 => %{ description: "Invalid IP", type: :access_restricted }, 40019 => %{ description: "Parameter QLCUSDT_SPBL cannot be empty", type: :invalid_parameters }, 4002 => %{ description: "Buffer full. cannot write data", type: :exchange_error }, 40020 => %{ description: "Parameter orderId error", type: :invalid_parameters }, 40024 => %{ description: "The currency is a regional currency and does not meet the purchase conditions.", type: :access_restricted }, 40031 => %{ description: "The account has been cancelled and cannot be used again", type: :access_restricted }, 40037 => %{ description: "Apikey does not exist", type: :invalid_credentials }, 401 => %{ description: "Unauthorized access", type: :invalid_credentials }, 4010 => %{ description: "For the security of your funds, withdrawals are not permitted within 24 hours after changing fund password / mobile number / Google Authenticator settings ", type: :access_restricted }, 40102 => %{ description: "Contract configuration does not exist, please check the parameters", type: :invalid_parameters }, 40103 => %{ description: "Request method cannot be empty", type: :invalid_parameters }, 40104 => %{ description: "Lever adjustment failure", type: :exchange_error }, 40105 => %{ description: "Abnormal access to current price limit data", type: :exchange_error }, 40106 => %{ description: "Abnormal get next settlement time", type: :exchange_error }, 40107 => %{ description: "Abnormal access to index price data", type: :exchange_error }, 40108 => %{ description: "Wrong order quantity", type: :invalid_order }, 40109 => %{ description: "The data of the order cannot be found, please confirm the order number", type: :order_not_found }, 40200 => %{ description: "Server upgrade, please try again later", type: :network_error }, 40201 => %{ description: "Order number cannot be empty", type: :invalid_order }, 40202 => %{ description: "User information cannot be empty", type: :exchange_error }, 40203 => %{ description: "The amount of adjustment margin cannot be empty or negative", type: :invalid_parameters }, 40204 => %{ description: "Adjustment margin type cannot be empty", type: :invalid_parameters }, 40205 => %{ description: "Adjusted margin type data is wrong", type: :invalid_parameters }, 40206 => %{ description: "The direction of the adjustment margin cannot be empty", type: :invalid_parameters }, 40207 => %{ description: "The adjustment margin data is wrong", type: :invalid_parameters }, 40208 => %{ description: "The accuracy of the adjustment margin amount is incorrect", type: :invalid_parameters }, 40209 => %{ description: "The current page number is wrong, please confirm", type: :invalid_parameters }, 403 => %{ description: "Access prohibited", type: :access_restricted }, 40300 => %{ description: "User does not exist", type: :exchange_error }, 40301 => %{ description: "Permission has not been obtained yet. If you need to use it, please contact customer service", type: :access_restricted }, 40302 => %{ description: "Parameter abnormality", type: :invalid_parameters }, 40303 => %{ description: "Can only query up to 20,000 data", type: :invalid_parameters }, 40304 => %{ description: "Parameter type is abnormal", type: :invalid_parameters }, 40305 => %{ description: "Client_oid length is not greater than 50, and cannot be Martian characters", type: :invalid_parameters }, 40306 => %{ description: "Batch processing orders can only process up to 20", type: :exchange_error }, 40308 => %{ description: "The contract is being temporarily maintained", type: :network_error }, 40309 => %{ description: "The contract has been removed", type: :invalid_order }, 404 => %{ description: "Request address does not exist", type: :invalid_parameters }, 40400 => %{ description: "Status check abnormal", type: :exchange_error }, 40401 => %{ description: "The operation cannot be performed", type: :exchange_error }, 40402 => %{ description: "The opening direction cannot be empty", type: :invalid_parameters }, 40403 => %{ description: "Wrong opening direction format", type: :invalid_parameters }, 40404 => %{ description: "Whether to enable automatic margin call parameters cannot be empty", type: :invalid_parameters }, 40405 => %{ description: "Whether to enable the automatic margin call parameter type is wrong", type: :invalid_parameters }, 40406 => %{ description: "Whether to enable automatic margin call parameters is of unknown type", type: :invalid_parameters }, 40407 => %{ description: "The query direction is not the direction entrusted by the plan", type: :exchange_error }, 40408 => %{ description: "Wrong time range", type: :exchange_error }, 40409 => %{ description: "Time format error", type: :exchange_error }, 405 => %{ description: "The HTTP Method is not supported", type: :invalid_parameters }, 40500 => %{ description: "Client_oid check error", type: :invalid_order }, 40501 => %{ description: "Channel name error", type: :exchange_error }, 40502 => %{ description: "If it is a copy user, you must pass the copy to whom", type: :exchange_error }, 40503 => %{ description: "With the single type", type: :exchange_error }, 40504 => %{ description: "Platform code must pass", type: :exchange_error }, 40505 => %{ description: "Not the same as single type", type: :exchange_error }, 40506 => %{ description: "Platform signature error", type: :invalid_credentials }, 40507 => %{ description: "Api signature error", type: :invalid_credentials }, 40508 => %{ description: "KOL is not authorized", type: :exchange_error }, 40509 => %{ description: "Abnormal copy end", type: :exchange_error }, 40600 => %{ description: "Copy function suspended", type: :exchange_error }, 40601 => %{ description: "Followers cannot be KOL", type: :exchange_error }, 40602 => %{ description: "The number of copies has reached the limit and cannot process the request", type: :exchange_error }, 40603 => %{ description: "Abnormal copy end", type: :exchange_error }, 40604 => %{ description: "Server is busy, please try again later", type: :network_error }, 40605 => %{ description: "Copy type, the copy number must be passed", type: :exchange_error }, 40606 => %{ description: "The type of document number is wrong", type: :exchange_error }, 40607 => %{ description: "Document number must be passed", type: :exchange_error }, 40608 => %{ description: "No documented products currently supported", type: :exchange_error }, 40609 => %{ description: "The contract product does not support copying", type: :exchange_error }, 40700 => %{ description: "Cursor parameters are incorrect", type: :invalid_parameters }, 40701 => %{ description: "KOL is not authorized", type: :exchange_error }, 40702 => %{ description: "Unauthorized copying user", type: :exchange_error }, 40703 => %{ description: "Bill inquiry start and end time cannot be empty", type: :exchange_error }, 40704 => %{ description: "Can only check the data of the last three months", type: :exchange_error }, 40705 => %{ description: "The start and end time cannot exceed 90 days", type: :invalid_parameters }, 40706 => %{ description: "Wrong order price", type: :invalid_order }, 40707 => %{ description: "Start time is greater than end time", type: :invalid_parameters }, 40708 => %{ description: "Parameter verification is abnormal", type: :invalid_parameters }, 40709 => %{ description: "There is no position in this position, and no automatic margin call can be set", type: :exchange_error }, 40710 => %{ description: "Abnormal account status", type: :exchange_error }, 40711 => %{ description: "Insufficient contract account balance", type: :insufficient_balance }, 40712 => %{ description: "Insufficient margin", type: :insufficient_balance }, 40713 => %{ description: "Cannot exceed the maximum transferable margin amount", type: :exchange_error }, 40714 => %{ description: "No direct margin call is allowed", type: :exchange_error }, 40762 => %{ description: "The order amount exceeds the balance", type: :insufficient_balance }, 40768 => %{ description: "Order does not exist", type: :order_not_found }, 40774 => %{ description: "The order type for unilateral position must also be the unilateral position type.", type: :invalid_order }, 40808 => %{ description: "Parameter verification exception size checkBDScale error value=2293.577 checkScale=2", type: :invalid_order }, 41103 => %{ description: "param price scale error error", type: :invalid_order }, 41114 => %{ description: "The current trading pair is under maintenance, please refer to the official announcement for the opening time", type: :network_error }, 415 => %{ description: "The current media type is not supported", type: :invalid_parameters }, 429 => %{ description: "Too many requests", type: :rate_limited }, 43001 => %{ description: nil, type: :order_not_found }, 43011 => %{ description: "The parameter does not meet the specification executePrice <= 0", type: :invalid_order }, 43012 => %{ description: "Insufficient balance", type: :insufficient_balance }, 43025 => %{ description: "Plan order does not exist", type: :invalid_order }, 43111 => %{ description: "参数错误 address not in address book", type: :access_restricted }, 43115 => %{ description: "The current trading pair is opening soon, please refer to the official announcement for the opening time", type: :network_error }, 45110 => %{ description: "less than the minimum amount 5 USDT", type: :invalid_order }, 45122 => %{ description: "Short position stop loss price please > mark price 106.86", type: :invalid_order }, 500 => %{ description: "System busy", type: :network_error }, 50003 => %{ description: "No record", type: :exchange_error }, 50004 => %{ description: "The transaction pair is currently not supported or has been suspended", type: :invalid_order }, 50006 => %{ description: "The account is forbidden to withdraw. If you have any questions, please contact customer service.", type: :access_restricted }, 50007 => %{ description: "The account is forbidden to withdraw within 24 hours. If you have any questions, please contact customer service.", type: :access_restricted }, 50008 => %{ description: "network timeout", type: :network_error }, 50009 => %{ description: "The operation is too frequent, please try again later", type: :rate_limited }, 50010 => %{ description: "The account is abnormally frozen. If you have any questions, please contact customer service.", type: :exchange_error }, 50014 => %{ description: "The transaction amount under minimum limits", type: :invalid_order }, 50015 => %{ description: "The transaction amount exceed maximum limits", type: :invalid_order }, 50016 => %{ description: "The price can't be higher than the current price", type: :invalid_order }, 50017 => %{ description: "Price under minimum limits", type: :invalid_order }, 50018 => %{ description: "The price exceed maximum limits", type: :invalid_order }, 50019 => %{ description: "The amount under minimum limits", type: :invalid_order }, 50020 => %{ description: "Insufficient balance", type: :insufficient_balance }, 50021 => %{ description: "Price is under minimum limits", type: :invalid_order }, 50026 => %{ description: "Market price parameter error", type: :invalid_order }, "Cash Withdrawal Is Less Than The Minimum Value" => %{ description: nil, type: :invalid_parameters }, "Cash Withdrawal Is More Than The Maximum Value" => %{ description: nil, type: :invalid_parameters }, "Request Frequency Is Too High" => %{ description: nil, type: :rate_limited }, "User Prohibited Cash Withdrawal" => %{ description: nil, type: :access_restricted }, "accesskey not null" => %{ description: "{\"status\":\"error\",\"ts\":1595704360508,\"err_code\":\"invalid-parameter\",\"err_msg\":\"accesskey not null\"}", type: :invalid_credentials }, "address invalid cointype" => %{ description: nil, type: :exchange_error }, "api signature not valid" => %{ description: nil, type: :invalid_credentials }, "audit failed" => %{ description: nil, type: :exchange_error }, "base date error" => %{ description: nil, type: :exchange_error }, "base symbol error" => %{ description: nil, type: :invalid_order }, "failure to get a peer from the ring-balancer" => %{ description: "failure to get a peer from the ring-balancer", type: :network_error }, "gateway internal error" => %{ description: nil, type: :exchange_error }, "illegal accesskey" => %{ description: nil, type: :invalid_credentials }, "illegal sign invalid" => %{ description: "{\"status\":\"error\",\"ts\":1595684716042,\"err_code\":\"invalid-parameter\",\"err_msg\":\"illegal sign invalid\"}", type: :invalid_credentials }, "invalid accountId" => %{ description: nil, type: :invalid_parameters }, "invalid address" => %{ description: nil, type: :invalid_parameters }, "invalid amount" => %{ description: nil, type: :invalid_order }, "invalid currency" => %{ description: "invalid trading pair", type: :invalid_order }, "invalid end time" => %{ description: "end time is a date 30 days ago; or end time is a date in the future", type: :invalid_parameters }, "invalid order query time" => %{ description: "start time is greater than end time; or the time interval between start time and end time is greater than 48 hours", type: :exchange_error }, "invalid orderId" => %{ description: nil, type: :invalid_order }, "invalid period" => %{ description: "invalid Kline type", type: :invalid_parameters }, "invalid record" => %{ description: nil, type: :exchange_error }, "invalid sign" => %{ description: nil, type: :invalid_credentials }, "invalid size, valid range" => %{ description: nil, type: :exchange_error }, "invalid start time" => %{ description: "start time is a date 30 days ago; or start time is a date in the future", type: :invalid_parameters }, "invalid symbol" => %{ description: nil, type: :invalid_order }, "invalid type" => %{ description: "{\"status\":\"error\",\"ts\":1595700344504,\"err_code\":\"invalid-parameter\",\"err_msg\":\"invalid type\"}", type: :invalid_order }, "invalid user" => %{ description: nil, type: :exchange_error }, "limit need price" => %{ description: nil, type: :invalid_order }, "market no need price" => %{ description: nil, type: :invalid_order }, "more than a daily rate of cash" => %{ description: nil, type: :invalid_parameters }, "more than the maximum daily withdrawal amount" => %{ description: nil, type: :invalid_parameters }, "need to bind email or mobile" => %{ description: nil, type: :exchange_error }, "order cancel fail" => %{ description: "{\"status\":\"error\",\"ts\":1595703343035,\"err_code\":\"bad-request\",\"err_msg\":\"order cancel fail\"}", type: :invalid_parameters }, "order queryorder invalid" => %{ description: nil, type: :invalid_parameters }, "permissions not right" => %{ description: "{\"status\":\"error\",\"ts\":1595704490084,\"err_code\":\"invalid-parameter\",\"err_msg\":\"permissions not right\"}", type: :access_restricted }, "req_time is too much difference from server time" => %{ description: nil, type: :invalid_credentials }, "sign not null" => %{ description: nil, type: :invalid_credentials }, "system exception" => %{ description: "{\"status\":\"error\",\"ts\":1595711862763,\"err_code\":\"system exception\",\"err_msg\":\"system exception\"}", type: :exchange_error }, "the account with in 24 hours ban coin" => %{ description: nil, type: :access_restricted }, "user forbid" => %{ description: nil, type: :access_restricted }, "user locked" => %{ description: nil, type: :access_restricted }, "userid not equal to account_id" => %{ description: nil, type: :exchange_error }, "your balance is low" => %{ description: "{\"status\":\"error\",\"ts\":1595594160149,\"err_code\":\"invalid-parameter\",\"err_msg\":\"invalid size, valid range: [1,2000]\"}", type: :insufficient_balance } }, error_codes: %{ 1 => :exchange_error, 1001 => :rate_limited, 1002 => :exchange_error, 1003 => :exchange_error, 20003 => :exchange_error, 21009 => :exchange_error, 30001 => :invalid_credentials, 30002 => :invalid_credentials, 30003 => :invalid_credentials, 30004 => :invalid_credentials, 30005 => :invalid_credentials, 30006 => :invalid_credentials, 30007 => :invalid_parameters, 30008 => :network_error, 30009 => :exchange_error, 30010 => :invalid_credentials, 30011 => :access_restricted, 30012 => :invalid_credentials, 30013 => :invalid_credentials, 30014 => :rate_limited, 30015 => :invalid_credentials, 30016 => :exchange_error, 30017 => :exchange_error, 30018 => :exchange_error, 30019 => :network_error, 30020 => :invalid_parameters, 30021 => :invalid_parameters, 30022 => :access_restricted, 30023 => :invalid_parameters, 30024 => :invalid_order, 30025 => :invalid_parameters, 30026 => :rate_limited, 30027 => :invalid_credentials, 30028 => :access_restricted, 30029 => :access_restricted, 30030 => :exchange_error, 30031 => :invalid_parameters, 30032 => :invalid_order, 30033 => :invalid_parameters, 30034 => :exchange_error, 30035 => :exchange_error, 30036 => :exchange_error, 30037 => :network_error, 30038 => :network_error, 32001 => :access_restricted, 32002 => :access_restricted, 32003 => :exchange_error, 32004 => :exchange_error, 32005 => :invalid_order, 32006 => :invalid_order, 32007 => :invalid_order, 32008 => :invalid_order, 32009 => :invalid_order, 32010 => :exchange_error, 32011 => :exchange_error, 32012 => :exchange_error, 32013 => :exchange_error, 32014 => :exchange_error, 32015 => :exchange_error, 32016 => :exchange_error, 32017 => :exchange_error, 32018 => :exchange_error, 32019 => :exchange_error, 32020 => :exchange_error, 32021 => :exchange_error, 32022 => :exchange_error, 32023 => :exchange_error, 32024 => :exchange_error, 32025 => :exchange_error, 32026 => :exchange_error, 32027 => :exchange_error, 32028 => :access_restricted, 32029 => :exchange_error, 32030 => :invalid_order, 32031 => :invalid_parameters, 32038 => :invalid_credentials, 32040 => :exchange_error, 32044 => :exchange_error, 32045 => :exchange_error, 32046 => :exchange_error, 32047 => :exchange_error, 32048 => :invalid_order, 32049 => :exchange_error, 32050 => :invalid_order, 32051 => :invalid_order, 32052 => :exchange_error, 32053 => :exchange_error, 32054 => :exchange_error, 32055 => :invalid_order, 32056 => :exchange_error, 32057 => :exchange_error, 32058 => :exchange_error, 32059 => :invalid_order, 32060 => :invalid_order, 32061 => :invalid_order, 32062 => :invalid_order, 32063 => :invalid_order, 32064 => :exchange_error, 32065 => :exchange_error, 32066 => :exchange_error, 32067 => :exchange_error, 32068 => :exchange_error, 32069 => :exchange_error, 32070 => :exchange_error, 32071 => :exchange_error, 32072 => :exchange_error, 32073 => :exchange_error, 32074 => :exchange_error, 32075 => :exchange_error, 32076 => :exchange_error, 32077 => :exchange_error, 32078 => :exchange_error, 32079 => :exchange_error, 32080 => :exchange_error, 32083 => :exchange_error, 33001 => :access_restricted, 33002 => :access_restricted, 33003 => :insufficient_balance, 33004 => :exchange_error, 33005 => :exchange_error, 33006 => :exchange_error, 33007 => :exchange_error, 33008 => :insufficient_balance, 33009 => :exchange_error, 33010 => :exchange_error, 33011 => :exchange_error, 33012 => :exchange_error, 33013 => :invalid_order, 33014 => :order_not_found, 33015 => :invalid_order, 33016 => :exchange_error, 33017 => :insufficient_balance, 33018 => :exchange_error, 33020 => :exchange_error, 33021 => :invalid_parameters, 33022 => :invalid_order, 33023 => :exchange_error, 33024 => :invalid_order, 33025 => :invalid_order, 33026 => :exchange_error, 33027 => :invalid_order, 33028 => :invalid_order, 33029 => :invalid_order, 33034 => :exchange_error, 33035 => :exchange_error, 33036 => :exchange_error, 33037 => :exchange_error, 33038 => :exchange_error, 33039 => :exchange_error, 33040 => :exchange_error, 33041 => :exchange_error, 33042 => :exchange_error, 33043 => :exchange_error, 33044 => :exchange_error, 33045 => :exchange_error, 33046 => :exchange_error, 33047 => :exchange_error, 33048 => :exchange_error, 33049 => :exchange_error, 33050 => :exchange_error, 33051 => :exchange_error, 33059 => :invalid_parameters, 33060 => :invalid_parameters, 33061 => :exchange_error, 33062 => :exchange_error, 33063 => :exchange_error, 33064 => :exchange_error, 33065 => :exchange_error, 34001 => :access_restricted, 34002 => :invalid_parameters, 34003 => :exchange_error, 34004 => :exchange_error, 34005 => :exchange_error, 34006 => :exchange_error, 34007 => :exchange_error, 34008 => :insufficient_balance, 34009 => :exchange_error, 34010 => :exchange_error, 34011 => :exchange_error, 34012 => :exchange_error, 34013 => :exchange_error, 34014 => :exchange_error, 34015 => :exchange_error, 34016 => :access_restricted, 34017 => :access_restricted, 34018 => :invalid_credentials, 34019 => :access_restricted, 34020 => :access_restricted, 34021 => :invalid_parameters, 34022 => :exchange_error, 34023 => :access_restricted, 34026 => :exchange_error, 34036 => :exchange_error, 34037 => :exchange_error, 34038 => :exchange_error, 34039 => :exchange_error, 35001 => :exchange_error, 35002 => :exchange_error, 35003 => :exchange_error, 35004 => :exchange_error, 35005 => :invalid_credentials, 35008 => :invalid_order, 35010 => :invalid_order, 35012 => :invalid_order, 35014 => :invalid_order, 35015 => :invalid_order, 35017 => :exchange_error, 35019 => :invalid_order, 35020 => :invalid_order, 35021 => :invalid_order, 35022 => :exchange_error, 35024 => :exchange_error, 35025 => :insufficient_balance, 35026 => :exchange_error, 35029 => :order_not_found, 35030 => :invalid_order, 35031 => :invalid_order, 35032 => :exchange_error, 35037 => :exchange_error, 35039 => :exchange_error, 35040 => :invalid_order, 35044 => :exchange_error, 35046 => :insufficient_balance, 35047 => :insufficient_balance, 35048 => :exchange_error, 35049 => :invalid_order, 35050 => :invalid_order, 35052 => :insufficient_balance, 35053 => :exchange_error, 35055 => :insufficient_balance, 35057 => :exchange_error, 35058 => :exchange_error, 35059 => :invalid_parameters, 35060 => :invalid_parameters, 35061 => :invalid_parameters, 35062 => :invalid_order, 35063 => :invalid_order, 35064 => :invalid_order, 35066 => :invalid_order, 35067 => :invalid_order, 35068 => :invalid_order, 35069 => :invalid_order, 35070 => :invalid_order, 35071 => :invalid_order, 35072 => :invalid_order, 35073 => :invalid_order, 35074 => :invalid_order, 35075 => :invalid_order, 35076 => :invalid_order, 35077 => :invalid_order, 35078 => :invalid_order, 35079 => :invalid_order, 35080 => :invalid_order, 35081 => :invalid_order, 35082 => :invalid_order, 35083 => :invalid_order, 35084 => :invalid_order, 35085 => :invalid_order, 35086 => :invalid_order, 35087 => :invalid_order, 35088 => :invalid_order, 35089 => :invalid_order, 35090 => :exchange_error, 35091 => :exchange_error, 35092 => :exchange_error, 35093 => :exchange_error, 35094 => :exchange_error, 35095 => :invalid_parameters, 35096 => :exchange_error, 35097 => :exchange_error, 35098 => :exchange_error, 35099 => :exchange_error, 36001 => :invalid_parameters, 36002 => :invalid_parameters, 36005 => :exchange_error, 36101 => :invalid_credentials, 36102 => :access_restricted, 36103 => :access_restricted, 36104 => :access_restricted, 36105 => :access_restricted, 36106 => :access_restricted, 36107 => :access_restricted, 36108 => :insufficient_balance, 36109 => :access_restricted, 36201 => :access_restricted, 36202 => :access_restricted, 36203 => :invalid_order, 36204 => :exchange_error, 36205 => :invalid_parameters, 36206 => :invalid_parameters, 36207 => :invalid_order, 36208 => :invalid_order, 36209 => :invalid_order, 36210 => :invalid_order, 36211 => :invalid_order, 36212 => :invalid_order, 36213 => :invalid_order, 36214 => :exchange_error, 36216 => :order_not_found, 36217 => :invalid_order, 36218 => :invalid_order, 36219 => :invalid_order, 36220 => :invalid_order, 36221 => :invalid_order, 36222 => :invalid_order, 36223 => :invalid_order, 36224 => :invalid_order, 36225 => :invalid_order, 36226 => :invalid_order, 36227 => :invalid_order, 36228 => :invalid_order, 36229 => :invalid_order, 36230 => :invalid_order, 400 => :invalid_parameters, 40001 => :invalid_credentials, 40002 => :invalid_credentials, 40003 => :invalid_credentials, 40004 => :invalid_credentials, 40005 => :invalid_credentials, 40006 => :invalid_credentials, 40007 => :invalid_parameters, 40008 => :invalid_credentials, 40009 => :invalid_credentials, 4001 => :exchange_error, 40010 => :invalid_credentials, 40011 => :invalid_credentials, 40012 => :invalid_credentials, 40013 => :exchange_error, 40014 => :access_restricted, 40015 => :exchange_error, 40016 => :access_restricted, 40017 => :exchange_error, 40018 => :access_restricted, 40019 => :invalid_parameters, 4002 => :exchange_error, 40020 => :invalid_parameters, 40024 => :access_restricted, 40031 => :access_restricted, 40037 => :invalid_credentials, 401 => :invalid_credentials, 4010 => :access_restricted, 40102 => :invalid_parameters, 40103 => :invalid_parameters, 40104 => :exchange_error, 40105 => :exchange_error, 40106 => :exchange_error, 40107 => :exchange_error, 40108 => :invalid_order, 40109 => :order_not_found, 40200 => :network_error, 40201 => :invalid_order, 40202 => :exchange_error, 40203 => :invalid_parameters, 40204 => :invalid_parameters, 40205 => :invalid_parameters, 40206 => :invalid_parameters, 40207 => :invalid_parameters, 40208 => :invalid_parameters, 40209 => :invalid_parameters, 403 => :access_restricted, 40300 => :exchange_error, 40301 => :access_restricted, 40302 => :invalid_parameters, 40303 => :invalid_parameters, 40304 => :invalid_parameters, 40305 => :invalid_parameters, 40306 => :exchange_error, 40308 => :network_error, 40309 => :invalid_order, 404 => :invalid_parameters, 40400 => :exchange_error, 40401 => :exchange_error, 40402 => :invalid_parameters, 40403 => :invalid_parameters, 40404 => :invalid_parameters, 40405 => :invalid_parameters, 40406 => :invalid_parameters, 40407 => :exchange_error, 40408 => :exchange_error, 40409 => :exchange_error, 405 => :invalid_parameters, 40500 => :invalid_order, 40501 => :exchange_error, 40502 => :exchange_error, 40503 => :exchange_error, 40504 => :exchange_error, 40505 => :exchange_error, 40506 => :invalid_credentials, 40507 => :invalid_credentials, 40508 => :exchange_error, 40509 => :exchange_error, 40600 => :exchange_error, 40601 => :exchange_error, 40602 => :exchange_error, 40603 => :exchange_error, 40604 => :network_error, 40605 => :exchange_error, 40606 => :exchange_error, 40607 => :exchange_error, 40608 => :exchange_error, 40609 => :exchange_error, 40700 => :invalid_parameters, 40701 => :exchange_error, 40702 => :exchange_error, 40703 => :exchange_error, 40704 => :exchange_error, 40705 => :invalid_parameters, 40706 => :invalid_order, 40707 => :invalid_parameters, 40708 => :invalid_parameters, 40709 => :exchange_error, 40710 => :exchange_error, 40711 => :insufficient_balance, 40712 => :insufficient_balance, 40713 => :exchange_error, 40714 => :exchange_error, 40762 => :insufficient_balance, 40768 => :order_not_found, 40774 => :invalid_order, 40808 => :invalid_order, 41103 => :invalid_order, 41114 => :network_error, 415 => :invalid_parameters, 429 => :rate_limited, 43001 => :order_not_found, 43011 => :invalid_order, 43012 => :insufficient_balance, 43025 => :invalid_order, 43111 => :access_restricted, 43115 => :network_error, 45110 => :invalid_order, 45122 => :invalid_order, 500 => :network_error, 50003 => :exchange_error, 50004 => :invalid_order, 50006 => :access_restricted, 50007 => :access_restricted, 50008 => :network_error, 50009 => :rate_limited, 50010 => :exchange_error, 50014 => :invalid_order, 50015 => :invalid_order, 50016 => :invalid_order, 50017 => :invalid_order, 50018 => :invalid_order, 50019 => :invalid_order, 50020 => :insufficient_balance, 50021 => :invalid_order, 50026 => :invalid_order, "Cash Withdrawal Is Less Than The Minimum Value" => :invalid_parameters, "Cash Withdrawal Is More Than The Maximum Value" => :invalid_parameters, "Request Frequency Is Too High" => :rate_limited, "User Prohibited Cash Withdrawal" => :access_restricted, "accesskey not null" => :invalid_credentials, "address invalid cointype" => :exchange_error, "api signature not valid" => :invalid_credentials, "audit failed" => :exchange_error, "base date error" => :exchange_error, "base symbol error" => :invalid_order, "failure to get a peer from the ring-balancer" => :network_error, "gateway internal error" => :exchange_error, "illegal accesskey" => :invalid_credentials, "illegal sign invalid" => :invalid_credentials, "invalid accountId" => :invalid_parameters, "invalid address" => :invalid_parameters, "invalid amount" => :invalid_order, "invalid currency" => :invalid_order, "invalid end time" => :invalid_parameters, "invalid order query time" => :exchange_error, "invalid orderId" => :invalid_order, "invalid period" => :invalid_parameters, "invalid record" => :exchange_error, "invalid sign" => :invalid_credentials, "invalid size, valid range" => :exchange_error, "invalid start time" => :invalid_parameters, "invalid symbol" => :invalid_order, "invalid type" => :invalid_order, "invalid user" => :exchange_error, "limit need price" => :invalid_order, "market no need price" => :invalid_order, "more than a daily rate of cash" => :invalid_parameters, "more than the maximum daily withdrawal amount" => :invalid_parameters, "need to bind email or mobile" => :exchange_error, "order cancel fail" => :invalid_parameters, "order queryorder invalid" => :invalid_parameters, "permissions not right" => :access_restricted, "req_time is too much difference from server time" => :invalid_credentials, "sign not null" => :invalid_credentials, "system exception" => :exchange_error, "the account with in 24 hours ban coin" => :access_restricted, "user forbid" => :access_restricted, "user locked" => :access_restricted, "userid not equal to account_id" => :exchange_error, "your balance is low" => :insufficient_balance }, exceptions: %{ broad: %{ "invalid size, valid range" => :exchange_error }, exact: %{ "01001" => :exchange_error, "1" => :exchange_error, "1001" => :rate_limit_exceeded, "1002" => :exchange_error, "1003" => :exchange_error, "20003" => :exchange_error, "21009" => :exchange_error, "30001" => :authentication_error, "30002" => :authentication_error, "30003" => :authentication_error, "30004" => :authentication_error, "30005" => :invalid_nonce, "30006" => :authentication_error, "30007" => :bad_request, "30008" => :request_timeout, "30009" => :exchange_error, "30010" => :authentication_error, "30011" => :permission_denied, "30012" => :authentication_error, "30013" => :authentication_error, "30014" => :ddos_protection, "30015" => :authentication_error, "30016" => :exchange_error, "30017" => :exchange_error, "30018" => :exchange_error, "30019" => :exchange_not_available, "30020" => :bad_request, "30021" => :bad_request, "30022" => :permission_denied, "30023" => :bad_request, "30024" => :bad_symbol, "30025" => :bad_request, "30026" => :ddos_protection, "30027" => :authentication_error, "30028" => :permission_denied, "30029" => :account_suspended, "30030" => :exchange_error, "30031" => :bad_request, "30032" => :bad_symbol, "30033" => :bad_request, "30034" => :exchange_error, "30035" => :exchange_error, "30036" => :exchange_error, "30037" => :exchange_not_available, "30038" => :on_maintenance, "32001" => :account_suspended, "32002" => :permission_denied, "32003" => :cancel_pending, "32004" => :exchange_error, "32005" => :invalid_order, "32006" => :invalid_order, "32007" => :invalid_order, "32008" => :invalid_order, "32009" => :invalid_order, "32010" => :exchange_error, "32011" => :exchange_error, "32012" => :exchange_error, "32013" => :exchange_error, "32014" => :exchange_error, "32015" => :exchange_error, "32016" => :exchange_error, "32017" => :exchange_error, "32018" => :exchange_error, "32019" => :exchange_error, "32020" => :exchange_error, "32021" => :exchange_error, "32022" => :exchange_error, "32023" => :exchange_error, "32024" => :exchange_error, "32025" => :exchange_error, "32026" => :exchange_error, "32027" => :exchange_error, "32028" => :account_suspended, "32029" => :exchange_error, "32030" => :invalid_order, "32031" => :arguments_required, "32038" => :authentication_error, "32040" => :exchange_error, "32044" => :exchange_error, "32045" => :exchange_error, "32046" => :exchange_error, "32047" => :exchange_error, "32048" => :invalid_order, "32049" => :exchange_error, "32050" => :invalid_order, "32051" => :invalid_order, "32052" => :exchange_error, "32053" => :exchange_error, "32054" => :exchange_error, "32055" => :invalid_order, "32056" => :exchange_error, "32057" => :exchange_error, "32058" => :exchange_error, "32059" => :invalid_order, "32060" => :invalid_order, "32061" => :invalid_order, "32062" => :invalid_order, "32063" => :invalid_order, "32064" => :exchange_error, "32065" => :exchange_error, "32066" => :exchange_error, "32067" => :exchange_error, "32068" => :exchange_error, "32069" => :exchange_error, "32070" => :exchange_error, "32071" => :exchange_error, "32072" => :exchange_error, "32073" => :exchange_error, "32074" => :exchange_error, "32075" => :exchange_error, "32076" => :exchange_error, "32077" => :exchange_error, "32078" => :exchange_error, "32079" => :exchange_error, "32080" => :exchange_error, "32083" => :exchange_error, "33001" => :permission_denied, "33002" => :account_suspended, "33003" => :insufficient_funds, "33004" => :exchange_error, "33005" => :exchange_error, "33006" => :exchange_error, "33007" => :exchange_error, "33008" => :insufficient_funds, "33009" => :exchange_error, "33010" => :exchange_error, "33011" => :exchange_error, "33012" => :exchange_error, "33013" => :invalid_order, "33014" => :order_not_found, "33015" => :invalid_order, "33016" => :exchange_error, "33017" => :insufficient_funds, "33018" => :exchange_error, "33020" => :exchange_error, "33021" => :bad_request, "33022" => :invalid_order, "33023" => :exchange_error, "33024" => :invalid_order, "33025" => :invalid_order, "33026" => :exchange_error, "33027" => :invalid_order, "33028" => :invalid_order, "33029" => :invalid_order, "33034" => :exchange_error, "33035" => :exchange_error, "33036" => :exchange_error, "33037" => :exchange_error, "33038" => :exchange_error, "33039" => :exchange_error, "33040" => :exchange_error, "33041" => :exchange_error, "33042" => :exchange_error, "33043" => :exchange_error, "33044" => :exchange_error, "33045" => :exchange_error, "33046" => :exchange_error, "33047" => :exchange_error, "33048" => :exchange_error, "33049" => :exchange_error, "33050" => :exchange_error, "33051" => :exchange_error, "33059" => :bad_request, "33060" => :bad_request, "33061" => :exchange_error, "33062" => :exchange_error, "33063" => :exchange_error, "33064" => :exchange_error, "33065" => :exchange_error, "34001" => :permission_denied, "34002" => :invalid_address, "34003" => :exchange_error, "34004" => :exchange_error, "34005" => :exchange_error, "34006" => :exchange_error, "34007" => :exchange_error, "34008" => :insufficient_funds, "34009" => :exchange_error, "34010" => :exchange_error, "34011" => :exchange_error, "34012" => :exchange_error, "34013" => :exchange_error, "34014" => :exchange_error, "34015" => :exchange_error, "34016" => :permission_denied, "34017" => :account_suspended, "34018" => :authentication_error, "34019" => :permission_denied, "34020" => :permission_denied, "34021" => :invalid_address, "34022" => :exchange_error, "34023" => :permission_denied, "34026" => :exchange_error, "34036" => :exchange_error, "34037" => :exchange_error, "34038" => :exchange_error, "34039" => :exchange_error, "35001" => :exchange_error, "35002" => :exchange_error, "35003" => :exchange_error, "35004" => :exchange_error, "35005" => :authentication_error, "35008" => :invalid_order, "35010" => :invalid_order, "35012" => :invalid_order, "35014" => :invalid_order, "35015" => :invalid_order, "35017" => :exchange_error, "35019" => :invalid_order, "35020" => :invalid_order, "35021" => :invalid_order, "35022" => :exchange_error, "35024" => :exchange_error, "35025" => :insufficient_funds, "35026" => :exchange_error, "35029" => :order_not_found, "35030" => :invalid_order, "35031" => :invalid_order, "35032" => :exchange_error, "35037" => :exchange_error, "35039" => :exchange_error, "35040" => :invalid_order, "35044" => :exchange_error, "35046" => :insufficient_funds, "35047" => :insufficient_funds, "35048" => :exchange_error, "35049" => :invalid_order, "35050" => :invalid_order, "35052" => :insufficient_funds, "35053" => :exchange_error, "35055" => :insufficient_funds, "35057" => :exchange_error, "35058" => :exchange_error, "35059" => :bad_request, "35060" => :bad_request, "35061" => :bad_request, "35062" => :invalid_order, "35063" => :invalid_order, "35064" => :invalid_order, "35066" => :invalid_order, "35067" => :invalid_order, "35068" => :invalid_order, "35069" => :invalid_order, "35070" => :invalid_order, "35071" => :invalid_order, "35072" => :invalid_order, "35073" => :invalid_order, "35074" => :invalid_order, "35075" => :invalid_order, "35076" => :invalid_order, "35077" => :invalid_order, "35078" => :invalid_order, "35079" => :invalid_order, "35080" => :invalid_order, "35081" => :invalid_order, "35082" => :invalid_order, "35083" => :invalid_order, "35084" => :invalid_order, "35085" => :invalid_order, "35086" => :invalid_order, "35087" => :invalid_order, "35088" => :invalid_order, "35089" => :invalid_order, "35090" => :exchange_error, "35091" => :exchange_error, "35092" => :exchange_error, "35093" => :exchange_error, "35094" => :exchange_error, "35095" => :bad_request, "35096" => :exchange_error, "35097" => :exchange_error, "35098" => :exchange_error, "35099" => :exchange_error, "36001" => :bad_request, "36002" => :bad_request, "36005" => :exchange_error, "36101" => :authentication_error, "36102" => :permission_denied, "36103" => :account_suspended, "36104" => :permission_denied, "36105" => :permission_denied, "36106" => :account_suspended, "36107" => :permission_denied, "36108" => :insufficient_funds, "36109" => :permission_denied, "36201" => :permission_denied, "36202" => :permission_denied, "36203" => :invalid_order, "36204" => :exchange_error, "36205" => :bad_request, "36206" => :bad_request, "36207" => :invalid_order, "36208" => :invalid_order, "36209" => :invalid_order, "36210" => :invalid_order, "36211" => :invalid_order, "36212" => :invalid_order, "36213" => :invalid_order, "36214" => :exchange_error, "36216" => :order_not_found, "36217" => :invalid_order, "36218" => :invalid_order, "36219" => :invalid_order, "36220" => :invalid_order, "36221" => :invalid_order, "36222" => :invalid_order, "36223" => :invalid_order, "36224" => :invalid_order, "36225" => :invalid_order, "36226" => :invalid_order, "36227" => :invalid_order, "36228" => :invalid_order, "36229" => :invalid_order, "36230" => :invalid_order, "400" => :bad_request, "40001" => :authentication_error, "40002" => :authentication_error, "40003" => :authentication_error, "40004" => :invalid_nonce, "40005" => :invalid_nonce, "40006" => :authentication_error, "40007" => :bad_request, "40008" => :invalid_nonce, "40009" => :authentication_error, "4001" => :exchange_error, "40010" => :authentication_error, "40011" => :authentication_error, "40012" => :authentication_error, "40013" => :exchange_error, "40014" => :permission_denied, "40015" => :exchange_error, "40016" => :permission_denied, "40017" => :exchange_error, "40018" => :permission_denied, "40019" => :bad_request, "4002" => :exchange_error, "40020" => :bad_request, "40024" => :restricted_location, "40031" => :account_suspended, "40037" => :authentication_error, "401" => :authentication_error, "4010" => :permission_denied, "40102" => :bad_request, "40103" => :bad_request, "40104" => :exchange_error, "40105" => :exchange_error, "40106" => :exchange_error, "40107" => :exchange_error, "40108" => :invalid_order, "40109" => :order_not_found, "40200" => :on_maintenance, "40201" => :invalid_order, "40202" => :exchange_error, "40203" => :bad_request, "40204" => :bad_request, "40205" => :bad_request, "40206" => :bad_request, "40207" => :bad_request, "40208" => :bad_request, "40209" => :bad_request, "403" => :permission_denied, "40300" => :exchange_error, "40301" => :permission_denied, "40302" => :bad_request, "40303" => :bad_request, "40304" => :bad_request, "40305" => :bad_request, "40306" => :exchange_error, "40308" => :on_maintenance, "40309" => :bad_symbol, "404" => :bad_request, "40400" => :exchange_error, "40401" => :exchange_error, "40402" => :bad_request, "40403" => :bad_request, "40404" => :bad_request, "40405" => :bad_request, "40406" => :bad_request, "40407" => :exchange_error, "40408" => :exchange_error, "40409" => :exchange_error, "405" => :bad_request, "40500" => :invalid_order, "40501" => :exchange_error, "40502" => :exchange_error, "40503" => :exchange_error, "40504" => :exchange_error, "40505" => :exchange_error, "40506" => :authentication_error, "40507" => :authentication_error, "40508" => :exchange_error, "40509" => :exchange_error, "40600" => :exchange_error, "40601" => :exchange_error, "40602" => :exchange_error, "40603" => :exchange_error, "40604" => :exchange_not_available, "40605" => :exchange_error, "40606" => :exchange_error, "40607" => :exchange_error, "40608" => :exchange_error, "40609" => :exchange_error, "40700" => :bad_request, "40701" => :exchange_error, "40702" => :exchange_error, "40703" => :exchange_error, "40704" => :exchange_error, "40705" => :bad_request, "40706" => :invalid_order, "40707" => :bad_request, "40708" => :bad_request, "40709" => :exchange_error, "40710" => :exchange_error, "40711" => :insufficient_funds, "40712" => :insufficient_funds, "40713" => :exchange_error, "40714" => :exchange_error, "40762" => :insufficient_funds, "40768" => :order_not_found, "40774" => :invalid_order, "40808" => :invalid_order, "41103" => :invalid_order, "41114" => :on_maintenance, "415" => :bad_request, "429" => :ddos_protection, "43001" => :order_not_found, "43011" => :invalid_order, "43012" => :insufficient_funds, "43025" => :invalid_order, "43111" => :permission_denied, "43115" => :on_maintenance, "45110" => :invalid_order, "45122" => :invalid_order, "500" => :exchange_not_available, "50003" => :exchange_error, "50004" => :bad_symbol, "50006" => :permission_denied, "50007" => :permission_denied, "50008" => :request_timeout, "50009" => :rate_limit_exceeded, "50010" => :exchange_error, "50014" => :invalid_order, "50015" => :invalid_order, "50016" => :invalid_order, "50017" => :invalid_order, "50018" => :invalid_order, "50019" => :invalid_order, "50020" => :insufficient_funds, "50021" => :invalid_order, "50026" => :invalid_order, "Cash Withdrawal Is Less Than The Minimum Value" => :bad_request, "Cash Withdrawal Is More Than The Maximum Value" => :bad_request, "Request Frequency Is Too High" => :rate_limit_exceeded, "User Prohibited Cash Withdrawal" => :permission_denied, "accesskey not null" => :authentication_error, "address invalid cointype" => :exchange_error, "api signature not valid" => :authentication_error, "audit failed" => :exchange_error, "base date error" => :exchange_error, "base symbol error" => :bad_symbol, "failure to get a peer from the ring-balancer" => :exchange_not_available, "gateway internal error" => :exchange_error, "illegal accesskey" => :authentication_error, "illegal sign invalid" => :authentication_error, "invalid accountId" => :bad_request, "invalid address" => :bad_request, "invalid amount" => :invalid_order, "invalid currency" => :bad_symbol, "invalid end time" => :bad_request, "invalid order query time" => :exchange_error, "invalid orderId" => :invalid_order, "invalid period" => :bad_request, "invalid record" => :exchange_error, "invalid sign" => :authentication_error, "invalid start time" => :bad_request, "invalid symbol" => :bad_symbol, "invalid type" => :invalid_order, "invalid user" => :exchange_error, "limit need price" => :invalid_order, "market no need price" => :invalid_order, "more than a daily rate of cash" => :bad_request, "more than the maximum daily withdrawal amount" => :bad_request, "need to bind email or mobile" => :exchange_error, "order cancel fail" => :bad_request, "order queryorder invalid" => :bad_request, "permissions not right" => :permission_denied, "req_time is too much difference from server time" => :invalid_nonce, "sign not null" => :authentication_error, "system exception" => :exchange_error, "the account with in 24 hours ban coin" => :permission_denied, "user forbid" => :permission_denied, "user locked" => :account_suspended, "userid not equal to account_id" => :exchange_error, "your balance is low" => :insufficient_funds } }, exchange_options: %{ "accountsById" => %{ "coin_futures" => "future", "crossed_margin" => "cross", "isolated_margin" => "isolated", "p2p" => "p2p", "spot" => "spot", "usdc_futures" => "usdc_swap", "usdt_futures" => "swap" }, "accountsByType" => %{ "cross" => "crossed_margin", "future" => "coin_futures", "isolated" => "isolated_margin", "p2p" => "p2p", "spot" => "spot", "swap" => "usdt_futures", "usdc_swap" => "usdc_futures" }, "adjustForTimeDifference" => false, "broker" => "p4sve", "createMarketBuyOrderRequiresPrice" => true, "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "defaultSubType" => "linear", "defaultTimeInForce" => "GTC", "defaultType" => "spot", "fetchFundingRate" => %{ "method" => "publicMixGetV2MixMarketCurrentFundRate" }, "fetchMarkets" => %{ "types" => [ "spot", "swap" ] }, "fetchOHLCV" => %{ "maxRecentDaysPerTimeframe" => %{ "12h" => 720, "15m" => 30, "1M" => 43200, "1d" => 1440, "1h" => 60, "1m" => 30, "1w" => 10080, "2h" => 120, "30m" => 30, "3d" => 4320, "3m" => 30, "4h" => 240, "5m" => 30, "6h" => 360 }, "spot" => %{ "maxLimitPerTimeframe" => %{ "1M" => 100, "1d" => 300, "1w" => 100, "3d" => 100 }, "method" => "publicSpotGetV2SpotMarketCandles" }, "swap" => %{ "maxLimitPerTimeframe" => %{ "12h" => 180, "1M" => 4, "1d" => 90, "1w" => 13, "3d" => 30, "4h" => 540, "6h" => 360 }, "method" => "publicMixGetV2MixMarketCandles" } }, "fetchPositions" => %{ "method" => "privateMixGetV2MixPositionAllPosition" }, "fetchTrades" => %{ "spot" => %{ "method" => "publicSpotGetV2SpotMarketFillsHistory" }, "swap" => %{ "method" => "publicMixGetV2MixMarketFillsHistory" } }, "fiatCurrencies" => [ "EUR", "VND", "PLN", "CZK", "HUF", "DKK", "AUD", "CAD", "NOK", "SEK", "CHF", "MXN", "COP", "ARS", "GBP", "BRL", "UAH", "ZAR" ], "networks" => %{ "ABBC" => "ABBCCoin", "ACA" => "AcalaToken", "ADA" => "Cardano", "APT" => "Aptos", "AR" => "Arweave", "ARBNOVA" => "ArbitrumNova", "ARBONE" => "ArbitrumOne", "ATOM" => "ATOM", "AVAXC" => "C-Chain", "AVAXX" => "X-Chain", "AZERO" => "AZERO", "BCH" => "BCH", "BCHA" => "BCHA", "BEP20" => "BSC", "BITCI" => "BITCI", "BTC" => "BTC", "CELO" => "CELO", "CHZ" => "ChilizChain", "CRC20" => "CronosChain", "CSPR" => "CSPR", "DOGE" => "DOGE", "DOT" => "DOT", "EGLD" => "Elrond", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "ETC", "ETHF" => "ETHFAIR", "ETHW" => "ETHW", "FET" => "FETCH", "FIL" => "FIL", "FIO" => "FIO", "FTM" => "Fantom", "GLMR" => "Moonbeam", "HNT" => "Helium", "HRC20" => "HECO", "ICP" => "ICP", "IOTX" => "IoTeX", "JUNO" => "JUNO", "KARDIA" => "KAI", "KAVA" => "KAVA", "KDA" => "KDA", "KLAY" => "Klaytn", "KSM" => "Kusama", "LAT" => "LAT", "LTC" => "LTC", "MATIC" => "Polygon", "METIS" => "MetisToken", "MINA" => "MINA", "MOVR" => "MOVR", "NEAR" => "NEARProtocol", "NEM" => "NEM", "NULS" => "NULS", "OASIS" => "ROSE", "OASYS" => "OASYS", "OMNI" => "OMNI", "ONE" => "Harmony", "ONT" => "Ontology", "OPTIMISM" => "Optimism", "OSMO" => "Osmosis", "POKT" => "PocketNetwork", "QTUM" => "QTUM", "REEF" => "REEF", "REI" => "REINetwork", "RSK" => "RSK", "SOL" => "SOL", "STARKNET" => "Starknet", "SXP" => "Solar", "SYS" => "SYS", "THETA" => "ThetaToken", "TLOS" => "Telos", "TON" => "TON", "TRC10" => "TRC10", "TRC20" => "TRC20", "TT" => "TT", "VIC" => "VICTION", "VITE" => "VITE", "WAVES" => "WAVES", "WAX" => "WAXP", "WEMIX" => "WEMIXMainnet", "XDC" => "XDCNetworkXDC", "XRP" => "XRP", "XYM" => "Symbol", "ZIL" => "ZIL", "ZKSYNC" => "zkSyncEra" }, "networksById" => %{ "ABBCCoin" => "ABBC", "ATOM" => "ATOM", "AZERO" => "AZERO", "AcalaToken" => "ACA", "Aptos" => "APT", "ArbitrumNova" => "ARBNOVA", "ArbitrumOne" => "ARBONE", "Arweave" => "AR", "BCH" => "BCH", "BCHA" => "BCHA", "BITCI" => "BITCI", "BSC" => "BEP20", "BTC" => "BTC", "C-Chain" => "AVAXC", "CELO" => "CELO", "CSPR" => "CSPR", "Cardano" => "ADA", "ChilizChain" => "CHZ", "CronosChain" => "CRC20", "DOGE" => "DOGE", "DOT" => "DOT", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "ETC", "ETHFAIR" => "ETHF", "ETHW" => "ETHW", "Elrond" => "EGLD", "FETCH" => "FET", "FIL" => "FIL", "FIO" => "FIO", "Fantom" => "FTM", "HECO" => "HRC20", "Harmony" => "ONE", "Helium" => "HNT", "ICP" => "ICP", "IoTeX" => "IOTX", "JUNO" => "JUNO", "KAI" => "KARDIA", "KAVA" => "KAVA", "KDA" => "KDA", "Klaytn" => "KLAY", "Kusama" => "KSM", "LAT" => "LAT", "LTC" => "LTC", "MINA" => "MINA", "MOVR" => "MOVR", "MetisToken" => "METIS", "Moonbeam" => "GLMR", "NEARProtocol" => "NEAR", "NEM" => "NEM", "NULS" => "NULS", "OASYS" => "OASYS", "OMNI" => "OMNI", "Ontology" => "ONT", "Optimism" => "OPTIMISM", "Osmosis" => "OSMO", "PocketNetwork" => "POKT", "Polygon" => "MATIC", "QTUM" => "QTUM", "REEF" => "REEF", "REINetwork" => "REI", "ROSE" => "OASIS", "RSK" => "RSK", "SOL" => "SOL", "SYS" => "SYS", "Solar" => "SXP", "Starknet" => "STARKNET", "Symbol" => "XYM", "TON" => "TON", "TRC10" => "TRC10", "TRC20" => "TRC20", "TT" => "TT", "Telos" => "TLOS", "ThetaToken" => "THETA", "VICTION" => "VIC", "VITE" => "VITE", "WAVES" => "WAVES", "WAXP" => "WAX", "WEMIXMainnet" => "WEMIX", "X-Chain" => "AVAXX", "XDCNetworkXDC" => "XDC", "XRP" => "XRP", "ZIL" => "ZIL", "zkSyncEra" => "ZKSYNC" }, "sandboxMode" => false, "timeDifference" => 0, "timeframes" => %{ "spot" => %{ "12h" => "12Hutc", "15m" => "15min", "1M" => "1Mutc", "1d" => "1Dutc", "1h" => "1h", "1m" => "1min", "1w" => "1Wutc", "30m" => "30min", "3d" => "3Dutc", "3m" => "3min", "4h" => "4h", "5m" => "5min", "6h" => "6Hutc" }, "swap" => %{ "12h" => "12Hutc", "15m" => "15m", "1M" => "1Mutc", "1d" => "1Dutc", "1h" => "1H", "1m" => "1m", "1w" => "1Wutc", "2h" => "2H", "30m" => "30m", "3d" => "3Dutc", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6Hutc" }, "uta" => %{ "12h" => "12H", "15m" => "15m", "1d" => "1D", "1h" => "1H", "1m" => "1m", "2h" => "2H", "30m" => "30m", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6H" } }, "uta" => false, "withdraw" => %{ "fillResponseFromRequest" => true } }, extended_metadata: %{ fees_url: "https://www.bitget.cc/zh-CN/rate?tab=1", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/fbaa10cc-a277-441d-a5b7-997dd9a87658", referral_url: "https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j" }, extracted_metadata: %{ ccxt_version: "4.5.42" }, features: %{ for_perps: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: false, trigger_price_type: %{ index: true, last: true, mark: true } }, hedged: true, market_buy_by_cost: false, market_buy_requires_price: false, stop_loss_price: true, take_profit_price: true, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: true, trigger_direction: false, trigger_price: true, trigger_price_type: %{ index: false, last: true, mark: true } }, extends: "spot", fetch_closed_orders: %{ trailing: true }, fetch_my_trades: %{ until_days: 7 } }, future: %{ inverse: %{ extends: "forPerps" }, linear: %{ extends: "forPerps" } }, spot: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: true, trigger_price_type: %{ index: false, last: false, mark: false } }, hedged: false, margin_mode: true, market_buy_by_cost: true, market_buy_requires_price: true, stop_loss_price: true, take_profit_price: true, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: false, trigger_direction: false, trigger_price: true, trigger_price_type: %{ index: false, last: true, mark: true } }, create_orders: %{ max: 50 }, fetch_closed_orders: %{ limit: 100, margin_mode: true, symbol_required: false, trailing: false, trigger: true, until_days: 90 }, fetch_my_trades: %{ limit: 100, margin_mode: true, symbol_required: true, until_days: 90 }, fetch_ohlcv: %{ limit: 200 }, fetch_open_orders: %{ limit: 100, margin_mode: true, symbol_required: false, trailing: false, trigger: true }, fetch_order: %{ margin_mode: false, symbol_required: true, trailing: false, trigger: false }, sandbox: true }, swap: %{ inverse: %{ extends: "forPerps" }, linear: %{ extends: "forPerps" } } }, fees: %{ spot: %{ maker: 0.002, taker: 0.002 }, swap: %{ maker: 0.0004, taker: 0.0006 } }, forward_aliases: %{ spot: %{ "DegenReborn" => "DEGEN" }, swap: %{ "DegenReborn" => "DEGEN" } }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (!response) {\n return undefined; // fallback to default error handler\n }\n //\n // spot\n //\n // {\"code\":\"00000\",\"msg\":\"success\",\"requestTime\":1713294492511,\"data\":[...]}\"\n //\n // {\"status\":\"fail\",\"err_code\":\"01001\",\"err_msg\":\"系统异常,请稍后重试\"}\n // {\"status\":\"error\",\"ts\":1595594160149,\"err_code\":\"invalid-parameter\",\"err_msg\":\"invalid size, valid range: [1,2000]\"}\n // {\"status\":\"error\",\"ts\":1595684716042,\"err_code\":\"invalid-parameter\",\"err_msg\":\"illegal sign invalid\"}\n // {\"status\":\"error\",\"ts\":1595700216275,\"err_code\":\"bad-request\",\"err_msg\":\"your balance is low!\"}\n // {\"status\":\"error\",\"ts\":1595700344504,\"err_code\":\"invalid-parameter\",\"err_msg\":\"invalid type\"}\n // {\"status\":\"error\",\"ts\":1595703343035,\"err_code\":\"bad-request\",\"err_msg\":\"order cancel fail\"}\n // {\"status\":\"error\",\"ts\":1595704360508,\"err_code\":\"invalid-parameter\",\"err_msg\":\"accesskey not null\"}\n // {\"status\":\"error\",\"ts\":1595704490084,\"err_code\":\"invalid-parameter\",\"err_msg\":\"permissions not right\"}\n // {\"status\":\"error\",\"ts\":1595711862763,\"err_code\":\"system exception\",\"err_msg\":\"system exception\"}\n // {\"status\":\"error\",\"ts\":1595730308979,\"err_code\":\"bad-request\",\"err_msg\":\"20003\"}\n //\n // swap\n //\n // {\"code\":\"40015\",\"msg\":\"\",\"requestTime\":1595698564931,\"data\":null}\n // {\"code\":\"40017\",\"msg\":\"Order id must not be blank\",\"requestTime\":1595702477835,\"data\":null}\n // {\"code\":\"40017\",\"msg\":\"Order Type must not be blank\",\"requestTime\":1595698516162,\"data\":null}\n // {\"code\":\"40301\",\"msg\":\"\",\"requestTime\":1595667662503,\"data\":null}\n // {\"code\":\"40017\",\"msg\":\"Contract code must not be blank\",\"requestTime\":1595703151651,\"data\":null}\n // {\"code\":\"40108\",\"msg\":\"\",\"requestTime\":1595885064600,\"data\":null}\n // {\"order_id\":\"513468410013679613\",\"client_oid\":null,\"symbol\":\"ethusd\",\"result\":false,\"err_code\":\"order_no_exist_error\",\"err_msg\":\"订单不存在!\"}\n //\n const message = this.safeString2(response, 'err_msg', 'msg');\n const feedback = this.id + ' ' + body;\n const nonEmptyMessage = ((message !== undefined) && (message !== '') && (message !== 'success'));\n if (nonEmptyMessage) {\n this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);\n this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);\n }\n const errorCode = this.safeString2(response, 'code', 'err_code');\n const nonZeroErrorCode = (errorCode !== undefined) && (errorCode !== '00000');\n if (nonZeroErrorCode) {\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);\n }\n if (nonZeroErrorCode || nonEmptyMessage) {\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }", has: %{ add_margin: true, borrow_cross_margin: true, borrow_isolated_margin: true, borrow_margin: false, c_o_r_s: false, cancel_all_orders: true, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: true, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, close_all_positions: true, close_position: true, create_convert_trade: true, create_deposit_address: false, create_limit_buy_order: false, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: false, create_limit_sell_order_ws: false, create_market_buy_order: false, create_market_buy_order_with_cost: true, create_market_buy_order_with_cost_ws: false, create_market_buy_order_ws: false, create_market_order: true, create_market_order_with_cost: false, create_market_order_with_cost_ws: false, create_market_order_ws: true, create_market_sell_order: false, create_market_sell_order_with_cost: false, create_market_sell_order_with_cost_ws: false, create_market_sell_order_ws: false, create_order: true, create_order_with_take_profit_and_stop_loss: 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: false, create_reduce_only_order_ws: false, create_stop_limit_order: true, create_stop_limit_order_ws: false, create_stop_loss_order: true, create_stop_loss_order_ws: false, create_stop_market_order: true, create_stop_market_order_ws: false, create_stop_order: true, create_stop_order_ws: false, create_take_profit_order: true, create_take_profit_order_ws: false, create_trailing_amount_order: false, create_trailing_amount_order_ws: false, create_trailing_percent_order: true, create_trailing_percent_order_ws: false, create_trigger_order: true, create_trigger_order_ws: false, deposit: false, edit_order: true, edit_order_with_client_order_id: false, edit_order_ws: false, edit_orders: false, fetch_a_d_l_rank: false, fetch_accounts: false, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: false, fetch_borrow_interest: true, 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: false, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: true, fetch_convert_quote: true, fetch_convert_trade: false, fetch_convert_trade_history: true, fetch_cross_borrow_rate: true, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: false, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: false, fetch_deposit_withdraw_fee: true, fetch_deposit_withdraw_fees: true, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: true, fetch_funding_interval: true, fetch_funding_intervals: true, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: true, fetch_greeks: false, fetch_index_ohlcv: true, fetch_isolated_borrow_rate: true, fetch_isolated_borrow_rates: false, fetch_isolated_positions: false, fetch_l2_order_book: true, fetch_l3_order_book: false, fetch_last_prices: false, fetch_ledger: true, fetch_ledger_entry: false, fetch_leverage: true, fetch_leverage_tiers: false, fetch_leverages: false, fetch_liquidations: false, fetch_long_short_ratio: false, fetch_long_short_ratio_history: true, fetch_margin_adjustment_history: false, fetch_margin_mode: true, fetch_margin_modes: false, fetch_mark_ohlcv: true, fetch_mark_price: 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: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: true, fetch_open_interest_history: false, fetch_open_interests: false, fetch_open_order: false, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: false, fetch_option_chain: false, fetch_order: true, fetch_order_book: true, fetch_order_book_ws: false, fetch_order_books: false, fetch_order_trades: false, fetch_order_with_client_order_id: false, fetch_order_ws: false, fetch_orders: false, fetch_orders_by_status: false, fetch_orders_ws: false, fetch_position: true, fetch_position_a_d_l_rank: false, fetch_position_history: true, fetch_position_mode: false, fetch_position_ws: false, fetch_positions: true, fetch_positions_a_d_l_rank: false, fetch_positions_for_symbol: false, fetch_positions_for_symbol_ws: false, fetch_positions_history: true, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: false, fetch_settlement_history: false, fetch_status: false, fetch_ticker: true, fetch_ticker_ws: false, fetch_tickers: true, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: true, fetch_trading_fees: 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: false, fetch_withdraw_addresses: false, fetch_withdrawal: false, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: true, margin: true, option: false, private_api: true, public_api: true, reduce_margin: true, repay_cross_margin: true, repay_isolated_margin: true, sandbox: false, 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: false, watch_liquidations_for_symbols: false, watch_my_liquidations: false, watch_my_liquidations_for_symbols: false, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: false, watch_order_book: true, watch_order_book_for_symbols: 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: "bitget", markets: nil, name: "Bitget", ohlcv_timestamp_resolution: :milliseconds, options: %{ :accounts_by_id => %{ "coin_futures" => "future", "crossed_margin" => "cross", "isolated_margin" => "isolated", "p2p" => "p2p", "spot" => "spot", "usdc_futures" => "usdc_swap", "usdt_futures" => "swap" }, :accounts_by_type => %{ "cross" => "crossed_margin", "future" => "coin_futures", "isolated" => "isolated_margin", "p2p" => "p2p", "spot" => "spot", "swap" => "usdt_futures", "usdc_swap" => "usdc_futures" }, :adjust_for_time_difference => false, :broker => "p4sve", :create_market_buy_order_requires_price => true, :default_account_type => "spot", :default_sub_type => "linear", :default_time_in_force => "GTC", :default_type => "spot", "fetch_funding_rate" => %{ "method" => "publicMixGetV2MixMarketCurrentFundRate" }, :fetch_markets => %{ "types" => [ "spot", "swap" ] }, :fetch_o_h_l_c_v => %{ "maxRecentDaysPerTimeframe" => %{ "12h" => 720, "15m" => 30, "1M" => 43200, "1d" => 1440, "1h" => 60, "1m" => 30, "1w" => 10080, "2h" => 120, "30m" => 30, "3d" => 4320, "3m" => 30, "4h" => 240, "5m" => 30, "6h" => 360 }, "spot" => %{ "maxLimitPerTimeframe" => %{ "1M" => 100, "1d" => 300, "1w" => 100, "3d" => 100 }, "method" => "publicSpotGetV2SpotMarketCandles" }, "swap" => %{ "maxLimitPerTimeframe" => %{ "12h" => 180, "1M" => 4, "1d" => 90, "1w" => 13, "3d" => 30, "4h" => 540, "6h" => 360 }, "method" => "publicMixGetV2MixMarketCandles" } }, :fetch_positions => %{ "method" => "privateMixGetV2MixPositionAllPosition" }, "fetch_trades" => %{ "spot" => %{ "method" => "publicSpotGetV2SpotMarketFillsHistory" }, "swap" => %{ "method" => "publicMixGetV2MixMarketFillsHistory" } }, "fiat_currencies" => [ "EUR", "VND", "PLN", "CZK", "HUF", "DKK", "AUD", "CAD", "NOK", "SEK", "CHF", "MXN", "COP", "ARS", "GBP", "BRL", "UAH", "ZAR" ], :networks => %{ "ABBC" => "ABBCCoin", "ACA" => "AcalaToken", "ADA" => "Cardano", "APT" => "Aptos", "AR" => "Arweave", "ARBNOVA" => "ArbitrumNova", "ARBONE" => "ArbitrumOne", "ATOM" => "ATOM", "AVAXC" => "C-Chain", "AVAXX" => "X-Chain", "AZERO" => "AZERO", "BCH" => "BCH", "BCHA" => "BCHA", "BEP20" => "BSC", "BITCI" => "BITCI", "BTC" => "BTC", "CELO" => "CELO", "CHZ" => "ChilizChain", "CRC20" => "CronosChain", "CSPR" => "CSPR", "DOGE" => "DOGE", "DOT" => "DOT", "EGLD" => "Elrond", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "ETC", "ETHF" => "ETHFAIR", "ETHW" => "ETHW", "FET" => "FETCH", "FIL" => "FIL", "FIO" => "FIO", "FTM" => "Fantom", "GLMR" => "Moonbeam", "HNT" => "Helium", "HRC20" => "HECO", "ICP" => "ICP", "IOTX" => "IoTeX", "JUNO" => "JUNO", "KARDIA" => "KAI", "KAVA" => "KAVA", "KDA" => "KDA", "KLAY" => "Klaytn", "KSM" => "Kusama", "LAT" => "LAT", "LTC" => "LTC", "MATIC" => "Polygon", "METIS" => "MetisToken", "MINA" => "MINA", "MOVR" => "MOVR", "NEAR" => "NEARProtocol", "NEM" => "NEM", "NULS" => "NULS", "OASIS" => "ROSE", "OASYS" => "OASYS", "OMNI" => "OMNI", "ONE" => "Harmony", "ONT" => "Ontology", "OPTIMISM" => "Optimism", "OSMO" => "Osmosis", "POKT" => "PocketNetwork", "QTUM" => "QTUM", "REEF" => "REEF", "REI" => "REINetwork", "RSK" => "RSK", "SOL" => "SOL", "STARKNET" => "Starknet", "SXP" => "Solar", "SYS" => "SYS", "THETA" => "ThetaToken", "TLOS" => "Telos", "TON" => "TON", "TRC10" => "TRC10", "TRC20" => "TRC20", "TT" => "TT", "VIC" => "VICTION", "VITE" => "VITE", "WAVES" => "WAVES", "WAX" => "WAXP", "WEMIX" => "WEMIXMainnet", "XDC" => "XDCNetworkXDC", "XRP" => "XRP", "XYM" => "Symbol", "ZIL" => "ZIL", "ZKSYNC" => "zkSyncEra" }, :networks_by_id => %{}, :sandbox_mode => false, :time_difference => 0, "timeframes" => %{ "spot" => %{ "12h" => "12Hutc", "15m" => "15min", "1M" => "1Mutc", "1d" => "1Dutc", "1h" => "1h", "1m" => "1min", "1w" => "1Wutc", "30m" => "30min", "3d" => "3Dutc", "3m" => "3min", "4h" => "4h", "5m" => "5min", "6h" => "6Hutc" }, "swap" => %{ "12h" => "12Hutc", "15m" => "15m", "1M" => "1Mutc", "1d" => "1Dutc", "1h" => "1H", "1m" => "1m", "1w" => "1Wutc", "2h" => "2H", "30m" => "30m", "3d" => "3Dutc", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6Hutc" }, "uta" => %{ "12h" => "12H", "15m" => "15m", "1d" => "1D", "1h" => "1H", "1m" => "1m", "2h" => "2H", "30m" => "30m", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6H" } }, "uta" => false, :withdraw => %{ "fillResponseFromRequest" => true } }, order_mappings: %{ side_format: :lowercase, side_key: "side", type_format: :lowercase, type_key: "orderType" }, param_mappings: %{ "amount" => "size", "code" => "coin", "cost" => "size", "fromAccount" => "fromType", "fromCode" => "fromCoin", "id" => "orderId", "since" => "startTime", "stopLoss" => "presetStopLossPrice", "takeProfit" => "presetStopSurplusPrice", "timeframe" => "granularity", "toAccount" => "toType", "toCode" => "toCoin", "type" => "orderType" }, parse_methods: [ %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"USDT\",\n \"available\": \"0.00000000\",\n \"limitAvailable\": \"0\",\n \"frozen\": \"0.00000000\",\n \"locked\": \"0.00000000\",\n \"uTime\": \"1699937566000\"\n }", "{\n \"marginCoin\": \"USDT\",\n \"locked\": \"0\",\n \"available\": \"0\",\n \"crossedMaxAvailable\": \"0\",\n \"isolatedMaxAvailable\": \"0\",\n \"maxTransferOut\": \"0\",\n \"accountEquity\": \"0\",\n \"usdtEquity\": \"0.000000005166\",\n \"btcEquity\": \"0\",\n \"crossedRiskRate\": \"0\",\n \"unrealizedPL\": \"0\",\n \"coupon\": \"0\",\n \"crossedUnrealizedPL\": null,\n \"isolatedUnrealizedPL\": null\n }", "{\n \"coin\": \"USDT\",\n \"totalAmount\": \"0.01\",\n \"available\": \"0.01\",\n \"frozen\": \"0\",\n \"borrow\": \"0\",\n \"interest\": \"0\",\n \"net\": \"0.01\",\n \"coupon\": \"0\",\n \"cTime\": \"1759828511592\",\n \"uTime\": \"1759828511592\"\n // \"symbol\": \"BTCUSDT\" // only for isolated margin\n }" ], "line_end" => 4674, "line_start" => 4597, "mappings" => [], "name" => "parseBalance", "signature" => "parseBalance (balance): Balances", "source" => "parseBalance (balance): Balances {\n const result: Dict = { 'info': balance };\n //\n // spot\n //\n // {\n // \"coin\": \"USDT\",\n // \"available\": \"0.00000000\",\n // \"limitAvailable\": \"0\",\n // \"frozen\": \"0.00000000\",\n // \"locked\": \"0.00000000\",\n // \"uTime\": \"1699937566000\"\n // }\n //\n // swap\n //\n // {\n // \"marginCoin\": \"USDT\",\n // \"locked\": \"0\",\n // \"available\": \"0\",\n // \"crossedMaxAvailable\": \"0\",\n // \"isolatedMaxAvailable\": \"0\",\n // \"maxTransferOut\": \"0\",\n // \"accountEquity\": \"0\",\n // \"usdtEquity\": \"0.000000005166\",\n // \"btcEquity\": \"0\",\n // \"crossedRiskRate\": \"0\",\n // \"unrealizedPL\": \"0\",\n // \"coupon\": \"0\",\n // \"crossedUnrealizedPL\": null,\n // \"isolatedUnrealizedPL\": null\n // }\n //\n // cross & isolated margin\n //\n // {\n // \"coin\": \"USDT\",\n // \"totalAmount\": \"0.01\",\n // \"available\": \"0.01\",\n // \"frozen\": \"0\",\n // \"borrow\": \"0\",\n // \"interest\": \"0\",\n // \"net\": \"0.01\",\n // \"coupon\": \"0\",\n // \"cTime\": \"1759828511592\",\n // \"uTime\": \"1759828511592\"\n // // \"symbol\": \"BTCUSDT\" // only for isolated margin\n // }\n //\n for (let i = 0; i < balance.length; i++) {\n const entry = balance[i];\n const account = this.account ();\n const currencyId = this.safeString2 (entry, 'marginCoin', 'coin');\n const code = this.safeCurrencyCode (currencyId);\n const borrow = this.safeString (entry, 'borrow');\n if (borrow !== undefined) {\n const interest = this.safeString (entry, 'interest');\n account['free'] = this.safeString (entry, 'transferable');\n account['total'] = this.safeString (entry, 'totalAmount');\n account['debt'] = Precise.stringAdd (borrow, interest);\n } else {\n // Use transferable instead of available for swap and margin https://github.com/ccxt/ccxt/pull/19127\n const spotAccountFree = this.safeString (entry, 'available');\n const contractAccountFree = this.safeString (entry, 'maxTransferOut');\n if (contractAccountFree !== undefined) {\n account['free'] = contractAccountFree;\n account['total'] = this.safeString (entry, 'accountEquity');\n } else {\n account['free'] = spotAccountFree;\n const frozen = this.safeString (entry, 'frozen');\n const locked = this.safeString (entry, 'locked');\n account['used'] = Precise.stringAdd (frozen, locked);\n }\n }\n result[code] = account;\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"interestId\": \"1112125304879067137\",\n \"interestCoin\": \"USDT\",\n \"dailyInterestRate\": \"0.00041095\",\n \"loanCoin\": \"USDT\",\n \"interestAmount\": \"0.0000685\",\n \"interstType\": \"first\",\n \"symbol\": \"BTCUSDT\",\n \"cTime\": \"1700877255648\",\n \"uTime\": \"1700877255648\"\n }", "{\n \"interestId\": \"1112122013642272769\",\n \"interestCoin\": \"USDT\",\n \"dailyInterestRate\": \"0.00041\",\n \"loanCoin\": \"USDT\",\n \"interestAmount\": \"0.00006834\",\n \"interstType\": \"first\",\n \"cTime\": \"1700876470957\",\n \"uTime\": \"1700876470957\"\n }" ], "line_end" => 10279, "line_start" => 10235, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeString (market, 'symbol')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (this.safeString (info, 'interestCoin'))" }, %{ "comment" => nil, "key" => "interest", "value" => "this.safeNumber (info, 'interestAmount')" }, %{ "comment" => nil, "key" => "interestRate", "value" => "this.safeNumber (info, 'dailyInterestRate')" }, %{ "comment" => nil, "key" => "amountBorrowed", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseBorrowInterest", "signature" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest", "source" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest {\n //\n // isolated\n //\n // {\n // \"interestId\": \"1112125304879067137\",\n // \"interestCoin\": \"USDT\",\n // \"dailyInterestRate\": \"0.00041095\",\n // \"loanCoin\": \"USDT\",\n // \"interestAmount\": \"0.0000685\",\n // \"interstType\": \"first\",\n // \"symbol\": \"BTCUSDT\",\n // \"cTime\": \"1700877255648\",\n // \"uTime\": \"1700877255648\"\n // }\n //\n // cross\n //\n // {\n // \"interestId\": \"1112122013642272769\",\n // \"interestCoin\": \"USDT\",\n // \"dailyInterestRate\": \"0.00041\",\n // \"loanCoin\": \"USDT\",\n // \"interestAmount\": \"0.00006834\",\n // \"interstType\": \"first\",\n // \"cTime\": \"1700876470957\",\n // \"uTime\": \"1700876470957\"\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n market = this.safeMarket (marketId, market);\n const marginMode = (marketId !== undefined) ? 'isolated' : 'cross';\n const timestamp = this.safeInteger (info, 'cTime');\n return {\n 'info': info,\n 'symbol': this.safeString (market, 'symbol'),\n 'currency': this.safeCurrencyCode (this.safeString (info, 'interestCoin')),\n 'interest': this.safeNumber (info, 'interestAmount'),\n 'interestRate': this.safeNumber (info, 'dailyInterestRate'),\n 'amountBorrowed': undefined,\n 'marginMode': marginMode,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n } as BorrowInterest;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"BTC\",\n \"leverage\": \"3\",\n \"transferable\": true,\n \"borrowable\": true,\n \"dailyInterestRate\": \"0.00007\",\n \"annualInterestRate\": \"0.02555\",\n \"maxBorrowableAmount\": \"26\",\n \"vipList\": [\n {\"level\":\"0\",\"limit\":\"26\",\"dailyInterestRate\":\"0.00007\",\"annualInterestRate\":\"0.02555\",\"discountRate\":\"1\"},\n {\"level\":\"1\",\"limit\":\"26.78\",\"dailyInterestRate\":\"0.0000679\",\"annualInterestRate\":\"0.0247835\",\"discountRate\":\"0.97\"},\n {\"level\":\"2\",\"limit\":\"28.08\",\"dailyInterestRate\":\"0.0000644\",\"annualInterestRate\":\"0.023506\",\"discountRate\":\"0.92\"},\n {\"level\":\"3\",\"limit\":\"30.16\",\"dailyInterestRate\":\"0.0000602\",\"annualInterestRate\":\"0.021973\",\"discountRate\":\"0.86\"},\n {\"level\":\"4\",\"limit\":\"34.58\",\"dailyInterestRate\":\"0.0000525\",\"annualInterestRate\":\"0.0191625\",\"discountRate\":\"0.75\"},\n {\"level\":\"5\",\"limit\":\"43.16\",\"dailyInterestRate\":\"0.000042\",\"annualInterestRate\":\"0.01533\",\"discountRate\":\"0.6\"}\n ]\n }", "{\n \"dailyInterest\": \"0.00100008\",\n \"annualInterest\": \"0.3650292\",\n \"limit\": \"100\"\n }" ], "line_end" => 10126, "line_start" => 10086, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "rate", "value" => "this.safeNumber2 (info, 'dailyInterestRate', 'dailyInterest')" }, %{ "comment" => nil, "key" => "period", "value" => "86400000" }, %{ "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 // default\n //\n // {\n // \"coin\": \"BTC\",\n // \"leverage\": \"3\",\n // \"transferable\": true,\n // \"borrowable\": true,\n // \"dailyInterestRate\": \"0.00007\",\n // \"annualInterestRate\": \"0.02555\",\n // \"maxBorrowableAmount\": \"26\",\n // \"vipList\": [\n // {\"level\":\"0\",\"limit\":\"26\",\"dailyInterestRate\":\"0.00007\",\"annualInterestRate\":\"0.02555\",\"discountRate\":\"1\"},\n // {\"level\":\"1\",\"limit\":\"26.78\",\"dailyInterestRate\":\"0.0000679\",\"annualInterestRate\":\"0.0247835\",\"discountRate\":\"0.97\"},\n // {\"level\":\"2\",\"limit\":\"28.08\",\"dailyInterestRate\":\"0.0000644\",\"annualInterestRate\":\"0.023506\",\"discountRate\":\"0.92\"},\n // {\"level\":\"3\",\"limit\":\"30.16\",\"dailyInterestRate\":\"0.0000602\",\"annualInterestRate\":\"0.021973\",\"discountRate\":\"0.86\"},\n // {\"level\":\"4\",\"limit\":\"34.58\",\"dailyInterestRate\":\"0.0000525\",\"annualInterestRate\":\"0.0191625\",\"discountRate\":\"0.75\"},\n // {\"level\":\"5\",\"limit\":\"43.16\",\"dailyInterestRate\":\"0.000042\",\"annualInterestRate\":\"0.01533\",\"discountRate\":\"0.6\"}\n // ]\n // }\n //\n // uta\n //\n // {\n // \"dailyInterest\": \"0.00100008\",\n // \"annualInterest\": \"0.3650292\",\n // \"limit\": \"100\"\n // }\n //\n const currencyId = this.safeString (info, 'coin');\n const timestamp = this.safeInteger (info, 'timestamp');\n return {\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'rate': this.safeNumber2 (info, 'dailyInterestRate', 'dailyInterest'),\n 'period': 86400000, // 1-Day\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"fromCoin\": \"USDT\",\n \"fromCoinSize\": \"5\",\n \"cnvtPrice\": \"0.9993007892377704\",\n \"toCoin\": \"USDC\",\n \"toCoinSize\": \"4.99650394\",\n \"traceId\": \"1159288930228187140\",\n \"fee\": \"0\"\n }", "{\n \"cnvtPrice\": \"0.99940076\",\n \"toCoin\": \"USDC\",\n \"toCoinSize\": \"4.99700379\",\n \"ts\": \"1712123746217\"\n }", "{\n \"id\": \"1159296505255219205\",\n \"fromCoin\": \"USDT\",\n \"fromCoinSize\": \"5\",\n \"cnvtPrice\": \"0.99940076\",\n \"toCoin\": \"USDC\",\n \"toCoinSize\": \"4.99700379\",\n \"ts\": \"1712123746217\",\n \"fee\": \"0\"\n }" ], "line_end" => 10798, "line_start" => 10745, "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, 'id', 'traceId')" }, %{ "comment" => nil, "key" => "fromCurrency", "value" => "fromCode" }, %{ "comment" => nil, "key" => "fromAmount", "value" => "this.safeNumber (conversion, 'fromCoinSize')" }, %{ "comment" => nil, "key" => "toCurrency", "value" => "toCode" }, %{ "comment" => nil, "key" => "toAmount", "value" => "this.safeNumber (conversion, 'toCoinSize')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (conversion, 'cnvtPrice')" }, %{ "comment" => nil, "key" => "fee", "value" => "this.safeNumber (conversion, 'fee')" } ], "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 // \"fromCoin\": \"USDT\",\n // \"fromCoinSize\": \"5\",\n // \"cnvtPrice\": \"0.9993007892377704\",\n // \"toCoin\": \"USDC\",\n // \"toCoinSize\": \"4.99650394\",\n // \"traceId\": \"1159288930228187140\",\n // \"fee\": \"0\"\n // }\n //\n // createConvertTrade\n //\n // {\n // \"cnvtPrice\": \"0.99940076\",\n // \"toCoin\": \"USDC\",\n // \"toCoinSize\": \"4.99700379\",\n // \"ts\": \"1712123746217\"\n // }\n //\n // fetchConvertTradeHistory\n //\n // {\n // \"id\": \"1159296505255219205\",\n // \"fromCoin\": \"USDT\",\n // \"fromCoinSize\": \"5\",\n // \"cnvtPrice\": \"0.99940076\",\n // \"toCoin\": \"USDC\",\n // \"toCoinSize\": \"4.99700379\",\n // \"ts\": \"1712123746217\",\n // \"fee\": \"0\"\n // }\n //\n const timestamp = this.safeInteger (conversion, 'ts');\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, 'id', 'traceId'),\n 'fromCurrency': fromCode,\n 'fromAmount': this.safeNumber (conversion, 'fromCoinSize'),\n 'toCurrency': toCode,\n 'toAmount': this.safeNumber (conversion, 'toCoinSize'),\n 'price': this.safeNumber (conversion, 'cnvtPrice'),\n 'fee': this.safeNumber (conversion, 'fee'),\n } as Conversion;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"BTC\",\n \"address\": \"1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA\",\n \"chain\": \"\",\n \"tag\": null,\n \"url\": \"https://blockchair.com/bitcoin/transaction/\"\n }" ], "line_end" => 3151, "line_start" => 3127, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "depositAddress" }, %{ "comment" => nil, "key" => "currency", "value" => "parsedCurrency" }, %{ "comment" => nil, "key" => "network", "value" => "network" }, %{ "comment" => nil, "key" => "address", "value" => "this.safeString (depositAddress, 'address')" }, %{ "comment" => nil, "key" => "tag", "value" => "this.safeString (depositAddress, 'tag')" } ], "name" => "parseDepositAddress", "signature" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress", "source" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress {\n //\n // {\n // \"coin\": \"BTC\",\n // \"address\": \"1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA\",\n // \"chain\": \"\",\n // \"tag\": null,\n // \"url\": \"https://blockchair.com/bitcoin/transaction/\"\n // }\n //\n const currencyId = this.safeString (depositAddress, 'coin');\n const networkId = this.safeString (depositAddress, 'chain');\n const parsedCurrency = this.safeCurrencyCode (currencyId, currency);\n let network = undefined;\n if (networkId !== undefined) {\n network = this.networkIdToCode (networkId, parsedCurrency);\n }\n return {\n 'info': depositAddress,\n 'currency': parsedCurrency,\n 'network': network,\n 'address': this.safeString (depositAddress, 'address'),\n 'tag': this.safeString (depositAddress, 'tag'),\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"chains\": [\n {\n \"browserUrl\": \"https://blockchair.com/bitcoin/transaction/\",\n \"chain\": \"BTC\",\n \"depositConfirm\": \"1\",\n \"extraWithdrawFee\": \"0\",\n \"minDepositAmount\": \"0.0001\",\n \"minWithdrawAmount\": \"0.005\",\n \"needTag\": \"false\",\n \"rechargeable\": \"true\",\n \"withdrawConfirm\": \"1\",\n \"withdrawFee\": \"0.0004\",\n \"withdrawable\": \"true\"\n },\n ],\n \"coin\": \"BTC\",\n \"coinId\": \"1\",\n \"transfer\": \"true\"\"\n }" ], "line_end" => 9490, "line_start" => 9438, "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)", "source" => "parseDepositWithdrawFee (fee, currency: Currency = undefined) {\n //\n // {\n // \"chains\": [\n // {\n // \"browserUrl\": \"https://blockchair.com/bitcoin/transaction/\",\n // \"chain\": \"BTC\",\n // \"depositConfirm\": \"1\",\n // \"extraWithdrawFee\": \"0\",\n // \"minDepositAmount\": \"0.0001\",\n // \"minWithdrawAmount\": \"0.005\",\n // \"needTag\": \"false\",\n // \"rechargeable\": \"true\",\n // \"withdrawConfirm\": \"1\",\n // \"withdrawFee\": \"0.0004\",\n // \"withdrawable\": \"true\"\n // },\n // ],\n // \"coin\": \"BTC\",\n // \"coinId\": \"1\",\n // \"transfer\": \"true\"\"\n // }\n //\n const chains = this.safeValue (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 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 return result;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 8830, "line_start" => 8814, "mappings" => [], "name" => "parseFundingHistories", "signature" => "parseFundingHistories (contracts, market = undefined, since: Int = undefined, limit: Int = undefined): FundingHistory[]", "source" => "parseFundingHistories (contracts, market = undefined, since: Int = undefined, limit: Int = undefined): FundingHistory[] {\n const result = [];\n for (let i = 0; i < contracts.length; i++) {\n const contract = contracts[i];\n const business = this.safeString (contract, 'businessType');\n if (business !== 'contract_settle_fee') {\n continue;\n }\n result.push (this.parseFundingHistory (contract, market));\n }\n const sorted = this.sortBy (result, 'timestamp');\n let symbol = undefined;\n if (market !== undefined) {\n symbol = market['symbol'];\n }\n return this.filterBySymbolSinceLimit (sorted, symbol, since, limit);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"billId\": \"1111499428100472833\",\n \"symbol\": \"BTCUSDT\",\n \"amount\": \"-0.004992\",\n \"fee\": \"0\",\n \"feeByCoupon\": \"\",\n \"businessType\": \"contract_settle_fee\",\n \"coin\": \"USDT\",\n \"cTime\": \"1700728034996\"\n }" ], "line_end" => 8812, "line_start" => 8787, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'swap')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "code", "value" => "this.safeCurrencyCode (currencyId)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (contract, 'amount')" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (contract, 'billId')" } ], "name" => "parseFundingHistory", "signature" => "parseFundingHistory (contract, market: Market = undefined)", "source" => "parseFundingHistory (contract, market: Market = undefined) {\n //\n // {\n // \"billId\": \"1111499428100472833\",\n // \"symbol\": \"BTCUSDT\",\n // \"amount\": \"-0.004992\",\n // \"fee\": \"0\",\n // \"feeByCoupon\": \"\",\n // \"businessType\": \"contract_settle_fee\",\n // \"coin\": \"USDT\",\n // \"cTime\": \"1700728034996\"\n // }\n //\n const marketId = this.safeString (contract, 'symbol');\n const currencyId = this.safeString (contract, 'coin');\n const timestamp = this.safeInteger (contract, 'cTime');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (marketId, market, undefined, 'swap'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'code': this.safeCurrencyCode (currencyId),\n 'amount': this.safeNumber (contract, 'amount'),\n 'id': this.safeString (contract, 'billId'),\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"fundingRate\": \"-0.000013\",\n \"fundingRateInterval\": \"8\",\n \"nextUpdate\": \"1745510400000\",\n \"minFundingRate\": \"-0.003\",\n \"maxFundingRate\": \"0.003\"\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"nextFundingTime\": \"1745424000000\",\n \"ratePeriod\": \"8\"\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"nextFundingTime\": \"1727942400000\",\n \"ratePeriod\": \"8\"\n }", "{\n \"symbol\": \"BTCUSD\",\n \"lastPr\": \"29904.5\",\n \"askPr\": \"29904.5\",\n \"bidPr\": \"29903.5\",\n \"bidSz\": \"0.5091\",\n \"askSz\": \"2.2694\",\n \"high24h\": \"0\",\n \"low24h\": \"0\",\n \"ts\": \"1695794271400\",\n \"change24h\": \"0\",\n \"baseVolume\": \"0\",\n \"quoteVolume\": \"0\",\n \"usdtVolume\": \"0\",\n \"openUtc\": \"0\",\n \"changeUtc24h\": \"0\",\n \"indexPrice\": \"29132.353333\",\n \"fundingRate\": \"-0.0007\",\n \"holdingAmount\": \"125.6844\",\n \"deliveryStartTime\": null,\n \"deliveryTime\": null,\n \"deliveryStatus\": \"delivery_normal\",\n \"open24h\": \"0\",\n \"markPrice\": \"12345\"\n }" ], "line_end" => 8715, "line_start" => 8627, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "markPrice", "value" => "markPrice" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "indexPrice" }, %{ "comment" => nil, "key" => "interestRate", "value" => "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" => "this.safeNumber (contract, '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 (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n //\n // fetchFundingRate: publicMixGetV2MixMarketCurrentFundRate, publicUtaGetV3MarketCurrentFundRate\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"fundingRate\": \"-0.000013\",\n // \"fundingRateInterval\": \"8\",\n // \"nextUpdate\": \"1745510400000\",\n // \"minFundingRate\": \"-0.003\",\n // \"maxFundingRate\": \"0.003\"\n // }\n //\n // fetchFundingRate: publicMixGetV2MixMarketFundingTime\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"nextFundingTime\": \"1745424000000\",\n // \"ratePeriod\": \"8\"\n // }\n //\n // fetchFundingInterval\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"nextFundingTime\": \"1727942400000\",\n // \"ratePeriod\": \"8\"\n // }\n //\n // fetchFundingRates\n //\n // {\n // \"symbol\": \"BTCUSD\",\n // \"lastPr\": \"29904.5\",\n // \"askPr\": \"29904.5\",\n // \"bidPr\": \"29903.5\",\n // \"bidSz\": \"0.5091\",\n // \"askSz\": \"2.2694\",\n // \"high24h\": \"0\",\n // \"low24h\": \"0\",\n // \"ts\": \"1695794271400\",\n // \"change24h\": \"0\",\n // \"baseVolume\": \"0\",\n // \"quoteVolume\": \"0\",\n // \"usdtVolume\": \"0\",\n // \"openUtc\": \"0\",\n // \"changeUtc24h\": \"0\",\n // \"indexPrice\": \"29132.353333\",\n // \"fundingRate\": \"-0.0007\",\n // \"holdingAmount\": \"125.6844\",\n // \"deliveryStartTime\": null,\n // \"deliveryTime\": null,\n // \"deliveryStatus\": \"delivery_normal\",\n // \"open24h\": \"0\",\n // \"markPrice\": \"12345\"\n // }\n //\n const marketId = this.safeString (contract, 'symbol');\n const symbol = this.safeSymbol (marketId, market, undefined, 'swap');\n const fundingTimestamp = this.safeInteger2 (contract, 'nextFundingTime', 'nextUpdate');\n const interval = this.safeString2 (contract, 'ratePeriod', 'fundingRateInterval');\n const timestamp = this.safeInteger (contract, 'ts');\n const markPrice = this.safeNumber (contract, 'markPrice');\n const indexPrice = this.safeNumber (contract, 'indexPrice');\n let intervalString = undefined;\n if (interval !== undefined) {\n intervalString = interval + 'h';\n }\n return {\n 'info': contract,\n 'symbol': symbol,\n 'markPrice': markPrice,\n 'indexPrice': indexPrice,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fundingRate': this.safeNumber (contract, '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\": \"BTCUSDT\",\n \"leverage\": \"10\",\n \"baseCoin\": \"BTC\",\n \"baseTransferable\": true,\n \"baseBorrowable\": true,\n \"baseDailyInterestRate\": \"0.00007\",\n \"baseAnnuallyInterestRate\": \"0.02555\",\n \"baseMaxBorrowableAmount\": \"27\",\n \"baseVipList\": [\n {\"level\":\"0\",\"dailyInterestRate\":\"0.00007\",\"limit\":\"27\",\"annuallyInterestRate\":\"0.02555\",\"discountRate\":\"1\"},\n {\"level\":\"1\",\"dailyInterestRate\":\"0.0000679\",\"limit\":\"27.81\",\"annuallyInterestRate\":\"0.0247835\",\"discountRate\":\"0.97\"},\n {\"level\":\"2\",\"dailyInterestRate\":\"0.0000644\",\"limit\":\"29.16\",\"annuallyInterestRate\":\"0.023506\",\"discountRate\":\"0.92\"},\n {\"level\":\"3\",\"dailyInterestRate\":\"0.0000602\",\"limit\":\"31.32\",\"annuallyInterestRate\":\"0.021973\",\"discountRate\":\"0.86\"},\n {\"level\":\"4\",\"dailyInterestRate\":\"0.0000525\",\"limit\":\"35.91\",\"annuallyInterestRate\":\"0.0191625\",\"discountRate\":\"0.75\"},\n {\"level\":\"5\",\"dailyInterestRate\":\"0.000042\",\"limit\":\"44.82\",\"annuallyInterestRate\":\"0.01533\",\"discountRate\":\"0.6\"}\n ],\n \"quoteCoin\": \"USDT\",\n \"quoteTransferable\": true,\n \"quoteBorrowable\": true,\n \"quoteDailyInterestRate\": \"0.00041095\",\n \"quoteAnnuallyInterestRate\": \"0.14999675\",\n \"quoteMaxBorrowableAmount\": \"300000\",\n \"quoteList\": [\n {\"level\":\"0\",\"dailyInterestRate\":\"0.00041095\",\"limit\":\"300000\",\"annuallyInterestRate\":\"0.14999675\",\"discountRate\":\"1\"},\n {\"level\":\"1\",\"dailyInterestRate\":\"0.00039863\",\"limit\":\"309000\",\"annuallyInterestRate\":\"0.14549995\",\"discountRate\":\"0.97\"},\n {\"level\":\"2\",\"dailyInterestRate\":\"0.00037808\",\"limit\":\"324000\",\"annuallyInterestRate\":\"0.1379992\",\"discountRate\":\"0.92\"},\n {\"level\":\"3\",\"dailyInterestRate\":\"0.00035342\",\"limit\":\"348000\",\"annuallyInterestRate\":\"0.1289983\",\"discountRate\":\"0.86\"},\n {\"level\":\"4\",\"dailyInterestRate\":\"0.00030822\",\"limit\":\"399000\",\"annuallyInterestRate\":\"0.1125003\",\"discountRate\":\"0.75\"},\n {\"level\":\"5\",\"dailyInterestRate\":\"0.00024657\",\"limit\":\"498000\",\"annuallyInterestRate\":\"0.08999805\",\"discountRate\":\"0.6\"}\n ]\n }" ], "line_end" => 10012, "line_start" => 9961, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "base", "value" => "this.safeCurrencyCode (baseId)" }, %{ "comment" => nil, "key" => "baseRate", "value" => "this.safeNumber (info, 'baseDailyInterestRate')" }, %{ "comment" => nil, "key" => "quote", "value" => "this.safeCurrencyCode (quoteId)" }, %{ "comment" => nil, "key" => "quoteRate", "value" => "this.safeNumber (info, 'quoteDailyInterestRate')" }, %{ "comment" => nil, "key" => "period", "value" => "86400000" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseIsolatedBorrowRate", "signature" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate", "source" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate {\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"leverage\": \"10\",\n // \"baseCoin\": \"BTC\",\n // \"baseTransferable\": true,\n // \"baseBorrowable\": true,\n // \"baseDailyInterestRate\": \"0.00007\",\n // \"baseAnnuallyInterestRate\": \"0.02555\",\n // \"baseMaxBorrowableAmount\": \"27\",\n // \"baseVipList\": [\n // {\"level\":\"0\",\"dailyInterestRate\":\"0.00007\",\"limit\":\"27\",\"annuallyInterestRate\":\"0.02555\",\"discountRate\":\"1\"},\n // {\"level\":\"1\",\"dailyInterestRate\":\"0.0000679\",\"limit\":\"27.81\",\"annuallyInterestRate\":\"0.0247835\",\"discountRate\":\"0.97\"},\n // {\"level\":\"2\",\"dailyInterestRate\":\"0.0000644\",\"limit\":\"29.16\",\"annuallyInterestRate\":\"0.023506\",\"discountRate\":\"0.92\"},\n // {\"level\":\"3\",\"dailyInterestRate\":\"0.0000602\",\"limit\":\"31.32\",\"annuallyInterestRate\":\"0.021973\",\"discountRate\":\"0.86\"},\n // {\"level\":\"4\",\"dailyInterestRate\":\"0.0000525\",\"limit\":\"35.91\",\"annuallyInterestRate\":\"0.0191625\",\"discountRate\":\"0.75\"},\n // {\"level\":\"5\",\"dailyInterestRate\":\"0.000042\",\"limit\":\"44.82\",\"annuallyInterestRate\":\"0.01533\",\"discountRate\":\"0.6\"}\n // ],\n // \"quoteCoin\": \"USDT\",\n // \"quoteTransferable\": true,\n // \"quoteBorrowable\": true,\n // \"quoteDailyInterestRate\": \"0.00041095\",\n // \"quoteAnnuallyInterestRate\": \"0.14999675\",\n // \"quoteMaxBorrowableAmount\": \"300000\",\n // \"quoteList\": [\n // {\"level\":\"0\",\"dailyInterestRate\":\"0.00041095\",\"limit\":\"300000\",\"annuallyInterestRate\":\"0.14999675\",\"discountRate\":\"1\"},\n // {\"level\":\"1\",\"dailyInterestRate\":\"0.00039863\",\"limit\":\"309000\",\"annuallyInterestRate\":\"0.14549995\",\"discountRate\":\"0.97\"},\n // {\"level\":\"2\",\"dailyInterestRate\":\"0.00037808\",\"limit\":\"324000\",\"annuallyInterestRate\":\"0.1379992\",\"discountRate\":\"0.92\"},\n // {\"level\":\"3\",\"dailyInterestRate\":\"0.00035342\",\"limit\":\"348000\",\"annuallyInterestRate\":\"0.1289983\",\"discountRate\":\"0.86\"},\n // {\"level\":\"4\",\"dailyInterestRate\":\"0.00030822\",\"limit\":\"399000\",\"annuallyInterestRate\":\"0.1125003\",\"discountRate\":\"0.75\"},\n // {\"level\":\"5\",\"dailyInterestRate\":\"0.00024657\",\"limit\":\"498000\",\"annuallyInterestRate\":\"0.08999805\",\"discountRate\":\"0.6\"}\n // ]\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n const symbol = this.safeSymbol (marketId, market, undefined, 'spot');\n const baseId = this.safeString (info, 'baseCoin');\n const quoteId = this.safeString (info, 'quoteCoin');\n const timestamp = this.safeInteger (info, 'timestamp');\n return {\n 'symbol': symbol,\n 'base': this.safeCurrencyCode (baseId),\n 'baseRate': this.safeNumber (info, 'baseDailyInterestRate'),\n 'quote': this.safeCurrencyCode (quoteId),\n 'quoteRate': this.safeNumber (info, 'quoteDailyInterestRate'),\n 'period': 86400000, // 1-Day\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"billId\": \"1111506298997215233\",\n \"coin\": \"USDT\",\n \"groupType\": \"transfer\",\n \"businessType\": \"transfer_out\",\n \"size\": \"-11.64958799\",\n \"balance\": \"0.00000000\",\n \"fees\": \"0.00000000\",\n \"cTime\": \"1700729673028\"\n }", "{\n \"billId\": \"1111499428100472833\",\n \"symbol\": \"\",\n \"amount\": \"-11.64958799\",\n \"fee\": \"0\",\n \"feeByCoupon\": \"\",\n \"businessType\": \"trans_to_exchange\",\n \"coin\": \"USDT\",\n \"cTime\": \"1700728034996\"\n }" ], "line_end" => 7541, "line_start" => 7481, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (item, 'billId')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "account", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceId", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseLedgerType (this.safeString (item, 'businessType'))" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "after" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': code,\n 'cost': fee,\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "fee" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // spot\n //\n // {\n // \"billId\": \"1111506298997215233\",\n // \"coin\": \"USDT\",\n // \"groupType\": \"transfer\",\n // \"businessType\": \"transfer_out\",\n // \"size\": \"-11.64958799\",\n // \"balance\": \"0.00000000\",\n // \"fees\": \"0.00000000\",\n // \"cTime\": \"1700729673028\"\n // }\n //\n // swap and future\n //\n // {\n // \"billId\": \"1111499428100472833\",\n // \"symbol\": \"\",\n // \"amount\": \"-11.64958799\",\n // \"fee\": \"0\",\n // \"feeByCoupon\": \"\",\n // \"businessType\": \"trans_to_exchange\",\n // \"coin\": \"USDT\",\n // \"cTime\": \"1700728034996\"\n // }\n //\n const currencyId = this.safeString (item, 'coin');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const timestamp = this.safeInteger (item, 'cTime');\n const after = this.safeNumber (item, 'balance');\n const fee = this.safeNumber2 (item, 'fees', 'fee');\n const amountRaw = this.safeString2 (item, 'size', 'amount');\n const amount = this.parseNumber (Precise.stringAbs (amountRaw));\n let direction = 'in';\n if (amountRaw.indexOf ('-') >= 0) {\n direction = 'out';\n }\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': this.safeString (item, 'billId'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'direction': direction,\n 'account': undefined,\n 'referenceId': undefined,\n 'referenceAccount': undefined,\n 'type': this.parseLedgerType (this.safeString (item, 'businessType')),\n 'currency': code,\n 'amount': amount,\n 'before': undefined,\n 'after': after,\n 'status': undefined,\n 'fee': {\n 'currency': code,\n 'cost': fee,\n },\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 7587, "line_start" => 7543, "mappings" => [], "name" => "parseLedgerType", "signature" => "parseLedgerType (type)", "source" => "parseLedgerType (type) {\n const types: Dict = {\n 'trans_to_cross': 'transfer',\n 'trans_from_cross': 'transfer',\n 'trans_to_exchange': 'transfer',\n 'trans_from_exchange': 'transfer',\n 'trans_to_isolated': 'transfer',\n 'trans_from_isolated': 'transfer',\n 'trans_to_contract': 'transfer',\n 'trans_from_contract': 'transfer',\n 'trans_to_otc': 'transfer',\n 'trans_from_otc': 'transfer',\n 'open_long': 'trade',\n 'close_long': 'trade',\n 'open_short': 'trade',\n 'close_short': 'trade',\n 'force_close_long': 'trade',\n 'force_close_short': 'trade',\n 'burst_long_loss_query': 'trade',\n 'burst_short_loss_query': 'trade',\n 'force_buy': 'trade',\n 'force_sell': 'trade',\n 'burst_buy': 'trade',\n 'burst_sell': 'trade',\n 'delivery_long': 'settlement',\n 'delivery_short': 'settlement',\n 'contract_settle_fee': 'fee',\n 'append_margin': 'transaction',\n 'adjust_down_lever_append_margin': 'transaction',\n 'reduce_margin': 'transaction',\n 'auto_append_margin': 'transaction',\n 'cash_gift_issue': 'cashback',\n 'cash_gift_recycle': 'cashback',\n 'bonus_issue': 'rebate',\n 'bonus_recycle': 'rebate',\n 'bonus_expired': 'rebate',\n 'transfer_in': 'transfer',\n 'transfer_out': 'transfer',\n 'deposit': 'deposit',\n 'withdraw': 'withdrawal',\n 'buy': 'trade',\n 'sell': 'trade',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 8990, "line_start" => 8979, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "marginMode", "value" => "isCrossMarginMode ? 'cross' : 'isolated'" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "this.safeInteger (leverage, longLevKey)" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "this.safeInteger (leverage, shortLevKey)" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage", "source" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage {\n const isCrossMarginMode = this.safeString (leverage, 'marginMode') === 'crossed';\n const longLevKey = isCrossMarginMode ? 'crossedMarginLeverage' : 'isolatedLongLever';\n const shortLevKey = isCrossMarginMode ? 'crossedMarginLeverage' : 'isolatedShortLever';\n return {\n 'info': leverage,\n 'symbol': market['symbol'],\n 'marginMode': isCrossMarginMode ? 'cross' : 'isolated',\n 'longLeverage': this.safeInteger (leverage, longLevKey),\n 'shortLeverage': this.safeInteger (leverage, shortLevKey),\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"liqId\": \"123\",\n \"symbol\": \"BTCUSDT\",\n \"liqStartTime\": \"1653453245342\",\n \"liqEndTime\": \"16312423423432\",\n \"liqRiskRatio\": \"1.01\",\n \"totalAssets\": \"1242.34\",\n \"totalDebt\": \"1100\",\n \"liqFee\": \"1.2\",\n \"uTime\": \"1692690126000\"\n \"cTime\": \"1653453245342\"\n }", "{\n \"liqId\": \"123\",\n \"liqStartTime\": \"1653453245342\",\n \"liqEndTime\": \"16312423423432\",\n \"liqRiskRatio\": \"1.01\",\n \"totalAssets\": \"1242.34\",\n \"totalDebt\": \"1100\",\n \"LiqFee\": \"1.2\",\n \"uTime\": \"1692690126000\"\n \"cTime\": \"1653453245342\"\n }" ], "line_end" => 9895, "line_start" => 9848, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "liquidation" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "contracts", "value" => "undefined" }, %{ "comment" => nil, "key" => "contractSize", "value" => "undefined" }, %{ "comment" => nil, "key" => "price", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseValue", "value" => "undefined" }, %{ "comment" => nil, "key" => "quoteValue", "value" => "this.parseNumber (quoteValueString)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseLiquidation", "signature" => "parseLiquidation (liquidation, market: Market = undefined)", "source" => "parseLiquidation (liquidation, market: Market = undefined) {\n //\n // isolated\n //\n // {\n // \"liqId\": \"123\",\n // \"symbol\": \"BTCUSDT\",\n // \"liqStartTime\": \"1653453245342\",\n // \"liqEndTime\": \"16312423423432\",\n // \"liqRiskRatio\": \"1.01\",\n // \"totalAssets\": \"1242.34\",\n // \"totalDebt\": \"1100\",\n // \"liqFee\": \"1.2\",\n // \"uTime\": \"1692690126000\"\n // \"cTime\": \"1653453245342\"\n // }\n //\n // cross\n //\n // {\n // \"liqId\": \"123\",\n // \"liqStartTime\": \"1653453245342\",\n // \"liqEndTime\": \"16312423423432\",\n // \"liqRiskRatio\": \"1.01\",\n // \"totalAssets\": \"1242.34\",\n // \"totalDebt\": \"1100\",\n // \"LiqFee\": \"1.2\",\n // \"uTime\": \"1692690126000\"\n // \"cTime\": \"1653453245342\"\n // }\n //\n const marketId = this.safeString (liquidation, 'symbol');\n const timestamp = this.safeInteger (liquidation, 'liqEndTime');\n const liquidationFee = this.safeString2 (liquidation, 'LiqFee', 'liqFee');\n const totalDebt = this.safeString (liquidation, 'totalDebt');\n const quoteValueString = Precise.stringAdd (liquidationFee, totalDebt);\n return this.safeLiquidation ({\n 'info': liquidation,\n 'symbol': this.safeSymbol (marketId, market),\n 'contracts': undefined,\n 'contractSize': undefined,\n 'price': undefined,\n 'baseValue': undefined,\n 'quoteValue': this.parseNumber (quoteValueString),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n });\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 10999, "line_start" => 10988, "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.safeNumber2 (info, 'longShortRatio', 'longShortAccountRatio')" } ], "name" => "parseLongShortRatio", "signature" => "parseLongShortRatio (info: Dict, market: Market = undefined): LongShortRatio", "source" => "parseLongShortRatio (info: Dict, market: Market = undefined): LongShortRatio {\n const marketId = this.safeString (info, 'symbol');\n const timestamp = this.safeIntegerOmitZero (info, 'ts');\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.safeNumber2 (info, 'longShortRatio', 'longShortAccountRatio'),\n } as LongShortRatio;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"loanId\": \"1112125304879067137\",\n \"symbol\": \"BTCUSDT\",\n \"coin\": \"USDT\",\n \"borrowAmount\": \"4\"\n }", "{\n \"loanId\": \"1112122013642272769\",\n \"coin\": \"USDT\",\n \"borrowAmount\": \"4\"\n }", "{\n \"remainDebtAmount\": \"0\",\n \"repayId\": \"1112126405439270912\",\n \"symbol\": \"BTCUSDT\",\n \"coin\": \"USDT\",\n \"repayAmount\": \"8.000137\"\n }", "{\n \"remainDebtAmount\": \"0\",\n \"repayId\": \"1112122994945830912\",\n \"coin\": \"USDT\",\n \"repayAmount\": \"4.00006834\"\n }" ], "line_end" => 9736, "line_start" => 9683, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (info, 'loanId', 'repayId')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber2 (info, 'borrowAmount', 'repayAmount')" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "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, market: Market = undefined)", "source" => "parseMarginLoan (info, currency: Currency = undefined, market: Market = undefined) {\n //\n // isolated: borrowMargin\n //\n // {\n // \"loanId\": \"1112125304879067137\",\n // \"symbol\": \"BTCUSDT\",\n // \"coin\": \"USDT\",\n // \"borrowAmount\": \"4\"\n // }\n //\n // cross: borrowMargin\n //\n // {\n // \"loanId\": \"1112122013642272769\",\n // \"coin\": \"USDT\",\n // \"borrowAmount\": \"4\"\n // }\n //\n // isolated: repayMargin\n //\n // {\n // \"remainDebtAmount\": \"0\",\n // \"repayId\": \"1112126405439270912\",\n // \"symbol\": \"BTCUSDT\",\n // \"coin\": \"USDT\",\n // \"repayAmount\": \"8.000137\"\n // }\n //\n // cross: repayMargin\n //\n // {\n // \"remainDebtAmount\": \"0\",\n // \"repayId\": \"1112122994945830912\",\n // \"coin\": \"USDT\",\n // \"repayAmount\": \"4.00006834\"\n // }\n //\n const currencyId = this.safeString (info, 'coin');\n const marketId = this.safeString (info, 'symbol');\n let symbol = undefined;\n if (marketId !== undefined) {\n symbol = this.safeSymbol (marketId, market, undefined, 'spot');\n }\n return {\n 'id': this.safeString2 (info, 'loanId', 'repayId'),\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'amount': this.safeNumber2 (info, 'borrowAmount', 'repayAmount'),\n 'symbol': symbol,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 10477, "line_start" => 10469, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "marginMode" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginType" } ], "name" => "parseMarginMode", "signature" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode", "source" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode {\n let marginType = this.safeString (marginMode, 'marginMode');\n marginType = (marginType === 'crossed') ? 'cross' : marginType;\n return {\n 'info': marginMode,\n 'symbol': market['symbol'],\n 'marginMode': marginType,\n } as MarginMode;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"code\": \"00000\",\n \"msg\": \"success\",\n \"requestTime\": 1700813444618,\n \"data\": \"\"\n }" ], "line_end" => 8886, "line_start" => 8861, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "data" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'isolated'" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "total", "value" => "undefined" }, %{ "comment" => nil, "key" => "code", "value" => "market['settle']" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" } ], "name" => "parseMarginModification", "signature" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification", "source" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification {\n //\n // addMargin/reduceMargin\n //\n // {\n // \"code\": \"00000\",\n // \"msg\": \"success\",\n // \"requestTime\": 1700813444618,\n // \"data\": \"\"\n // }\n //\n const errorCode = this.safeString (data, 'code');\n const status = (errorCode === '00000') ? 'ok' : 'failed';\n return {\n 'info': data,\n 'symbol': market['symbol'],\n 'type': undefined,\n 'marginMode': 'isolated',\n 'amount': undefined,\n 'total': undefined,\n 'code': market['settle'],\n 'status': status,\n 'timestamp': undefined,\n 'datetime': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"level\": \"1\",\n \"startUnit\": \"0\",\n \"endUnit\": \"150000\",\n \"leverage\": \"125\",\n \"keepMarginRate\": \"0.004\"\n }", "{\n \"tier\": \"1\",\n \"symbol\": \"BTCUSDT\",\n \"leverage\": \"10\",\n \"baseCoin\": \"BTC\",\n \"quoteCoin\": \"USDT\",\n \"baseMaxBorrowableAmount\": \"2\",\n \"quoteMaxBorrowableAmount\": \"24000\",\n \"maintainMarginRate\": \"0.05\",\n \"initRate\": \"0.1111\"\n }", "{\n \"tier\": \"1\",\n \"leverage\": \"3\",\n \"coin\": \"BTC\",\n \"maxBorrowableAmount\": \"26\",\n \"maintainMarginRate\": \"0.1\"\n }", "{\n \"tier\": \"1\",\n \"minTierValue\": \"0\",\n \"maxTierValue\": \"150000\",\n \"leverage\": \"125\",\n \"mmr\": \"0.004\"\n }" ], "line_end" => 2799, "line_start" => 2727, "mappings" => [ %{ "comment" => nil, "key" => "tier", "value" => "this.safeInteger2 (item, 'level', 'tier')" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId)" }, %{ "comment" => nil, "key" => "minNotional", "value" => "minNotional" }, %{ "comment" => nil, "key" => "maxNotional", "value" => "maxNotional" }, %{ "comment" => nil, "key" => "maintenanceMarginRate", "value" => "this.safeNumberN (item, [ 'keepMarginRate', 'maintainMarginRate', 'mmr' ])" }, %{ "comment" => nil, "key" => "maxLeverage", "value" => "this.safeNumber (item, 'leverage')" }, %{ "comment" => nil, "key" => "info", "value" => "item" } ], "name" => "parseMarketLeverageTiers", "signature" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[]", "source" => "parseMarketLeverageTiers (info, market: Market = undefined): LeverageTier[] {\n //\n // swap and future\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"level\": \"1\",\n // \"startUnit\": \"0\",\n // \"endUnit\": \"150000\",\n // \"leverage\": \"125\",\n // \"keepMarginRate\": \"0.004\"\n // }\n //\n // isolated\n //\n // {\n // \"tier\": \"1\",\n // \"symbol\": \"BTCUSDT\",\n // \"leverage\": \"10\",\n // \"baseCoin\": \"BTC\",\n // \"quoteCoin\": \"USDT\",\n // \"baseMaxBorrowableAmount\": \"2\",\n // \"quoteMaxBorrowableAmount\": \"24000\",\n // \"maintainMarginRate\": \"0.05\",\n // \"initRate\": \"0.1111\"\n // }\n //\n // cross\n //\n // {\n // \"tier\": \"1\",\n // \"leverage\": \"3\",\n // \"coin\": \"BTC\",\n // \"maxBorrowableAmount\": \"26\",\n // \"maintainMarginRate\": \"0.1\"\n // }\n //\n // uta\n //\n // {\n // \"tier\": \"1\",\n // \"minTierValue\": \"0\",\n // \"maxTierValue\": \"150000\",\n // \"leverage\": \"125\",\n // \"mmr\": \"0.004\"\n // }\n //\n const tiers = [];\n let minNotional = 0;\n for (let i = 0; i < info.length; i++) {\n const item = info[i];\n const minimumNotional = this.safeNumber2 (item, 'startUnit', 'minTierValue');\n if (minimumNotional !== undefined) {\n minNotional = minimumNotional;\n }\n const maxNotional = this.safeNumberN (item, [ 'endUnit', 'maxBorrowableAmount', 'baseMaxBorrowableAmount', 'maxTierValue' ]);\n const marginCurrency = this.safeString2 (item, 'coin', 'baseCoin');\n const currencyId = (marginCurrency !== undefined) ? marginCurrency : market['base'];\n const marketId = this.safeString (item, 'symbol');\n tiers.push ({\n 'tier': this.safeInteger2 (item, 'level', 'tier'),\n 'symbol': this.safeSymbol (marketId, market),\n 'currency': this.safeCurrencyCode (currencyId),\n 'minNotional': minNotional,\n 'maxNotional': maxNotional,\n 'maintenanceMarginRate': this.safeNumberN (item, [ 'keepMarginRate', 'maintainMarginRate', 'mmr' ]),\n 'maxLeverage': this.safeNumber (item, 'leverage'),\n 'info': item,\n });\n minNotional = maxNotional;\n }\n return tiers as LeverageTier[];\n }" }, %{ "comment" => nil, "examples" => [ "[\n \"1645911960000\",\n \"39406\",\n \"39407\",\n \"39374.5\",\n \"39379\",\n \"35.526\",\n \"1399132.341\"\n ]" ], "line_end" => 4213, "line_start" => 4191, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // [\n // \"1645911960000\",\n // \"39406\",\n // \"39407\",\n // \"39374.5\",\n // \"39379\",\n // \"35.526\",\n // \"1399132.341\"\n // ]\n //\n const inverse = this.safeBool (market, 'inverse');\n const volumeIndex = 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 \"openInterestList\": [\n {\n \"symbol\": \"BTCUSDT\",\n \"size\": \"52234.134\"\n }\n ],\n \"ts\": \"1700866041023\"\n }", "{\n \"list\": [\n {\n \"symbol\": \"BTCUSDT\",\n \"openInterest\": \"18166.3583\"\n }\n ],\n \"ts\": \"1751101220993\"\n }" ], "line_end" => 9272, "line_start" => 9235, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'contract')" }, %{ "comment" => nil, "key" => "openInterestAmount", "value" => "this.safeNumber2 (data[0], 'size', 'openInterest')" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "undefined" }, %{ "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 // default\n //\n // {\n // \"openInterestList\": [\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"size\": \"52234.134\"\n // }\n // ],\n // \"ts\": \"1700866041023\"\n // }\n //\n // uta\n //\n // {\n // \"list\": [\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"openInterest\": \"18166.3583\"\n // }\n // ],\n // \"ts\": \"1751101220993\"\n // }\n //\n const data = this.safeList2 (interest, 'openInterestList', 'list', []);\n const timestamp = this.safeInteger (interest, 'ts');\n const marketId = this.safeString (data[0], 'symbol');\n return this.safeOpenInterest ({\n 'symbol': this.safeSymbol (marketId, market, undefined, 'contract'),\n 'openInterestAmount': this.safeNumber2 (data[0], 'size', 'openInterest'),\n 'openInterestValue': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"clientOid\": \"abe95dbe-6081-4a6f-a2d3-ae49601cd479\",\n \"orderId\": null\n }", "[\n {\n \"orderId\": \"1111397214281175046\",\n \"clientOid\": \"766d3fc3-7321-4406-a689-15c9987a2e75\"\n },\n {\n \"orderId\": \"\",\n \"clientOid\": \"d1b75cb3-cc15-4ede-ad4c-3937396f75ab\",\n \"errorMsg\": \"less than the minimum amount 5 USDT\",\n \"errorCode\": \"45110\"\n },\n ]", "{\n \"orderId\": \"1098758604547850241\",\n \"clientOid\": \"1098758604585598977\"\n }", "{\n \"result\": \"success\"\n }", "{\n \"userId\": \"7264631750\",\n \"symbol\": \"BTCUSDT\",\n \"orderId\": \"1111499608327360513\",\n \"clientOid\": \"d0d4dad5-18d0-4869-a074-ec40bb47cba6\",\n \"size\": \"0.0002000000000000\", // COST for 'buy market' order! AMOUNT in all other cases\n \"price\": \"0\", // in fetchOrder: 0 for market order, otherwise limit price (field not present in fetchOpenOrders\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"status\": \"live\",\n \"basePrice\": \"0\",\n \"priceAvg\": \"25000.0000000000000000\", // 0 if nothing filled\n \"baseVolume\": \"0.0000000000000000\", // 0 if nothing filled\n \"quoteVolume\": \"0.0000000000000000\", // 0 if nothing filled\n \"enterPointSource\": \"WEB\",\n \"orderSource\": \"normal\",\n \"cTime\": \"1700728077966\",\n \"uTime\": \"1700728077966\"\n \"feeDetail\": \"{\\\\\"newFees\\\\\":{\\\\\"c\\\\\":0,\\\\\"d\\\\\":0,\\\\\"deduction\\\\\":false,\\\\\"r\\\\\":-0.0064699886,\\\\\"t\\\\\":-0.0064699886,\\\\\"totalDeductionFee\\\\\":0},\\\\\"USDT\\\\\":{\\\\\"deduction\\\\\":false,\\\\\"feeCoinCode\\\\\":\\\\\"USDT\\\\\",\\\\\"totalDeductionFee\\\\\":0,\\\\\"totalFee\\\\\":-0.0064699886000000}}\", // might not be present in fetchOpenOrders\n \"triggerPrice\": null,\n \"tpslType\": \"normal\",\n \"quoteCoin\": \"USDT\", // not present in fetchOpenOrders\n \"baseCoin\": \"DOT\", // not present in fetchOpenOrders\n \"cancelReason\": \"\", // not present in fetchOpenOrders\n }" ], "line_end" => 5040, "line_start" => 4698, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (order, 'orderId')" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString2 (order, 'clientOrderId', 'clientOid')" }, %{ "comment" => nil, "key" => "status", "value" => "'rejected'" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (order, 'orderId', 'data')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "updateTimestamp" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "updateTimestamp" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "orderType" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "amount", "value" => "size" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeString2 (order, 'quoteVolume', 'quoteSize')" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "filled", "value" => "filled" }, %{ "comment" => nil, "key" => "remaining", "value" => "undefined" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "timeInForce" }, %{ "comment" => nil, "key" => "postOnly", "value" => "postOnly" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "reduceOnly" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "this.safeNumber (order, 'triggerPrice')" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "this.safeNumberN (order, [ 'presetStopSurplusPrice', 'stopSurplusTriggerPrice', 'takeProfit' ])" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "this.safeNumberN (order, [ 'presetStopLossPrice', 'stopLossTriggerPrice', 'stopLoss' ])" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseOrderStatus (rawStatus)" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" }, %{ "comment" => nil, "key" => "cost", "value" => "this.parseNumber (Precise.stringNeg (utaFee))" }, %{ "comment" => nil, "key" => "currency", "value" => "market['settle']" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // createOrder, editOrder, closePosition\n //\n // {\n // \"clientOid\": \"abe95dbe-6081-4a6f-a2d3-ae49601cd479\",\n // \"orderId\": null\n // }\n //\n // createOrders\n //\n // [\n // {\n // \"orderId\": \"1111397214281175046\",\n // \"clientOid\": \"766d3fc3-7321-4406-a689-15c9987a2e75\"\n // },\n // {\n // \"orderId\": \"\",\n // \"clientOid\": \"d1b75cb3-cc15-4ede-ad4c-3937396f75ab\",\n // \"errorMsg\": \"less than the minimum amount 5 USDT\",\n // \"errorCode\": \"45110\"\n // },\n // ]\n //\n // spot, swap, future, spot margin and uta: cancelOrder, cancelOrders, cancelAllOrders\n //\n // {\n // \"orderId\": \"1098758604547850241\",\n // \"clientOid\": \"1098758604585598977\"\n // }\n //\n // spot trigger: cancelOrder\n //\n // {\n // \"result\": \"success\"\n // }\n //\n // spot: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders\n //\n // {\n // \"userId\": \"7264631750\",\n // \"symbol\": \"BTCUSDT\",\n // \"orderId\": \"1111499608327360513\",\n // \"clientOid\": \"d0d4dad5-18d0-4869-a074-ec40bb47cba6\",\n // \"size\": \"0.0002000000000000\", // COST for 'buy market' order! AMOUNT in all other cases\n // \"price\": \"0\", // in fetchOrder: 0 for market order, otherwise limit price (field not present in fetchOpenOrders\n // \"orderType\": \"limit\",\n // \"side\": \"buy\",\n // \"status\": \"live\",\n // \"basePrice\": \"0\",\n // \"priceAvg\": \"25000.0000000000000000\", // 0 if nothing filled\n // \"baseVolume\": \"0.0000000000000000\", // 0 if nothing filled\n // \"quoteVolume\": \"0.0000000000000000\", // 0 if nothing filled\n // \"enterPointSource\": \"WEB\",\n // \"orderSource\": \"normal\",\n // \"cTime\": \"1700728077966\",\n // \"uTime\": \"1700728077966\"\n // \"feeDetail\": \"{\\\\\"newFees\\\\\":{\\\\\"c\\\\\":0,\\\\\"d\\\\\":0,\\\\\"deduction\\\\\":false,\\\\\"r\\\\\":-0.0064699886,\\\\\"t\\\\\":-0.0064699886,\\\\\"totalDeductionFee\\\\\":0},\\\\\"USDT\\\\\":{\\\\\"deduction\\\\\":false,\\\\\"feeCoinCode\\\\\":\\\\\"USDT\\\\\",\\\\\"totalDeductionFee\\\\\":0,\\\\\"totalFee\\\\\":-0.0064699886000000}}\", // might not be present in fetchOpenOrders\n // \"triggerPrice\": null,\n // \"tpslType\": \"normal\",\n // \"quoteCoin\": \"USDT\", // not present in fetchOpenOrders\n // \"baseCoin\": \"DOT\", // not present in fetchOpenOrders\n // \"cancelReason\": \"\", // not present in fetchOpenOrders\n // }\n //\n // spot trigger: fetchOpenOrders, fetchCanceledAndClosedOrders\n //\n // {\n // \"orderId\": \"1111503385931620352\",\n // \"clientOid\": \"1111503385910648832\",\n // \"symbol\": \"BTCUSDT\",\n // \"size\": \"0.0002\",\n // \"planType\": \"AMOUNT\",\n // \"executePrice\": \"25000\",\n // \"triggerPrice\": \"26000\",\n // \"status\": \"live\",\n // \"orderType\": \"limit\",\n // \"side\": \"buy\",\n // \"triggerType\": \"fill_price\",\n // \"enterPointSource\": \"API\",\n // \"cTime\": \"1700728978617\",\n // \"uTime\": \"1700728978617\"\n // }\n //\n // spot margin: fetchOpenOrders, fetchCanceledAndClosedOrders\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"orderType\": \"limit\",\n // \"enterPointSource\": \"WEB\",\n // \"orderId\": \"1111506377509580801\",\n // \"clientOid\": \"2043a3b59a60445f9d9f7365bf3e960c\",\n // \"loanType\": \"autoLoanAndRepay\",\n // \"price\": \"25000\",\n // \"side\": \"buy\",\n // \"status\": \"live\",\n // \"baseSize\": \"0.0002\",\n // \"quoteSize\": \"5\",\n // \"priceAvg\": \"0\",\n // \"size\": \"0\",\n // \"amount\": \"0\",\n // \"force\": \"gtc\",\n // \"cTime\": \"1700729691866\",\n // \"uTime\": \"1700729691866\"\n // }\n //\n // swap and future: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"size\": \"0.001\",\n // \"orderId\": \"1111465253393825792\",\n // \"clientOid\": \"1111465253431574529\",\n // \"baseVolume\": \"0\",\n // \"fee\": \"0\",\n // \"price\": \"27000\",\n // \"priceAvg\": \"\",\n // \"state\": \"live\",\n // // \"status\": \"live\", // key for fetchOpenOrders, fetchClosedOrders\n // \"side\": \"buy\",\n // \"force\": \"gtc\",\n // \"totalProfits\": \"0\",\n // \"posSide\": \"long\",\n // \"marginCoin\": \"USDT\",\n // \"quoteVolume\": \"0\",\n // \"leverage\": \"20\",\n // \"marginMode\": \"crossed\",\n // \"enterPointSource\": \"API\",\n // \"tradeSide\": \"open\",\n // \"posMode\": \"hedge_mode\",\n // \"orderType\": \"limit\",\n // \"orderSource\": \"normal\",\n // \"presetStopSurplusPrice\": \"\",\n // \"presetStopLossPrice\": \"\",\n // \"reduceOnly\": \"NO\",\n // \"cTime\": \"1700719887120\",\n // \"uTime\": \"1700719887120\"\n //\n // for swap trigger order, the additional below fields are present:\n //\n // \"planType\": \"normal_plan\",\n // \"callbackRatio\": \"\",\n // \"triggerPrice\": \"24000\",\n // \"triggerType\": \"mark_price\",\n // \"planStatus\": \"live\",\n // \"stopSurplusTriggerPrice\": \"\",\n // \"stopSurplusExecutePrice\": \"\",\n // \"stopSurplusTriggerType\": \"fill_price\",\n // \"stopLossTriggerPrice\": \"\",\n // \"stopLossExecutePrice\": \"\",\n // \"stopLossTriggerType\": \"fill_price\",\n // }\n //\n // uta: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders\n //\n // {\n // \"orderId\": \"1320244799629316096\",\n // \"clientOid\": \"1320244799633510400\",\n // \"category\": \"USDT-FUTURES\",\n // \"symbol\": \"BTCUSDT\",\n // \"orderType\": \"limit\",\n // \"side\": \"buy\",\n // \"price\": \"50000\",\n // \"qty\": \"0.001\",\n // \"amount\": \"0\",\n // \"cumExecQty\": \"0\",\n // \"cumExecValue\": \"0\",\n // \"avgPrice\": \"0\",\n // \"timeInForce\": \"gtc\",\n // \"orderStatus\": \"live\",\n // \"posSide\": \"long\",\n // \"holdMode\": \"hedge_mode\",\n // \"reduceOnly\": \"NO\",\n // \"feeDetail\": [{\n // \"feeCoin\": \"\",\n // \"fee\": \"\"\n // }],\n // \"createdTime\": \"1750496809871\",\n // \"updatedTime\": \"1750496809886\",\n // \"cancelReason\": \"\",\n // \"execType\": \"normal\",\n // \"stpMode\": \"none\",\n // \"tpTriggerBy\": null,\n // \"slTriggerBy\": null,\n // \"takeProfit\": null,\n // \"stopLoss\": null,\n // \"tpOrderType\": null,\n // \"slOrderType\": null,\n // \"tpLimitPrice\": null,\n // \"slLimitPrice\": null\n // }\n //\n // uta trigger: fetchClosedOrders, fetchCanceledOrders\n //\n // {\n // \"orderId\": \"1330984742276198400\",\n // \"clientOid\": \"1330984742276198400\",\n // \"symbol\": \"BTCUSDT\",\n // \"category\": \"USDT-FUTURES\",\n // \"qty\": \"0.001\",\n // \"posSide\": \"long\",\n // \"tpTriggerBy\": \"market\",\n // \"slTriggerBy\": \"mark\",\n // \"takeProfit\": \"\",\n // \"stopLoss\": \"112000\",\n // \"tpOrderType\": \"market\",\n // \"slOrderType\": \"limit\",\n // \"tpLimitPrice\": \"\",\n // \"slLimitPrice\": \"111000\",\n // \"createdTime\": \"1753057411736\",\n // \"updatedTime\": \"1753058267412\"\n // }\n //\n const errorMessage = this.safeString (order, 'errorMsg');\n if (errorMessage !== undefined) {\n return this.safeOrder ({\n 'info': order,\n 'id': this.safeString (order, 'orderId'),\n 'clientOrderId': this.safeString2 (order, 'clientOrderId', 'clientOid'),\n 'status': 'rejected',\n }, market);\n }\n const posSide = this.safeString (order, 'posSide');\n const isContractOrder = (posSide !== undefined);\n let marketType = isContractOrder ? 'contract' : 'spot';\n if (market !== undefined) {\n marketType = market['type'];\n }\n const marketId = this.safeString (order, 'symbol');\n market = this.safeMarket (marketId, market, undefined, marketType);\n const timestamp = this.safeIntegerN (order, [ 'cTime', 'ctime', 'createdTime' ]);\n const updateTimestamp = this.safeInteger2 (order, 'uTime', 'updatedTime');\n const rawStatus = this.safeStringN (order, [ 'status', 'state', 'orderStatus', 'planStatus' ]);\n let fee = undefined;\n const feeCostString = this.safeString (order, 'fee');\n if (feeCostString !== undefined) {\n // swap\n fee = {\n 'cost': this.parseNumber (Precise.stringNeg (feeCostString)),\n 'currency': market['settle'],\n };\n }\n const feeDetail = this.safeValue (order, 'feeDetail');\n const uta = this.safeString (order, 'category') !== undefined;\n if (uta) {\n const feeResult = this.safeDict (feeDetail, 0, {});\n const utaFee = this.safeString (feeResult, 'fee');\n fee = {\n 'cost': this.parseNumber (Precise.stringNeg (utaFee)),\n 'currency': market['settle'],\n };\n } else {\n if (feeDetail !== undefined) {\n const parsedFeeDetail = JSON.parse (feeDetail);\n const feeValues = Object.values (parsedFeeDetail);\n let feeObject = undefined;\n for (let i = 0; i < feeValues.length; i++) {\n const feeValue = feeValues[i];\n if (this.safeValue (feeValue, 'feeCoinCode') !== undefined) {\n feeObject = feeValue;\n break;\n }\n }\n fee = {\n 'cost': this.parseNumber (Precise.stringNeg (this.safeString (feeObject, 'totalFee'))),\n 'currency': this.safeCurrencyCode (this.safeString (feeObject, 'feeCoinCode')),\n };\n }\n }\n let postOnly = undefined;\n let timeInForce = this.safeStringUpper2 (order, 'force', 'timeInForce');\n if (timeInForce === 'POST_ONLY') {\n postOnly = true;\n timeInForce = 'PO';\n }\n let reduceOnly = undefined;\n const reduceOnlyRaw = this.safeString (order, 'reduceOnly');\n if (reduceOnlyRaw !== undefined) {\n reduceOnly = (reduceOnlyRaw === 'NO') ? false : true;\n }\n let price = undefined;\n let average = undefined;\n const basePrice = this.safeString (order, 'basePrice');\n if (basePrice !== undefined) {\n // for spot fetchOpenOrders, the price is priceAvg and the filled price is basePrice\n price = this.safeString (order, 'priceAvg');\n average = this.safeString (order, 'basePrice');\n } else {\n price = this.safeStringN (order, [ 'price', 'executePrice', 'slLimitPrice', 'tpLimitPrice' ]);\n average = this.safeString (order, 'priceAvg');\n }\n let size = undefined;\n let filled = undefined;\n const baseSize = this.safeString (order, 'baseSize');\n if (baseSize !== undefined) {\n // for spot margin fetchOpenOrders, the order size is baseSize and the filled amount is size\n size = baseSize;\n filled = this.safeString (order, 'size');\n } else {\n size = this.safeString2 (order, 'size', 'qty');\n filled = this.safeString2 (order, 'baseVolume', 'cumExecQty');\n }\n let side = this.safeString (order, 'side');\n const posMode = this.safeString (order, 'posMode');\n if (posMode === 'hedge_mode' && reduceOnly) {\n side = (side === 'buy') ? 'sell' : 'buy';\n // on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell\n // so the side of the reduceOnly order is inversed\n }\n const orderType = this.safeString (order, 'orderType');\n const isBuyMarket = (side === 'buy') && (orderType === 'market');\n if (market['spot'] && isBuyMarket) {\n // as noted in top comment, for 'buy market' the 'size' field is COST, not AMOUNT\n size = this.safeString (order, 'baseVolume');\n }\n return this.safeOrder ({\n 'info': order,\n 'id': this.safeString2 (order, 'orderId', 'data'),\n 'clientOrderId': this.safeString2 (order, 'clientOrderId', 'clientOid'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': updateTimestamp,\n 'lastUpdateTimestamp': updateTimestamp,\n 'symbol': market['symbol'],\n 'type': orderType,\n 'side': side,\n 'price': price,\n 'amount': size,\n 'cost': this.safeString2 (order, 'quoteVolume', 'quoteSize'),\n 'average': average,\n 'filled': filled,\n 'remaining': undefined,\n 'timeInForce': timeInForce,\n 'postOnly': postOnly,\n 'reduceOnly': reduceOnly,\n 'triggerPrice': this.safeNumber (order, 'triggerPrice'),\n 'takeProfitPrice': this.safeNumberN (order, [ 'presetStopSurplusPrice', 'stopSurplusTriggerPrice', 'takeProfit' ]),\n 'stopLossPrice': this.safeNumberN (order, [ 'presetStopLossPrice', 'stopLossTriggerPrice', 'stopLoss' ]),\n 'status': this.parseOrderStatus (rawStatus),\n 'fee': fee,\n 'trades': undefined,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4696, "line_start" => 4676, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n 'new': 'open',\n 'init': 'open',\n 'not_trigger': 'open',\n 'partial_fill': 'open',\n 'partially_fill': 'open',\n 'partially_filled': 'open',\n 'triggered': 'closed',\n 'full_fill': 'closed',\n 'filled': 'closed',\n 'fail_trigger': 'rejected',\n 'cancel': 'canceled',\n 'cancelled': 'canceled',\n 'canceled': 'canceled',\n 'live': 'open',\n 'fail_execute': 'rejected',\n 'executed': 'closed',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"marginCoin\": \"USDT\",\n \"symbol\": \"BTCUSDT\",\n \"holdSide\": \"long\",\n \"openDelegateSize\": \"0\",\n \"marginSize\": \"3.73555\",\n \"available\": \"0.002\",\n \"locked\": \"0\",\n \"total\": \"0.002\",\n \"leverage\": \"20\",\n \"achievedProfits\": \"0\",\n \"openPriceAvg\": \"37355.5\",\n \"marginMode\": \"crossed\",\n \"posMode\": \"hedge_mode\",\n \"unrealizedPL\": \"0.007\",\n \"liquidationPrice\": \"31724.970702417\",\n \"keepMarginRate\": \"0.004\",\n \"markPrice\": \"37359\",\n \"marginRatio\": \"0.029599540355\",\n \"cTime\": \"1700807507275\"\n }", "{\n \"category\": \"USDT-FUTURES\",\n \"symbol\": \"BTCUSDT\",\n \"marginCoin\": \"USDT\",\n \"holdMode\": \"hedge_mode\",\n \"posSide\": \"long\",\n \"marginMode\": \"crossed\",\n \"positionBalance\": \"5.435199\",\n \"available\": \"0.001\",\n \"frozen\": \"0\",\n \"total\": \"0.001\",\n \"leverage\": \"20\",\n \"curRealisedPnl\": \"0\",\n \"avgPrice\": \"107410.3\",\n \"positionStatus\": \"normal\",\n \"unrealisedPnl\": \"0.0047\",\n \"liquidationPrice\": \"0\",\n \"mmr\": \"0.004\",\n \"profitRate\": \"0.0008647337475591\",\n \"markPrice\": \"107415.3\",\n \"breakEvenPrice\": \"107539.2\",\n \"totalFunding\": \"0\",\n \"openFeeTotal\": \"-0.06444618\",\n \"closeFeeTotal\": \"0\",\n \"createdTime\": \"1750495670699\",\n \"updatedTime\": \"1750929883465\"\n }", "{\n \"marginCoin\": \"USDT\",\n \"symbol\": \"BTCUSDT\",\n \"holdSide\": \"long\",\n \"openDelegateSize\": \"0\",\n \"marginSize\": \"3.73555\",\n \"available\": \"0.002\",\n \"locked\": \"0\",\n \"total\": \"0.002\",\n \"leverage\": \"20\",\n \"achievedProfits\": \"0\",\n \"openPriceAvg\": \"37355.5\",\n \"marginMode\": \"crossed\",\n \"posMode\": \"hedge_mode\",\n \"unrealizedPL\": \"0.03\",\n \"liquidationPrice\": \"31725.023602417\",\n \"keepMarginRate\": \"0.004\",\n \"markPrice\": \"37370.5\",\n \"marginRatio\": \"0.029550120396\",\n \"cTime\": \"1700807507275\"\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"marginCoin\": \"USDT\",\n \"holdSide\": \"long\",\n \"openAvgPrice\": \"37272.1\",\n \"closeAvgPrice\": \"37271.4\",\n \"marginMode\": \"crossed\",\n \"openTotalPos\": \"0.001\",\n \"closeTotalPos\": \"0.001\",\n \"pnl\": \"-0.0007\",\n \"netProfit\": \"-0.0454261\",\n \"totalFunding\": \"0\",\n \"openFee\": \"-0.02236326\",\n \"closeFee\": \"-0.02236284\",\n \"utime\": \"1700720700400\",\n \"ctime\": \"1700720651684\"\n }", "{\n \"orderId\": \"1120923953904893955\",\n \"clientOid\": \"1120923953904893956\"\n }" ], "line_end" => 8335, "line_start" => 8113, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (position, 'orderId', 'positionId')" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "notional", "value" => "this.parseNumber (notional)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "liquidationPrice" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.parseNumber (entryPrice)" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.parseNumber (unrealizedPnl)" }, %{ "comment" => nil, "key" => "realizedPnl", "value" => "this.safeNumberN (position, [ 'pnl', 'curRealisedPnl', 'cumRealisedPnl' ])" }, %{ "comment" => nil, "key" => "percentage", "value" => "this.parseNumber (percentage)" }, %{ "comment" => nil, "key" => "contracts", "value" => "contracts" }, %{ "comment" => nil, "key" => "contractSize", "value" => "contractSizeNumber" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.parseNumber (markPrice)" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "this.safeNumber2 (position, 'closeAvgPrice', 'closePriceAvg')" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "hedged", "value" => "hedged" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "this.safeInteger2 (position, 'utime', 'updatedTime')" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "this.parseNumber (maintenanceMargin)" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "this.parseNumber (maintenanceMarginPercentage)" }, %{ "comment" => nil, "key" => "collateral", "value" => "this.parseNumber (collateral)" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "this.parseNumber (initialMargin)" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "this.parseNumber (initialMarginPercentage)" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.parseNumber (leverage)" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "this.safeNumber2 (position, 'marginRatio', 'mmr')" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // fetchPosition\n //\n // {\n // \"marginCoin\": \"USDT\",\n // \"symbol\": \"BTCUSDT\",\n // \"holdSide\": \"long\",\n // \"openDelegateSize\": \"0\",\n // \"marginSize\": \"3.73555\",\n // \"available\": \"0.002\",\n // \"locked\": \"0\",\n // \"total\": \"0.002\",\n // \"leverage\": \"20\",\n // \"achievedProfits\": \"0\",\n // \"openPriceAvg\": \"37355.5\",\n // \"marginMode\": \"crossed\",\n // \"posMode\": \"hedge_mode\",\n // \"unrealizedPL\": \"0.007\",\n // \"liquidationPrice\": \"31724.970702417\",\n // \"keepMarginRate\": \"0.004\",\n // \"markPrice\": \"37359\",\n // \"marginRatio\": \"0.029599540355\",\n // \"cTime\": \"1700807507275\"\n // }\n //\n // uta: fetchPosition\n //\n // {\n // \"category\": \"USDT-FUTURES\",\n // \"symbol\": \"BTCUSDT\",\n // \"marginCoin\": \"USDT\",\n // \"holdMode\": \"hedge_mode\",\n // \"posSide\": \"long\",\n // \"marginMode\": \"crossed\",\n // \"positionBalance\": \"5.435199\",\n // \"available\": \"0.001\",\n // \"frozen\": \"0\",\n // \"total\": \"0.001\",\n // \"leverage\": \"20\",\n // \"curRealisedPnl\": \"0\",\n // \"avgPrice\": \"107410.3\",\n // \"positionStatus\": \"normal\",\n // \"unrealisedPnl\": \"0.0047\",\n // \"liquidationPrice\": \"0\",\n // \"mmr\": \"0.004\",\n // \"profitRate\": \"0.0008647337475591\",\n // \"markPrice\": \"107415.3\",\n // \"breakEvenPrice\": \"107539.2\",\n // \"totalFunding\": \"0\",\n // \"openFeeTotal\": \"-0.06444618\",\n // \"closeFeeTotal\": \"0\",\n // \"createdTime\": \"1750495670699\",\n // \"updatedTime\": \"1750929883465\"\n // }\n //\n // fetchPositions: privateMixGetV2MixPositionAllPosition\n //\n // {\n // \"marginCoin\": \"USDT\",\n // \"symbol\": \"BTCUSDT\",\n // \"holdSide\": \"long\",\n // \"openDelegateSize\": \"0\",\n // \"marginSize\": \"3.73555\",\n // \"available\": \"0.002\",\n // \"locked\": \"0\",\n // \"total\": \"0.002\",\n // \"leverage\": \"20\",\n // \"achievedProfits\": \"0\",\n // \"openPriceAvg\": \"37355.5\",\n // \"marginMode\": \"crossed\",\n // \"posMode\": \"hedge_mode\",\n // \"unrealizedPL\": \"0.03\",\n // \"liquidationPrice\": \"31725.023602417\",\n // \"keepMarginRate\": \"0.004\",\n // \"markPrice\": \"37370.5\",\n // \"marginRatio\": \"0.029550120396\",\n // \"cTime\": \"1700807507275\"\n // }\n //\n // fetchPositionsHistory: privateMixGetV2MixPositionHistoryPosition\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"marginCoin\": \"USDT\",\n // \"holdSide\": \"long\",\n // \"openAvgPrice\": \"37272.1\",\n // \"closeAvgPrice\": \"37271.4\",\n // \"marginMode\": \"crossed\",\n // \"openTotalPos\": \"0.001\",\n // \"closeTotalPos\": \"0.001\",\n // \"pnl\": \"-0.0007\",\n // \"netProfit\": \"-0.0454261\",\n // \"totalFunding\": \"0\",\n // \"openFee\": \"-0.02236326\",\n // \"closeFee\": \"-0.02236284\",\n // \"utime\": \"1700720700400\",\n // \"ctime\": \"1700720651684\"\n // }\n //\n // closeAllPositions\n //\n // {\n // \"orderId\": \"1120923953904893955\",\n // \"clientOid\": \"1120923953904893956\"\n // }\n //\n // uta: fetchPositionsHistory\n //\n // {\n // \"positionId\": \"1322441328637100049\",\n // \"category\": \"USDT-FUTURES\",\n // \"symbol\": \"BTCUSDT\",\n // \"marginCoin\": \"USDT\",\n // \"holdMode\": \"hedge_mode\",\n // \"posSide\": \"long\",\n // \"marginMode\": \"crossed\",\n // \"openPriceAvg\": \"107003.7\",\n // \"closePriceAvg\": \"107005.4\",\n // \"openTotalPos\": \"0.0001\",\n // \"closeTotalPos\": \"0.0001\",\n // \"cumRealisedPnl\": \"0.00017\",\n // \"netProfit\": \"-0.01267055\",\n // \"totalFunding\": \"0\",\n // \"openFeeTotal\": \"-0.00642022\",\n // \"closeFeeTotal\": \"-0.00642032\",\n // \"createdTime\": \"1751020503195\",\n // \"updatedTime\": \"1751020520458\"\n // }\n //\n const marketId = this.safeString (position, 'symbol');\n market = this.safeMarket (marketId, market, undefined, 'contract');\n const symbol = market['symbol'];\n const timestamp = this.safeIntegerN (position, [ 'cTime', 'ctime', 'createdTime' ]);\n let marginMode = this.safeString (position, 'marginMode');\n let collateral = undefined;\n let initialMargin = undefined;\n const unrealizedPnl = this.safeString2 (position, 'unrealizedPL', 'unrealisedPnl');\n const rawCollateral = this.safeString2 (position, 'marginSize', 'positionBalance');\n if (marginMode === 'isolated') {\n collateral = Precise.stringAdd (rawCollateral, unrealizedPnl);\n } else if (marginMode === 'crossed') {\n marginMode = 'cross';\n initialMargin = rawCollateral;\n }\n const holdMode = this.safeString2 (position, 'posMode', 'holdMode');\n let hedged = undefined;\n if (holdMode === 'hedge_mode') {\n hedged = true;\n } else if (holdMode === 'one_way_mode') {\n hedged = false;\n }\n const side = this.safeString2 (position, 'holdSide', 'posSide');\n const leverage = this.safeString (position, 'leverage');\n const contractSizeNumber = this.safeValue (market, 'contractSize');\n const contractSize = this.numberToString (contractSizeNumber);\n const baseAmount = this.safeString2 (position, 'total', 'openTotalPos');\n const entryPrice = this.safeStringN (position, [ 'openPriceAvg', 'openAvgPrice', 'avgPrice' ]);\n const maintenanceMarginPercentage = this.safeString (position, 'keepMarginRate');\n const openNotional = Precise.stringMul (entryPrice, baseAmount);\n if (initialMargin === undefined) {\n initialMargin = Precise.stringDiv (openNotional, leverage);\n }\n let contracts = this.parseNumber (Precise.stringDiv (baseAmount, contractSize));\n if (contracts === undefined) {\n contracts = this.safeNumber (position, 'closeTotalPos');\n }\n const markPrice = this.safeString (position, 'markPrice');\n const notional = Precise.stringMul (baseAmount, markPrice);\n const initialMarginPercentage = Precise.stringDiv (initialMargin, notional);\n let liquidationPrice = this.parseNumber (this.omitZero (this.safeString (position, 'liquidationPrice')));\n const calcTakerFeeRate = '0.0006';\n const calcTakerFeeMult = '0.9994';\n if ((liquidationPrice === undefined) && (marginMode === 'isolated') && Precise.stringGt (baseAmount, '0')) {\n let signedMargin = Precise.stringDiv (rawCollateral, baseAmount);\n let signedMmp = maintenanceMarginPercentage;\n if (side === 'short') {\n signedMargin = Precise.stringNeg (signedMargin);\n signedMmp = Precise.stringNeg (signedMmp);\n }\n let mmrMinusOne = Precise.stringSub ('1', signedMmp);\n let numerator = Precise.stringSub (entryPrice, signedMargin);\n if (side === 'long') {\n mmrMinusOne = Precise.stringMul (mmrMinusOne, calcTakerFeeMult);\n } else {\n numerator = Precise.stringMul (numerator, calcTakerFeeMult);\n }\n liquidationPrice = this.parseNumber (Precise.stringDiv (numerator, mmrMinusOne));\n }\n const feeToClose = Precise.stringMul (notional, calcTakerFeeRate);\n const maintenanceMargin = Precise.stringAdd (Precise.stringMul (maintenanceMarginPercentage, notional), feeToClose);\n const percentage = Precise.stringMul (Precise.stringDiv (unrealizedPnl, initialMargin, 4), '100');\n return this.safePosition ({\n 'info': position,\n 'id': this.safeString2 (position, 'orderId', 'positionId'),\n 'symbol': symbol,\n 'notional': this.parseNumber (notional),\n 'marginMode': marginMode,\n 'liquidationPrice': liquidationPrice,\n 'entryPrice': this.parseNumber (entryPrice),\n 'unrealizedPnl': this.parseNumber (unrealizedPnl),\n 'realizedPnl': this.safeNumberN (position, [ 'pnl', 'curRealisedPnl', 'cumRealisedPnl' ]),\n 'percentage': this.parseNumber (percentage),\n 'contracts': contracts,\n 'contractSize': contractSizeNumber,\n 'markPrice': this.parseNumber (markPrice),\n 'lastPrice': this.safeNumber2 (position, 'closeAvgPrice', 'closePriceAvg'),\n 'side': side,\n 'hedged': hedged,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastUpdateTimestamp': this.safeInteger2 (position, 'utime', 'updatedTime'),\n 'maintenanceMargin': this.parseNumber (maintenanceMargin),\n 'maintenanceMarginPercentage': this.parseNumber (maintenanceMarginPercentage),\n 'collateral': this.parseNumber (collateral),\n 'initialMargin': this.parseNumber (initialMargin),\n 'initialMarginPercentage': this.parseNumber (initialMarginPercentage),\n 'leverage': this.parseNumber (leverage),\n 'marginRatio': this.safeNumber2 (position, 'marginRatio', 'mmr'),\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"price\": \"26242\",\n \"indexPrice\": \"34867\",\n \"markPrice\": \"25555\",\n \"ts\": \"1695793390482\"\n }", "{\n \"open\": \"37202.46\",\n \"symbol\": \"BTCUSDT\",\n \"high24h\": \"37744.75\",\n \"low24h\": \"36666\",\n \"lastPr\": \"37583.69\",\n \"quoteVolume\": \"519127705.303\",\n \"baseVolume\": \"13907.0386\",\n \"usdtVolume\": \"519127705.302908\",\n \"ts\": \"1700532903261\",\n \"bidPr\": \"37583.68\",\n \"askPr\": \"37583.69\",\n \"bidSz\": \"0.0007\",\n \"askSz\": \"0.0829\",\n \"openUtc\": \"37449.4\",\n \"changeUtc24h\": \"0.00359\",\n \"change24h\": \"0.00321\"\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"lastPr\": \"104823.8\",\n \"askPr\": \"104823.8\",\n \"bidPr\": \"104823.5\",\n \"bidSz\": \"0.703\",\n \"askSz\": \"13.894\",\n \"high24h\": \"105289.3\",\n \"low24h\": \"103447.9\",\n \"ts\": \"1750332210370\",\n \"change24h\": \"0.00471\",\n \"baseVolume\": \"79089.5675\",\n \"quoteVolume\": \"8274870921.80485\",\n \"usdtVolume\": \"8274870921.80485\",\n \"openUtc\": \"104833\",\n \"changeUtc24h\": \"-0.00009\",\n \"indexPrice\": \"104881.953125\",\n \"fundingRate\": \"-0.000014\",\n \"holdingAmount\": \"7452.6421\",\n \"deliveryStartTime\": null,\n \"deliveryTime\": null,\n \"deliveryStatus\": \"\",\n \"open24h\": \"104332.3\",\n \"markPrice\": \"104824.2\"\n }", "{\n \"category\": \"SPOT\",\n \"symbol\": \"BTCUSDT\",\n \"ts\": \"1750330651972\",\n \"lastPrice\": \"104900.2\",\n \"openPrice24h\": \"104321.2\",\n \"highPrice24h\": \"107956.8\",\n \"lowPrice24h\": \"103600.1\",\n \"ask1Price\": \"104945.8\",\n \"bid1Price\": \"104880.6\",\n \"bid1Size\": \"0.266534\",\n \"ask1Size\": \"0.014001\",\n \"price24hPcnt\": \"0.00555\",\n \"volume24h\": \"355.941109\",\n \"turnover24h\": \"37302936.008134\"\n }", "{\n \"category\": \"USDT-FUTURES\",\n \"symbol\": \"BTCUSDT\",\n \"ts\": \"1750332730472\",\n \"lastPrice\": \"104738\",\n \"openPrice24h\": \"104374\",\n \"highPrice24h\": \"105289.3\",\n \"lowPrice24h\": \"103447.9\",\n \"ask1Price\": \"104738\",\n \"bid1Price\": \"104737.7\",\n \"bid1Size\": \"2.036\",\n \"ask1Size\": \"8.094\",\n \"price24hPcnt\": \"0.00349\",\n \"volume24h\": \"79101.6477\",\n \"turnover24h\": \"8276293391.45973\",\n \"indexPrice\": \"104785.956168\",\n \"markPrice\": \"104738\",\n \"fundingRate\": \"-0.000007\",\n \"openInterest\": \"7465.5938\",\n \"deliveryStartTime\": \"\",\n \"deliveryTime\": \"\",\n \"deliveryStatus\": \"\"\n }" ], "line_end" => 3365, "line_start" => 3221, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, marketType)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "this.safeString2 (ticker, 'high24h', 'highPrice24h')" }, %{ "comment" => nil, "key" => "low", "value" => "this.safeString2 (ticker, 'low24h', 'lowPrice24h')" }, %{ "comment" => nil, "key" => "bid", "value" => "this.safeString2 (ticker, 'bidPr', 'bid1Price')" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "this.safeString2 (ticker, 'bidSz', 'bid1Size')" }, %{ "comment" => nil, "key" => "ask", "value" => "this.safeString2 (ticker, 'askPr', 'ask1Price')" }, %{ "comment" => nil, "key" => "askVolume", "value" => "this.safeString2 (ticker, 'askSz', 'ask1Size')" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "this.safeStringN (ticker, [ 'open', 'open24h', 'openPrice24h' ])" }, %{ "comment" => nil, "key" => "close", "value" => "close" }, %{ "comment" => nil, "key" => "last", "value" => "close" }, %{ "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" => "this.safeString2 (ticker, 'baseVolume', 'volume24h')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "this.safeString2 (ticker, 'quoteVolume', 'turnover24h')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeString (ticker, 'indexPrice')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "markPrice" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker", "source" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker {\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"price\": \"26242\",\n // \"indexPrice\": \"34867\",\n // \"markPrice\": \"25555\",\n // \"ts\": \"1695793390482\"\n // }\n //\n // spot\n //\n // {\n // \"open\": \"37202.46\",\n // \"symbol\": \"BTCUSDT\",\n // \"high24h\": \"37744.75\",\n // \"low24h\": \"36666\",\n // \"lastPr\": \"37583.69\",\n // \"quoteVolume\": \"519127705.303\",\n // \"baseVolume\": \"13907.0386\",\n // \"usdtVolume\": \"519127705.302908\",\n // \"ts\": \"1700532903261\",\n // \"bidPr\": \"37583.68\",\n // \"askPr\": \"37583.69\",\n // \"bidSz\": \"0.0007\",\n // \"askSz\": \"0.0829\",\n // \"openUtc\": \"37449.4\",\n // \"changeUtc24h\": \"0.00359\",\n // \"change24h\": \"0.00321\"\n // }\n //\n // swap and future\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"lastPr\": \"104823.8\",\n // \"askPr\": \"104823.8\",\n // \"bidPr\": \"104823.5\",\n // \"bidSz\": \"0.703\",\n // \"askSz\": \"13.894\",\n // \"high24h\": \"105289.3\",\n // \"low24h\": \"103447.9\",\n // \"ts\": \"1750332210370\",\n // \"change24h\": \"0.00471\",\n // \"baseVolume\": \"79089.5675\",\n // \"quoteVolume\": \"8274870921.80485\",\n // \"usdtVolume\": \"8274870921.80485\",\n // \"openUtc\": \"104833\",\n // \"changeUtc24h\": \"-0.00009\",\n // \"indexPrice\": \"104881.953125\",\n // \"fundingRate\": \"-0.000014\",\n // \"holdingAmount\": \"7452.6421\",\n // \"deliveryStartTime\": null,\n // \"deliveryTime\": null,\n // \"deliveryStatus\": \"\",\n // \"open24h\": \"104332.3\",\n // \"markPrice\": \"104824.2\"\n // }\n //\n // spot uta\n //\n // {\n // \"category\": \"SPOT\",\n // \"symbol\": \"BTCUSDT\",\n // \"ts\": \"1750330651972\",\n // \"lastPrice\": \"104900.2\",\n // \"openPrice24h\": \"104321.2\",\n // \"highPrice24h\": \"107956.8\",\n // \"lowPrice24h\": \"103600.1\",\n // \"ask1Price\": \"104945.8\",\n // \"bid1Price\": \"104880.6\",\n // \"bid1Size\": \"0.266534\",\n // \"ask1Size\": \"0.014001\",\n // \"price24hPcnt\": \"0.00555\",\n // \"volume24h\": \"355.941109\",\n // \"turnover24h\": \"37302936.008134\"\n // }\n //\n // swap and future uta\n //\n // {\n // \"category\": \"USDT-FUTURES\",\n // \"symbol\": \"BTCUSDT\",\n // \"ts\": \"1750332730472\",\n // \"lastPrice\": \"104738\",\n // \"openPrice24h\": \"104374\",\n // \"highPrice24h\": \"105289.3\",\n // \"lowPrice24h\": \"103447.9\",\n // \"ask1Price\": \"104738\",\n // \"bid1Price\": \"104737.7\",\n // \"bid1Size\": \"2.036\",\n // \"ask1Size\": \"8.094\",\n // \"price24hPcnt\": \"0.00349\",\n // \"volume24h\": \"79101.6477\",\n // \"turnover24h\": \"8276293391.45973\",\n // \"indexPrice\": \"104785.956168\",\n // \"markPrice\": \"104738\",\n // \"fundingRate\": \"-0.000007\",\n // \"openInterest\": \"7465.5938\",\n // \"deliveryStartTime\": \"\",\n // \"deliveryTime\": \"\",\n // \"deliveryStatus\": \"\"\n // }\n //\n const marketId = this.safeString (ticker, 'symbol');\n const close = this.safeString2 (ticker, 'lastPr', 'lastPrice');\n const timestamp = this.safeIntegerOmitZero (ticker, 'ts'); // exchange bitget provided 0\n const category = this.safeString (ticker, 'category');\n const markPrice = this.safeString (ticker, 'markPrice');\n let marketType: string;\n if ((markPrice !== undefined) && (category !== 'SPOT')) {\n marketType = 'contract';\n } else {\n marketType = 'spot';\n }\n let percentage = this.safeString (ticker, 'price24hPcnt');\n if (percentage === undefined) {\n const change24h = this.safeString (ticker, 'change24h');\n percentage = Precise.stringMul (change24h, '100');\n }\n return this.safeTicker ({\n 'symbol': this.safeSymbol (marketId, market, undefined, marketType),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': this.safeString2 (ticker, 'high24h', 'highPrice24h'),\n 'low': this.safeString2 (ticker, 'low24h', 'lowPrice24h'),\n 'bid': this.safeString2 (ticker, 'bidPr', 'bid1Price'),\n 'bidVolume': this.safeString2 (ticker, 'bidSz', 'bid1Size'),\n 'ask': this.safeString2 (ticker, 'askPr', 'ask1Price'),\n 'askVolume': this.safeString2 (ticker, 'askSz', 'ask1Size'),\n 'vwap': undefined,\n 'open': this.safeStringN (ticker, [ 'open', 'open24h', 'openPrice24h' ]),\n 'close': close,\n 'last': close,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': percentage,\n 'average': undefined,\n 'baseVolume': this.safeString2 (ticker, 'baseVolume', 'volume24h'),\n 'quoteVolume': this.safeString2 (ticker, 'quoteVolume', 'turnover24h'),\n 'indexPrice': this.safeString (ticker, 'indexPrice'),\n 'markPrice': markPrice,\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"tradeId\": \"1075199767891652609\",\n \"price\": \"29376.5\",\n \"size\": \"6.035\",\n \"side\": \"Buy\",\n \"ts\": \"1692073521000\",\n \"symbol\": \"BTCUSDT\"\n }", "{\n \"userId\": \"7264631750\",\n \"symbol\": \"BTCUSDT\",\n \"orderId\": \"1098394344925597696\",\n \"tradeId\": \"1098394344974925824\",\n \"orderType\": \"market\",\n \"side\": \"sell\",\n \"priceAvg\": \"28467.68\",\n \"size\": \"0.0002\",\n \"amount\": \"5.693536\",\n \"feeDetail\": {\n \"deduction\": \"no\",\n \"feeCoin\": \"USDT\",\n \"totalDeductionFee\": \"\",\n \"totalFee\": \"-0.005693536\"\n },\n \"tradeScope\": \"taker\",\n \"cTime\": \"1697603539699\",\n \"uTime\": \"1697603539754\"\n }", "{\n \"orderId\": \"1099353730455318528\",\n \"tradeId\": \"1099353730627092481\",\n \"orderType\": \"market\",\n \"side\": \"sell\",\n \"priceAvg\": \"29543.7\",\n \"size\": \"0.0001\",\n \"amount\": \"2.95437\",\n \"tradeScope\": \"taker\",\n \"feeDetail\": {\n \"deduction\": \"no\",\n \"feeCoin\": \"USDT\",\n \"totalDeductionFee\": \"0\",\n \"totalFee\": \"-0.00295437\"\n },\n \"cTime\": \"1697832275063\",\n \"uTime\": \"1697832275150\"\n }", "{\n \"tradeId\": \"1111468664328269825\",\n \"symbol\": \"BTCUSDT\",\n \"orderId\": \"1111468664264753162\",\n \"price\": \"37271.4\",\n \"baseVolume\": \"0.001\",\n \"feeDetail\": [\n {\n \"deduction\": \"no\",\n \"feeCoin\": \"USDT\",\n \"totalDeductionFee\": null,\n \"totalFee\": \"-0.02236284\"\n }\n ],\n \"side\": \"buy\",\n \"quoteVolume\": \"37.2714\",\n \"profit\": \"-0.0007\",\n \"enterPointSource\": \"web\",\n \"tradeSide\": \"close\",\n \"posMode\": \"hedge_mode\",\n \"tradeScope\": \"taker\",\n \"cTime\": \"1700720700342\"\n }", "{\n \"execId\": \"1319896716324937729\",\n \"price\": \"105909.1\",\n \"size\": \"6.3090\",\n \"side\": \"sell\",\n \"ts\": \"1750413820344\"\n }" ], "line_end" => 3873, "line_start" => 3721, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (trade, 'tradeId', 'execId')" }, %{ "comment" => nil, "key" => "order", "value" => "this.safeString (trade, 'orderId')" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "side", "value" => "this.safeStringLower (trade, 'side')" }, %{ "comment" => nil, "key" => "type", "value" => "this.safeString (trade, 'orderType')" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "this.safeString (trade, 'tradeScope')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeStringN (trade, [ 'priceAvg', 'price', 'execPrice' ])" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeStringN (trade, [ 'baseVolume', 'size', 'execQty' ])" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeStringN (trade, [ 'quoteVolume', 'amount', 'execValue' ])" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "currency", "value" => "currencyCode" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // spot, swap and future: fetchTrades\n //\n // {\n // \"tradeId\": \"1075199767891652609\",\n // \"price\": \"29376.5\",\n // \"size\": \"6.035\",\n // \"side\": \"Buy\",\n // \"ts\": \"1692073521000\",\n // \"symbol\": \"BTCUSDT\"\n // }\n //\n // spot: fetchMyTrades\n //\n // {\n // \"userId\": \"7264631750\",\n // \"symbol\": \"BTCUSDT\",\n // \"orderId\": \"1098394344925597696\",\n // \"tradeId\": \"1098394344974925824\",\n // \"orderType\": \"market\",\n // \"side\": \"sell\",\n // \"priceAvg\": \"28467.68\",\n // \"size\": \"0.0002\",\n // \"amount\": \"5.693536\",\n // \"feeDetail\": {\n // \"deduction\": \"no\",\n // \"feeCoin\": \"USDT\",\n // \"totalDeductionFee\": \"\",\n // \"totalFee\": \"-0.005693536\"\n // },\n // \"tradeScope\": \"taker\",\n // \"cTime\": \"1697603539699\",\n // \"uTime\": \"1697603539754\"\n // }\n //\n // spot margin: fetchMyTrades\n //\n // {\n // \"orderId\": \"1099353730455318528\",\n // \"tradeId\": \"1099353730627092481\",\n // \"orderType\": \"market\",\n // \"side\": \"sell\",\n // \"priceAvg\": \"29543.7\",\n // \"size\": \"0.0001\",\n // \"amount\": \"2.95437\",\n // \"tradeScope\": \"taker\",\n // \"feeDetail\": {\n // \"deduction\": \"no\",\n // \"feeCoin\": \"USDT\",\n // \"totalDeductionFee\": \"0\",\n // \"totalFee\": \"-0.00295437\"\n // },\n // \"cTime\": \"1697832275063\",\n // \"uTime\": \"1697832275150\"\n // }\n //\n // swap and future: fetchMyTrades\n //\n // {\n // \"tradeId\": \"1111468664328269825\",\n // \"symbol\": \"BTCUSDT\",\n // \"orderId\": \"1111468664264753162\",\n // \"price\": \"37271.4\",\n // \"baseVolume\": \"0.001\",\n // \"feeDetail\": [\n // {\n // \"deduction\": \"no\",\n // \"feeCoin\": \"USDT\",\n // \"totalDeductionFee\": null,\n // \"totalFee\": \"-0.02236284\"\n // }\n // ],\n // \"side\": \"buy\",\n // \"quoteVolume\": \"37.2714\",\n // \"profit\": \"-0.0007\",\n // \"enterPointSource\": \"web\",\n // \"tradeSide\": \"close\",\n // \"posMode\": \"hedge_mode\",\n // \"tradeScope\": \"taker\",\n // \"cTime\": \"1700720700342\"\n // }\n //\n // uta fetchTrades\n //\n // {\n // \"execId\": \"1319896716324937729\",\n // \"price\": \"105909.1\",\n // \"size\": \"6.3090\",\n // \"side\": \"sell\",\n // \"ts\": \"1750413820344\"\n // }\n //\n // uta fetchMyTrades\n //\n // {\n // \"execId\": \"1322441401010528257\",\n // \"orderId\": \"1322441400976261120\",\n // \"category\": \"USDT-FUTURES\",\n // \"symbol\": \"BTCUSDT\",\n // \"orderType\": \"market\",\n // \"side\": \"sell\",\n // \"execPrice\": \"107005.4\",\n // \"execQty\": \"0.0001\",\n // \"execValue\": \"10.7005\",\n // \"tradeScope\": \"taker\",\n // \"feeDetail\": [{\n // \"feeCoin\": \"USDT\",\n // \"fee\":\"0.00642032\"\n // }],\n // \"createdTime\": \"1751020520451\",\n // \"updatedTime\": \"1751020520458\",\n // \"execPnl\": \"0.00017\"\n // }\n //\n const marketId = this.safeString (trade, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n const timestamp = this.safeIntegerN (trade, [ 'cTime', 'ts', 'createdTime' ]);\n let fee = undefined;\n const feeDetail = this.safeValue (trade, 'feeDetail');\n const posMode = this.safeString (trade, 'posMode');\n const category = this.safeString (trade, 'category');\n const isFeeStructure = (posMode !== undefined) || (category !== undefined);\n const feeStructure = isFeeStructure ? feeDetail[0] : feeDetail;\n if (feeStructure !== undefined) {\n const currencyCode = this.safeCurrencyCode (this.safeString (feeStructure, 'feeCoin'));\n fee = {\n 'currency': currencyCode,\n };\n const feeCostString = this.safeString2 (feeStructure, 'totalFee', 'fee');\n const deduction = this.safeString (feeStructure, 'deduction') === 'yes' ? true : false;\n if (deduction) {\n fee['cost'] = feeCostString;\n } else {\n fee['cost'] = Precise.stringNeg (feeCostString);\n }\n }\n return this.safeTrade ({\n 'info': trade,\n 'id': this.safeString2 (trade, 'tradeId', 'execId'),\n 'order': this.safeString (trade, 'orderId'),\n 'symbol': symbol,\n 'side': this.safeStringLower (trade, 'side'),\n 'type': this.safeString (trade, 'orderType'),\n 'takerOrMaker': this.safeString (trade, 'tradeScope'),\n 'price': this.safeStringN (trade, [ 'priceAvg', 'price', 'execPrice' ]),\n 'amount': this.safeStringN (trade, [ 'baseVolume', 'size', 'execQty' ]),\n 'cost': this.safeStringN (trade, [ 'quoteVolume', 'amount', 'execValue' ]),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fee': fee,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4189, "line_start" => 4179, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "data" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (data, 'makerFeeRate')" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (data, 'takerFeeRate')" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "tierBased", "value" => "undefined" } ], "name" => "parseTradingFee", "signature" => "parseTradingFee (data, market: Market = undefined)", "source" => "parseTradingFee (data, market: Market = undefined) {\n const marketId = this.safeString (data, 'symbol');\n return {\n 'info': data,\n 'symbol': this.safeSymbol (marketId, market),\n 'maker': this.safeNumber (data, 'makerFeeRate'),\n 'taker': this.safeNumber (data, 'takerFeeRate'),\n 'percentage': undefined,\n 'tierBased': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"orderId\": \"1083832260799930368\",\n \"tradeId\": \"35bf0e588a42b25c71a9d45abe7308cabdeec6b7b423910b9bd4743d3a9a9efa\",\n \"coin\": \"BTC\",\n \"type\": \"deposit\",\n \"size\": \"0.00030000\",\n \"status\": \"success\",\n \"toAddress\": \"1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA\",\n \"dest\": \"on_chain\",\n \"chain\": \"BTC\",\n \"fromAddress\": null,\n \"cTime\": \"1694131668281\",\n \"uTime\": \"1694131680247\"\n }", "{\n \"orderId\": \"1083832260799930368\",\n \"tradeId\": \"35bf0e588a42b25c71a9d45abe7308cabdeec6b7b423910b9bd4743d3a9a9efa\",\n \"clientOid\": \"123\",\n \"coin\": \"BTC\",\n \"type\": \"withdraw\",\n \"size\": \"0.00030000\",\n \"fee\": \"-1.0000000\",\n \"status\": \"success\",\n \"toAddress\": \"1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA\",\n \"dest\": \"on_chain\",\n \"chain\": \"BTC\",\n \"confirm\": \"100\",\n \"fromAddress\": null,\n \"cTime\": \"1694131668281\",\n \"uTime\": \"1694131680247\"\n }" ], "line_end" => 3075, "line_start" => 2997, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (transaction, 'orderId')" }, %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "txid", "value" => "this.safeString (transaction, 'tradeId')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (networkId)" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "this.safeString (transaction, 'fromAddress')" }, %{ "comment" => nil, "key" => "address", "value" => "this.safeString (transaction, 'toAddress')" }, %{ "comment" => nil, "key" => "addressTo", "value" => "this.safeString (transaction, 'toAddress')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amountString)" }, %{ "comment" => nil, "key" => "type", "value" => "this.safeString (transaction, 'type')" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransactionStatus (status)" }, %{ "comment" => nil, "key" => "updated", "value" => "this.safeInteger (transaction, 'uTime')" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" }, %{ "comment" => nil, "key" => "tagTo", "value" => "tag" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // fetchDeposits\n //\n // {\n // \"orderId\": \"1083832260799930368\",\n // \"tradeId\": \"35bf0e588a42b25c71a9d45abe7308cabdeec6b7b423910b9bd4743d3a9a9efa\",\n // \"coin\": \"BTC\",\n // \"type\": \"deposit\",\n // \"size\": \"0.00030000\",\n // \"status\": \"success\",\n // \"toAddress\": \"1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA\",\n // \"dest\": \"on_chain\",\n // \"chain\": \"BTC\",\n // \"fromAddress\": null,\n // \"cTime\": \"1694131668281\",\n // \"uTime\": \"1694131680247\"\n // }\n //\n // fetchWithdrawals\n //\n // {\n // \"orderId\": \"1083832260799930368\",\n // \"tradeId\": \"35bf0e588a42b25c71a9d45abe7308cabdeec6b7b423910b9bd4743d3a9a9efa\",\n // \"clientOid\": \"123\",\n // \"coin\": \"BTC\",\n // \"type\": \"withdraw\",\n // \"size\": \"0.00030000\",\n // \"fee\": \"-1.0000000\",\n // \"status\": \"success\",\n // \"toAddress\": \"1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA\",\n // \"dest\": \"on_chain\",\n // \"chain\": \"BTC\",\n // \"confirm\": \"100\",\n // \"fromAddress\": null,\n // \"cTime\": \"1694131668281\",\n // \"uTime\": \"1694131680247\"\n // }\n //\n const currencyId = this.safeString (transaction, 'coin');\n const code = this.safeCurrencyCode (currencyId, currency);\n const timestamp = this.safeInteger (transaction, 'cTime');\n const networkId = this.safeString (transaction, 'chain');\n const status = this.safeString (transaction, 'status');\n const tag = this.safeString (transaction, 'tag');\n const feeCostString = this.safeString (transaction, 'fee');\n let feeCostAbsString = undefined;\n if (feeCostString !== undefined) {\n feeCostAbsString = Precise.stringAbs (feeCostString);\n }\n let fee = undefined;\n let amountString = this.safeString (transaction, 'size');\n if (feeCostAbsString !== undefined) {\n fee = { 'currency': code, 'cost': this.parseNumber (feeCostAbsString) };\n amountString = Precise.stringSub (amountString, feeCostAbsString);\n }\n return {\n 'id': this.safeString (transaction, 'orderId'),\n 'info': transaction,\n 'txid': this.safeString (transaction, 'tradeId'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'network': this.networkIdToCode (networkId),\n 'addressFrom': this.safeString (transaction, 'fromAddress'),\n 'address': this.safeString (transaction, 'toAddress'),\n 'addressTo': this.safeString (transaction, 'toAddress'),\n 'amount': this.parseNumber (amountString),\n 'type': this.safeString (transaction, 'type'),\n 'currency': code,\n 'status': this.parseTransactionStatus (status),\n 'updated': this.safeInteger (transaction, 'uTime'),\n 'tagFrom': undefined,\n 'tag': tag,\n 'tagTo': tag,\n 'comment': undefined,\n 'internal': undefined,\n 'fee': fee,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3086, "line_start" => 3077, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: Str)", "source" => "parseTransactionStatus (status: Str) {\n const statuses: Dict = {\n 'success': 'ok',\n 'Pending': 'pending',\n 'pending_review': 'pending',\n 'pending_review_fail': 'failed',\n 'reject': 'failed',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"transferId\": \"1112112916581847040\",\n \"clientOrderId\": null,\n \"ts\": 1700874302021\n }", "{\n \"coin\": \"USDT\",\n \"status\": \"Successful\",\n \"toType\": \"crossed_margin\",\n \"toSymbol\": \"\",\n \"fromType\": \"spot\",\n \"fromSymbol\": \"\",\n \"size\": \"11.64958799\",\n \"ts\": \"1700729673028\",\n \"clientOid\": \"1111506298504744960\",\n \"transferId\": \"24930940\"\n }" ], "line_end" => 9429, "line_start" => 9385, "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, 'size')" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "fromAccount" }, %{ "comment" => nil, "key" => "toAccount", "value" => "toAccount" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransferStatus (status)" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry", "source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n //\n // transfer\n //\n // {\n // \"transferId\": \"1112112916581847040\",\n // \"clientOrderId\": null,\n // \"ts\": 1700874302021\n // }\n //\n // fetchTransfers\n //\n // {\n // \"coin\": \"USDT\",\n // \"status\": \"Successful\",\n // \"toType\": \"crossed_margin\",\n // \"toSymbol\": \"\",\n // \"fromType\": \"spot\",\n // \"fromSymbol\": \"\",\n // \"size\": \"11.64958799\",\n // \"ts\": \"1700729673028\",\n // \"clientOid\": \"1111506298504744960\",\n // \"transferId\": \"24930940\"\n // }\n //\n const timestamp = this.safeInteger (transfer, 'ts');\n const status = this.safeStringLower (transfer, 'status');\n const currencyId = this.safeString (transfer, 'coin');\n const fromAccountRaw = this.safeString (transfer, 'fromType');\n const accountsById = this.safeValue (this.options, 'accountsById', {});\n const fromAccount = this.safeString (accountsById, fromAccountRaw, fromAccountRaw);\n const toAccountRaw = this.safeString (transfer, 'toType');\n const toAccount = this.safeString (accountsById, toAccountRaw, toAccountRaw);\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, 'size'),\n 'fromAccount': fromAccount,\n 'toAccount': toAccount,\n 'status': this.parseTransferStatus (status),\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 9436, "line_start" => 9431, "mappings" => [], "name" => "parseTransferStatus", "signature" => "parseTransferStatus (status: Str): Str", "source" => "parseTransferStatus (status: Str): Str {\n const statuses: Dict = {\n 'successful': 'ok',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"USDT\",\n \"equity\": \"6.19300826\",\n \"usdValue\": \"6.19299777\",\n \"balance\": \"6.19300826\",\n \"available\": \"6.19300826\",\n \"debt\": \"0\",\n \"locked\": \"0\"\n }" ], "line_end" => 4595, "line_start" => 4570, "mappings" => [], "name" => "parseUtaBalance", "signature" => "parseUtaBalance (balance): Balances", "source" => "parseUtaBalance (balance): Balances {\n const result: Dict = { 'info': balance };\n //\n // {\n // \"coin\": \"USDT\",\n // \"equity\": \"6.19300826\",\n // \"usdValue\": \"6.19299777\",\n // \"balance\": \"6.19300826\",\n // \"available\": \"6.19300826\",\n // \"debt\": \"0\",\n // \"locked\": \"0\"\n // }\n //\n for (let i = 0; i < balance.length; i++) {\n const entry = balance[i];\n const account = this.account ();\n const currencyId = this.safeString (entry, 'coin');\n const code = this.safeCurrencyCode (currencyId);\n account['debt'] = this.safeString (entry, 'debt');\n account['used'] = this.safeString (entry, 'locked');\n account['free'] = this.safeString (entry, 'available');\n account['total'] = this.safeString (entry, 'balance');\n result[code] = account;\n }\n return this.safeBalance (result);\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 50, period: 1000, requests: 20, rolling_window_size: 1000 }, raw_endpoints: %{ private: [], public: [] }, required_credentials: %{ api_key: true, password: true, secret: true, uid: false }, requires_eddsa: false, response_error: %{ code_field: "code", field: "code", message_field: "msg", success_values: [ "00000" ], type: :success_code }, signing: %{ api_key_header: "ACCESS-KEY", confidence: :high, has_passphrase: true, passphrase_header: "ACCESS-PASSPHRASE", pattern: :hmac_sha256_passphrase_signed, signature_encoding: :base64, signature_header: "ACCESS-SIGN", timestamp_header: "ACCESS-TIMESTAMP" }, spec_format_version: 2, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ future: %{ base: "ETH", base_id: "ETH", case: :upper, contract: true, contract_size: 1, expiry: 1774598400000, expiry_datetime: "2026-03-27T08:00:00.000Z", id: "ETHUSDH26", inverse: true, limits: %{ "amount" => %{ "min" => 0.01 }, "cost" => %{}, "leverage" => %{ "max" => 50, "min" => 1 }, "price" => %{} }, linear: false, maker: 0.0002, precision: %{ "amount" => 0.01, "price" => 0.01 }, quote: "USD", quote_id: "USD", separator: "", settle: "ETH", settle_id: "ETH", symbol: "ETH/USD:ETH-260327", taker: 0.0006 }, precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 900000000000000000000, "min" => 0 }, "cost" => %{ "min" => 1 }, "price" => %{} }, sample_precision: %{ "amount" => 0.01, "price" => 0.001 }, spot: %{ base: "LUMIA", base_id: "LUMIA", case: :upper, contract: false, id: "LUMIAUSDT", limits: %{ "amount" => %{ "max" => 900000000000000000000, "min" => 0 }, "cost" => %{ "min" => 1 }, "leverage" => %{}, "price" => %{} }, maker: 0.001, precision: %{ "amount" => 0.01, "price" => 0.001 }, quote: "USDT", quote_id: "USDT", separator: "", symbol: "LUMIA/USDT", taker: 0.001 }, swap: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 1, id: "BTCUSDT", inverse: false, limits: %{ "amount" => %{ "min" => 0.0001 }, "cost" => %{ "min" => 5 }, "leverage" => %{ "max" => 150, "min" => 1 }, "price" => %{} }, linear: true, maker: 0.0002, precision: %{ "amount" => 0.0001, "price" => 0.1 }, quote: "USDT", quote_id: "USDT", separator: "", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT", taker: 0.0006 } }, symbol_patterns: %{ future: %{ case: :upper, component_order: [ :base, :quote, :date ], date_format: :yymmdd, pattern: :future_unknown, prefix: nil, separator: "-", suffix: nil }, spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :no_separator_upper, prefix: nil, separator: "", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, prefix: nil, separator: "", suffix: nil } }, timeframes: %{ "spot" => %{ "12h" => "12Hutc", "15m" => "15min", "1M" => "1Mutc", "1d" => "1Dutc", "1h" => "1h", "1m" => "1min", "1w" => "1Wutc", "30m" => "30min", "3d" => "3Dutc", "3m" => "3min", "4h" => "4h", "5m" => "5min", "6h" => "6Hutc" }, "swap" => %{ "12h" => "12Hutc", "15m" => "15m", "1M" => "1Mutc", "1d" => "1Dutc", "1h" => "1H", "1m" => "1m", "1w" => "1Wutc", "2h" => "2H", "30m" => "30m", "3d" => "3Dutc", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6Hutc" }, "uta" => %{ "12h" => "12H", "15m" => "15m", "1d" => "1D", "1h" => "1H", "1m" => "1m", "2h" => "2H", "30m" => "30m", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6H" } }, url_strategy: %{ detected_from: "api_structure", note: "paths_already_versioned", pattern: :version_in_path, prefix: nil }, urls: %{ api: "https://api.bitget.com", api_sections: %{ "broker" => "https://api.bitget.com", "common" => "https://api.bitget.com", "convert" => "https://api.bitget.com", "copy" => "https://api.bitget.com", "earn" => "https://api.bitget.com", "margin" => "https://api.bitget.com", "mix" => "https://api.bitget.com", "p2p" => "https://api.bitget.com", "spot" => "https://api.bitget.com", "tax" => "https://api.bitget.com", "user" => "https://api.bitget.com", "uta" => "https://api.bitget.com" }, doc: [ "https://www.bitget.com/api-doc/common/intro", "https://www.bitget.com/api-doc/spot/intro", "https://www.bitget.com/api-doc/contract/intro", "https://www.bitget.com/api-doc/broker/intro", "https://www.bitget.com/api-doc/margin/intro", "https://www.bitget.com/api-doc/copytrading/intro", "https://www.bitget.com/api-doc/earn/intro", "https://bitgetlimited.github.io/apidoc/en/mix", "https://bitgetlimited.github.io/apidoc/en/spot", "https://bitgetlimited.github.io/apidoc/en/broker", "https://bitgetlimited.github.io/apidoc/en/margin" ], other: nil, sandbox: nil, www: "https://www.bitget.com" }, version: "v2", ws: %{ auth: %{ algorithm: :sha256, encoding: :base64, market_specific: false, message_format: :op_args, op_field: "op", op_value: "auth", pattern: :generic_hmac, payload_format: "custom", requires_passphrase: true, timestamp_unit: :seconds }, channel_templates: %{ watch_balance: %{ channel_name: "account", market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_bids_asks: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_my_trades: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_ohlcv: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "interval" }, %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book: %{ channel_name: "books", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book_for_symbols: %{ channel_name: "books", 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" => "productType" }, %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_positions: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_private: %{ auth_required: true, market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_public: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_public_multiple: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_ticker: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_tickers: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_trades: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_trades_for_symbols: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." } }, has: %{ watch_balance: true, watch_bids_asks: true, watch_liquidations: nil, watch_liquidations_for_symbols: nil, watch_my_liquidations: nil, watch_my_liquidations_for_symbols: nil, watch_my_trades: true, watch_ohlcv: true, watch_ohlcv_for_symbols: false, watch_order_book: true, watch_order_book_for_symbols: 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: "bitget.com", message_patterns: [ %{ args_field: "args", format: :op, keys: [ "args", "op", "url" ], kind_field: "op", kind_value: "login", sources: [ :send, :watch ] }, %{ args_field: "args", format: :op, keys: [ "args", "op" ], kind_field: "op", kind_value: "subscribe", sources: [ :send, :watch, :watch_multiple ] }, %{ format: :string, sources: [ :ping ] } ], options: %{ "watchTrades" => %{ "ignoreDuplicates" => true } }, subscription_config: %{ args_field: "args", args_format: :string_list, market_id_format: :native, op_field: "op", separator: "." }, subscription_pattern: :op_subscribe, urls: %{ "private" => "wss://ws.bitget.com/v2/ws/private", "public" => "wss://ws.bitget.com/v2/ws/public", "utaPrivate" => "wss://ws.bitget.com/v3/ws/private", "utaPublic" => "wss://ws.bitget.com/v3/ws/public" }, watch_methods: [ "watchBalance", "watchBidsAsks", "watchMyTrades", "watchOHLCV", "watchOrderBook", "watchOrderBookForSymbols", "watchOrders", "watchPositions", "watchPrivate", "watchPublic", "watchPublicMultiple", "watchTicker", "watchTickers", "watchTrades", "watchTradesForSymbols" ] } }