Expand description
§Module: position
§Responsibility
Tracks individual positions per symbol and a multi-position ledger with cash accounting. Computes realized and unrealized P&L from fills.
§Guarantees
Position::apply_fillreturns realizedPnL(non-zero only when reducing position)PositionLedger::apply_filldebits/credits cash correctly including commissionsPosition::is_flatis true iffquantity == 0
§NOT Responsible For
- Risk checks (see
riskmodule) - Order management
Structs§
- Fill
- A single trade execution event.
- Position
- A single-symbol position tracking quantity, average cost, and realized P&L.
- Position
Ledger - A multi-symbol ledger tracking positions and a cash balance.
Enums§
- Position
Direction - Direction of an open position.