Labels: backend, enhancement, predictions, analytics
Problem
Users cannot see realized and unrealized profit/loss for their positions, so they lack a clear view of performance.
Requirements
- Compute realized P&L from settled predictions.
- Compute unrealized P&L from open positions at current odds.
- Add
GET /predictions/pnl returning both, with a time filter.
- Support per-market and aggregate breakdowns.
Acceptance Criteria
- Realized and unrealized P&L are computed correctly.
- The endpoint supports time filtering and breakdowns.
- Aggregate equals the sum of per-market values.
- Tests cover realized, unrealized, and aggregation math.
Files
backend/src/predictions/predictions.service.ts, backend/src/predictions/predictions.controller.ts, backend/src/predictions/dto
Labels: backend, enhancement, predictions, analytics
Problem
Users cannot see realized and unrealized profit/loss for their positions, so they lack a clear view of performance.
Requirements
GET /predictions/pnlreturning both, with a time filter.Acceptance Criteria
Files
backend/src/predictions/predictions.service.ts,backend/src/predictions/predictions.controller.ts,backend/src/predictions/dto