Skip to content

[Backend] — Prediction P&L Calculation Endpoint #1399

Description

@Olowodarey

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

  1. Compute realized P&L from settled predictions.
  2. Compute unrealized P&L from open positions at current odds.
  3. Add GET /predictions/pnl returning both, with a time filter.
  4. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions