Overview
Tracks positions, cash balance, exposure, and P&L in near real time. Updated after each simulated execution.
Documents
Position Manager
Responsibilities
Tracks open positions and realized P&L across all symbols.
- Subscribes to Execution events to update position quantities and average cost
- Publishes Position events after each update
- Maintains per-symbol position state (quantity, average cost, realized P&L)
Event Flow
Execution → PositionManager → Position (published)
Position State
| Field | Description |
|---|---|
symbol |
Ticker symbol |
quantity |
Net position (positive = long, negative = short) |
avg_cost |
Volume-weighted average cost |
realized_pnl |
Cumulative realized profit/loss |
Source
src/components/position_manager.py