live: record each session's target and its frictionless return; compare shows Ideal and Gap

A $10k book in whole shares holds SNDK at 17.8% for a 10% target, so the
live record mixes the strategy with rounding and fee noise (2026-09-25..10-12:
overnight_recovery_top10 -9.0% live vs -7.65% at its own weights). Each
daily_log entry now stores the target held from that close and ideal_return,
the previous target's return to this close with fractional shares, no fees,
no resize band and no idle cash. compare prints Ideal and Gap (live minus
ideal) over the recorded days. The recorded returns compound to the
frictionless ledger (new contract test); an in-memory rerun of 10-09/10-12 on
live states reproduces the recorded equity to the cent.

systemd: SuccessExitStatus=143 on the monitor and overnight-paper units, so a
stop or restart no longer logs 'Failed' and the journal shows only crashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 18:49:28 -07:00
parent a605d68ca8
commit 31a684fe70
5 changed files with 80 additions and 7 deletions

View File

@@ -7,6 +7,9 @@ Type=simple
WorkingDirectory=/home/gahow/projects/quant-trading
ExecStart=/home/gahow/projects/quant-trading/deploy/start-monitor.sh
Restart=always
# SIGTERM from a stop/restart ends the Python process with 143; count it as a
# clean stop so 'Failed' in the journal means a real crash.
SuccessExitStatus=143
RestartSec=10
Environment=PYTHONUNBUFFERED=1

View File

@@ -7,6 +7,9 @@ Type=simple
WorkingDirectory=/home/gahow/projects/quant-trading
ExecStart=/home/gahow/projects/quant-trading/deploy/start-overnight-paper.sh
Restart=always
# SIGTERM from a stop/restart ends the Python process with 143; count it as a
# clean stop so 'Failed' in the journal means a real crash.
SuccessExitStatus=143
RestartSec=30
Environment=PYTHONUNBUFFERED=1