Messages
{
"op": "sub",
"id": 2,
"t": "trades@f",
"m": "0x8121EE960066e4344A213F9aC7502395502aEe7a",
"feedEpoch": 0,
"seq": 1022
}Exchange WebSocket methods
Market trades stream
Replay and follow finalized taker-side fills for one market.
WSS
/
ws
trades@f
(feedEpoch, marketSeq). Without seq, it begins with live trades. With
seq, it replays retained fills after that cursor and then joins live delivery.
Subscribe
{
"op": "sub",
"id": 2,
"t": "trades@f",
"m": "0x8121EE960066e4344A213F9aC7502395502aEe7a",
"feedEpoch": 0,
"seq": 1022
}
Decoded event
The shape below is the innermessage returned by decodeExchangeWsEnvelope
or decodeExchangeWsMessage. Every binary socket message also carries an outer
id: bigint, matching your subscription ID. Use it to route snapshots, replay,
and live updates. See binary subscription envelopes.
interface ExchangeWsMarketTradesFrame {
wireVersion: 1;
feedEpoch: bigint;
view: "finalized";
kind: "trades";
marketAddress: string;
marketSeq: bigint;
previousMarketSeq: bigint | null;
globalSeq: bigint;
sourceBlock: { blockNumber: bigint; blockId: string };
trades: Array<{
tradeId: bigint;
recordIndex: number;
takerSide: "buy" | "sell";
price: bigint;
baseFilled: bigint;
blockTimestamp: bigint;
}>;
}
takerSide is the taker’s side. price is in native market price precision (pp); baseFilled remains in the
market’s native size precision. The stable identity of a fill
is (marketAddress, tradeId, recordIndex).
previousMarketSeq links to the previous publication in this exact market,
view, and topic stream; it is null when the wire value is zero. For a replay
requested after R, accept the first frame when marketSeq > R and its
predecessor is null or at most R. Subsequent frames require exact equality
between previousMarketSeq and the last accepted marketSeq.
PnL versus market trade prices
This market stream supplies execution prices and sizes for market data; it does not include user IDs, historical fee rates, or match boundaries. It cannot by itself reconstruct a user’s fee-adjusted PnL. Use the user trades accounting guide for position initialization, match-level fee rounding, and buy/sell accounting. That guide also explains when the user-scoped stream lacks enough information for exact maker accounting and when to use indexed PnL instead.Canonical event timestamp
Each decoded trade row or order delta event includesblockTimestamp: bigint
in Unix seconds. It is the source block’s canonical header timestamp and is
identical in live delivery and retained replay. It is not the publication time.
Order snapshot rows are unchanged. See the event timestamp changelog.Messages
{
"op": "sub",
"id": 2,
"t": "trades@f",
"m": "0x8121EE960066e4344A213F9aC7502395502aEe7a",
"feedEpoch": 0,
"seq": 1022
}trades@f subscription
type:object