live: IBKR order layer for trend_rider_v10 (guarded MOC orders via IB Gateway)
ibkr_trader.py computes the strategy's target for the close the way trader.py's morning phase does, sizes whole-share orders on min(NAV, $10.5k) less a 1% cash buffer against the account's real positions, and sends MOC orders, sells before buys. Guards: the login must manage IBKR_ACCOUNT; a live account needs --live and data/ibkr_live/ARMED; the account may hold only the strategy's universe; MOC whole-share orders only; one submission per session. After the close it records executions and commissions, scores each order against the primary exchange's closing cross (SIP condition 6) and compares NAV with the simulated account, with a preregistered verdict on the first 20 orders. A what-if run on the paper Gateway (no orders) accepted GLD/SHY MOC orders at $1.00 commission and rejected TQQQ/UPRO: the account lacks the Complex or Leveraged ETP permission. The live service is defined but not enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
11
CLAUDE.md
11
CLAUDE.md
@@ -50,6 +50,14 @@ uv run python overnight_paper.py buy|sell --dry-run # show the orders it wou
|
||||
uv run python overnight_paper.py report # paper fills vs official open/close prints, nightly returns
|
||||
uv run python overnight_paper.py daemon # the scheduler (service quant-trading-overnight-paper)
|
||||
|
||||
# trend_rider_v10 in an IBKR account: today's target as trader.py morning computes it, whole-share MOC orders
|
||||
# via IB Gateway, fills scored against the closing cross (IBKR_ACCOUNT/IBKR_PORT/IBKR_CLIENT_ID from .env)
|
||||
uv run python ibkr_trader.py check # account, positions, open orders (read-only)
|
||||
uv run python ibkr_trader.py plan [--what-if] # today's orders; --what-if: IBKR validates/prices them, nothing placed
|
||||
uv run python ibkr_trader.py submit --live # MOC orders, close-30 to close-15 min; live needs data/ibkr_live/ARMED
|
||||
uv run python ibkr_trader.py report # executions, fills vs closing cross, live vs simulated account
|
||||
uv run python ibkr_trader.py daemon --live # the scheduler (service quant-trading-ibkr-live, not enabled)
|
||||
|
||||
# Precompute the strategy page's backtests (writes data/precomputed/)
|
||||
uv run python precompute_backtest.py
|
||||
|
||||
@@ -217,7 +225,7 @@ The comparison writes its fixed budget and acceptance rule before running and re
|
||||
|
||||
## Server Deployment
|
||||
|
||||
Four `systemd --user` services and one timer, defined in `deploy/systemd/`, run from `/home/gahow/projects/quant-trading`:
|
||||
Four `systemd --user` services (a fifth defined but not enabled) and one timer, defined in `deploy/systemd/`, run from `/home/gahow/projects/quant-trading`:
|
||||
|
||||
| Service | Script | Role |
|
||||
|---|---|---|
|
||||
@@ -225,6 +233,7 @@ Four `systemd --user` services and one timer, defined in `deploy/systemd/`, run
|
||||
| `quant-trading-api` | `deploy/start-web-api.sh` | Web API on `127.0.0.1:8787` |
|
||||
| `quant-trading-vite` | `deploy/start-web-vite.sh` | Vite on `127.0.0.1:5174`, behind nginx on `:5443` |
|
||||
| `quant-trading-overnight-paper` | `deploy/start-overnight-paper.sh` | `overnight_paper.py daemon`: overnight-only momentum on the Alpaca paper account (from 2026-10-12) |
|
||||
| `quant-trading-ibkr-live` (not enabled) | `deploy/start-ibkr-live.sh` | `ibkr_trader.py daemon --live`: trend_rider_v10 in the $10k IBKR Pro live account. Needs a live IB Gateway on port 4001 (the paper Gateway on 4002 belongs to ../ibkr-quant, whose strategy owns that paper account), IBKR_ACCOUNT in .env, the Complex or Leveraged ETP permission (paper what-if 2026-10-13 rejected TQQQ/UPRO without it) and data/ibkr_live/ARMED |
|
||||
| `quant-trading-options` (timer, 16:25 New York Mon-Fri) | `deploy/start-options-snapshot.sh` | `research.lab.fetch_options snapshot`: S&P 500 option chains (indicative quotes), OPRA daily bars, per-name IV/skew/spread/volume summary and a quote-quality sample into `data/options/us/` (~15 MB/day); `status` prints the indicative-vs-OPRA verdict after 20 sessions |
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user