Skip to main content
This page covers subscribing to Unrealized PnL leaderboard invalidation hints with subscribe_unrealized_pnl, and the unrealizedPnlProjectionChanged payload that subscription delivers.

Subscribing to unrealized PnL updates

Subscribe to invalidation hints for the live Unrealized PnL leaderboards by emitting subscribe_unrealized_pnl. No authentication required. Two scopes are available: one leaderboard per open market, and a global biggest-open-positions list.
This event carries only a hint, not the leaderboard payload. When it arrives, refetch the corresponding REST route — GET /leaderboard/pnl/unrealized/markets/{marketId} or GET /leaderboard/pnl/unrealized/biggest-positions — which remains the serving contract.
To unsubscribe, emit unsubscribe_unrealized_pnl with the same payload shape.
At most 50 MARKET scopes per connection. Additional subscribe_unrealized_pnl calls with new marketIds beyond the limit are rejected with an error frame carrying code: "UNREALIZED_PNL_SCOPE_LIMIT". The BIGGEST_POSITIONS scope does not count against the market limit.
state on the hint tracks the projection. state: "READY" means the leaderboard you refetch will be current; BUILDING, STALE, or DEGRADED mean the REST route may return an empty or stale snapshot. Retry shortly.

Event payload

unrealizedPnlProjectionChanged

Invalidation hint delivered to subscribe_unrealized_pnl subscribers when the underlying projection for their scope changes. It does not carry the leaderboard rows. Refetch the matching REST route to get the updated snapshot. Market scope:
Biggest positions scope:
  • WebSocket overview: connection details, handshake authentication, and the full event reference