Skip to main content
Access to quote stream in production is gated: request an API key with quote stream access, or have an existing key upgraded.

Quote Stream

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 pricing a $10 USDC equivalent round-trip trade through the best path, so the bid and ask are the rates its two legs would execute at. For the full message format and parameters, see the Quote Stream API.
1

Set up

Import a WebSocket client, read the endpoint from the environment, and pick the pair to watch.
2

Connect and subscribe

Open the connection to /quote-stream and send a subscribe op once it is open. The API key header is only needed in production.
3

Read updates

Each message is a batch covering one slot. Read the updates array, and handle the per-pair e field for pairs with no route.
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. They can briefly cross (bid above ask) between slots.

Stream Order Book Depth

Read ten levels of depth per side.

Quote Stream API

Messages, fields, and the all-markets subscription.