# derive Exchange Specification # # Auto-generated by: mix ccxt.extract derive # CCXT version: 4.5.42 # Spec format version: 2 # # Review before use: # - signing: Detected from sign() method, verify with testnet # - endpoints: Raw paths extracted, map to unified API as needed # - exceptions: Extracted (exact, broad, HTTP status codes) # - features/options: Extracted from describe() # - classification: Set to :supported initially, promote after validation # %{ api_param_requirements: nil, certified: false, classification: :pro, comment: nil, countries: [], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "XBT" => "BTC" }, dex: true, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 7, "coveragePercent" => 100, "enabledMethods" => 27, "excluded" => [ %{ "method" => "fetchL2OrderBook", "reason" => "derive fetchOrderBook() is not supported yet" }, %{ "method" => "fetchLedger", "reason" => "derive fetchLedger() is not supported yet" }, %{ "method" => "fetchDepositWithdrawFee", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 3, "extractableMethods" => 24, "failures" => [ %{ "error" => "derive cancelAllOrders() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "cancelAllOrders" }, %{ "error" => "derive cancelOrder() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "cancelOrder" }, %{ "error" => "derive createOrder() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "createLimitOrder" }, %{ "error" => "derive createOrder() requires a price argument", "method" => "createMarketOrder" }, %{ "error" => "derive createOrder() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "createOrder" }, %{ "error" => "derive editOrder() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "editOrder" }, %{ "error" => "derive fetchBalance() requires a deriveWalletAddress parameter inside 'params' or exchange.options['deriveWalletAddress'] = ADDRESS, the address can find in HOME => Developers tab.", "method" => "fetchBalance" }, %{ "error" => "derive fetchOrders() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchCanceledOrders" }, %{ "error" => "derive fetchOrders() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchClosedOrders" }, %{ "error" => "derive fetchDeposits() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchDeposits" }, %{ "error" => "derive fetchFundingHistory() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchFundingHistory" }, %{ "error" => "derive fetchMyTrades() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchMyTrades" }, %{ "error" => "derive fetchOrders() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchOpenOrders" }, %{ "error" => "derive fetchOrders() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchOrders" }, %{ "error" => "derive fetchOrderTrades() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchOrderTrades" }, %{ "error" => "derive fetchPositions() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchPositions" }, %{ "error" => "derive fetchWithdrawals() requires a subaccount_id parameter inside 'params' or exchange.options['subaccount_id']=ID.", "method" => "fetchWithdrawals" } ] }, endpoints: [ %{ api_section: "public", auth: false, cost: 1, expects: :list, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/get_all_currencies", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, expects: :single, market_type: :swap, method: :post, name: :fetch_funding_rate, param_mappings: %{ "symbol" => "instrument_name" }, params: [ :symbol ], path: "/get_funding_rate_history", response_transformer: {:extract_path_unwrap, ["result", "funding_rate_history"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, expects: :list, market_type: :swap, method: :post, name: :fetch_funding_rate_history, param_mappings: %{ "symbol" => "instrument_name" }, params: [ :symbol, :since, :limit ], path: "/get_funding_rate_history", response_transformer: {:extract_path, ["result", "funding_rate_history"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "expired" => false, "instrument_type" => "erc20" }, expects: :list, market_type: :spot, method: :post, name: :fetch_markets, param_mappings: %{}, params: [], path: "/get_all_instruments", response_transformer: {:extract_path, ["result", "instruments"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, expects: :single, market_type: :spot, method: :post, name: :fetch_ticker, param_mappings: %{ "symbol" => "instrument_name" }, params: [ :symbol ], path: "/get_ticker", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, expects: :single, market_type: :spot, method: :post, name: :fetch_time, param_mappings: %{}, params: [], path: "/get_time", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, expects: :list, market_type: :spot, method: :post, name: :fetch_trades, param_mappings: %{ "limit" => "page_size", "since" => "from_timestamp", "symbol" => "instrument_name" }, params: [ :symbol, :since, :limit ], path: "/get_trade_history", response_transformer: {:extract_path, ["result", "trades"]}, source: :intercepted } ], error_code_details: %{ -32000 => %{ description: "Rate limit exceeded", type: :rate_limited }, -32100 => %{ description: "Number of concurrent websocket clients limit exceeded", type: :rate_limited }, -32600 => %{ description: "Invalid Request", type: :invalid_parameters }, -32601 => %{ description: "Method not found", type: :invalid_parameters }, -32602 => %{ description: "{\"id\":\"55e66a3d-6a4e-4a36-a23d-5cf8a91ef478\",\"error\":{\"code\":\"\",\"message\":\"Invalid params\"}}", type: :invalid_order }, -32603 => %{ description: "Internal error", type: :invalid_order }, -32700 => %{ description: "Parse error", type: :invalid_parameters }, 10000 => %{ description: "Manager not found", type: :invalid_parameters }, 10001 => %{ description: "Asset is not an ERC20 token", type: :invalid_parameters }, 10002 => %{ description: "Sender and recipient wallet do not match", type: :invalid_parameters }, 10003 => %{ description: "Sender and recipient subaccount IDs are the same", type: :invalid_parameters }, 10004 => %{ description: "Multiple currencies not supported", type: :invalid_order }, 10005 => %{ description: "Maximum number of subaccounts per wallet reached", type: :invalid_parameters }, 10006 => %{ description: "Maximum number of session keys per wallet reached", type: :invalid_parameters }, 10007 => %{ description: "Maximum number of assets per subaccount reached", type: :invalid_parameters }, 10008 => %{ description: "Maximum number of expiries per subaccount reached", type: :invalid_parameters }, 10009 => %{ description: "Recipient subaccount ID of the transfer cannot be 0", type: :invalid_parameters }, 10010 => %{ description: "PMRM only supports USDC asset collateral. Cannot trade spot markets.", type: :invalid_order }, 10011 => %{ description: "ERC20 allowance is insufficient", type: :insufficient_balance }, 10012 => %{ description: "ERC20 balance is less than transfer amount", type: :insufficient_balance }, 10013 => %{ description: "There is a pending deposit for this asset", type: :exchange_error }, 10014 => %{ description: "There is a pending withdrawal for this asset", type: :exchange_error }, 11000 => %{ description: "Insufficient funds", type: :insufficient_balance }, 11002 => %{ description: "Order rejected from queue", type: :invalid_order }, 11003 => %{ description: "Already cancelled", type: :invalid_order }, 11004 => %{ description: "Already filled", type: :invalid_order }, 11005 => %{ description: "Already expired", type: :invalid_order }, 11006 => %{ description: "Does not exist", type: :order_not_found }, 11007 => %{ description: "Self-crossing disallowed", type: :invalid_order }, 11008 => %{ description: "Post-only reject", type: :invalid_order }, 11009 => %{ description: "Zero liquidity for market or IOC/FOK order", type: :invalid_order }, 11010 => %{ description: "Post-only invalid order type", type: :invalid_order }, 11011 => %{ description: "Invalid signature expiry", type: :invalid_order }, 11012 => %{ description: "Invalid amount", type: :invalid_order }, 11013 => %{ description: "Invalid limit price", type: :invalid_order }, 11014 => %{ description: "Fill-or-kill not filled", type: :invalid_order }, 11015 => %{ description: "MMP frozen", type: :invalid_order }, 11016 => %{ description: "Already consumed", type: :invalid_order }, 11017 => %{ description: "Non unique nonce", type: :invalid_order }, 11018 => %{ description: "Invalid nonce date", type: :invalid_order }, 11019 => %{ description: "Open orders limit exceeded", type: :invalid_order }, 11020 => %{ description: "Negative ERC20 balance", type: :insufficient_balance }, 11021 => %{ description: "Instrument is not live", type: :invalid_order }, 11022 => %{ description: "Reject timestamp exceeded", type: :invalid_order }, 11023 => %{ description: "Max fee order param is too low", type: :invalid_order }, 11024 => %{ description: "Reduce only not supported with this time in force", type: :invalid_order }, 11025 => %{ description: "Reduce only reject", type: :invalid_order }, 11026 => %{ description: "Transfer reject", type: :invalid_parameters }, 11027 => %{ description: "Subaccount undergoing liquidation", type: :invalid_order }, 11028 => %{ description: "Replaced order filled amount does not match expected state.", type: :invalid_order }, 11050 => %{ description: "Trigger order was cancelled between the time worker sent order and engine processed order", type: :invalid_order }, 11051 => %{ description: "Trigger price must be higher than the current price for stop orders and vice versa for take orders", type: :invalid_order }, 11052 => %{ description: "Trigger order limit exceeded (separate limit from regular orders)", type: :invalid_order }, 11053 => %{ description: "Index and last-trade trigger price types not supported yet", type: :invalid_order }, 11054 => %{ description: "Trigger orders cannot replace or be replaced", type: :invalid_order }, 11055 => %{ description: "Market order limit_price is unfillable at the given trigger price", type: :invalid_order }, 11100 => %{ description: "Leg instruments are not unique", type: :invalid_order }, 11101 => %{ description: "RFQ not found", type: :invalid_order }, 11102 => %{ description: "Quote not found", type: :invalid_order }, 11103 => %{ description: "Quote leg does not match RFQ leg", type: :invalid_order }, 11104 => %{ description: "Requested quote or RFQ is not open", type: :invalid_order }, 11105 => %{ description: "Requested quote ID references a different RFQ ID", type: :invalid_order }, 11106 => %{ description: "Invalid RFQ counterparty", type: :invalid_order }, 11107 => %{ description: "Quote maker total cost too high", type: :invalid_order }, 11200 => %{ description: "Auction not ongoing", type: :invalid_order }, 11201 => %{ description: "Open orders not allowed", type: :invalid_order }, 11202 => %{ description: "Price limit exceeded", type: :invalid_order }, 11203 => %{ description: "Last trade ID mismatch", type: :invalid_order }, 12000 => %{ description: "Asset not found", type: :invalid_order }, 12001 => %{ description: "Instrument not found", type: :invalid_order }, 12002 => %{ description: "Currency not found", type: :invalid_parameters }, 12003 => %{ description: "USDC does not have asset caps per manager", type: :invalid_parameters }, 13000 => %{ description: "Invalid channels", type: :invalid_parameters }, 14000 => %{ description: "Account not found", type: :invalid_parameters }, 14001 => %{ description: "Subaccount not found", type: :invalid_order }, 14002 => %{ description: "Subaccount was withdrawn", type: :invalid_parameters }, 14008 => %{ description: "Cannot reduce expiry using registerSessionKey RPC route", type: :invalid_parameters }, 14009 => %{ description: "Session key expiry must be > utc_now + 10 min", type: :invalid_parameters }, 14010 => %{ description: "Session key already registered for this account", type: :invalid_parameters }, 14011 => %{ description: "Session key already registered with another account", type: :invalid_parameters }, 14012 => %{ description: "Address must be checksummed", type: :invalid_parameters }, 14013 => %{ description: "String is not a valid ethereum address", type: :invalid_parameters }, 14014 => %{ description: "Signature invalid for message or transaction", type: :invalid_order }, 14015 => %{ description: "Transaction count for given wallet does not match provided nonce", type: :invalid_parameters }, 14016 => %{ description: "The provided signed raw transaction contains function name that does not match the expected function name", type: :invalid_parameters }, 14017 => %{ description: "The provided signed raw transaction contains contract address that does not match the expected contract address", type: :invalid_parameters }, 14018 => %{ description: "The provided signed raw transaction contains function params that do not match any expected function params", type: :invalid_parameters }, 14019 => %{ description: "The provided signed raw transaction contains function param values that do not match the expected values", type: :invalid_parameters }, 14020 => %{ description: "The X-LyraWallet header does not match the requested subaccount_id or wallet", type: :invalid_parameters }, 14021 => %{ description: "The X-LyraWallet header not provided", type: :invalid_parameters }, 14022 => %{ description: "Subscription to a private channel failed", type: :invalid_credentials }, 14023 => %{ description: "Signer in on-chain related request is not wallet owner or registered session key", type: :invalid_order }, 14024 => %{ description: "Chain ID must match the current roll up chain id", type: :invalid_parameters }, 14025 => %{ description: "The private request is missing a wallet or subaccount_id param", type: :invalid_parameters }, 14026 => %{ description: "Session key not found", type: :invalid_parameters }, 14027 => %{ description: "Unauthorized as RFQ maker", type: :invalid_credentials }, 14028 => %{ description: "Cross currency RFQ not supported", type: :invalid_parameters }, 14029 => %{ description: "Session key IP not whitelisted", type: :invalid_credentials }, 14030 => %{ description: "Session key expired", type: :invalid_parameters }, 14031 => %{ description: "Unauthorized key scope", type: :invalid_credentials }, 14032 => %{ description: "Scope should not be changed", type: :invalid_parameters }, 16000 => %{ description: "You are in a restricted region that violates our terms of service.", type: :invalid_credentials }, 16001 => %{ description: "Account is disabled due to compliance violations, please contact support to enable it.", type: :invalid_credentials }, 16100 => %{ description: "Sentinel authorization is invalid", type: :invalid_credentials }, 17000 => %{ description: "This accoount does not have a shareable invite code", type: :invalid_parameters }, 17001 => %{ description: "Invalid invite code", type: :invalid_parameters }, 17002 => %{ description: "Invite code already registered for this account", type: :invalid_parameters }, 17003 => %{ description: "Invite code has no remaining uses", type: :invalid_parameters }, 17004 => %{ description: "Requirement for successful invite registration not met", type: :invalid_parameters }, 17005 => %{ description: "Account must register with a valid invite code to be elligible for points", type: :invalid_parameters }, 17006 => %{ description: "Point program does not exist", type: :invalid_parameters }, 17007 => %{ description: "Invalid leaderboard page number", type: :invalid_parameters }, 18000 => %{ description: "Invalid block number", type: :invalid_parameters }, 18001 => %{ description: "Failed to estimate block number. Please try again later.", type: :invalid_parameters }, 18002 => %{ description: "The provided smart contract owner does not match the wallet in LightAccountFactory.getAddress()", type: :invalid_parameters }, 18003 => %{ description: "Vault ERC20 asset does not exist", type: :invalid_parameters }, 18004 => %{ description: "Vault ERC20 pool does not exist", type: :invalid_parameters }, 18005 => %{ description: "Must add asset to pool before getting balances", type: :invalid_parameters }, 18006 => %{ description: "Invalid Swell season. Swell seasons are in the form 'swell_season_X'.", type: :invalid_parameters }, 18007 => %{ description: "Vault not found", type: :invalid_parameters }, 19000 => %{ description: "Maker program not found", type: :invalid_parameters }, 9000 => %{ description: "Order confirmation timeout", type: :invalid_order } }, error_codes: %{ -32000 => :rate_limited, -32100 => :rate_limited, -32600 => :invalid_parameters, -32601 => :invalid_parameters, -32602 => :invalid_order, -32603 => :invalid_order, -32700 => :invalid_parameters, 10000 => :invalid_parameters, 10001 => :invalid_parameters, 10002 => :invalid_parameters, 10003 => :invalid_parameters, 10004 => :invalid_order, 10005 => :invalid_parameters, 10006 => :invalid_parameters, 10007 => :invalid_parameters, 10008 => :invalid_parameters, 10009 => :invalid_parameters, 10010 => :invalid_order, 10011 => :insufficient_balance, 10012 => :insufficient_balance, 10013 => :exchange_error, 10014 => :exchange_error, 11000 => :insufficient_balance, 11002 => :invalid_order, 11003 => :invalid_order, 11004 => :invalid_order, 11005 => :invalid_order, 11006 => :order_not_found, 11007 => :invalid_order, 11008 => :invalid_order, 11009 => :invalid_order, 11010 => :invalid_order, 11011 => :invalid_order, 11012 => :invalid_order, 11013 => :invalid_order, 11014 => :invalid_order, 11015 => :invalid_order, 11016 => :invalid_order, 11017 => :invalid_order, 11018 => :invalid_order, 11019 => :invalid_order, 11020 => :insufficient_balance, 11021 => :invalid_order, 11022 => :invalid_order, 11023 => :invalid_order, 11024 => :invalid_order, 11025 => :invalid_order, 11026 => :invalid_parameters, 11027 => :invalid_order, 11028 => :invalid_order, 11050 => :invalid_order, 11051 => :invalid_order, 11052 => :invalid_order, 11053 => :invalid_order, 11054 => :invalid_order, 11055 => :invalid_order, 11100 => :invalid_order, 11101 => :invalid_order, 11102 => :invalid_order, 11103 => :invalid_order, 11104 => :invalid_order, 11105 => :invalid_order, 11106 => :invalid_order, 11107 => :invalid_order, 11200 => :invalid_order, 11201 => :invalid_order, 11202 => :invalid_order, 11203 => :invalid_order, 12000 => :invalid_order, 12001 => :invalid_order, 12002 => :invalid_parameters, 12003 => :invalid_parameters, 13000 => :invalid_parameters, 14000 => :invalid_parameters, 14001 => :invalid_order, 14002 => :invalid_parameters, 14008 => :invalid_parameters, 14009 => :invalid_parameters, 14010 => :invalid_parameters, 14011 => :invalid_parameters, 14012 => :invalid_parameters, 14013 => :invalid_parameters, 14014 => :invalid_order, 14015 => :invalid_parameters, 14016 => :invalid_parameters, 14017 => :invalid_parameters, 14018 => :invalid_parameters, 14019 => :invalid_parameters, 14020 => :invalid_parameters, 14021 => :invalid_parameters, 14022 => :invalid_credentials, 14023 => :invalid_order, 14024 => :invalid_parameters, 14025 => :invalid_parameters, 14026 => :invalid_parameters, 14027 => :invalid_credentials, 14028 => :invalid_parameters, 14029 => :invalid_credentials, 14030 => :invalid_parameters, 14031 => :invalid_credentials, 14032 => :invalid_parameters, 16000 => :invalid_credentials, 16001 => :invalid_credentials, 16100 => :invalid_credentials, 17000 => :invalid_parameters, 17001 => :invalid_parameters, 17002 => :invalid_parameters, 17003 => :invalid_parameters, 17004 => :invalid_parameters, 17005 => :invalid_parameters, 17006 => :invalid_parameters, 17007 => :invalid_parameters, 18000 => :invalid_parameters, 18001 => :invalid_parameters, 18002 => :invalid_parameters, 18003 => :invalid_parameters, 18004 => :invalid_parameters, 18005 => :invalid_parameters, 18006 => :invalid_parameters, 18007 => :invalid_parameters, 19000 => :invalid_parameters, 9000 => :invalid_order }, exceptions: %{ exact: %{ "-32000" => :rate_limit_exceeded, "-32100" => :rate_limit_exceeded, "-32600" => :bad_request, "-32601" => :bad_request, "-32602" => :invalid_order, "-32603" => :invalid_order, "-32700" => :bad_request, "10000" => :bad_request, "10001" => :bad_request, "10002" => :bad_request, "10003" => :bad_request, "10004" => :invalid_order, "10005" => :bad_request, "10006" => :bad_request, "10007" => :bad_request, "10008" => :bad_request, "10009" => :bad_request, "10010" => :invalid_order, "10011" => :insufficient_funds, "10012" => :insufficient_funds, "10013" => :exchange_error, "10014" => :exchange_error, "11000" => :insufficient_funds, "11002" => :invalid_order, "11003" => :invalid_order, "11004" => :invalid_order, "11005" => :invalid_order, "11006" => :order_not_found, "11007" => :invalid_order, "11008" => :invalid_order, "11009" => :invalid_order, "11010" => :invalid_order, "11011" => :invalid_order, "11012" => :invalid_order, "11013" => :invalid_order, "11014" => :invalid_order, "11015" => :invalid_order, "11016" => :invalid_order, "11017" => :invalid_order, "11018" => :invalid_order, "11019" => :invalid_order, "11020" => :insufficient_funds, "11021" => :invalid_order, "11022" => :invalid_order, "11023" => :invalid_order, "11024" => :invalid_order, "11025" => :invalid_order, "11026" => :bad_request, "11027" => :invalid_order, "11028" => :invalid_order, "11050" => :invalid_order, "11051" => :invalid_order, "11052" => :invalid_order, "11053" => :invalid_order, "11054" => :invalid_order, "11055" => :invalid_order, "11100" => :invalid_order, "11101" => :invalid_order, "11102" => :invalid_order, "11103" => :invalid_order, "11104" => :invalid_order, "11105" => :invalid_order, "11106" => :invalid_order, "11107" => :invalid_order, "11200" => :invalid_order, "11201" => :invalid_order, "11202" => :invalid_order, "11203" => :invalid_order, "12000" => :invalid_order, "12001" => :invalid_order, "12002" => :bad_request, "12003" => :bad_request, "13000" => :bad_request, "14000" => :bad_request, "14001" => :invalid_order, "14002" => :bad_request, "14008" => :bad_request, "14009" => :bad_request, "14010" => :bad_request, "14011" => :bad_request, "14012" => :bad_request, "14013" => :bad_request, "14014" => :invalid_order, "14015" => :bad_request, "14016" => :bad_request, "14017" => :bad_request, "14018" => :bad_request, "14019" => :bad_request, "14020" => :bad_request, "14021" => :bad_request, "14022" => :authentication_error, "14023" => :invalid_order, "14024" => :bad_request, "14025" => :bad_request, "14026" => :bad_request, "14027" => :authentication_error, "14028" => :bad_request, "14029" => :authentication_error, "14030" => :bad_request, "14031" => :authentication_error, "14032" => :bad_request, "16000" => :authentication_error, "16001" => :authentication_error, "16100" => :authentication_error, "17000" => :bad_request, "17001" => :bad_request, "17002" => :bad_request, "17003" => :bad_request, "17004" => :bad_request, "17005" => :bad_request, "17006" => :bad_request, "17007" => :bad_request, "18000" => :bad_request, "18001" => :bad_request, "18002" => :bad_request, "18003" => :bad_request, "18004" => :bad_request, "18005" => :bad_request, "18006" => :bad_request, "18007" => :bad_request, "19000" => :bad_request, "9000" => :invalid_order } }, exchange_options: %{ "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "deriveWalletAddress" => "", "id" => "0x0ad42b8e602c2d3d475ae52d678cf63d84ab2749", "networksById" => %{} }, extended_metadata: %{ fees_url: "https://docs.derive.xyz/reference/fees-1/", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/f835b95f-033a-43dd-b6bb-24e698fc498c", referral_url: "https://www.derive.xyz/invite/3VB0B" }, extracted_metadata: %{ ccxt_version: "4.5.42" }, features: nil, fees: nil, forward_aliases: nil, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (!response) {\n return undefined; // fallback to default error handler\n }\n const error = this.safeDict(response, 'error');\n if (error !== undefined) {\n const errorCode = this.safeString(error, 'code');\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_after: false, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: false, cancel_orders_for_symbols: false, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, close_all_positions: false, close_position: 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: false, 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: false, create_reduce_only_order_ws: false, create_stop_limit_order: false, create_stop_limit_order_ws: false, create_stop_loss_order: false, create_stop_loss_order_ws: false, create_stop_market_order: false, create_stop_market_order_ws: false, create_stop_order: false, create_stop_order_ws: false, create_take_profit_order: false, 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: false, 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: 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: true, 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: true, fetch_deposit_withdraw_fees: false, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: true, fetch_funding_interval: false, fetch_funding_intervals: false, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: false, 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: false, 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: false, 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: false, fetch_order_book: false, 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: false, fetch_position_a_d_l_rank: false, fetch_position_history: false, 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: false, 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: false, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: false, fetch_trading_fees: false, fetch_trading_fees_ws: false, fetch_trading_limits: false, fetch_transaction_fee: false, fetch_transaction_fees: false, fetch_transactions: false, fetch_transfer: 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: true, set_leverage: false, set_margin: false, set_margin_mode: false, set_position_mode: false, sign_in: false, spot: false, swap: false, 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: false, watch_bids_asks: false, watch_liquidations: false, watch_liquidations_for_symbols: false, watch_my_liquidations: false, watch_my_liquidations_for_symbols: false, watch_my_trades: true, watch_ohlcv: false, 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: false, watch_status: false, watch_ticker: true, watch_tickers: false, watch_trades: true, watch_trades_for_symbols: false, withdraw: false, ws: false }, http_config: nil, id: "derive", markets: nil, name: "derive", ohlcv_timestamp_resolution: :unknown, options: %{ "derive_wallet_address" => "", "id" => "0x0ad42b8e602c2d3d475ae52d678cf63d84ab2749" }, order_mappings: nil, param_mappings: %{ "limit" => "page_size", "since" => "from_timestamp", "symbol" => "instrument_name" }, parse_methods: [ %{ "comment" => nil, "examples" => [], "line_end" => 2484, "line_start" => 2462, "mappings" => [], "name" => "parseBalance", "signature" => "parseBalance (response): Balances", "source" => "parseBalance (response): Balances {\n const result: Dict = {\n 'info': response,\n };\n for (let i = 0; i < response.length; i++) {\n const subaccount = response[i];\n const collaterals = this.safeList (subaccount, 'collaterals', []);\n for (let j = 0; j < collaterals.length; j++) {\n const balance = collaterals[j];\n const code = this.safeCurrencyCode (this.safeString (balance, 'currency'));\n let account = this.safeDict (result, code);\n if (account === undefined) {\n account = this.account ();\n account['total'] = this.safeString (balance, 'amount');\n } else {\n const amount = this.safeString (balance, 'amount');\n account['total'] = Precise.stringAdd (account['total'], amount);\n }\n result[code] = account;\n }\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1138, "line_start" => 1115, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "interestRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "this.safeNumber (contract, 'fundingRate')" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "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" => "undefined" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n const symbol = this.safeString (contract, 'symbol');\n const fundingTimestamp = this.safeInteger (contract, 'timestamp');\n return {\n 'info': contract,\n 'symbol': symbol,\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\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': undefined,\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"instrument_name\": \"BTC-PERP\",\n \"timestamp\": 1738065307565,\n \"funding\": \"0\",\n \"pnl\": \"-0.39547479770461644\"\n }" ], "line_end" => 2392, "line_start" => 2368, "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" => "undefined" }, %{ "comment" => nil, "key" => "rate", "value" => "rate" } ], "name" => "parseIncome", "signature" => "parseIncome (income, market: Market = undefined)", "source" => "parseIncome (income, market: Market = undefined) {\n //\n // {\n // \"instrument_name\": \"BTC-PERP\",\n // \"timestamp\": 1738065307565,\n // \"funding\": \"0\",\n // \"pnl\": \"-0.39547479770461644\"\n // }\n //\n const marketId = this.safeString (income, 'instrument_name');\n const symbol = this.safeSymbol (marketId, market);\n const rate = this.safeString (income, 'funding');\n const code = this.safeCurrencyCode ('USDC');\n const timestamp = this.safeInteger (income, 'timestamp');\n return {\n 'info': income,\n 'symbol': symbol,\n 'code': code,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': undefined,\n 'amount': undefined,\n 'rate': rate,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 739, "line_start" => 636, "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" => "spot" }, %{ "comment" => nil, "key" => "margin", "value" => "margin" }, %{ "comment" => nil, "key" => "swap", "value" => "swap" }, %{ "comment" => nil, "key" => "future", "value" => "false" }, %{ "comment" => nil, "key" => "option", "value" => "option" }, %{ "comment" => nil, "key" => "active", "value" => "this.safeBool (market, 'is_active')" }, %{ "comment" => nil, "key" => "contract", "value" => "(swap || option)" }, %{ "comment" => nil, "key" => "linear", "value" => "linear" }, %{ "comment" => nil, "key" => "inverse", "value" => "inverse" }, %{ "comment" => nil, "key" => "contractSize", "value" => "(spot) ? undefined : 1" }, %{ "comment" => nil, "key" => "expiry", "value" => "expiry" }, %{ "comment" => nil, "key" => "expiryDatetime", "value" => "this.iso8601 (expiry)" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (market, 'taker_fee_rate')" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (market, 'maker_fee_rate')" }, %{ "comment" => nil, "key" => "strike", "value" => "strike" }, %{ "comment" => nil, "key" => "optionType", "value" => "optionType" }, %{ "comment" => nil, "key" => "precision", "value" => "{\n 'amount': this.safeNumber (market, 'amount_step'),\n 'price': this.safeNumber (market, 'tick_size'),\n }" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': this.safeNumber (market, 'minimum_amount'),\n 'max': this.safeNumber (market, 'maximum_amount'),\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': undefined,\n },\n }" }, %{ "comment" => nil, "key" => "created", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "market" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (market, 'amount_step')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (market, 'tick_size')" }, %{ "comment" => nil, "key" => "leverage", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "amount", "value" => "{\n 'min': this.safeNumber (market, 'minimum_amount'),\n 'max': this.safeNumber (market, 'maximum_amount'),\n }" }, %{ "comment" => nil, "key" => "price", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "cost", "value" => "{\n 'min': undefined,\n 'max': undefined,\n }" }, %{ "comment" => nil, "key" => "min", "value" => "undefined" }, %{ "comment" => nil, "key" => "max", "value" => "undefined" } ], "name" => "parseMarket", "signature" => "parseMarket (market: Dict): Market", "source" => "parseMarket (market: Dict): Market {\n const type = this.safeString (market, 'instrument_type');\n let marketType: MarketType;\n let spot = false;\n let margin = true;\n let swap = false;\n let option = false;\n let linear: Bool = undefined;\n let inverse: Bool = undefined;\n const baseId = this.safeString (market, 'base_currency');\n const quoteId = this.safeString (market, 'quote_currency');\n const base = this.safeCurrencyCode (baseId);\n const quote = this.safeCurrencyCode (quoteId);\n const marketId = this.safeString (market, 'instrument_name');\n let symbol = base + '/' + quote;\n let settleId: Str = undefined;\n let settle: Str = undefined;\n let expiry: Num = undefined;\n let strike: Num = undefined;\n let optionType: Str = undefined;\n let optionLetter: Str = undefined;\n if (type === 'erc20') {\n spot = true;\n marketType = 'spot';\n } else if (type === 'perp') {\n margin = false;\n settleId = 'USDC';\n settle = this.safeCurrencyCode (settleId);\n symbol = base + '/' + quote + ':' + settle;\n swap = true;\n linear = true;\n inverse = false;\n marketType = 'swap';\n } else if (type === 'option') {\n settleId = 'USDC';\n settle = this.safeCurrencyCode (settleId);\n margin = false;\n option = true;\n marketType = 'option';\n const optionDetails = this.safeDict (market, 'option_details');\n expiry = this.safeTimestamp (optionDetails, 'expiry');\n strike = this.safeInteger (optionDetails, 'strike');\n optionLetter = this.safeString (optionDetails, 'option_type');\n symbol = base + '/' + quote + ':' + settle + '-' + this.yymmdd (expiry) + '-' + this.numberToString (strike) + '-' + optionLetter;\n if (optionLetter === 'P') {\n optionType = 'put';\n } else {\n optionType = 'call';\n }\n linear = true;\n inverse = false;\n }\n return this.safeMarketStructure ({\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': spot,\n 'margin': margin,\n 'swap': swap,\n 'future': false,\n 'option': option,\n 'active': this.safeBool (market, 'is_active'),\n 'contract': (swap || option),\n 'linear': linear,\n 'inverse': inverse,\n 'contractSize': (spot) ? undefined : 1,\n 'expiry': expiry,\n 'expiryDatetime': this.iso8601 (expiry),\n 'taker': this.safeNumber (market, 'taker_fee_rate'),\n 'maker': this.safeNumber (market, 'maker_fee_rate'),\n 'strike': strike,\n 'optionType': optionType,\n 'precision': {\n 'amount': this.safeNumber (market, 'amount_step'),\n 'price': this.safeNumber (market, 'tick_size'),\n },\n 'limits': {\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'amount': {\n 'min': this.safeNumber (market, 'minimum_amount'),\n 'max': this.safeNumber (market, 'maximum_amount'),\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': undefined,\n },\n },\n 'created': undefined,\n 'info': market,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"subaccount_id\": 130837,\n \"nonce\": 1736923517552,\n \"module\": \"0x87F2863866D85E3192a35A73b388BD625D83f2be\",\n \"expiry\": 86400,\n \"owner\": \"0x108b9aF9279a525b8A8AeAbE7AC2bA925Bc50075\",\n \"signer\": \"0x108b9aF9279a525b8A8AeAbE7AC2bA925Bc50075\",\n \"signature\": \"0xaa4f42b2f3da33c668fa703ea872d4c3a6b55aca66025b5119e3bebb6679fe2e2794638db51dcace21fc39a498047835994f07eb59f311bb956ce057e66793d1c\",\n \"data\": {\n \"asset\": \"0xAFB6Bb95cd70D5367e2C39e9dbEb422B9815339D\",\n \"sub_id\": 0,\n \"limit_price\": \"10000\",\n \"desired_amount\": \"0.001\",\n \"worst_fee\": \"0\",\n \"recipient_id\": 130837,\n \"is_bid\": true,\n \"trade_id\": \"\"\n }\n }", "{\n \"subaccount_id\": 130837,\n \"order_id\": \"96349ebb-7d46-43ae-81c7-7ab390444293\",\n \"instrument_name\": \"BTC-PERP\",\n \"direction\": \"buy\",\n \"label\": \"\",\n \"quote_id\": null,\n \"creation_timestamp\": 1737467576257,\n \"last_update_timestamp\": 1737467576257,\n \"limit_price\": \"10000\",\n \"amount\": \"0.01\",\n \"filled_amount\": \"0\",\n \"average_price\": \"0\",\n \"order_fee\": \"0\",\n \"order_type\": \"limit\",\n \"time_in_force\": \"gtc\",\n \"order_status\": \"open\",\n \"max_fee\": \"210\",\n \"signature_expiry_sec\": 1737468175989,\n \"nonce\": 1737467575989,\n \"signer\": \"0x30CB7B06AdD6749BbE146A6827502B8f2a79269A\",\n \"signature\": \"0xd1ca49df1fa06bd805bb59b132ff6c0de29bf973a3e01705abe0a01cc956e4945ed9eb99ab68f3df4c037908113cac5a5bfc3a954a0b7103cdab285962fa6a51c\",\n \"cancel_reason\": \"\",\n \"mmp\": false,\n \"is_transfer\": false,\n \"replaced_order_id\": null,\n \"trigger_type\": null,\n \"trigger_price_type\": null,\n \"trigger_price\": null,\n \"trigger_reject_message\": null\n }" ], "line_end" => 1987, "line_start" => 1864, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "orderId" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString (order, 'label')" }, %{ "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" => "orderType" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "this.parseTimeInForce (timeInForce)" }, %{ "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" => "undefined" }, %{ "comment" => nil, "key" => "cost", "value" => "undefined" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'cost': fee,\n 'currency': 'USDC',\n }" }, %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "cost", "value" => "fee" }, %{ "comment" => nil, "key" => "currency", "value" => "'USDC'" } ], "name" => "parseOrder", "signature" => "parseOrder (rawOrder: Dict, market: Market = undefined): Order", "source" => "parseOrder (rawOrder: Dict, market: Market = undefined): Order {\n //\n // {\n // \"subaccount_id\": 130837,\n // \"nonce\": 1736923517552,\n // \"module\": \"0x87F2863866D85E3192a35A73b388BD625D83f2be\",\n // \"expiry\": 86400,\n // \"owner\": \"0x108b9aF9279a525b8A8AeAbE7AC2bA925Bc50075\",\n // \"signer\": \"0x108b9aF9279a525b8A8AeAbE7AC2bA925Bc50075\",\n // \"signature\": \"0xaa4f42b2f3da33c668fa703ea872d4c3a6b55aca66025b5119e3bebb6679fe2e2794638db51dcace21fc39a498047835994f07eb59f311bb956ce057e66793d1c\",\n // \"data\": {\n // \"asset\": \"0xAFB6Bb95cd70D5367e2C39e9dbEb422B9815339D\",\n // \"sub_id\": 0,\n // \"limit_price\": \"10000\",\n // \"desired_amount\": \"0.001\",\n // \"worst_fee\": \"0\",\n // \"recipient_id\": 130837,\n // \"is_bid\": true,\n // \"trade_id\": \"\"\n // }\n // }\n // {\n // \"subaccount_id\": 130837,\n // \"order_id\": \"96349ebb-7d46-43ae-81c7-7ab390444293\",\n // \"instrument_name\": \"BTC-PERP\",\n // \"direction\": \"buy\",\n // \"label\": \"\",\n // \"quote_id\": null,\n // \"creation_timestamp\": 1737467576257,\n // \"last_update_timestamp\": 1737467576257,\n // \"limit_price\": \"10000\",\n // \"amount\": \"0.01\",\n // \"filled_amount\": \"0\",\n // \"average_price\": \"0\",\n // \"order_fee\": \"0\",\n // \"order_type\": \"limit\",\n // \"time_in_force\": \"gtc\",\n // \"order_status\": \"open\",\n // \"max_fee\": \"210\",\n // \"signature_expiry_sec\": 1737468175989,\n // \"nonce\": 1737467575989,\n // \"signer\": \"0x30CB7B06AdD6749BbE146A6827502B8f2a79269A\",\n // \"signature\": \"0xd1ca49df1fa06bd805bb59b132ff6c0de29bf973a3e01705abe0a01cc956e4945ed9eb99ab68f3df4c037908113cac5a5bfc3a954a0b7103cdab285962fa6a51c\",\n // \"cancel_reason\": \"\",\n // \"mmp\": false,\n // \"is_transfer\": false,\n // \"replaced_order_id\": null,\n // \"trigger_type\": null,\n // \"trigger_price_type\": null,\n // \"trigger_price\": null,\n // \"trigger_reject_message\": null\n // }\n let order = this.safeDict (rawOrder, 'data');\n if (order === undefined) {\n order = rawOrder;\n }\n const timestamp = this.safeInteger2 (rawOrder, 'creation_timestamp', 'nonce');\n const orderId = this.safeString (order, 'order_id');\n const marketId = this.safeString (order, 'instrument_name');\n if (marketId !== undefined) {\n market = this.safeMarket (marketId, market);\n }\n const symbol = market['symbol'];\n const price = this.safeString (order, 'limit_price');\n const average = this.safeString (order, 'average_price');\n const amount = this.safeString (order, 'desired_amount');\n const filled = this.safeString (order, 'filled_amount');\n const fee = this.safeString (order, 'order_fee');\n const orderType = this.safeStringLower (order, 'order_type');\n const isBid = this.safeBool (order, 'is_bid');\n let side = this.safeString (order, 'direction');\n if (side === undefined) {\n if (isBid) {\n side = 'buy';\n } else {\n side = 'sell';\n }\n }\n const triggerType = this.safeString (order, 'trigger_type');\n let stopLossPrice = undefined;\n let takeProfitPrice = undefined;\n let triggerPrice = undefined;\n if (triggerType !== undefined) {\n triggerPrice = this.safeString (order, 'trigger_price');\n if (triggerType === 'stoploss') {\n stopLossPrice = triggerPrice;\n } else {\n takeProfitPrice = triggerPrice;\n }\n }\n const lastUpdateTimestamp = this.safeInteger (rawOrder, 'last_update_timestamp');\n const status = this.safeString (order, 'order_status');\n const timeInForce = this.safeString (order, 'time_in_force');\n return this.safeOrder ({\n 'id': orderId,\n 'clientOrderId': this.safeString (order, 'label'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': undefined,\n 'lastUpdateTimestamp': lastUpdateTimestamp,\n 'status': this.parseOrderStatus (status),\n 'symbol': symbol,\n 'type': orderType,\n 'timeInForce': this.parseTimeInForce (timeInForce),\n 'postOnly': undefined, // handled in safeOrder\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': undefined,\n 'cost': undefined,\n 'trades': undefined,\n 'fee': {\n 'cost': fee,\n 'currency': 'USDC',\n },\n 'info': order,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1862, "line_start" => 1850, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n if (status !== undefined) {\n const statuses: Dict = {\n 'open': 'open',\n 'untriggered': 'open',\n 'filled': 'closed',\n 'cancelled': 'canceled',\n 'expired': 'rejected',\n };\n return this.safeString (statuses, status, status);\n }\n return status;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"instrument_type\": \"perp\",\n \"instrument_name\": \"BTC-PERP\",\n \"amount\": \"-0.02\",\n \"average_price\": \"102632.9105389869500088\",\n \"realized_pnl\": \"0\",\n \"unrealized_pnl\": \"-2.6455959784245548835819950103759765625\",\n \"total_fees\": \"2.255789220260999824\",\n \"average_price_excl_fees\": \"102745.7\",\n \"realized_pnl_excl_fees\": \"0\",\n \"unrealized_pnl_excl_fees\": \"-0.3898067581635550595819950103759765625\",\n \"net_settlements\": \"-4.032902047219498639\",\n \"cumulative_funding\": \"-0.004677736347850093\",\n \"pending_funding\": \"0\",\n \"mark_price\": \"102765.190337908177752979099750518798828125\",\n \"index_price\": \"102767.657193800017641472\",\n \"delta\": \"1\",\n \"gamma\": \"0\",\n \"vega\": \"0\",\n \"theta\": \"0\",\n \"mark_value\": \"1.38730606879471451975405216217041015625\",\n \"maintenance_margin\": \"-101.37788426911356509663164615631103515625\",\n \"initial_margin\": \"-132.2074413704858670826070010662078857421875\",\n \"open_orders_margin\": \"264.116085900726830004714429378509521484375\",\n \"leverage\": \"8.6954476205089299495699106539379941746377322586618\",\n \"liquidation_price\": \"109125.705451984322280623018741607666015625\",\n \"creation_timestamp\": 1738065303840\n }" ], "line_end" => 2286, "line_start" => 2211, "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" => "this.safeString (position, 'initial_margin')" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "this.safeString (position, 'maintenance_margin')" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "notional", "value" => "this.parseNumber (notional)" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.safeNumber (position, 'leverage')" }, %{ "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, 'liquidation_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" => "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 // \"instrument_type\": \"perp\",\n // \"instrument_name\": \"BTC-PERP\",\n // \"amount\": \"-0.02\",\n // \"average_price\": \"102632.9105389869500088\",\n // \"realized_pnl\": \"0\",\n // \"unrealized_pnl\": \"-2.6455959784245548835819950103759765625\",\n // \"total_fees\": \"2.255789220260999824\",\n // \"average_price_excl_fees\": \"102745.7\",\n // \"realized_pnl_excl_fees\": \"0\",\n // \"unrealized_pnl_excl_fees\": \"-0.3898067581635550595819950103759765625\",\n // \"net_settlements\": \"-4.032902047219498639\",\n // \"cumulative_funding\": \"-0.004677736347850093\",\n // \"pending_funding\": \"0\",\n // \"mark_price\": \"102765.190337908177752979099750518798828125\",\n // \"index_price\": \"102767.657193800017641472\",\n // \"delta\": \"1\",\n // \"gamma\": \"0\",\n // \"vega\": \"0\",\n // \"theta\": \"0\",\n // \"mark_value\": \"1.38730606879471451975405216217041015625\",\n // \"maintenance_margin\": \"-101.37788426911356509663164615631103515625\",\n // \"initial_margin\": \"-132.2074413704858670826070010662078857421875\",\n // \"open_orders_margin\": \"264.116085900726830004714429378509521484375\",\n // \"leverage\": \"8.6954476205089299495699106539379941746377322586618\",\n // \"liquidation_price\": \"109125.705451984322280623018741607666015625\",\n // \"creation_timestamp\": 1738065303840\n // }\n //\n const contract = this.safeString (position, 'instrument_name');\n market = this.safeMarket (contract, market);\n let size = this.safeString (position, 'amount');\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, 'creation_timestamp');\n const unrealisedPnl = this.safeString (position, 'unrealized_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': this.safeString (position, 'initial_margin'),\n 'initialMarginPercentage': undefined,\n 'maintenanceMargin': this.safeString (position, 'maintenance_margin'),\n 'maintenanceMarginPercentage': undefined,\n 'entryPrice': undefined,\n 'notional': this.parseNumber (notional),\n 'leverage': this.safeNumber (position, 'leverage'),\n 'unrealizedPnl': this.parseNumber (unrealisedPnl),\n 'contracts': this.parseNumber (size),\n 'contractSize': this.parseNumber (contractSize),\n 'marginRatio': undefined,\n 'liquidationPrice': this.safeNumber (position, 'liquidation_price'),\n 'markPrice': this.parseNumber (markPrice),\n 'lastPrice': undefined,\n 'collateral': undefined,\n 'marginMode': undefined,\n 'side': side,\n 'percentage': undefined,\n 'hedged': undefined,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"instrument_type\": \"perp\",\n \"instrument_name\": \"BTC-PERP\",\n \"scheduled_activation\": 1701840228,\n \"scheduled_deactivation\": 9223372036854776000,\n \"is_active\": true,\n \"tick_size\": \"0.1\",\n \"minimum_amount\": \"0.01\",\n \"maximum_amount\": \"10000\",\n \"amount_step\": \"0.001\",\n \"mark_price_fee_rate_cap\": \"0\",\n \"maker_fee_rate\": \"0.00005\",\n \"taker_fee_rate\": \"0.0003\",\n \"base_fee\": \"0.1\",\n \"base_currency\": \"BTC\",\n \"quote_currency\": \"USD\",\n \"option_details\": null,\n \"perp_details\": {\n \"index\": \"BTC-USD\",\n \"max_rate_per_hour\": \"0.004\",\n \"min_rate_per_hour\": \"-0.004\",\n \"static_interest_rate\": \"0.0000125\",\n \"aggregate_funding\": \"10512.580833189805742522\",\n \"funding_rate\": \"-0.000022223906766867\"\n },\n \"erc20_details\": null,\n \"base_asset_address\": \"0xDBa83C0C654DB1cd914FA2710bA743e925B53086\",\n \"base_asset_sub_id\": \"0\",\n \"pro_rata_fraction\": \"0\",\n \"fifo_min_allocation\": \"0\",\n \"pro_rata_amount_step\": \"0.1\",\n \"best_ask_amount\": \"0.012\",\n \"best_ask_price\": \"99567.9\",\n \"best_bid_amount\": \"0.129\",\n \"best_bid_price\": \"99554.5\",\n \"five_percent_bid_depth\": \"11.208\",\n \"five_percent_ask_depth\": \"11.42\",\n \"option_pricing\": null,\n \"index_price\": \"99577.2\",\n \"mark_price\": \"99543.642926357933902181684970855712890625\",\n \"stats\": {\n \"contract_volume\": \"464.712\",\n \"num_trades\": \"10681\",\n \"open_interest\": \"72.804739389481989861\",\n \"high\": \"99519.1\",\n \"low\": \"97254.1\",\n \"percent_change\": \"0.0128\",\n \"usd_change\": \"1258.1\"\n },\n \"timestamp\": 1736140984000,\n \"min_price\": \"97591.2\",\n \"max_price\": \"101535.1\"\n }" ], "line_end" => 906, "line_start" => 821, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "this.safeString (stats, 'high')" }, %{ "comment" => nil, "key" => "low", "value" => "this.safeString (stats, 'low')" }, %{ "comment" => nil, "key" => "bid", "value" => "this.safeString (ticker, 'best_bid_price')" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "this.safeString (ticker, 'best_bid_amount')" }, %{ "comment" => nil, "key" => "ask", "value" => "this.safeString (ticker, 'best_ask_price')" }, %{ "comment" => nil, "key" => "askVolume", "value" => "this.safeString (ticker, 'best_ask_amount')" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "undefined" }, %{ "comment" => nil, "key" => "close", "value" => "undefined" }, %{ "comment" => nil, "key" => "last", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousClose", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "change" }, %{ "comment" => nil, "key" => "percentage", "value" => "Precise.stringMul (change, '100')" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "undefined" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "undefined" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeString (ticker, 'index_price')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeString (ticker, 'mark_price')" }, %{ "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 // \"instrument_type\": \"perp\",\n // \"instrument_name\": \"BTC-PERP\",\n // \"scheduled_activation\": 1701840228,\n // \"scheduled_deactivation\": 9223372036854776000,\n // \"is_active\": true,\n // \"tick_size\": \"0.1\",\n // \"minimum_amount\": \"0.01\",\n // \"maximum_amount\": \"10000\",\n // \"amount_step\": \"0.001\",\n // \"mark_price_fee_rate_cap\": \"0\",\n // \"maker_fee_rate\": \"0.00005\",\n // \"taker_fee_rate\": \"0.0003\",\n // \"base_fee\": \"0.1\",\n // \"base_currency\": \"BTC\",\n // \"quote_currency\": \"USD\",\n // \"option_details\": null,\n // \"perp_details\": {\n // \"index\": \"BTC-USD\",\n // \"max_rate_per_hour\": \"0.004\",\n // \"min_rate_per_hour\": \"-0.004\",\n // \"static_interest_rate\": \"0.0000125\",\n // \"aggregate_funding\": \"10512.580833189805742522\",\n // \"funding_rate\": \"-0.000022223906766867\"\n // },\n // \"erc20_details\": null,\n // \"base_asset_address\": \"0xDBa83C0C654DB1cd914FA2710bA743e925B53086\",\n // \"base_asset_sub_id\": \"0\",\n // \"pro_rata_fraction\": \"0\",\n // \"fifo_min_allocation\": \"0\",\n // \"pro_rata_amount_step\": \"0.1\",\n // \"best_ask_amount\": \"0.012\",\n // \"best_ask_price\": \"99567.9\",\n // \"best_bid_amount\": \"0.129\",\n // \"best_bid_price\": \"99554.5\",\n // \"five_percent_bid_depth\": \"11.208\",\n // \"five_percent_ask_depth\": \"11.42\",\n // \"option_pricing\": null,\n // \"index_price\": \"99577.2\",\n // \"mark_price\": \"99543.642926357933902181684970855712890625\",\n // \"stats\": {\n // \"contract_volume\": \"464.712\",\n // \"num_trades\": \"10681\",\n // \"open_interest\": \"72.804739389481989861\",\n // \"high\": \"99519.1\",\n // \"low\": \"97254.1\",\n // \"percent_change\": \"0.0128\",\n // \"usd_change\": \"1258.1\"\n // },\n // \"timestamp\": 1736140984000,\n // \"min_price\": \"97591.2\",\n // \"max_price\": \"101535.1\"\n // }\n //\n const marketId = this.safeString (ticker, 'instrument_name');\n const timestamp = this.safeIntegerOmitZero (ticker, 'timestamp');\n const symbol = this.safeSymbol (marketId, market);\n const stats = this.safeDict (ticker, 'stats');\n const change = this.safeString (stats, 'percent_change');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': this.safeString (stats, 'high'),\n 'low': this.safeString (stats, 'low'),\n 'bid': this.safeString (ticker, 'best_bid_price'),\n 'bidVolume': this.safeString (ticker, 'best_bid_amount'),\n 'ask': this.safeString (ticker, 'best_ask_price'),\n 'askVolume': this.safeString (ticker, 'best_ask_amount'),\n 'vwap': undefined,\n 'open': undefined,\n 'close': undefined,\n 'last': undefined,\n 'previousClose': undefined,\n 'change': change,\n 'percentage': Precise.stringMul (change, '100'),\n 'average': undefined,\n 'baseVolume': undefined,\n 'quoteVolume': undefined,\n 'indexPrice': this.safeString (ticker, 'index_price'),\n 'markPrice': this.safeString (ticker, 'mark_price'),\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1848, "line_start" => 1840, "mappings" => [], "name" => "parseTimeInForce", "signature" => "parseTimeInForce (timeInForce: Str)", "source" => "parseTimeInForce (timeInForce: Str) {\n const timeInForces: Dict = {\n 'ioc': 'IOC',\n 'fok': 'FOK',\n 'gtc': 'GTC',\n 'post_only': 'PO',\n };\n return this.safeString (timeInForces, timeInForce, undefined);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"subaccount_id\": 130837,\n \"order_id\": \"30c48194-8d48-43ac-ad00-0d5ba29eddc9\",\n \"instrument_name\": \"BTC-PERP\",\n \"direction\": \"sell\",\n \"label\": \"test1234\",\n \"quote_id\": null,\n \"trade_id\": \"f8a30740-488c-4c2d-905d-e17057bafde1\",\n \"timestamp\": 1738065303708,\n \"mark_price\": \"102740.137375457314192317\",\n \"index_price\": \"102741.553409299981533184\",\n \"trade_price\": \"102700.6\",\n \"trade_amount\": \"0.01\",\n \"liquidity_role\": \"taker\",\n \"realized_pnl\": \"0\",\n \"realized_pnl_excl_fees\": \"0\",\n \"is_transfer\": false,\n \"tx_status\": \"settled\",\n \"trade_fee\": \"1.127415534092999815\",\n \"tx_hash\": \"0xc55df1f07330faf86579bd8a6385391fbe9e73089301149d8550e9d29c9ead74\",\n \"transaction_id\": \"e18b9426-3fa5-41bb-99d3-8b54fb4d51bb\"\n }" ], "line_end" => 1027, "line_start" => 980, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "'USDC'" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeString (trade, 'trade_fee')" }, %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (trade, 'trade_id')" }, %{ "comment" => nil, "key" => "order", "value" => "this.safeString (trade, 'order_id')" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "side", "value" => "this.safeStringLower (trade, 'direction')" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "this.safeString (trade, 'liquidity_role')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeString (trade, 'trade_price')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeString (trade, 'trade_amount')" }, %{ "comment" => nil, "key" => "cost", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // {\n // \"subaccount_id\": 130837,\n // \"order_id\": \"30c48194-8d48-43ac-ad00-0d5ba29eddc9\",\n // \"instrument_name\": \"BTC-PERP\",\n // \"direction\": \"sell\",\n // \"label\": \"test1234\",\n // \"quote_id\": null,\n // \"trade_id\": \"f8a30740-488c-4c2d-905d-e17057bafde1\",\n // \"timestamp\": 1738065303708,\n // \"mark_price\": \"102740.137375457314192317\",\n // \"index_price\": \"102741.553409299981533184\",\n // \"trade_price\": \"102700.6\",\n // \"trade_amount\": \"0.01\",\n // \"liquidity_role\": \"taker\",\n // \"realized_pnl\": \"0\",\n // \"realized_pnl_excl_fees\": \"0\",\n // \"is_transfer\": false,\n // \"tx_status\": \"settled\",\n // \"trade_fee\": \"1.127415534092999815\",\n // \"tx_hash\": \"0xc55df1f07330faf86579bd8a6385391fbe9e73089301149d8550e9d29c9ead74\",\n // \"transaction_id\": \"e18b9426-3fa5-41bb-99d3-8b54fb4d51bb\"\n // }\n //\n const marketId = this.safeString (trade, 'instrument_name');\n const symbol = this.safeSymbol (marketId, market);\n const timestamp = this.safeInteger (trade, 'timestamp');\n const fee = {\n 'currency': 'USDC',\n 'cost': this.safeString (trade, 'trade_fee'),\n };\n return this.safeTrade ({\n 'info': trade,\n 'id': this.safeString (trade, 'trade_id'),\n 'order': this.safeString (trade, 'order_id'),\n 'symbol': symbol,\n 'side': this.safeStringLower (trade, 'direction'),\n 'type': undefined,\n 'takerOrMaker': this.safeString (trade, 'liquidity_role'),\n 'price': this.safeString (trade, 'trade_price'),\n 'amount': this.safeString (trade, 'trade_amount'),\n 'cost': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fee': fee,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"timestamp\": 1736860533599,\n \"transaction_id\": \"f2069395-ec00-49f5-925a-87202a5d240f\",\n \"asset\": \"ETH\",\n \"amount\": \"0.1\",\n \"tx_status\": \"settled\",\n \"tx_hash\": \"0xeda21a315c59302a19c42049b4cef05a10b685302b6cc3edbaf49102d91166d4\",\n \"error_log\": {}\n }" ], "line_end" => 2620, "line_start" => 2580, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "txid", "value" => "txId" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "address", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "tag", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "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, 'tx_status'))" }, %{ "comment" => nil, "key" => "updated", "value" => "undefined" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" }, %{ "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 //\n // {\n // \"timestamp\": 1736860533599,\n // \"transaction_id\": \"f2069395-ec00-49f5-925a-87202a5d240f\",\n // \"asset\": \"ETH\",\n // \"amount\": \"0.1\",\n // \"tx_status\": \"settled\",\n // \"tx_hash\": \"0xeda21a315c59302a19c42049b4cef05a10b685302b6cc3edbaf49102d91166d4\",\n // \"error_log\": {}\n // }\n //\n const code = this.safeString (transaction, 'asset');\n const timestamp = this.safeInteger (transaction, 'timestamp');\n let txId = this.safeString (transaction, 'tx_hash');\n if (txId === '0x0') {\n txId = undefined;\n }\n return {\n 'info': transaction,\n 'id': undefined,\n 'txid': txId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'address': undefined,\n 'addressFrom': undefined,\n 'addressTo': undefined,\n 'tag': undefined,\n 'tagFrom': undefined,\n 'tagTo': undefined,\n 'type': undefined,\n 'amount': this.safeNumber (transaction, 'amount'),\n 'currency': code,\n 'status': this.parseTransactionStatus (this.safeString (transaction, 'tx_status')),\n 'updated': undefined,\n 'comment': undefined,\n 'internal': undefined,\n 'fee': undefined,\n 'network': undefined,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2628, "line_start" => 2622, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: Str)", "source" => "parseTransactionStatus (status: Str) {\n const statuses: Dict = {\n 'settled': 'ok',\n 'reverted': 'failed',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1180, "line_start" => 1178, "mappings" => [], "name" => "parseUnits", "signature" => "parseUnits (num: string, dec = '1000000000000000000')", "source" => "parseUnits (num: string, dec = '1000000000000000000') {\n return Precise.stringMul (num, dec);\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 50, period: 1000, requests: 20, rolling_window_size: 60000 }, raw_endpoints: %{ private: [], public: [] }, required_credentials: %{ api_key: false, password: false, secret: false, uid: false }, requires_eddsa: false, response_error: nil, signing: %{ confidence: :medium, pattern: :hmac_sha256_headers, signature_header: "X-LyraSignature", timestamp_header: "X-LyraTimestamp" }, spec_format_version: 2, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ option: %{ base: "SOL", base_id: "SOL", case: :upper, contract: true, contract_size: 1, expiry: 1777017600000, expiry_datetime: "2026-04-24T08:00:00.000Z", id: "SOL-20260424-95-P", inverse: false, limits: %{ "amount" => %{ "max" => 100000, "min" => 1 }, "cost" => %{}, "leverage" => %{}, "price" => %{} }, linear: true, maker: 0.0001, precision: %{ "amount" => 0.1, "price" => 0.1 }, quote: "USDC", quote_id: "USDC", separator: "-", settle: "USDC", settle_id: "USDC", symbol: "SOL/USDC:USDC-260424-95-P", taker: 0.0003 }, precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 1000, "min" => 0.1 }, "cost" => %{}, "price" => %{} }, sample_precision: %{ "amount" => 0.01, "price" => 0.01 }, spot: %{ base: "WSTETH", base_id: "WSTETH", case: :upper, contract: false, id: "WSTETH-USDC", limits: %{ "amount" => %{ "max" => 1000, "min" => 0.1 }, "cost" => %{}, "leverage" => %{}, "price" => %{} }, maker: 0.0015, precision: %{ "amount" => 0.01, "price" => 0.01 }, quote: "USDC", quote_id: "USDC", separator: "-", symbol: "WSTETH/USDC", taker: 0.0015 }, swap: %{ base: "XRP", base_id: "XRP", case: :upper, contract: true, contract_size: 1, id: "XRP-PERP", inverse: false, limits: %{ "amount" => %{ "max" => 1000000, "min" => 10 }, "cost" => %{}, "leverage" => %{}, "price" => %{} }, linear: true, maker: 0.0001, precision: %{ "amount" => 0.1, "price" => 1.0e-5 }, quote: "USD", quote_id: "USD", separator: "-", settle: "USDC", settle_id: "USDC", symbol: "XRP/USD:USDC", taker: 0.0003 } }, symbol_patterns: %{ option: %{ case: :upper, component_order: [ :base, :date, :strike, :type ], date_format: :yyyymmdd, pattern: :option_unknown, prefix: nil, separator: "-", suffix: nil }, spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :dash_upper, prefix: nil, separator: "-", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :suffix_perp, prefix: nil, separator: "", suffix: "-PERP" } }, timeframes: %{ "12h" => "12h", "15m" => "15m", "1M" => "1M", "1d" => "1d", "1h" => "1h", "1m" => "1m", "1w" => "1w", "2h" => "2h", "30m" => "30m", "3d" => "3d", "3m" => "3m", "4h" => "4h", "5m" => "5m", "8h" => "8h" }, url_strategy: %{ detected_from: "fallback", pattern: :no_prefix, prefix: nil }, urls: %{ api: "https://api.lyra.finance/public", api_sections: %{ "private" => "https://api.lyra.finance/private", "public" => "https://api.lyra.finance/public" }, doc: "https://docs.derive.xyz/docs/", other: nil, sandbox: %{ "private" => "https://api-demo.lyra.finance/private", "public" => "https://api-demo.lyra.finance/public" }, www: "https://www.derive.xyz/" }, version: "v1", ws: %{ auth: %{ algorithm: :sha256, encoding: :hex, market_specific: false, message_format: :op_args, op_field: "op", op_value: "auth", pattern: :generic_hmac, payload_format: "custom", requires_passphrase: false, timestamp_unit: :milliseconds }, channel_templates: %{ watch_my_trades: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :method_params_subscribe }, watch_order_book: %{ channel_name: "orderbook", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :method_params_subscribe, separator: "." }, watch_orders: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :method_params_subscribe }, watch_private: %{ auth_required: true, market_id_format: :native, params: [], pattern: :method_params_subscribe }, watch_public: %{ market_id_format: :native, params: [], pattern: :method_params_subscribe }, watch_ticker: %{ channel_name: "ticker", market_id_format: :native, params: [], pattern: :method_params_subscribe, separator: "." }, watch_trades: %{ channel_name: "trades", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :method_params_subscribe, separator: "." } }, has: %{ watch_balance: false, watch_bids_asks: false, watch_liquidations: nil, watch_liquidations_for_symbols: nil, watch_my_liquidations: nil, watch_my_liquidations_for_symbols: nil, watch_my_trades: true, watch_ohlcv: false, 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: false, watch_status: nil, watch_ticker: true, watch_tickers: false, watch_trades: true, watch_trades_for_symbols: false }, hostname: "derive.xyz", message_patterns: [ %{ args_field: "params", format: :method, id_field: "id", keys: [ "id", "method", "params" ], kind_field: "method", kind_value: "subscribe", sources: [ :send, :watch ] } ], streaming: %{ keep_alive: 9000 }, subscription_config: %{ args_field: "params", args_format: :params_object, market_id_format: :native, op_field: "method" }, subscription_pattern: :method_params_subscribe, test_urls: "wss://api-demo.lyra.finance/ws", urls: "wss://api.lyra.finance/ws", watch_methods: [ "watchMyTrades", "watchOrderBook", "watchOrders", "watchPrivate", "watchPublic", "watchTicker", "watchTrades" ] } }