For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

get
/v1/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.

Query parameters
statusinteger · enumOptional

Filter by market status. 1=Delisted (no longer tradable), 2=Listed (actively trading), 3=Pending delist (will be removed soon)

Possible values:
is_memebooleanOptional

Set to true to return only meme coins

is_tradfibooleanOptional

Set to true to return only TradFi assets (stocks and metals)

Responses
200

List of trading markets

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/markets
GET /openapi/v1/markets HTTP/1.1
Host: api.deriw.com
Accept: */*
200

List of trading markets

{
  "code": 1,
  "msg": "text",
  "data": {
    "markets": [
      {
        "address": "text",
        "name": "text",
        "decimals": 1,
        "is_stable": true,
        "is_shortable": true,
        "is_wrapped": true,
        "is_meme": true,
        "is_tradfi": true,
        "coin_type": 1,
        "fee_rate": 1,
        "price": "text",
        "volume_24h": "text",
        "long_interest": "text",
        "short_interest": "text",
        "status": 1
      }
    ]
  }
}

Get account open positions

get
/v1/account/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.

Query parameters
accountstringRequired

Wallet address to query positions for

index_tokenstringOptional

Filter by index token contract address

is_longbooleanOptional

Set to true for long positions, false for short positions

page_indexinteger · min: 1Optional

Page number, starting from 1

Default: 1
page_sizeinteger · min: 1 · max: 100Optional

Number of records per page (max 100)

Default: 20
Responses
200

List of open positions

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/account/positions
GET /openapi/v1/account/positions?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "positions": [
      {
        "account": "text",
        "index_token": "text",
        "token_name": "text",
        "is_long": true,
        "size": "text",
        "collateral": "text",
        "leverage": "text",
        "total_fees": "text",
        "status": 1,
        "created_at": 1,
        "updated_at": 1
      }
    ],
    "total": 1
  }
}

Get account trade history

get
/v1/trades

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.

Query parameters
accountstringRequired

Wallet address to query trade history for

index_tokenstringOptional

Filter by index token contract address

trade_typestring · enumOptional

Filter by trade direction. 'increase' = opening positions, 'decrease' = closing positions. Omit to return both.

Possible values:
from_timestampintegerOptional

Start of time range filter (Unix timestamp in seconds)

to_timestampintegerOptional

End of time range filter (Unix timestamp in seconds)

page_indexinteger · min: 1Optional

Page number, starting from 1

Default: 1
page_sizeinteger · min: 1 · max: 100Optional

Number of records per page (max 100)

Default: 20
Responses
200

List of trade records

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/trades
GET /openapi/v1/trades?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "total_volume": "text",
    "history_volume": "text",
    "total": 1,
    "trades": [
      {
        "account": "text",
        "trade_type": "text",
        "index_token": "text",
        "token_name": "text",
        "is_long": true,
        "size": "text",
        "collateral": "text",
        "price": "text",
        "average_price": "text",
        "pnl": "text",
        "fee": "text",
        "tx_hash": "text",
        "block_number": 1,
        "created_at": 1
      }
    ]
  }
}

Get latest token prices

get
/v1/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).

Query parameters
index_tokenstringOptional

Filter by index token contract address

symbolstringOptional

Filter by token display symbol (e.g., BTC, ETH, SOL)

Responses
200

List of token prices

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/prices
GET /openapi/v1/prices HTTP/1.1
Host: api.deriw.com
Accept: */*
200

List of token prices

{
  "code": 1,
  "msg": "text",
  "data": {
    "prices": [
      {
        "index_token": "text",
        "symbol": "text",
        "price": "text",
        "high_24h": "text",
        "low_24h": "text",
        "change_24h": "text"
      }
    ]
  }
}

Get all supported tokens

get
/v1/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.

Query parameters
statusinteger · enumOptional

Filter by token status. 1=Delisted, 2=Listed, 3=Pending delist

Possible values:
is_memebooleanOptional

Set to true to return only meme coins

is_tradfibooleanOptional

Set to true to return only TradFi assets (stocks and metals)

Responses
200

List of supported tokens

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/tokens
GET /openapi/v1/tokens HTTP/1.1
Host: api.deriw.com
Accept: */*
200

List of supported tokens

{
  "code": 1,
  "msg": "text",
  "data": {
    "tokens": [
      {
        "address": "text",
        "name": "text",
        "decimals": 1,
        "is_stable": true,
        "is_shortable": true,
        "is_wrapped": true,
        "is_meme": true,
        "is_tradfi": true,
        "coin_type": 1,
        "fee_rate": "text",
        "price": "text",
        "status": 1
      }
    ]
  }
}

Get protocol statistics

get
/v1/stats

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.

Query parameters
from_timestampintegerOptional

Start of time range filter (Unix timestamp in seconds)

to_timestampintegerOptional

End of time range filter (Unix timestamp in seconds)

Responses
200

Protocol statistics

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/stats
GET /openapi/v1/stats HTTP/1.1
Host: api.deriw.com
Accept: */*
200

