Skip to main content
The quote-stream endpoint streams a live bid and ask for a pair of token mints. See Market Data Streams for what the quotes mean and when to use the stream; this page documents the message format.
Quotes are approximations across direct and one-hop routes, computed from a $10 USDC equivalent round-trip trade. They can differ from the quote you receive at order time.
Access to the quote stream is gated. Reach out to the team to request access.

Connection

See the Websockets Overview for endpoint details.

Subscribe

Send a subscribe op with the base and quote mints:
{
  "op": "subscribe",
  "base_mint": "So11111111111111111111111111111111111111112",
  "quote_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}

Subscribe to All Prediction Markets

Send subscribe_all_prediction_markets to receive quotes for every active prediction-market outcome mint against USDC, with new markets added and closed markets removed automatically:
{ "op": "subscribe_all_prediction_markets" }

Unsubscribe

{
  "op": "unsubscribe",
  "base_mint": "So11111111111111111111111111111111111111112",
  "quote_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}
Stop an all-markets subscription with { "op": "unsubscribe_all_prediction_markets" }.

Message Format

Each message is a batch covering one slot:
{
  "u": 425218378,
  "ts": 1780964565,
  "subscribe": [
    {
      "sb": "So11111111111111111111111111111111111111112",
      "sq": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "auto": false
    }
  ],
  "updates": [
    {
      "sb": "So11111111111111111111111111111111111111112",
      "sq": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "b": "66.46416041",
      "B": "9.99791400",
      "a": "66.46410253",
      "A": "9.99791400"
    }
  ]
}

Fields

FieldTypeDescription
unumberSlot the quotes were computed at
tsnumberUnix timestamp in seconds
updatesarrayPer-pair quote updates for this slot
subscribe / unsubscribearrayAcknowledgements of subscription changes. auto: true marks pairs added by an all-markets subscription
pm_start / pm_stoparrayPrediction markets that opened or closed this slot (only with an all-markets subscription)
Each entry in updates has:
FieldTypeDescription
sbstringBase mint
sqstringQuote mint
bstringBid price, quote per base, 8 decimals
astringAsk price, quote per base, 8 decimals
BstringBid size, quote-denominated ($10 USDC equivalent)
AstringAsk size, quote-denominated
estringPer-pair error code (for example no_route), present instead of prices when a quote is unavailable

Code Examples

// Dev endpoint — no API key required, but rate-limited.
// For production, use your production WS URL and add
// { headers: { "x-api-key": "YOUR_API_KEY" } } as the second arg to new WebSocket().
const WS_URL = "wss://dev-quote-api.dflow.net/quote-stream";

const SOL = "So11111111111111111111111111111111111111112";
const USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";

const ws = new WebSocket(WS_URL);

ws.onopen = () => {
  ws.send(JSON.stringify({ op: "subscribe", base_mint: SOL, quote_mint: USDC }));
};

ws.onmessage = (event) => {
  const frame = JSON.parse(event.data);
  for (const u of frame.updates ?? []) {
    if (u.e) {
      console.log(`${u.sb} / ${u.sq}: ${u.e}`);
      continue;
    }
    console.log(`slot ${frame.u}  bid ${u.b}  ask ${u.a}`);
  }
};

ws.onerror = (error) => console.error("WebSocket error:", error);
ws.onclose = () => console.log("WebSocket connection closed");
const WS_URL = "wss://dev-quote-api.dflow.net/quote-stream";

const ws = new WebSocket(WS_URL);

ws.onopen = () => {
  ws.send(JSON.stringify({ op: "subscribe_all_prediction_markets" }));
};

ws.onmessage = (event) => {
  const frame = JSON.parse(event.data);
  for (const m of frame.pm_start ?? []) {
    console.log("market opened:", m.sb);
  }
  for (const u of frame.updates ?? []) {
    if (!u.e) console.log(`${u.sb}  bid ${u.b}  ask ${u.a}`);
  }
};
interface QuoteUpdate {
  sb: string; // base mint
  sq: string; // quote mint
  b?: string; // bid, quote per base
  a?: string; // ask, quote per base
  B?: string; // bid size, quote-denominated
  A?: string; // ask size, quote-denominated
  e?: string; // per-pair error code
}

interface QuoteFrame {
  u: number; // slot
  ts: number; // unix seconds
  updates?: QuoteUpdate[];
  subscribe?: { sb: string; sq: string; auto: boolean }[];
  unsubscribe?: { sb: string; sq: string; auto: boolean }[];
  pm_start?: { sb: string; sq: string }[];
  pm_stop?: { sb: string; sq: string }[];
}

Book Stream

Stream 10 levels of order book depth

Market Data Streams

How the streams work and when to use each

Websockets Overview

Connection details for Trading API streams

Stream Top-of-Book Quotes

Recipe: connect, subscribe, and read quotes