Skip to main content
Connect to wss://api.pmx.trade/v2/ws/market and subscribe to one or more market IDs to receive the following events.

book — Full Orderbook Snapshot

Sent immediately after subscribing. Contains the full depth for both outcomes.
{
  "event": "book",
  "marketId": "abc-123",
  "yes": {
    "bids": [{ "price": 5500, "size": "10000000" }],
    "asks": [{ "price": 5600, "size": "5000000" }]
  },
  "no": {
    "bids": [{ "price": 4400, "size": "8000000" }],
    "asks": [{ "price": 4500, "size": "3000000" }]
  },
  "bestBid": { "yes": 5500, "no": 4400 },
  "bestAsk": { "yes": 5600, "no": 4500 },
  "timestamp": 1711234567890
}
Prices are in basis points (1–9999). Sizes are raw token amounts (6 decimals).

price_change — Individual Level Update

Sent when a single price level changes. A size of "0" means the level was removed.
{
  "event": "price_change",
  "marketId": "abc-123",
  "outcome": "yes",
  "side": "bid",
  "price": 5500,
  "size": "15000000",
  "timestamp": 1711234567891
}

best_bid_ask — Top of Book Change

Sent only when the best bid or ask changes for either outcome.
{
  "event": "best_bid_ask",
  "marketId": "abc-123",
  "bestBid": { "yes": 5500, "no": 4400 },
  "bestAsk": { "yes": 5600, "no": 4500 },
  "timestamp": 1711234567892
}

trade — Fill Execution

Sent when an order is matched or settled. Use the id field to deduplicate — a trade may fire twice (once on matched, once on settled with settleTx).
{
  "event": "trade",
  "id": "fill-uuid",
  "marketId": "abc-123",
  "outcome": "yes",
  "priceBps": 5500,
  "quantity": "10000000",
  "usdcAmount": "5500000",
  "fillType": "direct",
  "status": "matched",
  "takerSide": "buy",
  "settleTx": null,
  "timestamp": 1711234567893
}
FieldDescription
idUnique fill ID
fillTypedirect, complementary, or sell_complementary
statusmatched or settled
settleTxSolana transaction signature (present when status is settled)

market_resolved — Market Resolution

Sent when a market is resolved by its admin.
{
  "event": "market_resolved",
  "marketId": "abc-123",
  "outcome": "yes",
  "timestamp": 1711234567894
}

Example: JavaScript Client

const ws = new WebSocket("wss://api.pmx.trade/v2/ws/market");

ws.onopen = () => {
  ws.send(JSON.stringify({
    type: "subscribe",
    markets: ["your-market-id"],
  }));

  // Heartbeat
  setInterval(() => ws.send("PING"), 14_000);
};

ws.onmessage = (event) => {
  if (event.data === "PONG") return;
  const msg = JSON.parse(event.data);
  console.log(msg.event, msg);
};

Example: wscat

wscat -c "wss://api.pmx.trade/v2/ws/market"
> {"type":"subscribe","markets":["your-market-id"]}