Expand description
Market positions, replay history, and checked financial arithmetic.
Position tracks open and closed positions from fills, adjustments, and instrument settlement.
It records quantity, side, average prices, commissions, and realized PnL.
§Replay
The replay journal records fills, adjustments, and instrument close events. Retained history supports price restatements and cumulative fill corrections across close and reopen cycles.
§Checked Arithmetic
Financial calculations use checked domain types and [Decimal]. The shared arithmetic also
supports account projections and splitting fills for position reversals.
- Input conversions reject precision loss and overflow.
- Derived products, cost sums, division, and proportional intermediates round at Decimal precision. Cost allocations retain a representable remainder.
- Arithmetic rejects a nonzero operand or result that would disappear at that precision.
PnL sums may absorb a disappearing residual smaller than one native settlement
Moneyunit. - Derived
Moneyvalues round midpoint to even at their native fixed-point scale.
Structs§
- Position
- An open or closed position in a market.
- Position
Fill Void
Enums§
Functions§
- fold_
net_ position - Replays position legs onto a hypothetical NETTING position in
ts_openedorder, returning(net_signed_qty, net_avg_px_open).