VeztaVezta
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

FieldTypeDescription
totalValuestringTotal current portfolio value in USD
totalCoststringTotal cost basis of all positions
unrealizedPnlstringTotal unrealized profit/loss
unrealizedPnlPercentstringUnrealized PnL as a percentage
realizedPnlstringTotal realized profit/loss from closed positions
dayPnlstringPnL change for the current day
dayPnlPercentstringDay PnL as a percentage
positionsarrayList of current open positions (see below)
updatedAtstringISO 8601 timestamp

Position Object

FieldTypeDescription
positionIdstringUnique position identifier (UUID)
marketIdstringMarket the position belongs to
marketTitlestringMarket title for display
sidestringyes or no
sharesstringNumber of shares held
entryPricestringAverage entry price
currentPricestringCurrent market price for this side
valuestringCurrent position value (shares * currentPrice)
unrealizedPnlstringUnrealized PnL for this position
unrealizedPnlPercentstringUnrealized 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 dayPnl values reset at midnight UTC

On this page