> For the complete documentation index, see [llms.txt](https://docs.deriw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deriw.com/deriw-mainnet/openapi-reference.md).

# OpenAPI Reference

OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision.

## Get all available trading markets

> Returns a list of all available trading markets with real-time prices, 24h trading volume, current open interest, and position fee rates. WBTC and WETH names are displayed as BTC and ETH.

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/markets":{"get":{"tags":["v1"],"summary":"Get all available trading markets","description":"Returns a list of all available trading markets with real-time prices, 24h trading volume, current open interest, and position fee rates. WBTC and WETH names are displayed as BTC and ETH.","parameters":[{"name":"status","in":"query","schema":{"type":"integer","enum":[1,2,3]},"description":"Filter by market status. 1=Delisted (no longer tradable), 2=Listed (actively trading), 3=Pending delist (will be removed soon)"},{"name":"is_meme","in":"query","schema":{"type":"boolean"},"description":"Set to true to return only meme coins"},{"name":"is_tradfi","in":"query","schema":{"type":"boolean"},"description":"Set to true to return only TradFi assets (stocks and metals)"}],"responses":{"200":{"description":"List of trading markets","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketsResponse"}}}}}}}},"components":{"schemas":{"MarketsResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"type":"object","properties":{"markets":{"type":"array","items":{"$ref":"#/components/schemas/MarketItem"},"description":"List of trading markets"}}}}},"MarketItem":{"type":"object","description":"A single trading market with real-time data","properties":{"address":{"type":"string","description":"Token contract address on the blockchain"},"name":{"type":"string","description":"Token display symbol. WBTC is shown as BTC, WETH as ETH"},"decimals":{"type":"integer","description":"Number of decimal places for the token (e.g., 18 for most tokens, 6 for USDT)"},"is_stable":{"type":"boolean","description":"Whether this token is a stablecoin (e.g., USDT)"},"is_shortable":{"type":"boolean","description":"Whether short positions can be opened on this token"},"is_wrapped":{"type":"boolean","description":"Whether this token is a wrapped version of another asset"},"is_meme":{"type":"boolean","description":"Whether this token is classified as a meme coin"},"is_tradfi":{"type":"boolean","description":"Whether this token is a TradFi asset (stock or precious metal)"},"coin_type":{"type":"integer","description":"Asset classification. 1=Cryptocurrency, 2=Stock, 3=Precious metal"},"fee_rate":{"type":"integer","description":"Position opening fee rate in basis points (1 bps = 0.01%). For example, 2 means 0.02% fee"},"price":{"type":"string","description":"Real-time market price with 6-decimal precision (multiplied by 1e6)"},"volume_24h":{"type":"string","description":"Total trading volume over the last 24 hours with 6-decimal precision"},"long_interest":{"type":"string","description":"Current total long position open interest with 6-decimal precision"},"short_interest":{"type":"string","description":"Current total short position open interest with 6-decimal precision"},"status":{"type":"integer","description":"Market listing status. 1=Delisted (no longer tradable), 2=Listed (actively trading), 3=Pending delist"}}}}}}
```

## Get account open positions

> Returns the current open positions for the specified wallet address. Supports pagination up to 100 records per page, with a maximum of 10,000 total accessible records. All size, collateral, and fee values use 6-decimal precision.

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/account/positions":{"get":{"tags":["v1"],"summary":"Get account open positions","description":"Returns the current open positions for the specified wallet address. Supports pagination up to 100 records per page, with a maximum of 10,000 total accessible records. All size, collateral, and fee values use 6-decimal precision.","parameters":[{"name":"account","in":"query","schema":{"type":"string"},"required":true,"description":"Wallet address to query positions for"},{"name":"index_token","in":"query","schema":{"type":"string"},"description":"Filter by index token contract address"},{"name":"is_long","in":"query","schema":{"type":"boolean"},"description":"Set to true for long positions, false for short positions"},{"name":"page_index","in":"query","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number, starting from 1"},{"name":"page_size","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"description":"Number of records per page (max 100)"}],"responses":{"200":{"description":"List of open positions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PositionsResponse"}}}},"400":{"description":"Request exceeds the maximum accessible page range"}}}}},"components":{"schemas":{"PositionsResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"type":"object","properties":{"positions":{"type":"array","items":{"$ref":"#/components/schemas/PositionItem"},"description":"List of open positions"},"total":{"type":"integer","description":"Total number of open positions matching the query filters"}}}}},"PositionItem":{"type":"object","description":"A single open position","properties":{"account":{"type":"string","description":"Wallet address that owns this position"},"index_token":{"type":"string","description":"Index token contract address (the traded asset)"},"token_name":{"type":"string","description":"Token display symbol. WBTC is shown as BTC, WETH as ETH"},"is_long":{"type":"boolean","description":"Position direction. true = long (expects price to rise), false = short (expects price to fall)"},"size":{"type":"string","description":"Position size in USD with 6-decimal precision"},"collateral":{"type":"string","description":"Collateral amount locked for this position with 6-decimal precision"},"leverage":{"type":"string","description":"Effective leverage ratio (size / collateral)"},"total_fees":{"type":"string","description":"Total accumulated fees paid for this position with 6-decimal precision"},"status":{"type":"integer","description":"Position status. 1=Currently open, 2=Closed"},"created_at":{"type":"integer","description":"Position creation time as Unix timestamp in seconds"},"updated_at":{"type":"integer","description":"Position last update time as Unix timestamp in seconds"}}}}}}
```

