# Mode Trade Exchange Specification # # Auto-generated by: mix ccxt.extract modetrade # CCXT version: 4.5.34 # Spec format version: 1 # # Review before use: # - signing: Detected from sign() method, verify with testnet # - endpoints: Raw paths extracted, map to unified API as needed # - exceptions: Extracted (exact, broad, HTTP status codes) # - features/options: Extracted from describe() # - classification: Set to :supported initially, promote after validation # %{ api_param_requirements: nil, certified: false, classification: :pro, comment: nil, countries: [ "KY" ], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "XBT" => "BTC" }, dex: true, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 42, "coveragePercent" => 100, "enabledMethods" => 46, "excluded" => [ %{ "method" => "editOrder", "reason" => "emulated (returns cached data, no HTTP call)" }, %{ "method" => "fetchTransactions", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 2, "extractableMethods" => 44, "failures" => [ %{ "error" => "outterOrder.push is not a function", "method" => "createOrderWithTakeProfitAndStopLoss" }, %{ "error" => "modetrade withdraw() only support USDC", "method" => "withdraw" } ] }, endpoints: [ %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :delete, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :delete, name: :cancel_order, param_mappings: %{ "id" => "order_id" }, params: [ :id, :symbol ], path: "/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "order_ids" => "test-order-id" }, market_type: :swap, method: :delete, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/batch-order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "order_type" => "LIMIT" }, market_type: :swap, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "order_quantity", "price" => "order_price" }, params: [ :symbol, :side, :amount, :price ], path: "/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "order_type" => "MARKET" }, market_type: :swap, method: :post, name: :create_market_order, param_mappings: %{ "amount" => "order_quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :post, name: :create_order, param_mappings: %{ "amount" => "order_quantity", "price" => "order_price", "type" => "order_type" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "reduce_only" => true }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "order_quantity", "price" => "order_price", "type" => "order_type" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "algo_type" => "STOP", "triggerDirection" => "below", "type" => "LIMIT" }, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "trigger_price" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/algo/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "triggerDirection" => "below" }, market_type: :swap, method: :post, name: :create_stop_loss_order, param_mappings: %{ "amount" => "order_quantity", "price" => "order_price", "type" => "order_type" }, params: [ :symbol, :type, :side, :amount, :price, :stopLossPrice ], path: "/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "algo_type" => "STOP", "triggerDirection" => "below", "type" => "MARKET" }, market_type: :swap, method: :post, name: :create_stop_market_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "trigger_price" }, params: [ :symbol, :side, :amount, :triggerPrice ], path: "/algo/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "algo_type" => "STOP", "triggerDirection" => "below" }, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "trigger_price" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/algo/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "triggerDirection" => "above" }, market_type: :swap, method: :post, name: :create_take_profit_order, param_mappings: %{ "amount" => "order_quantity", "price" => "order_price", "type" => "order_type" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfitPrice ], path: "/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "algo_type" => "STOP", "triggerDirection" => "below" }, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "quantity", "triggerPrice" => "trigger_price" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/algo/order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/client/holding", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "size" => 500, "status" => "COMPLETED" }, market_type: :swap, method: :get, name: :fetch_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/orders", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/public/token", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 60, default_params: %{ "side" => "DEPOSIT" }, market_type: :swap, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "balance_token" }, params: [ :code, :since, :limit ], path: "/asset/history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 60, market_type: :swap, method: :get, name: :fetch_deposits_withdrawals, param_mappings: %{ "code" => "balance_token" }, params: [ :code, :since, :limit ], path: "/asset/history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 30, market_type: :swap, method: :get, name: :fetch_funding_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/funding_fee/history", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 0.33, market_type: :swap, method: :get, name: :fetch_funding_interval, param_mappings: %{}, params: [ :symbol ], path: "/public/funding_rate/{symbol}", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 0.33, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/public/funding_rate/{symbol}", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_funding_rate_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/public/funding_rate_history", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/public/funding_rates", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/orderbook/{symbol}", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 60, market_type: :swap, method: :get, name: :fetch_ledger, param_mappings: %{ "code" => "balance_token" }, params: [ :code, :since, :limit ], path: "/asset/history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 60, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{}, params: [ :symbol ], path: "/client/info", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/public/info", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "size" => 500 }, market_type: :swap, method: :get, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trades", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_ohlcv, param_mappings: %{ "timeframe" => "type" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/kline", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "size" => 500, "status" => "INCOMPLETE" }, market_type: :swap, method: :get, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/orders", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_order, param_mappings: %{ "id" => "oid" }, params: [ :id, :symbol ], path: "/order/{oid}", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_order_book, param_mappings: %{ "limit" => "max_level" }, params: [ :symbol, :limit ], path: "/orderbook/{symbol}", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_order_trades, param_mappings: %{ "id" => "oid" }, params: [ :id, :symbol, :since, :limit ], path: "/order/{oid}/trades", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 1, default_params: %{ "size" => 500 }, market_type: :swap, method: :get, name: :fetch_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/orders", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 3.33, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/position/{symbol}", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 3.33, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/positions", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_status, param_mappings: %{}, params: [], path: "/public/system_info", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/public/system_info", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/public", auth: false, cost: 1, market_type: :swap, method: :get, name: :fetch_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/public/market_trades", response_transformer: {:extract_path, ["data", "rows"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 60, market_type: :swap, method: :get, name: :fetch_trading_fees, param_mappings: %{}, params: [], path: "/client/info", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 60, default_params: %{ "side" => "WITHDRAW" }, market_type: :swap, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "balance_token" }, params: [ :code, :since, :limit ], path: "/asset/history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "v1/private", auth: true, cost: 120, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/client/leverage", response_transformer: {:extract_path, ["data"]}, source: :intercepted } ], error_code_details: %{ -1000 => %{ description: "UNKNOWN The data does not exist", type: :exchange_error }, -1001 => %{ description: "INVALID_SIGNATURE The api key or secret is in wrong format.", type: :invalid_credentials }, -1002 => %{ description: "UNAUTHORIZED API key or secret is invalid, it may because key have insufficient permission or the key is expired/revoked.", type: :invalid_credentials }, -1003 => %{ description: "TOO_MANY_REQUEST Rate limit exceed.", type: :rate_limited }, -1004 => %{ description: "UNKNOWN_PARAM An unknown parameter was sent.", type: :invalid_parameters }, -1005 => %{ description: "INVALID_PARAM Some parameters are in wrong format for api.", type: :invalid_parameters }, -1006 => %{ description: "RESOURCE_NOT_FOUND The data is not found in server. For example, when client try canceling a CANCELLED order, will raise this error.", type: :invalid_order }, -1007 => %{ description: "DUPLICATE_REQUEST The data is already exists or your request is duplicated.", type: :invalid_parameters }, -1008 => %{ description: "QUANTITY_TOO_HIGH The quantity of settlement is too high than you can request.", type: :invalid_order }, -1009 => %{ description: "CAN_NOT_WITHDRAWAL Can not request withdrawal settlement, you need to deposit other arrears first.", type: :insufficient_balance }, -1011 => %{ description: "RPC_NOT_CONNECT Can not place/cancel orders, it may because internal network error. Please try again in a few seconds.", type: :network_error }, -1012 => %{ description: "RPC_REJECT The place/cancel order request is rejected by internal module, it may because the account is in liquidation or other internal errors. Please try again in a few seconds.", type: :invalid_parameters }, -1101 => %{ description: "RISK_TOO_HIGH The risk exposure for client is too high, it may cause by sending too big order or the leverage is too low. please refer to client info to check the current exposure.", type: :insufficient_balance }, -1102 => %{ description: "MIN_NOTIONAL The order value (price * size) is too small.", type: :invalid_order }, -1103 => %{ description: "PRICE_FILTER The order price is not following the tick size rule for the symbol.", type: :invalid_order }, -1104 => %{ description: "SIZE_FILTER The order quantity is not following the step size rule for the symbol.", type: :invalid_order }, -1105 => %{ description: "PERCENTAGE_FILTER Price is X% too high or X% too low from the mid price.", type: :invalid_order }, -1201 => %{ description: "LIQUIDATION_REQUEST_RATIO_TOO_SMALL total notional < 10000, least req ratio should = 1", type: :invalid_parameters }, -1202 => %{ description: "LIQUIDATION_STATUS_ERROR No need to liquidation because user margin is enough.", type: :invalid_parameters }, 15 => %{ description: "BrokerId is not exist", type: :invalid_parameters }, 2 => %{ description: "Timestamp expired", type: :invalid_parameters }, 29 => %{ description: "Verify contract is invalid", type: :invalid_parameters }, 3 => %{ description: "Signature error", type: :invalid_credentials }, 9 => %{ description: "Address and signature do not match", type: :invalid_credentials } }, error_codes: %{ -1000 => :exchange_error, -1001 => :invalid_credentials, -1002 => :invalid_credentials, -1003 => :rate_limited, -1004 => :invalid_parameters, -1005 => :invalid_parameters, -1006 => :invalid_order, -1007 => :invalid_parameters, -1008 => :invalid_order, -1009 => :insufficient_balance, -1011 => :network_error, -1012 => :invalid_parameters, -1101 => :insufficient_balance, -1102 => :invalid_order, -1103 => :invalid_order, -1104 => :invalid_order, -1105 => :invalid_order, -1201 => :invalid_parameters, -1202 => :invalid_parameters, 15 => :invalid_parameters, 2 => :invalid_parameters, 29 => :invalid_parameters, 3 => :invalid_credentials, 9 => :invalid_credentials }, exceptions: %{ exact: %{ "-1000" => :exchange_error, "-1001" => :authentication_error, "-1002" => :authentication_error, "-1003" => :rate_limit_exceeded, "-1004" => :bad_request, "-1005" => :bad_request, "-1006" => :invalid_order, "-1007" => :bad_request, "-1008" => :invalid_order, "-1009" => :insufficient_funds, "-1011" => :network_error, "-1012" => :bad_request, "-1101" => :insufficient_funds, "-1102" => :invalid_order, "-1103" => :invalid_order, "-1104" => :invalid_order, "-1105" => :invalid_order, "-1201" => :bad_request, "-1202" => :bad_request, "15" => :bad_request, "2" => :bad_request, "29" => :bad_request, "3" => :authentication_error, "9" => :authentication_error } }, exchange_options: %{ "brokerId" => "CCXTMODE", "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "networksById" => %{}, "sandboxMode" => false, "verifyingContractAddress" => "0x6F7a338F2aA472838dEFD3283eB360d4Dff5D203" }, extended_metadata: %{ limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/cec2b7f1-3b2b-4502-971b-447ee1937d6b", referral_discount: 0.2, referral_url: "https://trade.mode.network?ref=MODETRADE" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ default: %{ create_order: %{ hedged: false, iceberg: true, leverage: true, margin_mode: false, market_buy_by_cost: false, market_buy_requires_price: false, self_trade_prevention: false, stop_loss_price: false, take_profit_price: false, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: true, trigger_direction: false, trigger_price: true }, create_orders: %{ max: 10 }, fetch_closed_orders: %{ limit: 500, margin_mode: false, symbol_required: false, trailing: false, trigger: true, until_days: 100000 }, fetch_my_trades: %{ limit: 500, margin_mode: false, symbol_required: false, until_days: 100000 }, fetch_ohlcv: %{ limit: 1000 }, fetch_open_orders: %{ limit: 500, margin_mode: false, symbol_required: false, trailing: false, trigger: true }, fetch_order: %{ margin_mode: false, symbol_required: false, trailing: false, trigger: true }, sandbox: true }, for_derivatives: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: false } }, extends: "default" }, future: %{}, spot: %{ extends: "default" }, swap: %{ linear: %{ extends: "forDerivatives" } } }, fees: %{ trading: %{ maker: 0.0002, percentage: true, taker: 0.0005, tier_based: true } }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (!response) {\n return undefined; // fallback to default error handler\n }\n //\n // 400 Bad Request {\"success\":false,\"code\":-1012,\"message\":\"Amount is required for buy market orders when margin disabled.\"}\n // {\"code\":\"-1011\",\"message\":\"The system is under maintenance.\",\"success\":false}\n //\n const success = this.safeBool(response, 'success');\n const errorCode = this.safeString(response, 'code');\n if (!success) {\n const feedback = this.id + ' ' + this.json(response);\n this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);\n throw new errors.ExchangeError(feedback);\n }\n return undefined;\n }", has: %{ add_margin: false, borrow_cross_margin: false, borrow_isolated_margin: false, 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, cancel_withdraw: false, close_all_positions: false, close_position: false, create_convert_trade: false, 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: false, 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: false, create_post_only_order: false, create_post_only_order_ws: false, create_reduce_only_order: true, create_reduce_only_order_ws: false, create_stop_limit_order: 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: false, create_trailing_percent_order_ws: false, create_trigger_order: true, create_trigger_order_ws: false, deposit: false, edit_order: true, edit_order_with_client_order_id: false, edit_order_ws: false, edit_orders: false, fetch_accounts: false, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: false, fetch_borrow_interest: false, fetch_borrow_rate: false, fetch_borrow_rate_histories: false, fetch_borrow_rate_history: false, fetch_borrow_rates: false, fetch_borrow_rates_per_symbol: false, fetch_canceled_and_closed_orders: false, fetch_canceled_orders: false, fetch_closed_order: false, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: false, fetch_convert_quote: false, fetch_convert_trade: false, fetch_convert_trade_history: false, fetch_cross_borrow_rate: false, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: false, fetch_deposit_address: false, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: false, fetch_deposit_withdraw_fee: false, fetch_deposit_withdraw_fees: false, fetch_deposits: true, fetch_deposits_withdrawals: true, fetch_deposits_ws: false, fetch_funding_history: true, fetch_funding_interval: true, fetch_funding_intervals: false, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: true, fetch_greeks: false, fetch_index_ohlcv: false, fetch_isolated_borrow_rate: false, fetch_isolated_borrow_rates: false, fetch_isolated_positions: false, fetch_l2_order_book: true, fetch_l3_order_book: false, fetch_last_prices: false, fetch_ledger: 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: false, fetch_margin_adjustment_history: false, fetch_margin_mode: false, fetch_margin_modes: false, fetch_mark_ohlcv: false, fetch_mark_prices: false, fetch_market_leverage_tiers: false, fetch_markets: true, fetch_markets_ws: false, fetch_my_liquidations: false, fetch_my_settlement_history: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: false, 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: true, fetch_order_with_client_order_id: false, fetch_order_ws: false, fetch_orders: true, fetch_orders_by_status: false, fetch_orders_ws: false, fetch_position: true, fetch_position_history: false, fetch_position_mode: false, fetch_position_ws: false, fetch_positions: true, fetch_positions_for_symbol: false, fetch_positions_for_symbol_ws: false, fetch_positions_history: false, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: false, fetch_settlement_history: false, fetch_status: true, fetch_ticker: false, fetch_ticker_ws: false, fetch_tickers: false, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: false, fetch_trading_fees: true, fetch_trading_fees_ws: false, fetch_trading_limits: false, fetch_transaction_fee: false, fetch_transaction_fees: false, fetch_transactions: true, fetch_transfer: false, fetch_transfers: false, fetch_underlying_assets: false, fetch_volatility_history: false, fetch_withdraw_addresses: false, fetch_withdrawal: false, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: false, margin: false, option: false, private_api: true, public_api: true, reduce_margin: false, repay_cross_margin: false, repay_isolated_margin: false, sandbox: false, set_leverage: true, set_margin: false, set_margin_mode: false, set_position_mode: false, sign_in: false, spot: false, swap: true, transfer: false, 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: false, 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: false, withdraw: true, ws: false }, http_config: nil, id: "modetrade", markets: nil, name: "Mode Trade", ohlcv_timestamp_resolution: :unknown, options: %{ :broker_id => "CCXTMODE", :sandbox_mode => false, "verifying_contract_address" => "0x6F7a338F2aA472838dEFD3283eB360d4Dff5D203" }, order_mappings: %{ side_format: :uppercase, side_key: "side", type_format: :uppercase, type_key: "order_type" }, param_mappings: %{ "amount" => "quantity", "code" => "balance_token", "id" => "oid", "limit" => "max_level", "price" => "order_price", "timeframe" => "type", "triggerPrice" => "trigger_price", "type" => "order_type" }, parse_methods: [ %{ "comment" => nil, "examples" => [], "line_end" => 2273, "line_start" => 2259, "mappings" => [], "name" => "parseBalance", "signature" => "parseBalance (response): Balances", "source" => "parseBalance (response): Balances {\n const result: Dict = {\n 'info': response,\n };\n const balances = this.safeList (response, 'holding', []);\n for (let i = 0; i < balances.length; i++) {\n const balance = balances[i];\n const code = this.safeCurrencyCode (this.safeString (balance, 'token'));\n const account = this.account ();\n account['total'] = this.safeString (balance, 'holding');\n account['used'] = this.safeString (balance, 'frozen');\n result[code] = account;\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 898, "line_start" => 889, "mappings" => [], "name" => "parseFundingInterval", "signature" => "parseFundingInterval (interval)", "source" => "parseFundingInterval (interval) {\n const intervals: Dict = {\n '3600000': '1h',\n '14400000': '4h',\n '28800000': '8h',\n '57600000': '16h',\n '86400000': '24h',\n };\n return this.safeString (intervals, interval, interval);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\":\"PERP_AAVE_USDT\",\n \"est_funding_rate\":-0.00003447,\n \"est_funding_rate_timestamp\":1653633959001,\n \"last_funding_rate\":-0.00002094,\n \"last_funding_rate_timestamp\":1653631200000,\n \"next_funding_time\":1653634800000,\n \"sum_unitary_funding\": 521.367\n }" ], "line_end" => 887, "line_start" => 847, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fundingRate" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "interestRate", "value" => "this.parseNumber ('0')" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "estFundingRateTimestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (estFundingRateTimestamp)" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "this.safeNumber (fundingRate, 'est_funding_rate')" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "nextFundingTimestamp" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "this.iso8601 (nextFundingTimestamp)" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "this.safeNumber (fundingRate, 'last_funding_rate')" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "lastFundingRateTimestamp" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "this.iso8601 (lastFundingRateTimestamp)" }, %{ "comment" => nil, "key" => "interval", "value" => "this.parseFundingInterval (millisecondsInterval)" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (fundingRate, market: Market = undefined): FundingRate", "source" => "parseFundingRate (fundingRate, market: Market = undefined): FundingRate {\n //\n // {\n // \"symbol\":\"PERP_AAVE_USDT\",\n // \"est_funding_rate\":-0.00003447,\n // \"est_funding_rate_timestamp\":1653633959001,\n // \"last_funding_rate\":-0.00002094,\n // \"last_funding_rate_timestamp\":1653631200000,\n // \"next_funding_time\":1653634800000,\n // \"sum_unitary_funding\": 521.367\n // }\n //\n const symbol = this.safeString (fundingRate, 'symbol');\n market = this.market (symbol);\n const nextFundingTimestamp = this.safeInteger (fundingRate, 'next_funding_time');\n const estFundingRateTimestamp = this.safeInteger (fundingRate, 'est_funding_rate_timestamp');\n const lastFundingRateTimestamp = this.safeInteger (fundingRate, 'last_funding_rate_timestamp');\n const fundingTimeString = this.safeString (fundingRate, 'last_funding_rate_timestamp');\n const nextFundingTimeString = this.safeString (fundingRate, 'next_funding_time');\n const millisecondsInterval = Precise.stringSub (nextFundingTimeString, fundingTimeString);\n return {\n 'info': fundingRate,\n 'symbol': market['symbol'],\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': this.parseNumber ('0'),\n 'estimatedSettlePrice': undefined,\n 'timestamp': estFundingRateTimestamp,\n 'datetime': this.iso8601 (estFundingRateTimestamp),\n 'fundingRate': this.safeNumber (fundingRate, 'est_funding_rate'),\n 'fundingTimestamp': nextFundingTimestamp,\n 'fundingDatetime': this.iso8601 (nextFundingTimestamp),\n 'nextFundingRate': undefined,\n 'nextFundingTimestamp': undefined,\n 'nextFundingDatetime': undefined,\n 'previousFundingRate': this.safeNumber (fundingRate, 'last_funding_rate'),\n 'previousFundingTimestamp': lastFundingRateTimestamp,\n 'previousFundingDatetime': this.iso8601 (lastFundingRateTimestamp),\n 'interval': this.parseFundingInterval (millisecondsInterval),\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"PERP_ETH_USDC\",\n \"funding_rate\": 0.00046875,\n \"mark_price\": 2100,\n \"funding_fee\": 0.000016,\n \"payment_type\": \"Pay\",\n \"status\": \"Accrued\",\n \"created_time\": 1682235722003,\n \"updated_time\": 1682235722003\n }" ], "line_end" => 1083, "line_start" => 1052, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "income" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "code", "value" => "code" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amount)" }, %{ "comment" => nil, "key" => "rate", "value" => "rate" } ], "name" => "parseIncome", "signature" => "parseIncome (income, market: Market = undefined)", "source" => "parseIncome (income, market: Market = undefined) {\n //\n // {\n // \"symbol\": \"PERP_ETH_USDC\",\n // \"funding_rate\": 0.00046875,\n // \"mark_price\": 2100,\n // \"funding_fee\": 0.000016,\n // \"payment_type\": \"Pay\",\n // \"status\": \"Accrued\",\n // \"created_time\": 1682235722003,\n // \"updated_time\": 1682235722003\n // }\n //\n const marketId = this.safeString (income, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n let amount = this.safeString (income, 'funding_fee');\n const code = this.safeCurrencyCode ('USDC');\n const timestamp = this.safeInteger (income, 'updated_time');\n const rate = this.safeNumber (income, 'funding_rate');\n const paymentType = this.safeString (income, 'payment_type');\n amount = (paymentType === 'Pay') ? Precise.stringNeg (amount) : amount;\n return {\n 'info': income,\n 'symbol': symbol,\n 'code': code,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': undefined,\n 'amount': this.parseNumber (amount),\n 'rate': rate,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2380, "line_start" => 2354, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (item, 'id')" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "account", "value" => "this.safeString (item, 'account')" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceId", "value" => "this.safeString (item, 'tx_id')" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransactionStatus (this.safeString (item, 'status'))" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseLedgerEntryType (this.safeString (item, 'type'))" }, %{ "comment" => nil, "key" => "info", "value" => "item" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n const currencyId = this.safeString (item, 'token');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const amount = this.safeNumber (item, 'amount');\n const side = this.safeString (item, 'token_side');\n const direction = (side === 'DEPOSIT') ? 'in' : 'out';\n const timestamp = this.safeInteger (item, 'created_time');\n const fee = this.parseTokenAndFeeTemp (item, 'fee_token', 'fee_amount');\n return this.safeLedgerEntry ({\n 'id': this.safeString (item, 'id'),\n 'currency': code,\n 'account': this.safeString (item, 'account'),\n 'referenceAccount': undefined,\n 'referenceId': this.safeString (item, 'tx_id'),\n 'status': this.parseTransactionStatus (this.safeString (item, 'status')),\n 'amount': amount,\n 'before': undefined,\n 'after': undefined,\n 'fee': fee,\n 'direction': direction,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'type': this.parseLedgerEntryType (this.safeString (item, 'type')),\n 'info': item,\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2388, "line_start" => 2382, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const types: Dict = {\n 'BALANCE': 'transaction', // Funds moved in/out wallet\n 'COLLATERAL': 'transfer', // Funds moved between portfolios\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2641, "line_start" => 2632, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "marginMode", "value" => "undefined" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "leverageValue" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "leverageValue" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage, market = undefined): Leverage", "source" => "parseLeverage (leverage, market = undefined): Leverage {\n const leverageValue = this.safeInteger (leverage, 'max_leverage');\n return {\n 'info': leverage,\n 'symbol': market['symbol'],\n 'marginMode': undefined,\n 'longLeverage': leverageValue,\n 'shortLeverage': leverageValue,\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"PERP_BTC_USDC\",\n \"quote_min\": 123,\n \"quote_max\": 100000,\n \"quote_tick\": 0.1,\n \"base_min\": 0.00001,\n \"base_max\": 20,\n \"base_tick\": 0.00001,\n \"min_notional\": 1,\n \"price_range\": 0.02,\n \"price_scope\": 0.4,\n \"std_liquidation_fee\": 0.03,\n \"liquidator_fee\": 0.015,\n \"claim_insurance_fund_discount\": 0.0075,\n \"funding_period\": 8,\n \"cap_funding\": 0.000375,\n \"floor_funding\": -0.000375,\n \"interest_rate\": 0.0001,\n \"created_time\": 1684140107326,\n \"updated_time\": 1685345968053,\n \"base_mmr\": 0.05,\n \"base_imr\": 0.1,\n \"imr_factor\": 0.0002512,\n \"liquidation_tier\": \"1\"\n }" ], "line_end" => 577, "line_start" => 490, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "marketId" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "base", "value" => "base" }, %{ "comment" => nil, "key" => "quote", "value" => "quote" }, %{ "comment" => nil, "key" => "settle", "value" => "settle" }, %{ "comment" => nil, "key" => "baseId", "value" => "baseId" }, %{ "comment" => nil, "key" => "quoteId", "value" => "quoteId" }, %{ "comment" => nil, "key" => "settleId", "value" => "settleId" }, %{ "comment" => nil, "key" => "type", "value" => "marketType" }, %{ "comment" => nil, "key" => "spot", "value" => "false" }, %{ "comment" => nil, "key" => "margin", "value" => "false" }, %{ "comment" => nil, "key" => "swap", "value" => "true" }, %{ "comment" => nil, "key" => "future", "value" => "false" }, %{ "comment" => nil, "key" => "option", "value" => "false" }, %{ "comment" => nil, "key" => "active", "value" => "undefined" }, %{ "comment" => nil, "key" => "contract", "value" => "true" }, %{ "comment" => nil, "key" => "linear", "value" => "true" }, %{ "comment" => nil, "key" => "inverse", "value" => "false" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.parseNumber ('1')" }, %{ "comment" => nil, "key" => "expiry", "value" => "undefined" }, %{ "comment" => nil, "key" => "expiryDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "strike", "value" => "undefined" }, %{ "comment" => nil, "key" => "optionType", "value" => "undefined" }, %{ "comment" => nil, "key" => "precision", "value" => "{\n 'amount': this.safeNumber (market, 'base_tick'),\n 'price': this.safeNumber (market, 'quote_tick'),\n }" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': this.safeNumber (market, 'base_min'),\n 'max': this.safeNumber (market, 'base_max'),\n },\n 'price': {\n 'min': this.safeNumber (market, 'quote_min'),\n 'max': this.safeNumber (market, 'quote_max'),\n },\n 'cost': {\n 'min': this.safeNumber (market, 'min_notional'),\n 'max': undefined,\n },\n }" }, %{ "comment" => nil, "key" => "created", "value" => "this.safeInteger (market, 'created_time')" }, %{ "comment" => nil, "key" => "info", "value" => "market" }, %{ "comment" => nil, "key" => "leverage", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "amount", "value" => "{\n 'min': this.safeNumber (market, 'base_min'),\n 'max': this.safeNumber (market, 'base_max'),\n }" }, %{ "comment" => nil, "key" => "price", "value" => "{\n 'min': this.safeNumber (market, 'quote_min'),\n 'max': this.safeNumber (market, 'quote_max'),\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "{\n 'min': this.safeNumber (market, 'min_notional'),\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "min", "value" => "this.safeNumber (market, 'quote_min')" }, %{ "comment" => nil, "key" => "max", "value" => "this.safeNumber (market, 'quote_max')" }, %{ "comment" => nil, "key" => "min", "value" => "this.safeNumber (market, 'min_notional')" }, %{ "comment" => nil, "key" => "max", "value" => "undefined" } ], "name" => "parseMarket", "signature" => "parseMarket (market: Dict): Market", "source" => "parseMarket (market: Dict): Market {\n //\n // {\n // \"symbol\": \"PERP_BTC_USDC\",\n // \"quote_min\": 123,\n // \"quote_max\": 100000,\n // \"quote_tick\": 0.1,\n // \"base_min\": 0.00001,\n // \"base_max\": 20,\n // \"base_tick\": 0.00001,\n // \"min_notional\": 1,\n // \"price_range\": 0.02,\n // \"price_scope\": 0.4,\n // \"std_liquidation_fee\": 0.03,\n // \"liquidator_fee\": 0.015,\n // \"claim_insurance_fund_discount\": 0.0075,\n // \"funding_period\": 8,\n // \"cap_funding\": 0.000375,\n // \"floor_funding\": -0.000375,\n // \"interest_rate\": 0.0001,\n // \"created_time\": 1684140107326,\n // \"updated_time\": 1685345968053,\n // \"base_mmr\": 0.05,\n // \"base_imr\": 0.1,\n // \"imr_factor\": 0.0002512,\n // \"liquidation_tier\": \"1\"\n // }\n //\n const marketId = this.safeString (market, 'symbol');\n const parts = marketId.split ('_');\n const marketType = 'swap';\n const baseId = this.safeString (parts, 1);\n const quoteId = this.safeString (parts, 2);\n const base = this.safeCurrencyCode (baseId);\n const quote = this.safeCurrencyCode (quoteId);\n const settleId: Str = this.safeString (parts, 2);\n const settle: Str = this.safeCurrencyCode (settleId);\n const symbol = base + '/' + quote + ':' + settle;\n return {\n 'id': marketId,\n 'symbol': symbol,\n 'base': base,\n 'quote': quote,\n 'settle': settle,\n 'baseId': baseId,\n 'quoteId': quoteId,\n 'settleId': settleId,\n 'type': marketType,\n 'spot': false,\n 'margin': false,\n 'swap': true,\n 'future': false,\n 'option': false,\n 'active': undefined,\n 'contract': true,\n 'linear': true,\n 'inverse': false,\n 'contractSize': this.parseNumber ('1'),\n 'expiry': undefined,\n 'expiryDatetime': undefined,\n 'strike': undefined,\n 'optionType': undefined,\n 'precision': {\n 'amount': this.safeNumber (market, 'base_tick'),\n 'price': this.safeNumber (market, 'quote_tick'),\n },\n 'limits': {\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': this.safeNumber (market, 'base_min'),\n 'max': this.safeNumber (market, 'base_max'),\n },\n 'price': {\n 'min': this.safeNumber (market, 'quote_min'),\n 'max': this.safeNumber (market, 'quote_max'),\n },\n 'cost': {\n 'min': this.safeNumber (market, 'min_notional'),\n 'max': undefined,\n },\n },\n 'created': this.safeInteger (market, 'created_time'),\n 'info': market,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1258, "line_start" => 1249, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n return [\n this.safeInteger (ohlcv, 'start_timestamp'),\n this.safeNumber (ohlcv, 'open'),\n this.safeNumber (ohlcv, 'high'),\n this.safeNumber (ohlcv, 'low'),\n this.safeNumber (ohlcv, 'close'),\n this.safeNumber (ohlcv, 'volume'),\n ];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"orderId\": \"1578938\",\n \"clientOrderId\": \"0\",\n \"algoType\": \"STOP_LOSS\",\n \"quantity\": \"0.1\"\n }", "{\n \"algoOrderId\": \"1578958\",\n \"clientOrderId\": \"0\",\n \"rootAlgoOrderId\": \"1578958\",\n \"parentAlgoOrderId\": \"0\",\n \"symbol\": \"SPOT_LTC_USDT\",\n \"orderTag\": \"default\",\n \"algoType\": \"STOP_LOSS\",\n \"side\": \"BUY\",\n \"quantity\": \"0.1\",\n \"isTriggered\": false,\n \"triggerPrice\": \"100\",\n \"triggerStatus\": \"USELESS\",\n \"type\": \"LIMIT\",\n \"rootAlgoStatus\": \"CANCELLED\",\n \"algoStatus\": \"CANCELLED\",\n \"triggerPriceType\": \"MARKET_PRICE\",\n \"price\": \"75\",\n \"triggerTime\": \"0\",\n \"totalExecutedQuantity\": \"0\",\n \"averageExecutedPrice\": \"0\",\n \"totalFee\": \"0\",\n \"feeAsset\": '',\n \"reduceOnly\": false,\n \"createdTime\": \"1686149609.744\",\n \"updatedTime\": \"1686149903.362\"\n }" ], "line_end" => 1422, "line_start" => 1308, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "orderId" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "clientOrderId" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "lastUpdateTimestamp" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseOrderStatus (status)" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseOrderType (orderType)" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "this.parseTimeInForce (orderType)" }, %{ "comment" => nil, "key" => "postOnly", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "triggerPrice" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "takeProfitPrice" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "stopLossPrice" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "filled", "value" => "filled" }, %{ "comment" => nil, "key" => "remaining", "value" => "remaining" }, %{ "comment" => nil, "key" => "trades", "value" => "transactions" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'cost': fee,\n 'currency': feeCurrency,\n }" }, %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "cost", "value" => "fee" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrency" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // Possible input functions:\n // * createOrder\n // * createOrders\n // * cancelOrder\n // * fetchOrder\n // * fetchOrders\n // const isFromFetchOrder = ('order_tag' in order); TO_DO\n //\n // stop order after creating it:\n // {\n // \"orderId\": \"1578938\",\n // \"clientOrderId\": \"0\",\n // \"algoType\": \"STOP_LOSS\",\n // \"quantity\": \"0.1\"\n // }\n // stop order after fetching it:\n // {\n // \"algoOrderId\": \"1578958\",\n // \"clientOrderId\": \"0\",\n // \"rootAlgoOrderId\": \"1578958\",\n // \"parentAlgoOrderId\": \"0\",\n // \"symbol\": \"SPOT_LTC_USDT\",\n // \"orderTag\": \"default\",\n // \"algoType\": \"STOP_LOSS\",\n // \"side\": \"BUY\",\n // \"quantity\": \"0.1\",\n // \"isTriggered\": false,\n // \"triggerPrice\": \"100\",\n // \"triggerStatus\": \"USELESS\",\n // \"type\": \"LIMIT\",\n // \"rootAlgoStatus\": \"CANCELLED\",\n // \"algoStatus\": \"CANCELLED\",\n // \"triggerPriceType\": \"MARKET_PRICE\",\n // \"price\": \"75\",\n // \"triggerTime\": \"0\",\n // \"totalExecutedQuantity\": \"0\",\n // \"averageExecutedPrice\": \"0\",\n // \"totalFee\": \"0\",\n // \"feeAsset\": '',\n // \"reduceOnly\": false,\n // \"createdTime\": \"1686149609.744\",\n // \"updatedTime\": \"1686149903.362\"\n // }\n //\n const timestamp = this.safeIntegerN (order, [ 'timestamp', 'created_time', 'createdTime' ]);\n const orderId = this.safeStringN (order, [ 'order_id', 'orderId', 'algoOrderId' ]);\n const clientOrderId = this.omitZero (this.safeString2 (order, 'client_order_id', 'clientOrderId')); // Somehow, this always returns 0 for limit order\n const marketId = this.safeString (order, 'symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const price = this.safeString2 (order, 'order_price', 'price');\n const amount = this.safeString2 (order, 'order_quantity', 'quantity'); // This is base amount\n const cost = this.safeString2 (order, 'order_amount', 'amount'); // This is quote amount\n const orderType = this.safeStringLower2 (order, 'order_type', 'type');\n let status = this.safeValue2 (order, 'status', 'algoStatus');\n const success = this.safeBool (order, 'success');\n if (success !== undefined) {\n status = (success) ? 'NEW' : 'REJECTED';\n }\n const side = this.safeStringLower (order, 'side');\n const filled = this.omitZero (this.safeValue2 (order, 'executed', 'totalExecutedQuantity'));\n const average = this.omitZero (this.safeString2 (order, 'average_executed_price', 'averageExecutedPrice'));\n const remaining = Precise.stringSub (cost, filled);\n const fee = this.safeValue2 (order, 'total_fee', 'totalFee');\n const feeCurrency = this.safeString2 (order, 'fee_asset', 'feeAsset');\n const transactions = this.safeValue (order, 'Transactions');\n const triggerPrice = this.safeNumber (order, 'triggerPrice');\n let takeProfitPrice: Num = undefined;\n let stopLossPrice: Num = undefined;\n const childOrders = this.safeValue (order, 'childOrders');\n if (childOrders !== undefined) {\n const first = this.safeValue (childOrders, 0);\n const innerChildOrders = this.safeValue (first, 'childOrders', []);\n const innerChildOrdersLength = innerChildOrders.length;\n if (innerChildOrdersLength > 0) {\n const takeProfitOrder = this.safeValue (innerChildOrders, 0);\n const stopLossOrder = this.safeValue (innerChildOrders, 1);\n takeProfitPrice = this.safeNumber (takeProfitOrder, 'triggerPrice');\n stopLossPrice = this.safeNumber (stopLossOrder, 'triggerPrice');\n }\n }\n const lastUpdateTimestamp = this.safeInteger2 (order, 'updatedTime', 'updated_time');\n return this.safeOrder ({\n 'id': orderId,\n 'clientOrderId': clientOrderId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': undefined,\n 'lastUpdateTimestamp': lastUpdateTimestamp,\n 'status': this.parseOrderStatus (status),\n 'symbol': symbol,\n 'type': this.parseOrderType (orderType),\n 'timeInForce': this.parseTimeInForce (orderType),\n 'postOnly': undefined, // TO_DO\n 'reduceOnly': this.safeBool (order, 'reduce_only'),\n 'side': side,\n 'price': price,\n 'triggerPrice': triggerPrice,\n 'takeProfitPrice': takeProfitPrice,\n 'stopLossPrice': stopLossPrice,\n 'average': average,\n 'amount': amount,\n 'filled': filled,\n 'remaining': remaining, // TO_DO\n 'cost': cost,\n 'trades': transactions,\n 'fee': {\n 'cost': fee,\n 'currency': feeCurrency,\n },\n 'info': order,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1449, "line_start" => 1433, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n if (status !== undefined) {\n const statuses: Dict = {\n 'NEW': 'open',\n 'FILLED': 'closed',\n 'CANCEL_SENT': 'canceled',\n 'CANCEL_ALL_SENT': 'canceled',\n 'CANCELLED': 'canceled',\n 'PARTIAL_FILLED': 'open',\n 'REJECTED': 'rejected',\n 'INCOMPLETE': 'open',\n 'COMPLETED': 'closed',\n };\n return this.safeString (statuses, status, status);\n }\n return status;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1458, "line_start" => 1451, "mappings" => [], "name" => "parseOrderType", "signature" => "parseOrderType (type: Str)", "source" => "parseOrderType (type: Str) {\n const types: Dict = {\n 'LIMIT': 'limit',\n 'MARKET': 'market',\n 'POST_ONLY': 'limit',\n };\n return this.safeStringLower (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"IMR_withdraw_orders\": 0.1,\n \"MMR_with_orders\": 0.05,\n \"average_open_price\": 27908.14386047,\n \"cost_position\": -139329.358492,\n \"est_liq_price\": 117335.92899428,\n \"fee_24_h\": 123,\n \"imr\": 0.1,\n \"last_sum_unitary_funding\": 70.38,\n \"mark_price\": 27794.9,\n \"mmr\": 0.05,\n \"pending_long_qty\": 123,\n \"pending_short_qty\": 123,\n \"pnl_24_h\": 123,\n \"position_qty\": -5,\n \"settle_price\": 27865.8716984,\n \"symbol\": \"PERP_BTC_USDC\",\n \"timestamp\": 1685429350571,\n \"unsettled_pnl\": 354.858492\n }" ], "line_end" => 2779, "line_start" => 2710, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeString (market, 'symbol')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.parseNumber (entryPrice)" }, %{ "comment" => nil, "key" => "notional", "value" => "this.parseNumber (notional)" }, %{ "comment" => nil, "key" => "leverage", "value" => "undefined" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.parseNumber (unrealisedPnl)" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (size)" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.parseNumber (contractSize)" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "undefined" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "this.safeNumber (position, 'est_liq_price')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.parseNumber (markPrice)" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "collateral", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'cross'" }, %{ "comment" => nil, "key" => "marginType", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "hedged", "value" => "undefined" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"IMR_withdraw_orders\": 0.1,\n // \"MMR_with_orders\": 0.05,\n // \"average_open_price\": 27908.14386047,\n // \"cost_position\": -139329.358492,\n // \"est_liq_price\": 117335.92899428,\n // \"fee_24_h\": 123,\n // \"imr\": 0.1,\n // \"last_sum_unitary_funding\": 70.38,\n // \"mark_price\": 27794.9,\n // \"mmr\": 0.05,\n // \"pending_long_qty\": 123,\n // \"pending_short_qty\": 123,\n // \"pnl_24_h\": 123,\n // \"position_qty\": -5,\n // \"settle_price\": 27865.8716984,\n // \"symbol\": \"PERP_BTC_USDC\",\n // \"timestamp\": 1685429350571,\n // \"unsettled_pnl\": 354.858492\n // }\n //\n const contract = this.safeString (position, 'symbol');\n market = this.safeMarket (contract, market);\n let size = this.safeString (position, 'position_qty');\n let side: Str = undefined;\n if (Precise.stringGt (size, '0')) {\n side = 'long';\n } else {\n side = 'short';\n }\n const contractSize = this.safeString (market, 'contractSize');\n const markPrice = this.safeString (position, 'mark_price');\n const timestamp = this.safeInteger (position, 'timestamp');\n const entryPrice = this.safeString (position, 'average_open_price');\n const unrealisedPnl = this.safeString (position, 'unsettled_pnl');\n size = Precise.stringAbs (size);\n const notional = Precise.stringMul (size, markPrice);\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': this.safeString (market, 'symbol'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastUpdateTimestamp': undefined,\n 'initialMargin': undefined,\n 'initialMarginPercentage': undefined,\n 'maintenanceMargin': undefined,\n 'maintenanceMarginPercentage': undefined,\n 'entryPrice': this.parseNumber (entryPrice),\n 'notional': this.parseNumber (notional),\n 'leverage': undefined,\n 'unrealizedPnl': this.parseNumber (unrealisedPnl),\n 'contracts': this.parseNumber (size),\n 'contractSize': this.parseNumber (contractSize),\n 'marginRatio': undefined,\n 'liquidationPrice': this.safeNumber (position, 'est_liq_price'),\n 'markPrice': this.parseNumber (markPrice),\n 'lastPrice': undefined,\n 'collateral': undefined,\n 'marginMode': 'cross',\n 'marginType': undefined,\n 'side': side,\n 'percentage': undefined,\n 'hedged': undefined,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1431, "line_start" => 1424, "mappings" => [], "name" => "parseTimeInForce", "signature" => "parseTimeInForce (timeInForce: Str)", "source" => "parseTimeInForce (timeInForce: Str) {\n const timeInForces: Dict = {\n 'ioc': 'IOC',\n 'fok': 'FOK',\n 'post_only': 'PO',\n };\n return this.safeString (timeInForces, timeInForce, undefined);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 738, "line_start" => 726, "mappings" => [ %{ "comment" => nil, "key" => "cost", "value" => "feeCost" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrencyCode" } ], "name" => "parseTokenAndFeeTemp", "signature" => "parseTokenAndFeeTemp (item, feeTokenKey, feeAmountKey)", "source" => "parseTokenAndFeeTemp (item, feeTokenKey, feeAmountKey) {\n const feeCost = this.safeString (item, feeAmountKey);\n let fee = undefined;\n if (feeCost !== undefined) {\n const feeCurrencyId = this.safeString (item, feeTokenKey);\n const feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);\n fee = {\n 'cost': feeCost,\n 'currency': feeCurrencyCode,\n };\n }\n return fee;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"PERP_ETH_USDC\",\n \"side\": \"SELL\",\n \"executed_price\": 46222.35,\n \"executed_quantity\": 0.0012,\n \"executed_timestamp\": \"1683878609166\"\n }", "{\n \"id\": \"99119876\",\n \"symbol\": \"PERP_BTC_USDC\",\n \"fee\": \"0.0024\",\n \"side\": \"BUY\",\n \"executed_timestamp\": \"1641481113084\",\n \"order_id\": \"87001234\",\n \"order_tag\": \"default\", <-- this param only in \"fetchOrderTrades\"\n \"executed_price\": \"1\",\n \"executed_quantity\": \"12\",\n \"fee_asset\": \"BTC\",\n \"is_maker\": \"1\"\n }" ], "line_end" => 804, "line_start" => 740, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "order", "value" => "order_id" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "info", "value" => "trade" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // public/market_trades\n //\n // {\n // \"symbol\": \"PERP_ETH_USDC\",\n // \"side\": \"SELL\",\n // \"executed_price\": 46222.35,\n // \"executed_quantity\": 0.0012,\n // \"executed_timestamp\": \"1683878609166\"\n // }\n //\n // fetchOrderTrades, fetchOrder\n //\n // {\n // \"id\": \"99119876\",\n // \"symbol\": \"PERP_BTC_USDC\",\n // \"fee\": \"0.0024\",\n // \"side\": \"BUY\",\n // \"executed_timestamp\": \"1641481113084\",\n // \"order_id\": \"87001234\",\n // \"order_tag\": \"default\", <-- this param only in \"fetchOrderTrades\"\n // \"executed_price\": \"1\",\n // \"executed_quantity\": \"12\",\n // \"fee_asset\": \"BTC\",\n // \"is_maker\": \"1\"\n // }\n //\n const isFromFetchOrder = ('id' in trade);\n const timestamp = this.safeInteger (trade, 'executed_timestamp');\n const marketId = this.safeString (trade, 'symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const price = this.safeString (trade, 'executed_price');\n const amount = this.safeString (trade, 'executed_quantity');\n const order_id = this.safeString (trade, 'order_id');\n const fee = this.parseTokenAndFeeTemp (trade, 'fee_asset', 'fee');\n const feeCost = this.safeString (fee, 'cost');\n if (feeCost !== undefined) {\n fee['cost'] = feeCost;\n }\n const cost = Precise.stringMul (price, amount);\n const side = this.safeStringLower (trade, 'side');\n const id = this.safeString (trade, 'id');\n let takerOrMaker: Str = undefined;\n if (isFromFetchOrder) {\n const isMaker = this.safeString (trade, 'is_maker') === '1';\n takerOrMaker = isMaker ? 'maker' : 'taker';\n }\n return this.safeTrade ({\n 'id': id,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'side': side,\n 'price': price,\n 'amount': amount,\n 'cost': cost,\n 'order': order_id,\n 'takerOrMaker': takerOrMaker,\n 'type': undefined,\n 'fee': fee,\n 'info': trade,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2441, "line_start" => 2408, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (transaction, 'id', 'withdraw_id')" }, %{ "comment" => nil, "key" => "txid", "value" => "this.safeString (transaction, 'tx_id')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "address", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "addressFrom" }, %{ "comment" => nil, "key" => "addressTo", "value" => "addressTo" }, %{ "comment" => nil, "key" => "tag", "value" => "this.safeString (transaction, 'extra')" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "movementDirection" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (transaction, 'amount')" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransactionStatus (this.safeString (transaction, 'status'))" }, %{ "comment" => nil, "key" => "updated", "value" => "this.safeInteger (transaction, 'updated_time')" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "network", "value" => "undefined" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n // example in fetchLedger\n const code = this.safeString (transaction, 'token');\n let movementDirection = this.safeStringLower (transaction, 'token_side');\n if (movementDirection === 'withdraw') {\n movementDirection = 'withdrawal';\n }\n const fee = this.parseTokenAndFeeTemp (transaction, 'fee_token', 'fee_amount');\n const addressTo = this.safeString (transaction, 'target_address');\n const addressFrom = this.safeString (transaction, 'source_address');\n const timestamp = this.safeInteger (transaction, 'created_time');\n return {\n 'info': transaction,\n 'id': this.safeString2 (transaction, 'id', 'withdraw_id'),\n 'txid': this.safeString (transaction, 'tx_id'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'address': undefined,\n 'addressFrom': addressFrom,\n 'addressTo': addressTo,\n 'tag': this.safeString (transaction, 'extra'),\n 'tagFrom': undefined,\n 'tagTo': undefined,\n 'type': movementDirection,\n 'amount': this.safeNumber (transaction, 'amount'),\n 'currency': code,\n 'status': this.parseTransactionStatus (this.safeString (transaction, 'status')),\n 'updated': this.safeInteger (transaction, 'updated_time'),\n 'comment': undefined,\n 'internal': undefined,\n 'fee': fee,\n 'network': undefined,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2452, "line_start" => 2443, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: Str)", "source" => "parseTransactionStatus (status: Str) {\n const statuses: Dict = {\n 'NEW': 'pending',\n 'CONFIRMING': 'pending',\n 'PROCESSING': 'pending',\n 'COMPLETED': 'ok',\n 'CANCELED': 'canceled',\n };\n return this.safeString (statuses, status, status);\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 100, period: 1000, requests: 10, rolling_window_size: 60000 }, raw_endpoints: %{ private: [], public: [] }, required_credentials: %{ api_key: true, password: false, secret: true, uid: false }, requires_eddsa: false, response_error: %{ code_field: "error", field: "success", message_field: "message", success_values: nil, type: :success_bool }, signing: %{ api_key_header: "orderly-key", confidence: :high, pattern: :hmac_sha256_headers, signature_header: "orderly-signature", timestamp_header: "orderly-timestamp" }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 480000, "min" => 0.1 }, "cost" => %{ "min" => 10 }, "price" => %{ "max" => 100000, "min" => 0 } }, sample_precision: %{ "amount" => 0.1, "price" => 0.0001 }, swap: %{ base: "1000000MOG", base_id: "1000000MOG", case: :upper, contract: true, contract_size: 1, id: "PERP_1000000MOG_USDC", inverse: false, limits: %{ "amount" => %{ "max" => 480000, "min" => 0.1 }, "cost" => %{ "min" => 10 }, "leverage" => %{}, "price" => %{ "max" => 100000, "min" => 0 } }, linear: true, maker: 0.0002, precision: %{ "amount" => 0.1, "price" => 0.0001 }, quote: "USDC", quote_id: "USDC", separator: "_", settle: "USDC", settle_id: "USDC", symbol: "1000000MOG/USDC:USDC", taker: 0.0005 } }, symbol_patterns: %{ swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, separator: "_", suffix: nil } }, timeframes: %{ "12h" => "12h", "15m" => "15m", "1M" => "1mon", "1d" => "1d", "1h" => "1h", "1m" => "1m", "1w" => "1w", "1y" => "1y", "30m" => "30m", "4h" => "4h", "5m" => "5m" }, url_strategy: %{ detected_from: "fallback", pattern: :no_prefix, prefix: nil }, urls: %{ api: "https://api-evm.orderly.org", api_sections: %{ "private" => "https://api-evm.orderly.org", "public" => "https://api-evm.orderly.org" }, doc: nil, other: nil, sandbox: %{ "private" => "https://testnet-api-evm.orderly.org", "public" => "https://testnet-api-evm.orderly.org" }, www: "https://trade.mode.network" }, version: "v1", ws: %{ auth: %{ algorithm: :sha256, encoding: :hex, market_specific: false, message_format: :event_auth, op_field: "event", op_value: "auth", pattern: :generic_hmac, payload_format: "custom", requires_passphrase: false, timestamp_unit: :milliseconds }, channel_templates: %{ watch_balance: %{ auth_required: true, market_id_format: :native, params: [], pattern: :event_based }, watch_bids_asks: %{ channel_name: "bbos", market_id_format: :native, params: [], pattern: :event_based }, watch_my_trades: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_based }, watch_ohlcv: %{ channel_name: "kline", market_id_format: :native, params: [ %{ "default" => nil, "name" => "interval" }, %{ "default" => nil, "name" => "limit" } ], pattern: :event_based }, watch_order_book: %{ channel_name: "orderbook", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_based }, watch_orders: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_based }, watch_positions: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_based }, watch_private: %{ auth_required: true, market_id_format: :native, params: [], pattern: :event_based }, watch_private_multiple: %{ auth_required: true, market_id_format: :native, params: [], pattern: :event_based }, watch_public: %{ market_id_format: :native, params: [], pattern: :event_based }, watch_ticker: %{ channel_name: "ticker", market_id_format: :native, params: [], pattern: :event_based }, watch_tickers: %{ channel_name: "tickers", market_id_format: :native, params: [], pattern: :event_based }, watch_trades: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :event_based } }, 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: nil, watch_order_book: true, watch_order_book_for_symbols: nil, 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: false }, hostname: "trade.mode.network", message_patterns: [ %{ format: :event, keys: [ "event" ], kind_field: "event", kind_value: "ping", sources: [ :ping ] }, %{ args_field: "topic", format: :event, id_field: "id", keys: [ "event", "id", "topic" ], kind_field: "event", kind_value: "subscribe", sources: [ :send, :watch ] } ], options: %{ "watchPositions" => %{ "awaitPositionsSnapshot" => true, "fetchPositionsSnapshot" => true } }, streaming: %{ keep_alive: 10000 }, subscription_config: %{ args_field: "channel", args_format: :string, market_id_format: :native, op_field: "event" }, subscription_pattern: :event_subscribe, test_urls: %{ "private" => "wss://testnet-ws-private-evm.orderly.org/v2/ws/private/stream", "public" => "wss://testnet-ws-evm.orderly.org/ws/stream" }, urls: %{ "private" => "wss://ws-private-evm.orderly.org/v2/ws/private/stream", "public" => "wss://ws-evm.orderly.org/ws/stream" }, watch_methods: [ "watchBalance", "watchBidsAsks", "watchMyTrades", "watchOHLCV", "watchOrderBook", "watchOrders", "watchPositions", "watchPrivate", "watchPrivateMultiple", "watchPublic", "watchTicker", "watchTickers", "watchTrades" ] } }