### Run Development Server Source: https://github.com/deepxfinance/docs/blob/main/README.md Use these commands to start the development server for the project. Ensure you have Node.js and npm, pnpm, or yarn installed. ```bash npm run dev # or pnpm dev # or yarn dev ``` -------------------------------- ### Long-Short Ratio Push Payload Example Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/market-data.mdx This is an example of the data payload received when subscribing to the `perp@long-short-ratio` channel. It includes the symbol, the ratio, and a timestamp. ```json { "channel": "perp@long-short-ratio", "data": { "symbol": "ETH-USDC", "longShortRatio": "4.0", "time": 1713825891591 } } ``` -------------------------------- ### Candles Push Payload Example Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/market-data.mdx Example of a push payload for the candles stream. It contains market data including open, high, low, close prices, volume, and timestamp for the specified interval. ```json { "channel": "perp@candles", "data": { "symbol": "ETH-USDC", "interval": "1m", "open": "2033.50", "high": "2036.00", "low": "2032.80", "close": "2034.75", "volume": "18.420", "time": 1713825840000 } } ``` -------------------------------- ### Get Spot Market by Symbol Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/spot-markets/getSpotMarket.mdx Retrieves the current trading rules for a specified symbol. ```APIDOC ## GET /v1/spot/markets/{symbol} ### Description Retrieves the current trading rules for a specified symbol. ### Method GET ### Endpoint /v1/spot/markets/{symbol} ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the market to retrieve. ``` -------------------------------- ### Get Lending Market by Asset Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/lending-markets/getLendingMarket.mdx Fetches the static configuration parameters for a lending pool identified by its asset. ```APIDOC ## GET /v1/lending/markets/{asset} ### Description Retrieves the static configuration parameters for a specified lending pool. ### Method GET ### Endpoint /v1/lending/markets/{asset} ### Parameters #### Path Parameters - **asset** (string) - Required - The identifier of the asset for the lending market. ``` -------------------------------- ### Get Server Time Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/system/getServerTime.mdx Retrieves the current server time. ```APIDOC ## GET /v1/time ### Description Returns the current server time. ### Method GET ### Endpoint /v1/time ### Response #### Success Response (200) - **time** (string) - The current server time in ISO 8601 format. ``` -------------------------------- ### Spot Orders Initial Snapshot Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx This is an example of the initial snapshot data received for the account@spot-orders channel, containing an array of open orders. ```json { "channel": "account@spot-orders", "data": [ { "orderId": "41200", "symbol": "BTC-USDC", "subaccount": "{SUBACCOUNT_ADDRESS}", "side": "BUY", "type": "LIMIT", "status": "OPEN", "price": "63000.00", "slippage": null, "qty": "0.001", "remainingQty": "0.001", "quoteQty": "63.00", "remainingQuoteQty": "63.00", "fee": "0.000000", "postOnly": false, "reduceOnly": false, "frozen": false, "blockNumber": 8689320, "txHash": "0xghi789...", "time": 1713825810000 } ] } ``` -------------------------------- ### Get Funding Rate Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/getPerpFundingRate.mdx Retrieves the current real-time funding rate for a specified perpetual market. ```APIDOC ## GET /v1/perp/markets/{symbol}/funding-rate ### Description Retrieves the current real-time funding rate for a specified perpetual market. ### Method GET ### Endpoint /v1/perp/markets/{symbol}/funding-rate ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the perpetual market (e.g., BTC-PERPETUAL). ### Response #### Success Response (200) - **rate** (string) - The current funding rate. - **symbol** (string) - The symbol of the perpetual market. - **timestamp** (integer) - The Unix timestamp when the funding rate was recorded. ``` -------------------------------- ### Get Open Interest Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/getPerpOpenInterest.mdx Retrieves the current real-time open interest for a specified perpetual market. ```APIDOC ## GET /v1/perp/markets/{symbol}/open-interest ### Description Retrieves the current real-time open interest for a specified perpetual market. ### Method GET ### Endpoint /v1/perp/markets/{symbol}/open-interest ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the perpetual market. ``` -------------------------------- ### Get One-Click Trading Accounts Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getOneClickTradingAccounts.mdx Retrieves a list of session-key (One-Click Trading) accounts linked to a primary wallet address. ```APIDOC ## GET /v1/account/wallets/{address}/one-click-trading-accounts ### Description Retrieves a list of session-key (One-Click Trading) accounts linked to a primary wallet address. ### Method GET ### Endpoint /v1/account/wallets/{address}/one-click-trading-accounts ### Parameters #### Path Parameters - **address** (string) - Required - The primary wallet address for which to retrieve One-Click Trading accounts. ``` -------------------------------- ### Get Open Spot Orders Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getSpotOpenOrders.mdx Retrieves currently open spot orders for a specific subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/spot/orders/open ### Description Retrieves currently open spot orders for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/spot/orders/open ### Parameters #### Path Parameters - **address** (string) - Required - The unique identifier of the subaccount. ``` -------------------------------- ### Funding Rate Push Payload Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/market-data.mdx This is an example of the data payload received when subscribed to the funding rate stream. It includes the current and 24h average funding rates, along with a timestamp. ```json { "channel": "perp@funding-rate", "data": { "symbol": "ETH-USDC", "fundingRate": "0.0000125", "avgFundingRate24h": "0.000204", "time": 1713825891591 } } ``` -------------------------------- ### Get a Perpetual Market by Symbol Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/getPerpMarket.mdx Retrieves the trading and risk rules for a specified perpetual market using its symbol. ```APIDOC ## GET /v1/perp/markets/{symbol} ### Description Retrieves the trading and risk rules for a specified perpetual market. ### Method GET ### Endpoint /v1/perp/markets/{symbol} ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the perpetual market. ``` -------------------------------- ### Portfolio Summary Stream Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx Subscribe to the account@portfolio channel to get unified portfolio metrics for a specific subaccount. The stream provides total deposits, borrows, collateral, and the uniMMR, which indicates liquidation eligibility when below 1.0. ```APIDOC ## Subscribe to Portfolio Summary (`account@portfolio`) ### Description This operation allows you to subscribe to the `account@portfolio` channel to receive unified portfolio metrics for a specified subaccount. The data includes total deposits, borrows, collateral, and the Unified Maintenance Margin Ratio (uniMMR). A uniMMR below 1.0 signifies that the subaccount is eligible for liquidation. ### Method `SUBSCRIBE` (WebSocket) ### Endpoint `account@portfolio` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body ```json { "method": "subscribe", "id": "req-16", "params": { "channel": "account@portfolio", "subaccount": "{SUBACCOUNT_ADDRESS}" } } ``` ### Request Example ```json { "method": "subscribe", "id": "req-16", "params": { "channel": "account@portfolio", "subaccount": "0x1234567890abcdef1234567890abcdef12345678" } } ``` ### Response #### Success Response (Push Payload) - **channel** (string) - The name of the channel, `account@portfolio`. - **data** (object) - Contains the portfolio metrics. - **subaccount** (string) - The address of the subaccount. - **totalDepositsUsd** (string) - The total USD value of deposited assets. - **totalBorrowsUsd** (string) - The total USD value of borrowed assets. - **totalCollateral** (string) - The total collateral value after haircuts. - **maintenanceMarginReq** (string) - The minimum collateral required to avoid liquidation. - **uniMMR** (string) - The Unified Maintenance Margin Ratio (`totalCollateral / maintenanceMarginReq`). A value below `1.0` triggers liquidation. - **time** (int64) - The timestamp of the data snapshot in epoch milliseconds. #### Response Example ```json { "channel": "account@portfolio", "data": { "subaccount": "0x1234567890abcdef1234567890abcdef12345678", "totalDepositsUsd": "799.80", "totalBorrowsUsd": "0.00", "totalCollateral": "800.19", "maintenanceMarginReq": "0.41", "uniMMR": "1951.68", "time": 1713825891591 } } ``` ### Update cadence Updates are pushed on any change to collateral or position state. ``` -------------------------------- ### Get Perp Market Candles Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/getPerpCandles.mdx Retrieves historical candle data. If `startTime` and `endTime` are not provided, the most recent candles up to the `limit` are returned. ```APIDOC ## GET /v1/perp/markets/{symbol}/candles ### Description Retrieves historical candle data. If `startTime` and `endTime` are not provided, the most recent candles up to the `limit` are returned. ### Method GET ### Endpoint /v1/perp/markets/{symbol}/candles ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the market for which to retrieve candles. #### Query Parameters - **startTime** (integer) - Optional - The start of the time range for the candles (Unix timestamp in milliseconds). - **endTime** (integer) - Optional - The end of the time range for the candles (Unix timestamp in milliseconds). - **limit** (integer) - Optional - The maximum number of candles to return. Defaults to 100. - **interval** (string) - Optional - The interval for the candles (e.g., '1m', '5m', '1h', '1d'). Defaults to '1m'. ``` -------------------------------- ### Get Funding Rate History Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/getPerpFundingRateHistory.mdx Retrieves historical funding rate data points for a specified perpetual market. If `startTime` and `endTime` are not provided, the most recent records up to the `limit` are returned. ```APIDOC ## GET /v1/perp/markets/{symbol}/funding-rate/history ### Description Retrieves historical funding rate data points for a specified perpetual market. If `startTime` and `endTime` are not provided, the most recent records up to the `limit` are returned. ### Method GET ### Endpoint /v1/perp/markets/{symbol}/funding-rate/history ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the perpetual market. #### Query Parameters - **startTime** (integer) - Optional - The start timestamp for the historical data (Unix timestamp in seconds). - **endTime** (integer) - Optional - The end timestamp for the historical data (Unix timestamp in seconds). - **limit** (integer) - Optional - The maximum number of records to return. Defaults to 50. ### Response #### Success Response (200) - **fundingRate** (string) - The funding rate. - **fundingTimestamp** (integer) - The timestamp of the funding rate record (Unix timestamp in seconds). #### Response Example ```json { "fundingRate": "0.0001", "fundingTimestamp": 1678886400 } ``` ``` -------------------------------- ### Get Subaccount Portfolio Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getSubaccountPortfolio.mdx Retrieves a unified portfolio summary for a subaccount, including net account value, deposit/borrow totals, collateral, and risk metrics. ```APIDOC ## GET /v1/account/subaccounts/{address}/portfolio ### Description Retrieves a unified portfolio summary for a subaccount, including net account value, deposit/borrow totals, collateral, and risk metrics. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/portfolio ### Parameters #### Path Parameters - **address** (string) - Required - The unique identifier of the subaccount. ``` -------------------------------- ### Account Portfolio Data Payload Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx This is an example of the data payload received when subscribed to the `account@portfolio` channel. It includes key financial metrics for the specified subaccount, such as total deposits, borrows, collateral, and the uniMMR. ```json { "channel": "account@portfolio", "data": { "subaccount": "{SUBACCOUNT_ADDRESS}", "totalDepositsUsd": "799.80", "totalBorrowsUsd": "0.00", "totalCollateral": "800.19", "maintenanceMarginReq": "0.41", "uniMMR": "1951.68", "time": 1713825891591 } } ``` -------------------------------- ### Spot Trades Push Payload Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/market-data.mdx This is an example of the JSON payload received for a new trade execution in a spot market. It contains similar trade details as perpetual trades but omits the `marketId` field. ```json { "channel": "spot@trades", "data": { "id": "12041", "symbol": "BTC-USDC", "time": 1713825891591, "price": "63450.00", "qty": "0.010", "quoteQty": "634.50", "takerSide": "SELL", "buyOrderId": "41200", "sellOrderId": "41199", "takerFee": "0.634500", "makerFee": "0.317250" } } ``` -------------------------------- ### Get Spot Market Candles Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/spot-markets/getSpotCandles.mdx Retrieves historical candle data for a given spot market symbol. If startTime and endTime are not provided, the most recent candles up to the limit are returned. ```APIDOC ## GET /v1/spot/markets/{symbol}/candles ### Description Retrieves historical candle data for a given spot market symbol. If `startTime` and `endTime` are not provided, the most recent candles up to the `limit` are returned. ### Method GET ### Endpoint /v1/spot/markets/{symbol}/candles ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading symbol for the market (e.g., BTC-USD). - **startTime** (integer) - Optional - The start of the interval in UNIX timestamp format. - **endTime** (integer) - Optional - The end of the interval in UNIX timestamp format. - **limit** (integer) - Optional - The maximum number of candles to return. Defaults to 100. - **interval** (string) - Optional - The interval of the candles (e.g., 1m, 5m, 1h, 1d). Defaults to 1m. ### Response #### Success Response (200) - **candles** (array) - An array of candle objects. - **timestamp** (integer) - The timestamp of the candle in UNIX ms format. - **open** (string) - The opening price. - **high** (string) - The highest price. - **low** (string) - The lowest price. - **close** (string) - The closing price. - **volume** (string) - The trading volume. ``` -------------------------------- ### WebSocket Push Frame Envelope Example Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/01-general-info.mdx This JSON structure represents the standard envelope for data and acknowledgement frames pushed by the server. Clients should route messages based on the 'channel' field. ```json { "channel": "spot@trades", "data": { "example": "payload" } } ``` -------------------------------- ### Spot Trades Initial Snapshot Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx This is the format of the initial snapshot received when subscribing to `account@spot-trades`. It contains an array of recent spot fills. ```json { "channel": "account@spot-trades", "data": [ { "id": "12041", "symbol": "BTC-USDC", "time": 1713825850000, "subaccount": "{SUBACCOUNT_ADDRESS}", "orderId": "41199", "side": "SELL", "role": "MAKER", "price": "63450.00", "qty": "0.010", "quoteQty": "634.50", "fee": "0.317250" } ] } ``` -------------------------------- ### List Lending Markets Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/lending-markets/listLendingMarkets.mdx Retrieves the static configuration parameters for all supported lending pools. ```APIDOC ## GET /v1/lending/markets ### Description Retrieves the static configuration parameters for all supported lending pools. ### Method GET ### Endpoint /v1/lending/markets ``` -------------------------------- ### Get Orderbook Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/getPerpOrderbook.mdx Retrieves the orderbook depth for a specified perpetual market. ```APIDOC ## GET /v1/perp/markets/{symbol}/orderbook ### Description Retrieves the orderbook depth for a specified perpetual market. ### Method GET ### Endpoint /v1/perp/markets/{symbol}/orderbook ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the perpetual market (e.g., BTC-PERP). ### Response #### Success Response (200) - **symbol** (string) - The symbol of the perpetual market. - **bids** (array) - An array of bid orders, each with `price` and `quantity`. - **asks** (array) - An array of ask orders, each with `price` and `quantity`. ``` -------------------------------- ### Get Spot Orderbook Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/spot-markets/getSpotOrderbook.mdx Retrieves the orderbook depth for a specified spot market. ```APIDOC ## GET /v1/spot/markets/{symbol}/orderbook ### Description Retrieves the orderbook depth for a specified spot market. ### Method GET ### Endpoint /v1/spot/markets/{symbol}/orderbook ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the market to retrieve the orderbook for. ``` -------------------------------- ### Account Balances Initial Snapshot Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx The initial snapshot for the `account@balances` channel provides an array of all asset balances for the specified subaccount. ```json { "channel": "account@balances", "data": [ { "asset": "USDC", "balance": "799.80", "price": "1.0" }, { "asset": "ETH", "balance": "0.500", "price": "2034.75" } ] } ``` -------------------------------- ### Initial Snapshot of Open Orders Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx This JSON structure represents the initial data received upon subscribing, showing all currently open perpetual orders for the specified scope. It includes detailed order parameters. ```json { "channel": "account@perp-orders", "data": [ { "orderId": "88383", "symbol": "ETH-USDC", "subaccount": "{SUBACCOUNT_ADDRESS}", "side": "BUY", "type": "LIMIT", "status": "OPEN", "price": "2000.00", "qty": "0.01", "filledQty": "0.00", "remainingQty": "0.01", "leverage": "10", "slippage": null, "takeProfit": null, "stopLoss": null, "reduceOnly": false, "postOnly": false, "fee": "0.000000", "blockNumber": 8996440, "txHash": "0xabc123...", "time": 1713825800000 } ] } ``` -------------------------------- ### Get Subaccount Perpetual Orders Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getPerpOrders.mdx Fetches historical perpetual order records for a specified subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/perp/orders ### Description Retrieves historical perpetual order records for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/perp/orders ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### Perpetual Positions Initial Snapshot Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx The server sends an array of current position states upon subscription. This is a raw array without pagination wrappers. ```json { "channel": "account@perp-positions", "data": [ { "symbol": "ETH-USDC", "subaccount": "{SUBACCOUNT_ADDRESS}", "side": "BUY", "qty": "0.01", "entryPrice": "2025.48", "leverage": "10", "liquidationPrice": "1850.00", "unrealizedPnl": "12.50", "fundingPayment": "-0.138", "takeProfit": null, "stopLoss": null, "time": 1713800000000, "updatedTime": 1713825891591 } ] } ``` -------------------------------- ### Get Subaccount Info Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getSubaccountInfo.mdx Retrieves profile information (owner, name) for a specific subaccount address. ```APIDOC ## GET /v1/account/subaccounts/{address}/info ### Description Retrieves profile information (owner, name) for a specific subaccount address. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/info ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### List Perpetual Markets Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/listPerpMarkets.mdx Retrieves the trading and risk rules for all perpetual markets. If no markets match the provided filters, an empty array `[]` is returned. ```APIDOC ## GET /v1/perp/markets ### Description Retrieves the trading and risk rules for all perpetual markets. If no markets match the provided filters, an empty array `[]` is returned. ### Method GET ### Endpoint /v1/perp/markets ### Response #### Success Response (200) - **markets** (array) - An array of perpetual market objects. Each object contains trading and risk rules. ``` -------------------------------- ### Get Subaccount Spot Trades Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getSpotTrades.mdx Retrieves historical spot trade fills for a specific subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/spot/trades ### Description Retrieves historical spot trade fills for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/spot/trades ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### Perpetual Trades Initial Snapshot Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx This JSON structure represents the initial snapshot for the account@perp-trades channel, showing recent fills. ```json { "channel": "account@perp-trades", "data": [ { "id": "74821", "symbol": "ETH-USDC", "marketId": 3, "time": 1713825891591, "subaccount": "{SUBACCOUNT_ADDRESS}", "orderId": "88383", "side": "BUY", "role": "TAKER", "leverage": "10", "price": "2034.75", "qty": "0.01", "fee": "0.000101" } ] } ``` -------------------------------- ### Get Subaccount Balances Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getSubaccountBalances.mdx Retrieves the current net balance of every asset held in a subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/balances ### Description Retrieves the current net balance of every asset held in a subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/balances ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### Get Subaccount Open Positions Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getPerpPositions.mdx Retrieves the current active perpetual positions for a specific subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/perp/positions ### Description Retrieves the current active perpetual positions for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/perp/positions ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### Subscribe to Spot Orders Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx Use this JSON payload to subscribe to the account@spot-orders channel. Ensure you specify either a subaccount or wallet scope. ```json { "method": "subscribe", "id": "req-12", "params": { "channel": "account@spot-orders", "subaccount": "{SUBACCOUNT_ADDRESS}" } } ``` -------------------------------- ### Get Subaccount Spot Orders Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getSpotOrders.mdx Retrieves historical spot order records for a specific subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/spot/orders ### Description Retrieves historical spot order records for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/spot/orders ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### List Spot Markets Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/spot-markets/listSpotMarkets.mdx Retrieves the current trading rules for multiple symbols. If no markets match the provided filters, an empty array `[]` is returned. ```APIDOC ## GET /v1/spot/markets ### Description Retrieves the current trading rules for multiple symbols. If no markets match the provided filters, an empty array `[]` is returned. ### Method GET ### Endpoint /v1/spot/markets ``` -------------------------------- ### Get Perpetual Order by Transaction Hash Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getPerpOrderByTx.mdx Fetches a perpetual order using its transaction hash. ```APIDOC ## GET /v1/account/perp/orders/tx/{txHash} ### Description Retrieves a specific perpetual order record using its on-chain transaction hash. ### Method GET ### Endpoint /v1/account/perp/orders/tx/{txHash} ### Parameters #### Path Parameters - **txHash** (string) - Required - The transaction hash of the perpetual order. ``` -------------------------------- ### Subscribe to Spot Trades Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx Use this JSON payload to subscribe to the `account@spot-trades` channel. Specify the `subaccount` address you wish to monitor. ```json { "method": "subscribe", "id": "req-14", "params": { "channel": "account@spot-trades", "subaccount": "{SUBACCOUNT_ADDRESS}" } } ``` -------------------------------- ### Get Long-Short Ratio Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/perp-markets/getPerpLongShortRatio.mdx Retrieves the current real-time long-to-short position ratio for a specified perpetual market. ```APIDOC ## GET /v1/perp/markets/{symbol}/long-short-ratio ### Description Retrieves the current real-time long-to-short position ratio for a specified perpetual market. ### Method GET ### Endpoint /v1/perp/markets/{symbol}/long-short-ratio ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the perpetual market. ``` -------------------------------- ### List Lending Market Statuses Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/lending-markets/listLendingMarketStatuses.mdx Retrieves real-time market status (supply/borrow APR) for all lending pools. ```APIDOC ## GET /v1/lending/markets/status ### Description Retrieves real-time market status (supply/borrow APR) for all lending pools. ### Method GET ### Endpoint /v1/lending/markets/status ### Response #### Success Response (200) - **market_statuses** (array) - An array of market status objects. - **pool_id** (string) - The unique identifier for the lending pool. - **supply_apr** (string) - The current supply Annual Percentage Rate (APR). - **borrow_apr** (string) - The current borrow Annual Percentage Rate (APR). ### Response Example ```json { "market_statuses": [ { "pool_id": "0xabc123...", "supply_apr": "0.05", "borrow_apr": "0.07" }, { "pool_id": "0xdef456...", "supply_apr": "0.03", "borrow_apr": "0.06" } ] } ``` ``` -------------------------------- ### Get Subaccount Perpetual Trade History Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getPerpTrades.mdx Retrieves historical perpetual trade fills for a specific subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/perp/trades ### Description Retrieves historical perpetual trade fills for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/perp/trades ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### Subscribe to Lending Market Status Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/market-data.mdx This snippet shows how to subscribe to the lending market status stream. You can subscribe to a specific asset by providing the 'asset' parameter, or omit it to receive updates for all active lending assets. ```APIDOC ## Subscribe to Lending Market Status (`lending@market-status`) ### Description Real-time utilization rates, APRs, and supply/borrow totals for a lending asset. ### Method `subscribe` ### Parameters #### Channel - **channel** (string) - Required - The channel name: `"lending@market-status"` - **asset** (string) - Optional - The specific asset to subscribe to (e.g., `"USDC"`). Omit to subscribe to all assets. ### Request Example (Single Asset) ```json { "method": "subscribe", "id": "req-9", "params": { "channel": "lending@market-status", "asset": "USDC" } } ``` ### Request Example (All Assets) ```json { "method": "subscribe", "id": "req-9", "params": { "channel": "lending@market-status" } } ``` ### Push Payload Structure ```json { "channel": "lending@market-status", "data": { "asset": "string", "indexPrice": "string", "totalSupplied": "string", "totalBorrowed": "string", "utilizationRate": "string", "supplyApr": "string", "borrowApr": "string", "time": "int64" } } ``` ### Payload Fields - **asset** (string) - Token symbol (e.g., `"USDC"`) - **indexPrice** (string) - Current index price of the asset - **totalSupplied** (string) - Total amount supplied to the pool - **totalBorrowed** (string) - Total amount borrowed from the pool - **utilizationRate** (string) - `totalBorrowed / totalSupplied` - **supplyApr** (string) - Annualized yield for suppliers - **borrowApr** (string) - Annualized interest rate for borrowers - **time** (int64) - Snapshot timestamp (epoch ms) ### Update Cadence On change ``` -------------------------------- ### Get Subaccount Open Perpetual Orders Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getPerpOpenOrders.mdx Retrieves currently open perpetual orders for a specific subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/perp/orders/open ### Description Retrieves currently open perpetual orders for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/perp/orders/open ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### Get Lending Market Status Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/lending-markets/getLendingMarketStatus.mdx Retrieves real-time market status (supply/borrow APR) for a specified lending pool. ```APIDOC ## GET /v1/lending/markets/{asset}/status ### Description Retrieves real-time market status (supply/borrow APR) for a specified lending pool. ### Method GET ### Endpoint /v1/lending/markets/{asset}/status ### Parameters #### Path Parameters - **asset** (string) - Required - The asset identifier for the lending pool. ``` -------------------------------- ### Subscribe to Lending Market Status for a Single Asset Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/market-data.mdx Use this JSON payload to subscribe to real-time market status updates for a specific lending asset. Ensure the 'asset' parameter is correctly set. ```json { "method": "subscribe", "id": "req-9", "params": { "channel": "lending@market-status", "asset": "USDC" } } ``` -------------------------------- ### Get Subaccount Funding Payments Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getPerpFundingPayments.mdx Retrieves historical perpetual funding payment records for a specific subaccount address. ```APIDOC ## GET /v1/account/subaccounts/{address}/perp/funding-payments ### Description Retrieves historical perpetual funding payment records for a specific subaccount address. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/perp/funding-payments ### Parameters #### Path Parameters - **address** (string) - Required - The subaccount address for which to retrieve funding payments. ``` -------------------------------- ### Subscribe to Perpetual Orders Stream Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/account-data.mdx This snippet shows how to subscribe to the `account@perp-orders` channel. You can subscribe either by subaccount or at the wallet level to receive updates for all subaccounts. ```APIDOC ## Subscribe to Perpetual Orders Stream ### Description Pushes order state as it transitions through its lifecycle: pending → open → filled / canceled. ### Channel `account@perp-orders` ### Scope `subaccount` or `wallet` (one required) ### Subscribe (Subaccount Level) ```json { "method": "subscribe", "id": "req-11", "params": { "channel": "account@perp-orders", "subaccount": "{SUBACCOUNT_ADDRESS}" } } ``` ### Subscribe (Wallet Level - All Subaccounts) ```json { "method": "subscribe", "id": "req-11", "params": { "channel": "account@perp-orders", "wallet": "{WALLET_ADDRESS}" } } ``` ### Initial Snapshot Example ```json { "channel": "account@perp-orders", "data": [ { "orderId": "88383", "symbol": "ETH-USDC", "subaccount": "{SUBACCOUNT_ADDRESS}", "side": "BUY", "type": "LIMIT", "status": "OPEN", "price": "2000.00", "qty": "0.01", "filledQty": "0.00", "remainingQty": "0.01", "leverage": "10", "slippage": null, "takeProfit": null, "stopLoss": null, "reduceOnly": false, "postOnly": false, "fee": "0.000000", "blockNumber": 8996440, "txHash": "0xabc123...", "time": 1713825800000 } ] } ``` ### Incremental Update Example (Order Fill) ```json { "channel": "account@perp-orders", "data": { "orderId": "88383", "symbol": "ETH-USDC", "subaccount": "{SUBACCOUNT_ADDRESS}", "side": "BUY", "type": "LIMIT", "status": "FILLED", "price": "2000.00", "qty": "0.01", "filledQty": "0.01", "remainingQty": "0.00", "leverage": "10", "slippage": null, "takeProfit": null, "stopLoss": null, "reduceOnly": false, "postOnly": false, "fee": "0.002022", "blockNumber": 8996441, "txHash": "0xdef456...", "time": 1713825800000 } } ``` For the full order field reference, see [Get Subaccount Perpetual Order History](../../apis/account/getPerpOrders.mdx). ``` -------------------------------- ### Get Subaccount Perpetual Position History Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getPerpPositionsHistory.mdx Retrieves historical (closed) perpetual position records for a specific subaccount. ```APIDOC ## GET /v1/account/subaccounts/{address}/perp/positions/history ### Description Retrieves historical (closed) perpetual position records for a specific subaccount. ### Method GET ### Endpoint /v1/account/subaccounts/{address}/perp/positions/history ### Parameters #### Path Parameters - **address** (string) - Required - The address of the subaccount. ``` -------------------------------- ### Subscribe to Funding Rate Stream Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/websocket/streams/market-data.mdx Use this JSON payload to subscribe to the funding rate stream for a specific perpetual market. Ensure the 'symbol' parameter is set to the desired market. ```json { "method": "subscribe", "id": "req-5", "params": { "channel": "perp@funding-rate", "symbol": "ETH-USDC" } } ``` -------------------------------- ### Get Spot Order by Transaction Hash Source: https://github.com/deepxfinance/docs/blob/main/content/docs/developer/apis/account/getSpotOrderByTx.mdx Retrieves a specific spot order record using its on-chain transaction hash. ```APIDOC ## GET /v1/account/spot/orders/tx/{txHash} ### Description Retrieves a specific spot order record using its on-chain transaction hash. ### Method GET ### Endpoint /v1/account/spot/orders/tx/{txHash} ### Parameters #### Path Parameters - **txHash** (string) - Required - The transaction hash of the spot order. ```