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

# Market Data Streams

> Stream live top-of-book quotes and order book depth over WebSocket

DFlow serves live market data over two WebSocket streams on the Trading API.
Subscribe to the pairs you want and read updates each slot.

| Stream       | What you get                 | Coverage                  | Endpoint        |
| ------------ | ---------------------------- | ------------------------- | --------------- |
| Quote stream | Top-of-book bid and ask      | Direct and one-hop routes | `/quote-stream` |
| Book stream  | Ten levels of depth per side | Direct routes only        | `/book-stream`  |

See [Endpoints](/get-started/endpoints) for the WebSocket URLs and access details.

## Connecting

As a security best practice, keep your DFlow API key on the backend, not in browser code where anyone can read it. Stream through a backend proxy that holds the key, connects to DFlow, and relays messages to the browser.

In production, access to the quote and book streams is granted per API key: a key that works for `/order` is not automatically allowed on the streams. Reach out to the team to request stream access on your key.

## Quote Stream

The quote stream returns a live bid and ask for any pair of token mints, across
direct and one-hop routes. New quotes stream out as the underlying liquidity
moves, so you read prices as they change without polling.

DFlow builds each quote by routing a \$10 USDC equivalent trade through the best
path in each direction, so the bid and ask are the rates that trade would
execute at.

For the full message format and parameters, see the [Quote Stream API](/resources/trading-api/websockets/quote-stream). The [Stream Top-of-Book Quotes recipe](/spot/recipes/stream-quotes) shows how to connect and read updates in code.

## Book Stream

The book stream gives you ten levels of order book depth per side, with the mid
price and tick size. Levels are cumulative from the spot outward, so each level
carries the total size available up to that price. The book stream covers direct
routes only.

For the full message format and parameters, see the [Book Stream API](/resources/trading-api/websockets/book-stream). The [Stream Order Book Depth recipe](/spot/recipes/stream-order-book) shows how to connect and render depth in code.

## Accuracy

Quotes and book levels are approximations. DFlow computes them at runtime from current routes, so they may differ from the quote you receive at order time. Treat them as a live read on the market, not a guaranteed execution price.

## Choosing a Stream

Use the **quote stream** for price displays, pre-trade pricing, and watching
many pairs at once. Use the **book stream**
when you need depth: order book visualizations, depth charts, and sizing larger
trades against available liquidity.
