> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dune.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Market Data Feeds

> Real-time onchain market data from Dune: spot DEX trades, pool liquidity books and perpetual futures trades over WebSocket, with history in DuneSQL and Datashare.

Dune Market Data Feeds are real-time streams of onchain market data. There are three feeds:

| Feed | What one message holds | Chains and venues | Live delivery |
| - | - | - | - |
| [Spot Trades](https://docs.dune.com/market-data-feeds/spot-trades.md) | Every DEX trade in one block, with price, side, USD notional and the transaction behind it | 12 EVM chains and Solana | WebSocket |
| [Spot Liquidity](https://docs.dune.com/market-data-feeds/liquidity.md) | Every liquidity add, remove and limit order in one block, plus a ±2% book for each pool the block changed | 12 EVM chains and Solana, 18 concentrated-liquidity and bin venues | WebSocket |
| [Perpetuals Trades](https://docs.dune.com/market-data-feeds/perp-trades.md) | Every perpetual futures fill in one venue block, with both parties, fees and position effect | Hyperliquid (HyperCore), Lighter, Lighter Robinhood | WebSocket |

Trade history for spot and perpetuals is in two Dune tables, `historical_spot_trades` and `historical_perp_trades`. See [History](#history).

To see the instruments the feeds carry, open the [instrument explorer](https://dune.com/data/feeds).

## Chains

The Spot Trades and Spot Liquidity feeds cover the same 13 chains.

| Chain | `chain.type` | `chain.id` |
| - | - | - |
| Arbitrum | `evm` | `42161` |
| Arc | `evm` | `5042` |
| Avalanche C-Chain | `evm` | `43114` |
| Base | `evm` | `8453` |
| BNB Chain | `evm` | `56` |
| Ethereum | `evm` | `1` |
| HyperEVM | `evm` | `999` |
| Monad | `evm` | `143` |
| Optimism | `evm` | `10` |
| Polygon | `evm` | `137` |
| Robinhood Chain | `evm` | `4663` |
| X Layer | `evm` | `196` |
| Solana | `svm` | `1` |

`chain.id` is scoped by `chain.type`. Ethereum is `{"id": 1, "type": "evm"}` and Solana is `{"id": 1, "type": "svm"}`. Always key on both fields.

## Connect

All live feeds are WebSocket endpoints on `wss://api.dune.com`. Authenticate with your Dune API key in the `X-Dune-Api-Key` header. The key must be enabled for feed access. See [Get access](#get-access).

| Feed | Endpoint |
| - | - |
| Spot Trades, EVM | `wss://api.dune.com/api/feed/dex/trades/evm/{chain_id}` |
| Spot Trades, Solana | `wss://api.dune.com/api/feed/dex/trades/svm/1` |
| Spot Liquidity, EVM | `wss://api.dune.com/api/feed/dex/liquidity/evm/{chain_id}` |
| Spot Liquidity, Solana | `wss://api.dune.com/api/feed/dex/liquidity/svm/1` |
| Perpetuals, Hyperliquid | `wss://api.dune.com/api/feed/perp/trades/1` |
| Perpetuals, Lighter | `wss://api.dune.com/api/feed/perp/trades/lighter/1` |
| Perpetuals, Lighter Robinhood | `wss://api.dune.com/api/feed/perp/trades/lighter/2` |

```bash websocat theme={null}
websocat -B 16777216 -H "X-Dune-Api-Key: $DUNE_API_KEY" \
  "wss://api.dune.com/api/feed/dex/trades/evm/8453"
```

```python Python theme={null}
import asyncio, json, os
import websockets

URL = "wss://api.dune.com/api/feed/dex/trades/evm/8453"

async def main():
    headers = {"X-Dune-Api-Key": os.environ["DUNE_API_KEY"]}
    async with websockets.connect(URL, additional_headers=headers, max_size=None) as ws:
        async for frame in ws:
            block = json.loads(frame)
            print(block["block_number"], block["op"], len(block["trades"]))

asyncio.run(main())
```

### Messages

* One WebSocket message holds one block. Messages arrive in order.
* Each message is a binary frame of UTF-8 JSON. In a browser, set `binaryType = "arraybuffer"` and decode with `TextDecoder`.
* `schema_version` names the message format, for example `dex-trades.json.v2`.
* `sequence_number` is the position of the message in the chain's stream. It is a JSON string, so it stays exact in JavaScript.
* `block_timestamp` and `block_notification_time` are RFC 3339 timestamps in UTC. `block_notification_time` is when Dune first observed the block.

### Resume after a disconnect

* Without a query parameter, a connection starts at the live tip.
* To resume, reconnect with `?resume_after={sequence_number}`, using the last `sequence_number` you processed. The stream continues from the next message, then stays live.
* Do not use a block number as a cursor. A correction of an old block arrives at a later sequence number.
* A `resume_after` value outside the retained range is rejected with HTTP `400`. An unsupported chain is rejected with HTTP `404`.
* Close code `1001` means the server is shutting down. Close code `1008` means your client fell behind the live buffer. In both cases, reconnect with `resume_after`.

## Corrections and provisional blocks

The feeds publish a block when it is first observed, before the chain finalizes it. If the block changes later, for example after a reorg, Dune sends it again.

* `op` is `INSERT` for the first message of a block and `UPDATE` for a correction. The Spot Liquidity feed writes these values in lowercase.
* `incarnation_version` starts at `0` and increases with each correction. Keep the message with the highest `incarnation_version` for each `(chain, block_number)`.
* Every message is the complete content of its block. An `UPDATE` replaces all that you hold for that block. A trade or event that is missing from the `UPDATE` is cancelled. There is no separate cancel message.
* An `UPDATE` can be empty. This tells you to delete everything you hold for that block.
* Trade and event identifiers (`trade_id`, `event_id`) are stable. The same trade seen again carries the same identifier.
* On Solana, trades are published at the *confirmed* commitment level and each slot is checked again at finality.

## Latency

Dune measured the public endpoints from outside Dune's network on 10 November 2026. Each connection ran for 180 seconds. Latency is the time the message was received minus its `block_timestamp`, so it includes block propagation, Dune processing, WebSocket delivery and internet transit. Percentiles are per message, not per trade. These are short samples, not a service level agreement.

| Feed and chain | Messages | p50 | p95 |
| - | - | - | - |
| Spot Trades, Optimism | 90 | 0.170 s | 0.273 s |
| Spot Trades, X Layer | 180 | 0.244 s | 0.387 s |
| Spot Trades, HyperEVM | 183 | 0.955 s | 1.190 s |
| Spot Trades, Arc | 355 | 0.785 s | 1.243 s |
| Spot Trades, Arbitrum | 646 | 0.876 s | 1.341 s |
| Spot Trades, Base | 901 | 1.052 s | 1.487 s |
| Spot Trades, Solana | 839 | 1.047 s | 1.593 s |
| Spot Trades, Robinhood Chain | 1,727 | 1.131 s | 1.657 s |
| Spot Trades, Monad | 598 | 1.036 s | 1.694 s |
| Spot Trades, BNB Chain | 400 | 1.405 s | 1.946 s |
| Spot Trades, Avalanche C-Chain | 194 | 1.416 s | 1.956 s |
| Spot Trades, Ethereum | 15 | 3.023 s | 5.545 s |
| Perpetuals, Hyperliquid | 1,507 | 0.400 s | 0.469 s |

The Spot Liquidity feed showed similar numbers on each chain, for example p95 of 1.315 s on Arbitrum, 1.506 s on Base and 1.880 s on Solana.

Notes on the sample:

* Ethereum produces a block every 12 seconds, so its 180-second sample has few messages and its p95 is not a stable estimate.
* Polygon is not in the table. Its block timestamps are later than the receive times, so they cannot give a valid latency.
* Lighter: a 60-second sample gave p50 1.504 s and p95 2.268 s. An earlier 180-second sample on the same day had a p95 of 121 s. The cause of that delay was not found.

## History

Dune rebuilds trade history from raw chain data with the same decoders and pricing as the live feeds. One row is one trade.

| Table | Contents | First day |
| - | - | - |
| `dune.dune.historical_spot_trades` | Spot trades on the 13 chains above | Polygon 2022-03-09, Solana 2022-04-07, Ethereum 2023-01-01. See [Spot Trades](https://docs.dune.com/market-data-feeds/spot-trades.md#history) for all chains. |
| `dune.dune.historical_perp_trades` | Perpetuals trades on Hyperliquid, Lighter, Lighter Robinhood and Kalshi | Lighter 2025-01-17, Hyperliquid 2025-07-27. See [Perpetuals Trades](https://docs.dune.com/market-data-feeds/perp-trades.md#history) for all venues. |

* A new day is written each night, after the day is complete on the chain.
* On 19 November 2026, both tables had a partition for every calendar day from each chain's first day to 2026-11-18. A present day does not prove that every trade of that day is present.
* History is available through DuneSQL, through [Datashare](https://docs.dune.com/datashare/datashare.md) to your own warehouse, and as monthly CSV files during a trial. Access is granted per customer.

```sql DuneSQL theme={null}
SELECT block_timestamp, instrument_code, side, executed_price, notional_usd, tx_hash
FROM dune.dune.historical_spot_trades
WHERE block_date = DATE '2026-11-17'
  AND chain_type = 'evm' AND chain_id = 8453
  AND instrument_code = 'WETH-USDC.UNIV3.BASE'
ORDER BY block_timestamp
LIMIT 100
```

## Get access

Feed access is enabled per Dune team. To request access or a trial, use **Request a demo** on the [Market Data Feeds page](https://dune.com/feeds). A trial includes the live WebSocket feeds and monthly history files.

## What the feeds do not include

* Centralized exchange trades.
* A consolidated or aggregated price. Each trade and each pool book is published on its own.
* Constant-product pools in the Spot Liquidity feed. See [Spot Liquidity](https://docs.dune.com/market-data-feeds/liquidity.md#venues).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.