Loading...
Loading...
Stream real-time DFlow spot market data over WebSocket, including live top-of-book quotes, ten-level order-book depth, and priority-fee estimates for Solana token pairs. Use when the user wants a live price ticker, a streaming order book, a depth chart, real-time bid/ask for a pair, or to watch priority fees without polling. Read-only market data. To place a swap or take a builder platform fee, use `dflow-spot-trading`.
npx skill4agent add dflowprotocol/dflow-skills dflow-market-datadflow-spot-tradingwss://quote-api.dflow.netwss://dev-quote-api.dflow.net| Stream | Path | Gives you |
|---|---|---|
| Quotes | | live top-of-book bid/ask for a pair |
| Order book | | ten levels of depth per side |
| Priority fees | | live priority-fee estimates (no polling) |
x-api-key// Backend relay (Node, `ws`). The browser connects to THIS; the backend holds the key.
import { WebSocketServer, WebSocket } from "ws";
const wss = new WebSocketServer({ server }); // same origin as your app
wss.on("connection", (client) => {
const up = new WebSocket(`${process.env.DFLOW_TRADE_API_WS_URL}/book-stream`,
{ headers: { "x-api-key": process.env.DFLOW_API_KEY } });
const q = [];
up.on("open", () => { q.forEach((m) => up.send(m)); q.length = 0; });
up.on("message", (d) => client.readyState === 1 && client.send(d.toString()));
client.on("message", (m) => up.readyState === 1 ? up.send(m.toString()) : q.push(m.toString()));
client.on("close", () => up.close()); up.on("close", () => client.close());
});https://pond.dflow.net/mcpsearch_d_flowquery_docs_filesystem_d_flow/resources/trading-api/websockets/{overview,quote-stream,book-stream,priority-fees-stream}In production, access to the quote and book streams is granted per key: a key that works formay need stream access enabled on it, so a valid key can still be refused on the stream until the team turns it on. The priority-fees stream is not gated./order
{ "op": "subscribe", "base_mint": "<mint>", "quote_mint": "<mint>" }unsubscribe{ u: <slot>, ts, updates: [ { sb, sq, ... } ] }updates[]sbsq{ e: <code>, sb, sq }bamidtickcumulative_size_humanuskipped{ mediumMicroLamports, highMicroLamports, veryHighMicroLamports }GET /priority-fees/resources/trading-api/websockets/priority-fees-stream/order/orderdflow-spot-tradingx-api-keywss://quote-api.dflow.netwss://dev-quote-api.dflow.nethttps://pond.dflow.net/get-started/api-key/resources/trading-api/websockets/*/book-stream/spot/recipes/stream-order-book/spot/recipes/stream-quotesdflow-spot-tradingdflow-spot-trading