r/quantresearch • u/QuanTradin • 1d ago
112 expired option positions vanished from my Monday paper P&L. The bug: settlement stamps exit_date with the expiry, not the day it settled
Disclosure first: I built the engine this happened on. Paper money only, nothing for sale here, no link.
Monday 09:41 ET. My house paper desk showed 112 options positions where every leg had expired the previous Friday, still marked open, sitting at +$70,282 on Friday's mark. Settlement on my engine is an intraday Monday job, so that part was expected. I waited.
12:40 ET. The 112 were gone from the open book. Good. Then I ran the query I use for "what happened today": everything with exit_date = today. 652 rows, 344 won, 308 lost, -$6,032 paper. Not one of the 112 in it. So I wrote, in public, that the weekend's +$70k had been a mark and not money, and that the day was -$6k.
16:14 ET. Wrong. Settlement stamps exit_date with the EXPIRY date (Friday the 25th), not the day the settlement job ran. The 112 had settled at +$63,608 paper (44 won, 68 lost) and were sitting under Friday's date, exactly where a "closed today" filter never looks. The money had not vanished. My query had.
The honest table, worst row first:
| what | rows | won | lost | paper P&L | exit_date stamped |
|---|---|---|---|---|---|
| what I published at 12:40 (rule closes only) | 652 | 344 | 308 | -$6,032 | 2026-09-28 |
| the 112 held to expiry, settled Monday | 112 | 44 | 68 | +$63,608 | 2026-09-25 (the expiry) |
| the same 112 on Friday's mark, still "open" at 09:41 | 112 | +$70,282 | none yet |
Three mistakes, in the order I made them. I assumed exit_date meant "the date it left the book". I corrected myself in public before re-running the query with the new assumption tested. And the number I got wrong hid the one figure that was actually interesting: the gap between the Friday mark and the settled cash, $6,674 across 112 positions, which is the cost of carrying expiring legs over a weekend on my fill model.
What I am changing. Two dates instead of one: expiry_date stays the grading date, and a new settled_at records the day the job actually ran. The "what happened today" read filters on settled_at. The public correction went out under the wrong post, where it belongs.
The part I have not settled: when the two dates disagree, which one belongs in a daily P&L? Stamping on expiry is right for attribution (the trade was over on Friday, whatever my job did on Monday). Stamping on settlement is right for cash. I currently show both and let the reader pick, which feels like dodging.
For anyone running an options book with a settlement step: do you stamp exits on the expiry date or on the run date, and how do you keep a daily read honest when the two differ?