WebSocket Reference
user:portfolio
Portfolio value and position updates
The user:portfolio channel broadcasts real-time updates to the authenticated user's portfolio, including position value changes, PnL updates, and overall portfolio metrics.
Subscribe
{ "event": "subscribe", "data": { "channel": "user:portfolio" } }Unsubscribe
{ "event": "unsubscribe", "data": { "channel": "user:portfolio" } }Server Broadcast
{
"channel": "user:portfolio",
"data": {
"totalValue": "4523.450000",
"totalCost": "3800.000000",
"unrealizedPnl": "723.450000",
"unrealizedPnlPercent": "19.0382",
"realizedPnl": "1250.670000",
"dayPnl": "45.230000",
"dayPnlPercent": "1.0100",
"positions": [
{
"positionId": "b1c2d3e4-f5a6-7890-bcde-f12345678901",
"marketId": "c5a2e7f1-3b4d-4e6a-8f9c-1d2e3f4a5b6c",
"marketTitle": "Will Bitcoin hit $100K by June 2026?",
"side": "yes",
"shares": "100.000000",
"entryPrice": "0.670000",
"currentPrice": "0.723400",
"value": "72.340000",
"unrealizedPnl": "5.340000",
"unrealizedPnlPercent": "7.9701"
}
],
"updatedAt": "2026-03-27T14:30:00.000Z"
}
}Payload Schema
| Field | Type | Description |
|---|---|---|
totalValue | string | Total current portfolio value in USD |
totalCost | string | Total cost basis of all positions |
unrealizedPnl | string | Total unrealized profit/loss |
unrealizedPnlPercent | string | Unrealized PnL as a percentage |
realizedPnl | string | Total realized profit/loss from closed positions |
dayPnl | string | PnL change for the current day |
dayPnlPercent | string | Day PnL as a percentage |
positions | array | List of current open positions (see below) |
updatedAt | string | ISO 8601 timestamp |
Position Object
| Field | Type | Description |
|---|---|---|
positionId | string | Unique position identifier (UUID) |
marketId | string | Market the position belongs to |
marketTitle | string | Market title for display |
side | string | yes or no |
shares | string | Number of shares held |
entryPrice | string | Average entry price |
currentPrice | string | Current market price for this side |
value | string | Current position value (shares * currentPrice) |
unrealizedPnl | string | Unrealized PnL for this position |
unrealizedPnlPercent | string | Unrealized PnL as a percentage |
Notes
- This channel requires authentication. Only the authenticated user's portfolio data is delivered.
- Portfolio updates are triggered when market prices change and the user has open positions
- All financial values are strings representing Decimal types for precision
- Positions with
status: "open"are included; closed positions are excluded - The
dayPnlvalues reset at midnight UTC