docs/content/standards/deepbookv3-indexer.mdx
DeepBookV3 Indexer provides streamlined, real-time access to order book and trading data from the DeepBookV3 protocol. It acts as a centralized service to aggregate and expose critical data points for developers, traders, and analysts who interact with DeepBookV3.
DeepBookV3 Indexer simplifies data retrieval by offering endpoints that enable:
You can either use a publicly available indexer or spin up your own service. The choice you make depends on a few factors.
Use the public service if:
Run your own indexer if:
Mysten Labs provides public indexers for DeepBookV3.
https://deepbook-indexer.mainnet.mystenlabs.com/
https://deepbook-indexer.testnet.mystenlabs.com/
Volumes returned by the following endpoints are expressed in the smallest unit of the corresponding asset.
/all_historical_volume/historical_volume/historical_volume_by_balance_manager_id/historical_volume_by_balance_manager_id_with_intervalFollowing are the decimal places (scalars) used to determine the base unit for each asset.
| Asset | Scalar |
|---|---|
| ALKIMI | 9 |
| AUSD | 6 |
| Bridged Eth (BETH) | 8 |
| DEEP | 6 |
| DRF | 6 |
| IKA | 9 |
| LayerZero WBTC (LZWBTC) | 8 |
| Native USDC | 6 |
| NS | 6 |
| SEND | 6 |
| SUI | 9 |
| TYPUS | 9 |
| SUIUSDE | 6 |
| USDSUI | 6 |
| WAL | 9 |
| Wormhole USDC (WUSDC) | 6 |
| Wormhole USDT (WUSDT) | 6 |
| xBTC | 8 |
To convert the returned volume to the standard asset unit, divide the value by 10^SCALAR. For example:
If the volume returned in the base asset for the SUI/USDC pool is 1,000,000,000 SUI UNIT, the correct volume in SUI is 1,000,000,000 / 10^(SUI_SCALAR) = 1 SUI. Similarly, if the volume returned in the quote asset for the SUI/USDC pool is 1,000,000,000 USDC UNIT, the correct volume is 1,000,000,000 / 10^(USDC_SCALAR) = 1,000 USDC.
Use these conversions to interpret the volumes correctly across all pools and assets.
You can perform the following tasks using the endpoints that the indexer API for DeepBookV3 provides.
<details> <summary>Get all pool information</summary>/get_pools
Returns a list of all available pools, each containing detailed information about the base and quote assets, as well as pool parameters like minimum size, lot size, and tick size.
[
{
"pool_id": "string",
"pool_name": "string",
"base_asset_id": "string",
"base_asset_decimals": integer,
"base_asset_symbol": "string",
"base_asset_name": "string",
"quote_asset_id": "string",
"quote_asset_decimals": integer,
"quote_asset_symbol": "string",
"quote_asset_name": "string",
"min_size": integer,
"lot_size": integer,
"tick_size": integer
},
...
]
Each pool object in the response includes the following fields:
A successful request to the following endpoint
/get_pools
produces a response similar to
[
{
"pool_id": "0xb663828d6217467c8a1838a03793da896cbe745b150ebd57d82f814ca579fc22",
"pool_name": "DEEP_SUI",
"base_asset_id": "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
"base_asset_decimals": 6,
"base_asset_symbol": "DEEP",
"base_asset_name": "DeepBook Token",
"quote_asset_id": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
"quote_asset_decimals": 9,
"quote_asset_symbol": "SUI",
"quote_asset_name": "Sui",
"min_size": 100000000,
"lot_size": 10000000,
"tick_size": 10000000
},
{
"pool_id": "0xf948981b806057580f91622417534f491da5f61aeaf33d0ed8e69fd5691c95ce",
"pool_name": "DEEP_USDC",
"base_asset_id": "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
"base_asset_decimals": 6,
"base_asset_symbol": "DEEP",
"base_asset_name": "DeepBook Token",
"quote_asset_id": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
"quote_asset_decimals": 6,
"quote_asset_symbol": "USDC",
"quote_asset_name": "USDC",
"min_size": 100000000,
"lot_size": 10000000,
"tick_size": 10000
}
]
/historical_volume/:pool_names?start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&volume_in_base=<BOOLEAN>
Use this endpoint to get historical volume for pools for a specific time range. Delimit the pool_names with commas, and use Unix timestamp seconds for start_time and end_time values.
By default, this endpoint retrieves the last 24-hour trading volume in the quote asset for specified pools. If you want to query the base asset instead, set volume_in_base to true.
Returns the historical volume for each specified pool within the given time range.
{
"pool_name_1": total_pool1_volume,
"pool_name_2": total_pool2_volume,
...
}
A successful request to the following endpoint
/historical_volume/DEEP_SUI,SUI_USDC?start_time=1731260703&end_time=1731692703&volume_in_base=true
produces a response similar to
{
"DEEP_SUI": 22557460000000,
"SUI_USDC": 19430171000000000
}
/all_historical_volume?start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&volume_in_base=<BOOLEAN>
Use this endpoint to get historical volume for all pools. Include the optional start_time and end_time values as Unix timestamp seconds to retrieve the volume within that time range.
By default, this endpoint retrieves the last 24-hour trading volume in the quote asset. If you want to query the base asset instead, set volume_in_base to true.
Returns the historical volume for all available pools within the time range (if provided).
{
"pool_name_1": total_pool1_volume,
"pool_name_2": total_pool2_volume
}
A successful request to the following endpoint
/all_historical_volume?start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&volume_in_base=<BOOLEAN>
produces a response similar to
{
"DEEP_SUI": 22557460000000,
"WUSDT_USDC": 10265000000,
"NS_USDC": 4399650900000,
"NS_SUI": 6975475200000,
"SUI_USDC": 19430171000000000,
"WUSDC_USDC": 23349574900000,
"DEEP_USDC": 130000590000000
}
/historical_volume_by_balance_manager_id/:pool_names/:balance_manager_id?start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&volume_in_base=<BOOLEAN>
Get historical volume by balance manager for a specific time range. Delimit the pool_names with commas, and use Unix timestamp seconds for the optional start_time and end_time values.
By default, this endpoint retrieves the last 24-hour trading volume for the balance manager in the quote asset for specified pools. If you want to query the base asset instead, set volume_in_base to true.
{
"pool_name_1": [maker_volume, taker_volume],
"pool_name_2": …
}
A successful request to the following endpoint
/historical_volume_by_balance_manager_id/SUI_USDC,DEEP_SUI/0x344c2734b1d211bd15212bfb7847c66a3b18803f3f5ab00f5ff6f87b6fe6d27d?start_time=1731260703&end_time=1731692703&volume_in_base=true
produces a response similar to
{
"DEEP_SUI": [
14207960000000,
3690000000
],
"SUI_USDC": [
2089300100000000,
17349400000000
]
}
/historical_volume_by_balance_manager_id_with_interval/:pool_names/:balance_manager_id?start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&interval=<UNIX_TIMESTAMP_SECONDS>&volume_in_base=<BOOLEAN>
Get historical volume by BalanceManager for a specific time range with intervals. Delimit pool_names with commas and use Unix timestamp seconds for the optional start_time and end_time values. Use number of seconds for the interval value. As a simplified interval example, if start_time is 5, end_time is 10, and interval is 2, then the response includes volume from 5 to 7 and 7 to 9, with start time of the periods as keys.
By default, this endpoint retrieves the last 24-hour trading volume for the balance manager in the quote asset for specified pools. If you want to query the base asset instead, set volume_in_base to true.
{
"[time_1_start, time_1_end]": {
"pool_name_1": [maker_volume, taker_volume],
"pool_name_2": …
},
"[time_2_start, time_2_end]": {
"pool_name_1": [maker_volume, taker_volume],
"pool_name_2": …
}
}
A successful request to the following endpoint with an interval of 24 hours
/historical_volume_by_balance_manager_id_with_interval/USDC_DEEP,SUI_USDC/0x344c2734b1d211bd15212bfb7847c66a3b18803f3f5ab00f5ff6f87b6fe6d27d?start_time=1731460703&end_time=1731692703&interval=86400&volume_in_base=true
produces a response similar to
{
"[1731460703, 1731547103]": {
"SUI_USDC": [
505887400000000,
2051300000000
]
},
"[1731547103, 1731633503]": {
"SUI_USDC": [
336777500000000,
470600000000
]
}
}
/summary
Returns a summary in JSON for all trading pairs in DeepBookV3.
Each summary object has the following form. The order of fields in the JSON object is not guaranteed.
{
"trading_pairs": "string",
"quote_currency": "string",
"last_price": float,
"lowest_price_24h": float,
"highest_bid": float,
"base_volume": float,
"price_change_percent_24h": float,
"quote_volume": float,
"lowest_ask": float,
"highest_price_24h": float,
"base_currency": "string"
}
A successful request to
/summary
produces a response similar to
[
{
"trading_pairs": "AUSD_USDC",
"quote_currency": "USDC",
"last_price": 1.0006,
"lowest_price_24h": 0.99905,
"highest_bid": 1.0006,
"base_volume": 1169.2,
"price_change_percent_24h": 0.07501125168773992,
"quote_volume": 1168.961637,
"lowest_ask": 1.0007,
"highest_price_24h": 1.00145,
"base_currency": "AUSD"
},
{
"quote_volume": 4063809.55231,
"lowest_price_24h": 0.9999,
"highest_price_24h": 1.009,
"base_volume": 4063883.6,
"quote_currency": "USDC",
"price_change_percent_24h": 0.0,
"base_currency": "WUSDC",
"trading_pairs": "WUSDC_USDC",
"last_price": 1.0,
"highest_bid": 1.0,
"lowest_ask": 1.0001
},
{
"price_change_percent_24h": 0.0,
"quote_currency": "USDC",
"lowest_price_24h": 0.0,
"quote_volume": 0.0,
"base_volume": 0.0,
"highest_price_24h": 0.0,
"lowest_ask": 1.04,
"last_price": 1.04,
"base_currency": "WUSDT",
"highest_bid": 0.90002,
"trading_pairs": "WUSDT_USDC"
},
...
]
/ticker
Returns all trading pairs volume (already scaled), last price, and isFrozen value. Possible values for isFrozen is either:
0: Pool is active1: Pool is inactive{
"TRADING_PAIR": {
"base_volume": float,
"quote_volume": float,
"last_price": float,
"isFrozen": integer (0 | 1)
}
}
A successful request to
/ticker
produces a response similar to
{
"DEEP_USDC": {
"last_price": 0.07055,
"base_volume": 43760440.0,
"quote_volume": 3096546.9161,
"isFrozen": 0
},
"NS_SUI": {
"last_price": 0.08323,
"base_volume": 280820.8,
"quote_volume": 23636.83837,
"isFrozen": 0
},
...
}
/trades/:pool_name?limit=<INTEGER>&start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&maker_balance_manager_id=<ID>&taker_balance_manager_id=<ID>
Returns the most recent trades in the pool.
[
{
"event_digest": "string",
"digest": "string",
"trade_id": "string",
"maker_order_id": "string",
"taker_order_id": "string",
"maker_balance_manager_id": "string",
"taker_balance_manager_id": "string",
"price": float,
"base_volume": float,
"quote_volume": float,
"timestamp": integer,
"type": "string",
"taker_is_bid": boolean,
"taker_fee": float,
"maker_fee": float,
"taker_fee_is_deep": boolean,
"maker_fee_is_deep": boolean
}
]
The timestamp value is in Unix milliseconds. The type value is either "buy" or "sell" based on the taker's direction.
A successful request to
trades/SUI_USDC?limit=2&start_time=1738093405&end_time=1738096485&maker_balance_manager_id=0x344c2734b1d211bd15212bfb7847c66a3b18803f3f5ab00f5ff6f87b6fe6d27d&taker_balance_manager_id=0x47dcbbc8561fe3d52198336855f0983878152a12524749e054357ac2e3573d58
produces a response similar to
[
{
"event_digest": "abc123...",
"digest": "def456...",
"trade_id": "136321457151457660152049680",
"maker_order_id": "68160737799100866923792791",
"taker_order_id": "170141183460537392451039660509112362617",
"maker_balance_manager_id": "0x344c2734b1d211bd15212bfb7847c66a3b18803f3f5ab00f5ff6f87b6fe6d27d",
"taker_balance_manager_id": "0x47dcbbc8561fe3d52198336855f0983878152a12524749e054357ac2e3573d58",
"price": 3.695,
"base_volume": 405.0,
"quote_volume": 1499.0,
"timestamp": 1738096392913,
"type": "sell",
"taker_is_bid": false,
"taker_fee": 0.001,
"maker_fee": 0.0005,
"taker_fee_is_deep": true,
"maker_fee_is_deep": true
},
...
]
/order_updates/:pool_name?limit=<INTEGER>&start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&status=<"Placed" or "Canceled">&balance_manager_id=<ID>
Returns the orders that were recently placed or canceled in the pool
[
{
"order_id": "string",
"balance_manager_id": "string",
"timestamp": integer,
"original_quantity": integer,
"remaining_quantity": integer,
"filled_quantity": integer,
"price": integer,
"status": "string",
"type": "string"
}
]
The timestamp value is in Unix milliseconds.
A successful request to
/order_updates/DEEP_USDC?start_time=1738703053&end_time=1738704080&limit=2&status=Placed&balance_manager_id=0xd335e8aa19d6dc04273d77e364c936bad69db4905a4ab3b2733d644dd2b31e0a
produces a response similar to
[
{
"order_id": "170141183464610341308794360958165054983",
"balance_manager_id": "0xd335e8aa19d6dc04273d77e364c936bad69db4905a4ab3b2733d644dd2b31e0a",
"timestamp": 1738704071994,
"original_quantity": 8910,
"remaining_quantity": 8910,
"filled_quantity": 0,
"price": 22449,
"status": "Placed",
"type": "sell"
},
...
]
/orderbook/:pool_name?level={1|2}&depth={integer}
Returns the bids and asks for the relevant pool. The bids and asks returned are each sorted from best to worst. There are two optional query parameters in the endpoint:
level value can be either 1 or 2.
1: Only the best bid and ask.2: Arranged by best bids and asks. This is the default value.depth value can be 0 or greater than 1. A value of 0 returns the entire order book, and a value greater than 1 returns the specified number of both bids and asks. In other words, if you provide depth=100, then your response includes 50 bids and 50 asks. If the depth value is odd, it's treated as the next lowest even value. Consequently, depth=101 also returns 50 bids and 50 asks. If you do not provide a depth parameter, the response defaults to all orders in the order book.{
"timestamp": "string",
"bids": [
[
"string",
"string"
],
[
"string",
"string"
]
],
"asks": [
[
"string",
"string"
],
[
"string",
"string"
]
]
}
The timestamp returned is a string that represents a Unix timestamp in milliseconds.
A successful request to
/orderbook/SUI_USDC?level=2&depth=4
produces a response similar to
{
"timestamp": "1733874965431",
"bids": [
[
"3.715",
"2.7"
],
[
"3.713",
"2294.8"
]
],
"asks": [
[
"3.717",
"0.9"
],
[
"3.718",
"1000"
]
]
}
/assets
Returns asset information for all coins being traded on DeepBookV3.
Each asset object has the following form:
"ASSET_NAME": {
"unified_cryptoasset_id": "string",
"name": "string",
"contractAddress": "string",
"contractAddressUrl": "string",
"can_deposit": "string (true | false)",
"can_withdraw": "string (true | false)"
}
A successful request to
/assets
produces a response similar to
{
"NS": {
"unified_cryptoasset_id": "32942",
"name": "Sui Name Service",
"contractAddress": "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178",
"contractAddressUrl": "https://suiscan.xyz/mainnet/object/0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178",
"can_deposit": "true",
"can_withdraw": "true"
},
"AUSD": {
"unified_cryptoasset_id": "32864",
"name": "AUSD",
"contractAddress": "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2",
"contractAddressUrl": "https://suiscan.xyz/mainnet/object/0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2",
"can_deposit": "true",
"can_withdraw": "true"
},
...
}
/orders/:pool_name/:balance_manager_id?limit=<INTEGER>&status=<STATUS>
Returns orders for a specific balance manager in a pool. The status parameter can filter by order status (e.g., Placed, Canceled, Filled). Multiple statuses can be provided as comma-separated values.
[
{
"order_id": "string",
"balance_manager_id": "string",
"type": "string",
"current_status": "string",
"price": float,
"placed_at": integer,
"last_updated_at": integer,
"original_quantity": float,
"filled_quantity": float,
"remaining_quantity": float
}
]
/trade_count?start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>
Returns the total number of trades across all pools within the specified time range.
integer
/ohclv/:pool_name?interval=<INTERVAL>&start_time=<UNIX_TIMESTAMP_SECONDS>&end_time=<UNIX_TIMESTAMP_SECONDS>&limit=<INTEGER>
Returns OHLCV (Open, High, Low, Close, Volume) candlestick data for a pool. Valid intervals are: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w.
{
"candles": [
[timestamp, open, high, low, close, volume],
...
]
}
A successful request to
/ohclv/SUI_USDC?interval=1h&limit=10
produces a response similar to
{
"candles": [
[1738000000, 3.5, 3.6, 3.4, 3.55, 1000000],
[1738003600, 3.55, 3.7, 3.5, 3.65, 1500000],
...
]
}
/get_net_deposits/:asset_ids/:timestamp
Returns the net deposits (deposits minus withdrawals) for specified assets up to a given timestamp. Asset IDs should be comma-separated.
{
"asset_id_1": integer,
"asset_id_2": integer,
...
}
/deep_supply
Returns the total supply of DEEP tokens.
{
"total_supply": "string"
}
/deposited_assets/:balance_manager_ids
Returns the list of assets that have been deposited into the specified balance managers. Balance manager IDs should be comma-separated.
[
{
"balance_manager_id": "string",
"assets": ["string", ...]
}
]
/status?max_checkpoint_lag=<INTEGER>&max_time_lag_seconds=<INTEGER>
Returns the health status of the indexer, including checkpoint lag information for each pipeline. The optional parameters set thresholds for determining healthy status (defaults: max_checkpoint_lag=100, max_time_lag_seconds=60).
{
"status": "OK" | "UNHEALTHY",
"latest_onchain_checkpoint": integer,
"current_time_ms": integer,
"earliest_checkpoint": integer,
"max_lag_pipeline": "string",
"max_checkpoint_lag": integer,
"max_time_lag_seconds": integer,
"pipelines": [
{
"pipeline": "string",
"indexed_checkpoint": integer,
"indexed_epoch": integer,
"indexed_timestamp_ms": integer,
"checkpoint_lag": integer,
"time_lag_seconds": integer,
"latest_onchain_checkpoint": integer
}
]
}
/get_points?addresses=<ADDRESS1>,<ADDRESS2>,...
Returns the total points accumulated for the specified addresses. Points are earned through trading activity on DeepBookV3. Provide addresses as comma-separated values.
[
{
"address": "0x1234...",
"total_points": 1000000
},
{
"address": "0x5678...",
"total_points": 500000
}
]
A successful request to
/get_points?addresses=0x344c2734b1d211bd15212bfb7847c66a3b18803f3f5ab00f5ff6f87b6fe6d27d,0x47dcbbc8561fe3d52198336855f0983878152a12524749e054357ac2e3573d58
produces a response similar to
[
{
"address": "0x344c2734b1d211bd15212bfb7847c66a3b18803f3f5ab00f5ff6f87b6fe6d27d",
"total_points": 1250000
},
{
"address": "0x47dcbbc8561fe3d52198336855f0983878152a12524749e054357ac2e3573d58",
"total_points": 750000
}
]
/margin_supply
Returns the total supply balance for each margin pool, queried on-chain via the margin pool contract.
{
"0x2::sui::SUI": 1000000000000,
"0xdba3...::usdc::USDC": 5000000000000
}
A map of asset type to total supply amount (in smallest units).
</details> <details> <summary>Get pool creation events</summary>/pool_created
Returns events for when DeepBook pools are created.
[
{
"event_digest": "0xabc123...",
"digest": "0xdef456...",
"sender": "0x1111...",
"checkpoint": 12345678,
"checkpoint_timestamp_ms": 1738000000000,
"package": "0x2222...",
"pool_id": "0x1234...",
"taker_fee": 1000000,
"maker_fee": 500000,
"tick_size": 10000,
"lot_size": 10000000,
"min_size": 100000000,
"whitelisted_pool": false,
"treasury_address": "0x5678..."
}
]
/book_params_updated?pool_id=<ID>
Returns the most recent book parameter update event for a pool. The pool_id parameter is required.
{
"event_digest": "0xabc123...",
"digest": "0xdef456...",
"sender": "0x1111...",
"checkpoint": 12345678,
"checkpoint_timestamp_ms": 1738000000000,
"package": "0x2222...",
"pool_id": "0x1234...",
"tick_size": 10000,
"lot_size": 10000000,
"min_size": 100000000,
"onchain_timestamp": 1738000000000
}
/portfolio/:wallet_address
Returns a comprehensive portfolio view for a wallet address, including margin positions, collateral balances, LP positions, and a summary of total equity.
{
"margin_positions": [
{
"margin_manager_id": "0x1234...",
"pool": "SUI_USDC",
"base_asset_symbol": "SUI",
"quote_asset_symbol": "USDC",
"base_asset": 100.0,
"quote_asset": 500.0,
"base_debt": 50.0,
"quote_debt": 200.0,
"base_asset_usd": 350.0,
"quote_asset_usd": 500.0,
"base_debt_usd": 175.0,
"quote_debt_usd": 200.0,
"total_debt_usd": 375.0,
"net_value_usd": 475.0,
"risk_ratio": 2.27
}
],
"collateral_balances": [
{
"asset": "SUI",
"balance": 100.0,
"balance_usd": 350.0
}
],
"lp_positions": [
{
"margin_pool_id": "0x5678...",
"asset": "USDC",
"supplied": 1000.0,
"shares": 1000000000,
"supplied_usd": 1000.0
}
],
"summary": {
"total_equity_usd": 1850.0,
"total_debt_usd": 375.0,
"net_value_usd": 1475.0
}
}
/referral_fee_events?pool_id=<ID>&referral_id=<ID>
Returns events for referral fees earned during trading. These events track fees earned by referrals across different pools.
[
{
"event_digest": "0xabc123...",
"digest": "0xdef456...",
"sender": "0x1111...",
"checkpoint": 12345678,
"checkpoint_timestamp_ms": 1738000000000,
"package": "0x2222...",
"pool_id": "0x1234...",
"referral_id": "0x5678...",
"base_fee": 1000000,
"quote_fee": 500000,
"deep_fee": 250000
}
]