Skip to main content
Subscribe to aggregated trades for a market.
  • Topic: trade/{market_addr}
  • Stream: Public (wss://api.ekiden.fi/ws/public)

Subscribe

{ "op": "subscribe", "args": ["trade/0x88a70ff..."], "req_id": "102001" }
Ack:
{ "op": "subscribed", "args": ["trade/0x88a70ff..."], "req_id": "102001" }

Events

Messages arrive with op: "event", topic: "trade/{addr}", and data containing trades. Example:
{
	"op": "event",
	"topic": "trade/0x88a70ff...",
	"data": {
		"market_addr": "0x88a70ff...",
		"trades": [
			{ "id": 9723498234, "side": "buy",  "price": 100200000000, "size": 100000000, "seq": 12345, "timestamp": 1718000000 },
			{ "id": 7349823987, "side": "sell", "price": 100100000000, "size": 200000000, "seq": 12346, "timestamp": 1718000001 }
		]
	}
}
Notes:
  • price and size are scaled integers (int64). They match private streams and on-chain representation.
  • seq is the max sequence among fills aggregated into the trade; timestamp is the latest fill timestamp (seconds).
  • There is no top-level ts in the trade event payload.
See schema details in AsyncAPI: AggregatedTrades, Trade.

Trade ID

Field id is a 64‑bit unsigned integer, stable for a given aggregated trade and unique within a market. It is derived from a hash of (market_addr, price, side, seq, timestamp) after aggregation:
  • Multiple fills at the same price & side inside the same execution window collapse into one aggregated trade sharing a single id.
  • Identical (price, side, seq, timestamp) on different markets produce different IDs (market included in hash).
  • If the same batch is replayed (e.g. recovery) the id remains stable, aiding client deduplication.
You can treat id + market_addr as a primary key. Do not assume ordering by id; rely on provided seq and ts.