## Get account trade history

> Returns the trade history (both open and close positions) for the specified wallet address. Each record is either an 'increase' (opening) or 'decrease' (closing) trade. Supports filtering by time range and trade type. All financial fields use 6-decimal precision.

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/trades":{"get":{"tags":["v1"],"summary":"Get account trade history","description":"Returns the trade history (both open and close positions) for the specified wallet address. Each record is either an 'increase' (opening) or 'decrease' (closing) trade. Supports filtering by time range and trade type. All financial fields use 6-decimal precision.","parameters":[{"name":"account","in":"query","schema":{"type":"string"},"required":true,"description":"Wallet address to query trade history for"},{"name":"index_token","in":"query","schema":{"type":"string"},"description":"Filter by index token contract address"},{"name":"trade_type","in":"query","schema":{"type":"string","enum":["increase","decrease"]},"description":"Filter by trade direction. 'increase' = opening positions, 'decrease' = closing positions. Omit to return both."},{"name":"from_timestamp","in":"query","schema":{"type":"integer"},"description":"Start of time range filter (Unix timestamp in seconds)"},{"name":"to_timestamp","in":"query","schema":{"type":"integer"},"description":"End of time range filter (Unix timestamp in seconds)"},{"name":"page_index","in":"query","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number, starting from 1"},{"name":"page_size","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"description":"Number of records per page (max 100)"}],"responses":{"200":{"description":"List of trade records","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradesResponse"}}}},"400":{"description":"Request exceeds the maximum accessible page range"}}}}},"components":{"schemas":{"TradesResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"type":"object","properties":{"total_volume":{"type":"string","description":"Sum of trade sizes on the current page with 6-decimal precision"},"history_volume":{"type":"string","description":"Total cumulative trading volume for this account across all history with 6-decimal precision"},"total":{"type":"integer","description":"Total number of trade records matching the query filters"},"trades":{"type":"array","items":{"$ref":"#/components/schemas/TradeItem"},"description":"List of trade records for the current page"}}}}},"TradeItem":{"type":"object","description":"A single trade record (position open or close)","properties":{"account":{"type":"string","description":"Wallet address that executed this trade"},"trade_type":{"type":"string","description":"Trade direction. 'increase' = opened a position (long or short), 'decrease' = closed a position (partially or fully)"},"index_token":{"type":"string","description":"Index token contract address (the traded asset)"},"token_name":{"type":"string","description":"Token display symbol. WBTC is shown as BTC, WETH as ETH"},"is_long":{"type":"boolean","description":"Position direction. true = long, false = short"},"size":{"type":"string","description":"Trade size in USD with 6-decimal precision"},"collateral":{"type":"string","description":"Collateral amount involved with 6-decimal precision"},"price":{"type":"string","description":"Execution price with 6-decimal precision"},"average_price":{"type":"string","description":"Average entry price of the position when it was opened, with 6-decimal precision. Only present for decrease (close) trades"},"pnl":{"type":"string","description":"Realized profit and loss for this trade with 6-decimal precision. Only present for decrease (close) trades. Positive = profit, negative = loss"},"fee":{"type":"string","description":"Fee paid for this trade with 6-decimal precision"},"tx_hash":{"type":"string","description":"Blockchain transaction hash of this trade"},"block_number":{"type":"integer","description":"Block number where this trade was executed"},"created_at":{"type":"integer","description":"Trade execution time as Unix timestamp in seconds"}}}}}}
```

## Get latest token prices

> Returns the latest real-time price and 24-hour statistics (high, low, change) for all listed tokens. Prices use 6-decimal precision (multiplied by 1e6).

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/prices":{"get":{"tags":["v1"],"summary":"Get latest token prices","description":"Returns the latest real-time price and 24-hour statistics (high, low, change) for all listed tokens. Prices use 6-decimal precision (multiplied by 1e6).","parameters":[{"name":"index_token","in":"query","schema":{"type":"string"},"description":"Filter by index token contract address"},{"name":"symbol","in":"query","schema":{"type":"string"},"description":"Filter by token display symbol (e.g., BTC, ETH, SOL)"}],"responses":{"200":{"description":"List of token prices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricesResponse"}}}}}}}},"components":{"schemas":{"PricesResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"type":"object","properties":{"prices":{"type":"array","items":{"$ref":"#/components/schemas/PriceItem"},"description":"List of token price data"}}}}},"PriceItem":{"type":"object","description":"Latest price data for a single token","properties":{"index_token":{"type":"string","description":"Index token contract address"},"symbol":{"type":"string","description":"Token display symbol (e.g., BTC, ETH, SOL). WBTC is shown as BTC, WETH as ETH"},"price":{"type":"string","description":"Latest real-time price with 6-decimal precision (multiplied by 1e6)"},"high_24h":{"type":"string","description":"Highest price in the last 24 hours with 6-decimal precision (multiplied by 1e6)"},"low_24h":{"type":"string","description":"Lowest price in the last 24 hours with 6-decimal precision (multiplied by 1e6)"},"change_24h":{"type":"string","description":"24-hour price change percentage (e.g., '2.50' means +2.50%)"}}}}}}
```

## Get all supported tokens

> Returns metadata for all supported tokens including contract address, display name, decimals, trading attributes, coin type classification, and current fee rate. WBTC and WETH names are displayed as BTC and ETH.

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/tokens":{"get":{"tags":["v1"],"summary":"Get all supported tokens","description":"Returns metadata for all supported tokens including contract address, display name, decimals, trading attributes, coin type classification, and current fee rate. WBTC and WETH names are displayed as BTC and ETH.","parameters":[{"name":"status","in":"query","schema":{"type":"integer","enum":[1,2,3]},"description":"Filter by token status. 1=Delisted, 2=Listed, 3=Pending delist"},{"name":"is_meme","in":"query","schema":{"type":"boolean"},"description":"Set to true to return only meme coins"},{"name":"is_tradfi","in":"query","schema":{"type":"boolean"},"description":"Set to true to return only TradFi assets (stocks and metals)"}],"responses":{"200":{"description":"List of supported tokens","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokensResponse"}}}}}}}},"components":{"schemas":{"TokensResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/TokenItem"},"description":"List of supported tokens"}}}}},"TokenItem":{"type":"object","description":"Metadata for a single supported token","properties":{"address":{"type":"string","description":"Token contract address on the blockchain"},"name":{"type":"string","description":"Token display name. WBTC is shown as BTC, WETH as ETH"},"decimals":{"type":"integer","description":"Number of decimal places for the token (e.g., 18 for most tokens, 6 for USDT)"},"is_stable":{"type":"boolean","description":"Whether this token is a stablecoin"},"is_shortable":{"type":"boolean","description":"Whether short positions can be opened on this token"},"is_wrapped":{"type":"boolean","description":"Whether this token is a wrapped version of another asset"},"is_meme":{"type":"boolean","description":"Whether this token is classified as a meme coin"},"is_tradfi":{"type":"boolean","description":"Whether this token is a TradFi asset (stock or precious metal)"},"coin_type":{"type":"integer","description":"Asset classification. 1=Cryptocurrency, 2=Stock, 3=Precious metal"},"fee_rate":{"type":"string","description":"Position opening fee rate in basis points (1 bps = 0.01%). For example, '2' means 0.02% fee"},"price":{"type":"string","description":"Real-time market price with 6-decimal precision (multiplied by 1e6)"},"status":{"type":"integer","description":"Token listing status. 1=Delisted, 2=Listed, 3=Pending delist"}}}}}}
```

## Get protocol statistics

> Returns aggregated protocol-wide statistics including trading volume, fees, revenue, open interest, TVL, fund pool data, and unique trader count. All financial fields use 6-decimal precision. Unique traders is an integer count.

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/stats":{"get":{"tags":["v1"],"summary":"Get protocol statistics","description":"Returns aggregated protocol-wide statistics including trading volume, fees, revenue, open interest, TVL, fund pool data, and unique trader count. All financial fields use 6-decimal precision. Unique traders is an integer count.","parameters":[{"name":"from_timestamp","in":"query","schema":{"type":"integer"},"description":"Start of time range filter (Unix timestamp in seconds)"},{"name":"to_timestamp","in":"query","schema":{"type":"integer"},"description":"End of time range filter (Unix timestamp in seconds)"}],"responses":{"200":{"description":"Protocol statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StakingResponse"}}}}}}}},"components":{"schemas":{"StakingResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"$ref":"#/components/schemas/StatsData"}}},"StatsData":{"type":"object","description":"Aggregated protocol-wide statistics","properties":{"total_volume":{"type":"string","description":"Cumulative total trading volume since inception with 6-decimal precision"},"trading_volume":{"type":"string","description":"Total trading volume with 6-decimal precision"},"long_volume":{"type":"string","description":"Total long position trading volume with 6-decimal precision"},"short_volume":{"type":"string","description":"Total short position trading volume with 6-decimal precision"},"total_fees":{"type":"string","description":"Cumulative total fees collected since inception with 6-decimal precision"},"open_fee":{"type":"string","description":"Total opening position fees with 6-decimal precision"},"close_fee":{"type":"string","description":"Total closing position fees with 6-decimal precision"},"liquidation_fee":{"type":"string","description":"Total liquidation fees with 6-decimal precision"},"manage_fee":{"type":"string","description":"Total management fees with 6-decimal precision"},"total_revenue":{"type":"string","description":"Total protocol revenue with 6-decimal precision"},"long_revenue":{"type":"string","description":"Revenue from long positions with 6-decimal precision"},"short_revenue":{"type":"string","description":"Revenue from short positions with 6-decimal precision"},"open_interest":{"type":"string","description":"Total open interest across all markets with 6-decimal precision"},"long_open_interest":{"type":"string","description":"Total long position open interest with 6-decimal precision"},"short_open_interest":{"type":"string","description":"Total short position open interest with 6-decimal precision"},"long_weighting":{"type":"string","description":"Long position weighting factor (e.g., '1661' represents 16.61%)"},"short_weighting":{"type":"string","description":"Short position weighting factor"},"tvl":{"type":"string","description":"Total Value Locked in the protocol with 6-decimal precision"},"fund_pool_volume":{"type":"string","description":"Total fund pool volume with 6-decimal precision"},"fund_pool_raised":{"type":"string","description":"Total fund pool amount raised with 6-decimal precision"},"unique_traders":{"type":"integer","description":"Total number of unique trader addresses"},"updated_at":{"type":"integer","description":"Statistics data timestamp as Unix timestamp in seconds"}}}}}}
```

## Get account liquidation history

> Returns liquidation records for the specified wallet address. Each record includes liquidation type: type 2 or 3 indicates normal liquidation events, type 4 indicates forced closure due to coin delisting, and type 5 indicates ADL (Auto-Deleveraging) events. All financial fields use 6-decimal precision.

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/liquidations":{"get":{"tags":["v1"],"summary":"Get account liquidation history","description":"Returns liquidation records for the specified wallet address. Each record includes liquidation type: type 2 or 3 indicates normal liquidation events, type 4 indicates forced closure due to coin delisting, and type 5 indicates ADL (Auto-Deleveraging) events. All financial fields use 6-decimal precision.","parameters":[{"name":"account","in":"query","schema":{"type":"string"},"required":true,"description":"Wallet address to query liquidation history for"},{"name":"index_token","in":"query","schema":{"type":"string"},"description":"Filter by index token contract address"},{"name":"is_long","in":"query","schema":{"type":"boolean"},"description":"Set to true for long positions, false for short positions"},{"name":"from_timestamp","in":"query","schema":{"type":"integer"},"description":"Start of time range filter (Unix timestamp in seconds)"},{"name":"to_timestamp","in":"query","schema":{"type":"integer"},"description":"End of time range filter (Unix timestamp in seconds)"},{"name":"page_index","in":"query","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number, starting from 1"},{"name":"page_size","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"description":"Number of records per page (max 100)"}],"responses":{"200":{"description":"List of liquidation records","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiquidationsResponse"}}}},"400":{"description":"Request exceeds the maximum accessible page range"}}}}},"components":{"schemas":{"LiquidationsResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"type":"object","properties":{"liquidations":{"type":"array","items":{"$ref":"#/components/schemas/LiquidationItem"},"description":"List of liquidation records"},"total":{"type":"integer","description":"Total number of liquidation records matching the query filters"}}}}},"LiquidationItem":{"type":"object","description":"A single liquidation event record","properties":{"account":{"type":"string","description":"Wallet address that was liquidated"},"index_token":{"type":"string","description":"Index token contract address (the liquidated asset)"},"is_long":{"type":"boolean","description":"Position direction that was liquidated. true = long, false = short"},"size":{"type":"string","description":"Position size at the time of liquidation with 6-decimal precision"},"collateral":{"type":"string","description":"Collateral amount at the time of liquidation with 6-decimal precision"},"average_price":{"type":"string","description":"Average entry price of the position with 6-decimal precision"},"mark_price":{"type":"string","description":"Mark price at the moment of liquidation with 6-decimal precision"},"liquidation_price":{"type":"string","description":"Theoretical liquidation trigger price with 6-decimal precision"},"fee":{"type":"string","description":"Liquidation fee charged with 6-decimal precision"},"realised_pnl":{"type":"string","description":"Realized profit and loss from this liquidation with 6-decimal precision. Negative values indicate a loss"},"liquidation_type":{"type":"integer","description":"Type of liquidation event. 2 or 3=Normal liquidation (margin below maintenance), 4=Forced close due to coin delisting, 5=ADL (Auto-Deleveraging)"},"tx_hash":{"type":"string","description":"Blockchain transaction hash of this liquidation"},"block_number":{"type":"integer","description":"Block number where this liquidation was executed"},"created_at":{"type":"integer","description":"Liquidation time as Unix timestamp in seconds"}}}}}}
```

## Get current position fee rates

> Returns the current position fee rate (in basis points) for each listed token. The fee rate represents the cost to open a position, expressed in bps where 1 bps = 0.01%. Returns all listed tokens when no filter is specified.

```json
{"openapi":"3.0.3","info":{"title":"DEX Server OpenAPI","version":"1.0.0"},"tags":[{"name":"v1","description":"OpenAPI v1 — Public market data, account positions, trade history, token metadata, protocol statistics, liquidation records, and current funding rates. All financial fields are returned as decimal string values. Price and position-related fields use 6-decimal precision."}],"servers":[{"url":"https://api.deriw.com/openapi","description":"Production"},{"url":"https://api.test.deriw.com/openapi","description":"Test"}],"paths":{"/v1/funding_rates":{"get":{"tags":["v1"],"summary":"Get current position fee rates","description":"Returns the current position fee rate (in basis points) for each listed token. The fee rate represents the cost to open a position, expressed in bps where 1 bps = 0.01%. Returns all listed tokens when no filter is specified.","parameters":[{"name":"index_token","in":"query","schema":{"type":"string"},"description":"Filter by index token contract address. Omit to return fee rates for all listed tokens."}],"responses":{"200":{"description":"List of current fee rates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingRatesResponse"}}}}}}}},"components":{"schemas":{"FundingRatesResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response status code. 0 = success"},"msg":{"type":"string","description":"Response message. 'success' on success"},"data":{"type":"object","properties":{"funding_rates":{"type":"array","items":{"$ref":"#/components/schemas/FundingRateItem"},"description":"List of current fee rates"}}}}},"FundingRateItem":{"type":"object","description":"Current fee rate for a single token","properties":{"index_token":{"type":"string","description":"Index token contract address"},"name":{"type":"string","description":"Token display name. WBTC is shown as BTC, WETH as ETH"},"fee_rate":{"type":"integer","description":"Position opening fee rate in basis points (1 bps = 0.01%). For example, 2 means 0.02% fee"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deriw.com/deriw-mainnet/openapi-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
