Overview
Current position snapshot produced by PositionManager after each Execution. Represents the live state of a symbol holding including P&L. Defined in src/domain/__init__.py.
Contract
Consumers
- AuditLog
- IPositionRepository
Types
| Name | Base | Constraints / Values | Description |
|---|---|---|---|
| Position | dataclass | — | Current position snapshot published by PositionManager after each fill. |
Documents
Position Data Contract
Current position snapshot produced by PositionManager and published to the EventBus.
Consumed by MonitoringAndReporting and UserInterfaceDashboard.
Source: src/domain/__init__.py — @dataclass class Position
Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
symbol |
str |
✓ | — | Ticker symbol (e.g. AAPL, MSFT) |
qty |
float |
✓ | — | Current net position quantity (positive = long, negative = short) |
avg_cost |
float |
✓ | — | Volume-weighted average cost per share |
market_value |
float |
✓ | — | Current market value (qty × last_price) |
unrealized_pnl |
float |
✓ | — | Unrealized profit/loss (market_value - (qty × avg_cost)) |
realized_pnl |
float |
✓ | — | Cumulative realized profit/loss from closed trades |
timestamp |
datetime |
now() |
UTC timestamp of snapshot |
Consumers
| Component | Usage |
|---|---|
MonitoringAndReporting |
Aggregates position snapshots for P&L reports and alerts |
UserInterfaceDashboard |
Displays real-time positions and P&L to the trader |
Notes
Positionis a snapshot — a new instance is published after everyExecutionthat changes the positionqty == 0indicates a flat (closed) positionunrealized_pnlfluctuates with market price;realized_pnlis locked in on close- No
position_idfield — positions are keyed bysymbol