Protocol statistics

{
  "code": 1,
  "msg": "text",
  "data": {
    "total_volume": "text",
    "trading_volume": "text",
    "long_volume": "text",
    "short_volume": "text",
    "total_fees": "text",
    "open_fee": "text",
    "close_fee": "text",
    "liquidation_fee": "text",
    "manage_fee": "text",
    "total_revenue": "text",
    "long_revenue": "text",
    "short_revenue": "text",
    "open_interest": "text",
    "long_open_interest": "text",
    "short_open_interest": "text",
    "long_weighting": "text",
    "short_weighting": "text",
    "tvl": "text",
    "fund_pool_volume": "text",
    "fund_pool_raised": "text",
    "unique_traders": 1,
    "updated_at": 1
  }
}

Get account liquidation history

get
/v1/liquidations

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.

Query parameters
accountstringRequired

Wallet address to query liquidation history for

index_tokenstringOptional

Filter by index token contract address

is_longbooleanOptional

Set to true for long positions, false for short positions

from_timestampintegerOptional

Start of time range filter (Unix timestamp in seconds)

to_timestampintegerOptional

End of time range filter (Unix timestamp in seconds)

page_indexinteger · min: 1Optional

Page number, starting from 1

Default: 1
page_sizeinteger · min: 1 · max: 100Optional

Number of records per page (max 100)

Default: 20
Responses
200

List of liquidation records

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/liquidations
GET /openapi/v1/liquidations?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "liquidations": [
      {
        "account": "text",
        "index_token": "text",
        "is_long": true,
        "size": "text",
        "collateral": "text",
        "average_price": "text",
        "mark_price": "text",
        "liquidation_price": "text",
        "fee": "text",
        "realised_pnl": "text",
        "liquidation_type": 1,
        "tx_hash": "text",
        "block_number": 1,
        "created_at": 1
      }
    ],
    "total": 1
  }
}

Get current position fee rates

get
/v1/funding_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.

Query parameters
index_tokenstringOptional

Filter by index token contract address. Omit to return fee rates for all listed tokens.

Responses
200

List of current fee rates

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/funding_rates
GET /openapi/v1/funding_rates HTTP/1.1
Host: api.deriw.com
Accept: */*
200

List of current fee rates

{
  "code": 1,
  "msg": "text",
  "data": {
    "funding_rates": [
      {
        "index_token": "text",
        "name": "text",
        "fee_rate": 1
      }
    ]
  }
}

Get room open positions

get
/v1/rooms/open_positions

Returns the current open positions of traders in the specified host's room. Data is served from a background cache and is eventually consistent; an empty list is returned when the cache has not been warmed yet. PnL is from the room (LP) perspective. All amounts are USDT-denominated decimal strings.

Query parameters
accountstringRequired

Room host (creator) wallet address. Note: unlike other v1 endpoints, this is the room host address, not a trader address

page_indexinteger · min: 1Optional

Page number, starting from 1

Default: 1
page_sizeinteger · min: 1 · max: 100Optional

Number of records per page (max 100)

Default: 20
Responses
200

List of room open positions. Business errors are also returned with HTTP 200 and a non-zero code: 100438 = invalid account address or page out of range

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/rooms/open_positions
GET /openapi/v1/rooms/open_positions?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "items": [
      {
        "account": "text",
        "market": "text",
        "index_token": "text",
        "direction": "text",
        "leverage": "text",
        "average_price": "text",
        "now_price": "text",
        "liquidation_price": "text",
        "collateral_size": "text",
        "size_delta": "text",
        "unreleased_pnl": "text"
      }
    ],
    "total": 1,
    "page_index": 1,
    "page_size": 1
  }
}

Get room close position history

get
/v1/rooms/close_position_history

Returns the closed position history of traders in the specified host's room, including force-close and liquidation flags and the room fee share. PnL is from the room (LP) perspective. All amounts are USDT-denominated decimal strings.

Query parameters
accountstringRequired

Room host (creator) wallet address

page_indexinteger · min: 1Optional

Page number, starting from 1

Default: 1
page_sizeinteger · min: 1 · max: 100Optional

Number of records per page (max 100)

Default: 20
Responses
200

List of room closed positions. Business errors are also returned with HTTP 200 and a non-zero code: 100438 = invalid account address or page out of range

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/rooms/close_position_history
GET /openapi/v1/rooms/close_position_history?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "items": [
      {
        "account": "text",
        "market": "text",
        "direction": "text",
        "leverage": "text",
        "average_price": "text",
        "close_price": "text",
        "collateral_size": "text",
        "size_delta": "text",
        "released_pnl": "text",
        "fee_share": "text",
        "time": 1,
        "is_force_close": true,
        "is_liq": true,
        "tx_hash": "text"
      }
    ],
    "total": 1,
    "page_index": 1,
    "page_size": 1
  }
}

Get room liquidity change history

get
/v1/rooms/lp_change

Returns the host's liquidity deposit and withdrawal history for the room pool, sourced from on-chain liquidity events. All amounts are USDT-denominated decimal strings.

Query parameters
accountstringRequired

Room host (creator) wallet address

page_indexinteger · min: 1Optional

Page number, starting from 1

Default: 1
page_sizeinteger · min: 1 · max: 100Optional

Number of records per page (max 100)

Default: 20
Responses
200

List of room liquidity changes. Business errors are also returned with HTTP 200 and a non-zero code: 100438 = invalid account address or page out of range

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/rooms/lp_change
GET /openapi/v1/rooms/lp_change?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "items": [
      {
        "account": "text",
        "amount": "text",
        "type": "text",
        "symbol": "text",
        "contract_address": "text",
        "status": "text",
        "time": 1
      }
    ],
    "total": 1,
    "page_index": 1,
    "page_size": 1
  }
}

Get room daily fee share trend

get
/v1/rooms/fee

Returns the room pool's daily fee share trend in ascending date order. The window covers the last N calendar days including today; days before the room's reopen time are returned as 0. Amounts are USDT-denominated decimal strings.

Query parameters
accountstringRequired

Room host (creator) wallet address

limitintegerOptional

Number of calendar days to return (default 10)

Default: 10
Responses
200

Daily fee share trend. Business errors are also returned with HTTP 200 and a non-zero code: 100438 = invalid account address, 100009 = room pool not found for this account

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/rooms/fee
GET /openapi/v1/rooms/fee?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "items": [
      {
        "day": "text",
        "volume": "text"
      }
    ]
  }
}

Get room daily TVL trend

get
/v1/rooms/tvl

Returns the room pool's daily TVL (total value locked) trend in ascending date order. Historical days are read from daily snapshots; today's value is read from the blockchain in real time. Days before the room's reopen time are returned as 0. Amounts are USDT-denominated decimal strings.

Query parameters
accountstringRequired

Room host (creator) wallet address

limitintegerOptional

Number of calendar days to return (default 10)

Default: 10
Responses
200

Daily TVL trend. Business errors are also returned with HTTP 200 and a non-zero code: 100438 = invalid account address, 100009 = room pool not found for this account

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/rooms/tvl
GET /openapi/v1/rooms/tvl?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "items": [
      {
        "day": "text",
        "volume": "text"
      }
    ]
  }
}

Get room detail overview

get
/v1/rooms/detail

Returns an aggregated overview of the specified host's room: deposits, pool equity, TVL, open interest capacity, active traders, 24h volume, realized PnL, net revenue, and room health. Amounts are USDT-denominated decimal strings; percentage fields are decimal ratio strings (e.g. '0.05' = 5%).

Query parameters
accountstringRequired

Room host (creator) wallet address

Responses
200

Room detail overview. Business errors are also returned with HTTP 200 and a non-zero code: 100438 = invalid account address, 100009 = room pool not found for this account

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/rooms/detail
GET /openapi/v1/rooms/detail?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "net_deposits": "text",
    "net_deposits_change_percent": "text",
    "total_deposits": "text",
    "total_deposits_change_percent": "text",
    "withdrawable_amount": "text",
    "pool_equity": "text",
    "pool_equity_change_percent": "text",
    "total_tvl": "text",
    "total_reversed_oi": "text",
    "total_reversed_oi_percent": "text",
    "max_oi": "text",
    "total_available_oi": "text",
    "active_trader": "text",
    "total_volume": "text",
    "realized_pnl": "text",
    "net_revenue": "text",
    "room_health": {
      "utilization_rate": "text",
      "risk_exposure": "text",
      "risk_exposure_rate": "text"
    }
  }
}

Get room trader summary

get
/v1/rooms/traders

Returns aggregated per-trader statistics for the specified host's room: total volume, win rate, fees, and PnL from the room (LP) perspective. All amounts are USDT-denominated decimal strings.

Query parameters
accountstringRequired

Room host (creator) wallet address

page_indexinteger · min: 1Optional

Page number, starting from 1

Default: 1
page_sizeinteger · min: 1 · max: 100Optional

Number of records per page (max 100)

Default: 20
Responses
200

List of room trader statistics. Business errors are also returned with HTTP 200 and a non-zero code: 100438 = invalid account address or page out of range

application/json
codeintegerOptional

Response status code. 0 = success

msgstringOptional

Response message. 'success' on success

get/v1/rooms/traders
GET /openapi/v1/rooms/traders?account=text HTTP/1.1
Host: api.deriw.com
Accept: */*
{
  "code": 1,
  "msg": "text",
  "data": {
    "items": [
      {
        "account": "text",
        "total_volume": "text",
        "win_rate": "text",
        "total_fee": "text",
        "unreleased_pnl": "text",
        "released_pnl": "text",
        "managed_fee": "text"
      }
    ],
    "total": 1,
    "page_index": 1,
    "page_size": 1
  }
}

Last updated