adsf
This commit is contained in:
1 parent
d8addf37b2
commit
25f3397724
318 files changed
+253904
-48
No files matched your search
@@ -1,13 +1,18 @@
|
||||
# Handoff: Prop-firm fee mispricing project (Lucid Trading, LucidPro 50K)
|
||||
|
||||
Snapshot v3.2: 27 Nov 2026. **v3.2: lock-day overshoot dropped (aim exactly at the lock), and all book figures redone with 15 seeds; the earlier 3-seed book numbers were badly understated (8.4, 8.9b).** v3.1 added the closed indicator idea (8.9a), `ind_*.py`, and roll-adjusted pre-2015 files. New in v3.0 (replacing v2.9):
|
||||
Snapshot v3.9: 27 Nov 2026. **v3.9: implementable re-test done (#210–212): keep D1i (Drive, else coin at open+3); D3s (Drive, else NA, else skip) is the best small-bankroll survival mode; the 09:30 coin look-ahead overstated D1's 2025–26 book figures by ~$22–26k/yr (section 8.12).** v3.8: look-ahead found in how no-signal days were simulated (#207–209, mildly #193–201); D3 adoption SUSPENDED; implementable re-test `book_na2.py` (#210–212) pre-registered; TradingView indicator `tradingview/lucid_signals.pine` written (not yet compiled).** v3.7: D3 adopted (#207–209, section 8.11). **v3.6: slate 1 results (#202–206, section 8.10): noise-area breakout PASSES and replicates on CL+GC; opening relative volume strengthens Drive (filter not adopted); FOMC fade, time-series momentum and last-half-hour momentum fail.** v3.5: slate 1 pre-registered and scripted (`RUN_SLATE1.md`). **v3.4: Drive adopted at book level (Drive where it fires, coin otherwise; 8.9c); survival settings re-checked with 15 seeds, nothing changed.** v3.3 added `book_next.py`. **v3.2: lock-day overshoot dropped (aim exactly at the lock), and all book figures redone with 15 seeds; the earlier 3-seed book numbers were badly understated (8.4, 8.9b).** v3.1 added the closed indicator idea (8.9a), `ind_*.py`, and roll-adjusted pre-2015 files. New in v3.0 (replacing v2.9):
|
||||
- **First user strategy tested** (opening "Drive" rule, section 8.8): the only direction rule so far to pass a pre-registered test. It replicates on CL/GC 2015–24 but is not confirmed in 2010–14 or the 2025–26 holdout. Holdout now **spent** (section 5).
|
||||
- Cost model: **2.0 ticks on 09:30 entries**, 1.5 elsewhere (section 3). Measured from the user's trade prints.
|
||||
- Dealer-gamma / DIX test (8.6), pre-2015 data (6), new instruments in the sim, per-session instrument support, all scripts honour `LUCID_DATA` (7).
|
||||
|
||||
How to start the next session:
|
||||
- Give it this file, `RUN_PERSIST.md`, `RUN_OVERSHOOT.md`, the `code/` folder and the `scripts/` folder.
|
||||
- Give it this file, the `RUN_*.md` files, the `code/` folder and the `scripts/` folder.
|
||||
- `book_overshoot.py` (#192) was run on the user's machine: 16 cores, 0.6 min.
|
||||
- `book_next.py` (#193–201) was run on the user's machine (2.4 min): D1 adopted by the rule; Part 1 changed nothing (8.9c).
|
||||
- `book_na.py` (#207–209) was run on the user's Mac (1.3 min): D3 passed the rule, but the comparison used hindsight on no-signal days, so the adoption is suspended.
|
||||
- `book_na2.py` (#210–212) was run on the user's Mac (1.8 min): **keep D1i**; D3s = survival mode (8.12).
|
||||
- `tradingview/lucid_signals.pine`: **not yet compiled on TradingView**; ask whether it compiled and whether `scripts/signal_list.py` matched the chart labels.
|
||||
- `run_slate1.py` (#202–206) was run on the user's Mac (16 cores, a few minutes). 2010–14 parquet was converted here 27 Nov and now sits in the Mac's `<DATA>/pre/`.
|
||||
- Upload the data separately (section 6), then run `python -I code/build_sessions.py` (~30 s) and the checks in section 7.
|
||||
|
||||
---
|
||||
@@ -150,7 +155,7 @@ When the floor is the stop, slippage past the floor costs nothing: the account i
|
||||
- **Holdout 2025–26: SPENT 27 Nov** on the Drive rule (8.8). The user decided holding out made little sense with dozens of strategies to come. NQ 2025–26 had already been seen by the user while designing.
|
||||
- **Validation now rests on:**
|
||||
1. Pre-registering each test (spec and pass criteria in the script docstring and a log row) **before** running.
|
||||
2. **Logging every variant** in `code/RESEARCH_LOG.md` (rows #1–192 as of 27 Nov). Direction rules tested: 5 on 26 Nov (#46–61), the user's overnight idea (#62–65), 9 flow rules (#107–115), 2 gamma/DIX rules (#116–120), and the user's R2–R4 across 9 markets and 3 periods (#122–156).
|
||||
2. **Logging every variant** in `code/RESEARCH_LOG.md` (rows #1–212 as of 27 Nov). Direction rules tested: 5 on 26 Nov (#46–61), the user's overnight idea (#62–65), 9 flow rules (#107–115), 2 gamma/DIX rules (#116–120), and the user's R2–R4 across 9 markets and 3 periods (#122–156).
|
||||
3. **Replication on markets the rule wasn't designed on**, and on 2010–14.
|
||||
4. **A higher bar for anything chosen out of many tries:** z ≥ 3 pooled, or a significant replication in an untouched market.
|
||||
5. **Forward data from December 2026 onward is the new holdout.** Ask the user for monthly data updates and a log of live fills per signal.
|
||||
@@ -178,6 +183,8 @@ Set `LUCID_DATA` to the data root (default `/home/claude/data`; **every script h
|
||||
trade prints: price,size,side (B/A aggressor),instrument_id,ts_et
|
||||
<DATA>/pre/{NQ,CL,GC,SI}/{2010..2014}_1min_bars_data0.parquet from pre-2015_raw_tar.lz4 via scripts/convert_pre2015.py
|
||||
```
|
||||
**User's Mac layout (27 Nov):** `nq_raw/NQ`, `raw_CL`, `raw_GC`, `raw_NG`, but `es_raw`, `bz_raw`, `pl_raw`, `si_raw`, `6e_raw` (lowercase), and `pre/` (added 27 Nov). `slate_lib.find_dir()` handles both layouts; older scripts (`strat_more.py`, `event_drive.py`, `ind_*.py`, `strat_pre2015.py`) still hard-code `raw_<SYM>/<SYM>` and `pre/`.
|
||||
|
||||
Run `python -I code/build_sessions.py` once (~30 s). It builds `sessions_multi.pkl` (NQ/CL/GC/NG, 2015–24, with forecasts and `entry_min`). **Rebuild after updating the code**: old caches lack `entry_min`, and the resolvers raise without it.
|
||||
|
||||
**Environment used 27 Nov:** Python 3.13, pandas 3.0.5, numpy 2.5, pyarrow 26 (install it), scikit-learn 1.9. All regression checks reproduce on these versions.
|
||||
@@ -268,13 +275,21 @@ Run `python -I code/build_sessions.py` once (~30 s). It builds `sessions_multi.p
|
||||
| `ind_lib.py` | Clock-aligned tf-minute bars on roll-adjusted prices; EMA ribbon, Stoch RSI, confirmed divergence, TTM squeeze; `grid()` gives the indicator state at each candidate entry minute. Reusable for any bar-indicator idea. |
|
||||
| `dp_eval.py` | Evaluation-phase DP with simulation check (#184; `--restricted` = contracts and target only). ~4 min full, ~20 s restricted. |
|
||||
| `book_recheck.py` | Book-level re-check of play settings across 2015–19 / 2020–24 / 2025–26 (#186–191; builds `sessions_recent.pkl`). ~4 min. |
|
||||
| `book_next.py` + `RUN_BOOK_NEXT.md` | 15-seed book test of early-stage settings (m, one eval at a time, mix, pause) and Drive at book level (#193–201). Builds `drive_sessions.pkl`. User's machine; `--quick` smoke test. |
|
||||
| `book_overshoot.py` + `RUN_OVERSHOOT.md` | 15-seed overshoot decision run with paired block-bootstrap CIs (#192). User's machine; `--quick` smoke test. |
|
||||
| `event_drive.py`, `jump_bound.py` | Drive at London open / releases / EIA (#180–182) and the release-jump feasibility bound (#183). |
|
||||
| `ind_test.py`, `ind_cross.py` | Indicator-rule test (NQ/GC, 15/30/60 min, dev + replication, step-0 volatility check; ~1 min) and cross-market replication (~40 s). `ind_test.score_grid()` scores coin vs rule at arbitrary entry minutes. |
|
||||
| **`slate_lib.py`** | Slate-1 helpers: markets (open, cash close), pre+2015 data loader, forecast at any minute, bracket scoring at any entry minute, month-cluster bootstrap summaries, process pool over markets. |
|
||||
| `na_test.py`, `fomc_fade.py`, `rvol_drive.py`, `tsmom_test.py`, `lasthalf.py` + `run_slate1.py`, `RUN_SLATE1.md` | Slate 1 (#202–206): noise-area breakout, FOMC fade, RVOL Drive filter, time-series momentum, last-half-hour momentum. `--quick` (2013–18), `--jobs N`. Outputs to `<DATA>/slate1/`. |
|
||||
| `book_na.py` + `RUN_BOOK_NA.md` | Noise-area breakout per account (Part A, #207) and at book level (Part B, #208; decision #209): D1 vs D3 (Drive, else NA, else coin), D4, P0; 15 seeds. Builds `na_sessions.pkl`. D1 and P0 reproduce `book_next.py` exactly (0 mismatches). User's machine; `--quick`. |
|
||||
| `book_na2.py` | Implementable-fallback re-test (#210–212): D1i, D2, D3s vs look-ahead D1/D3 and P0. Builds `o3_sessions.pkl`. References reproduce `book_na.py` exactly. |
|
||||
| `RESEARCH_LOG.md` | Every variant tested, with results. |
|
||||
|
||||
**To test a new strategy:** add its signal to `strat_test.rules()`, or write a direction array per session. Run `test_A` per market, then the lifecycle with `strat_life.runs()` (a skipped day means the session is absent from the list). For multi-market accounts, set `s['inst']` per session, as in `strat_multi.py`.
|
||||
|
||||
### `tradingview/`
|
||||
`lucid_signals.pine` (Drive + noise-area labels and alerts) and `README.md` (install, alerts, validation, trade log).
|
||||
|
||||
### `scripts/` (helpers outside `code/`; they find `code/` relative to themselves and read `LUCID_DATA`)
|
||||
|
||||
| File | Purpose |
|
||||
@@ -283,6 +298,8 @@ Run `python -I code/build_sessions.py` once (~30 s). It builds `sessions_multi.p
|
||||
| `open_slip.py`, `open_slip2.py <trades.csv.gz>` | 09:30 spread and 4-lot sweep cost from trade prints (`open_slip2` is the final 10 ms method). |
|
||||
| `slip_sens.py`, `per_acct.py`, `with_old_slip.py <script> <args>` | Slippage sensitivity, old vs new cost per account, and running any script at the pre-27-Nov cost. |
|
||||
| `strat_robust.py` | R2/R3 delayed entries and long vs short split on NQ. |
|
||||
| `signal_list.py SYM [n] [date]` | Drive / NA signals for the last n sessions (and sigma / bands per mark for one date) from the parquet data, to check the TradingView indicator. |
|
||||
| `make_synth.py <out_root>` | Synthetic bars in the project layout with planted effects, for smoke tests only. |
|
||||
|
||||
**Policy parameters** (dict): `n_eval/k_eval`, `n_pre/k_pre`, `n_post/k_post`, `overshoot`, `f_post`.
|
||||
- `n_*` = fixed contract count.
|
||||
@@ -456,6 +473,42 @@ See section 3. Measured with `scripts/open_slip2.py`; the 2025–26 prints were
|
||||
- **Overshoot (#185–192): DROPPED.** Per account it adds about $100 but cuts P(first payout) from 18% to 15% (the user's concern). At book level with 15 seeds, aiming exactly at the lock earned more in all 9 period × bank cells: 2020–24 +$8.2–8.7k/yr (CIs above 0), 2015–19 +$1.7–3.4k, 2025–26 +$3.0–9.5k (CIs include 0, 46 windows); ruin equal or lower; payouts/yr +15–20%. The strict pre-registered criterion was not met (2025–26 CIs), so it was the user's call, and the user adopted it.
|
||||
- **Post-lock pace f=0.5: rejected at book level in all three samples.** k=0.5 / 1.0: mixed, no change.
|
||||
|
||||
### 8.9c Early-stage settings and Drive at book level (27 Nov; log #193–201; 15 seeds)
|
||||
- **Survival settings:** nothing beats the current cash rule (m=20) with 4 NQ / 3 GC / 3 CL. m=10 raises ruin by 5–19 pts. m=40 cuts ruin by 1–8 pts but costs $7–18k/yr. One evaluation at a time does the same at far greater cost. The market mix changes almost nothing. Pausing purchases while a pass waits only loses profit.
|
||||
- **Drive at book level:** D1 (Drive direction and entry on days it fires, coin otherwise) was better in all 9 period × bank cells: +$17–23k/yr (2015–19), +$40–44k (2020–24), +$55–62k (2025–26), with equal or lower ruin ($5k: 36→33%, 28→15%, 30→11%). Adopted by the pre-registered rule. D2 (trade Drive days only) nearly eliminates ruin at $5k (17% / 1.4% / 0%) but earns less in 2015–24: a possible survival mode while the bankroll is small.
|
||||
- **Caveats:** Drive's direction is identical across seeds (one historical path), so the CIs understate uncertainty about the edge. NQ is in-sample for the rule's design. The per-bracket edge is probably smaller than measured, so expect a smaller book gain. Even so, D1 costs nothing if the edge is zero (coin on all other days).
|
||||
|
||||
### 8.10 Slate 1: literature-based direction ideas (27 Nov; log #202–206; 2010–26)
|
||||
Bracket uplift in implied P(pass) points vs a coin at the same minute; month-cluster CIs. 2 of 5 primaries passed (≈0.6% chance if all null).
|
||||
- **S1 noise-area breakout (Zarattini, Aziz & Barbon 2024): PASS and replicates.** First breach of a band (open/prior close ± 14-day average move to that time of day), checked at HH:00/HH:30, sets the time and direction of the day's bracket. NQ+ES +2.14 [+0.97, +3.25], z = 3.6; **CL+GC +1.49 [+0.44, +2.49], z = 2.8, 14/17 years** (markets the paper never studied). Fires on ~55–60% of days; median entry 10:30 (NQ/ES), 10:00 (CL), 09:30 (GC). On non-Drive days (NQ+CL+GC) +1.29 [+0.25, +2.32]. Equity effect mostly from 2020. **Not yet tested per account or per book** (later entries leave less of the day to resolve the bracket).
|
||||
- **S3 opening relative volume: primary PASS, filter not adopted.** Drive on high-volume opens +4.77 (z = 5.6) vs low +1.31; difference +3.47 [+0.94, +5.96]. Low-volume days are still positive, so the pre-registered rule keeps Drive unfiltered. A predicted dose-response came true: Drive's credibility goes up (assessment now about 70%, was 60–65%).
|
||||
- **S2 FOMC fade: fail** (pooled −1.5; CL +14.5 and GC −12.5 cancel). **S4 time-series momentum: fail** (pooled −0.43; keep the coin). The 63-day lookback was significantly *negative* (−0.75, z = −3.5, 8/9 markets): a fade-the-trend lead for forward data only. **S5 last-half-hour momentum: fail** (NQ+ES −2.2); GC +6.7 standardised but gross $9.74 per contract vs $34.60 cost.
|
||||
|
||||
### 8.11 Noise-area breakout at account and book level (27 Nov; log #207–209; 15 seeds)
|
||||
- **LOOK-AHEAD, adoption suspended:** no-signal days took a coin trade at the default open, but a no-signal day is known only at open+3 (Drive) or the last NA mark (NA); D3's no-signal days are by construction days that stayed inside the noise band. Figures below are kept for reference. Re-test with implementable fallbacks: #210–212 (`book_na2.py`).
|
||||
- D3 (Drive where it fires; else NA where it fires; else coin) passed the pre-registered rule. Book profit vs D1: +$5–7k/yr 2015–19 (n.s.), +$15–19k 2020–24 (significant), +$15–21k 2025–26 (borderline, 46 windows). **Ruin lower in every cell**: at $5k 33 → 24% / 15 → 8% / 11 → 3%; at $10k 16 → 7% / 2.3 → 0.3% / 1.9 → 0.4%.
|
||||
- At $10k, D3 makes about $66k / $142k / $152k a year in the three periods (D1: $61k / $125k / $137k).
|
||||
- Per account the gain is small and not significant (−$69 to +$138 per funded); P(pass) flat or slightly lower because NA entries come later. The book gain comes mainly from lower ruin and more payouts per year.
|
||||
- **NA alone (D4) is worse than Drive + coin everywhere and worse than a pure coin in 2015–19.** NA earns its place only as the second signal after Drive, on days Drive is silent.
|
||||
- Expect a smaller real gain than simulated: both signals replay one historical path in every seed.
|
||||
- Practical: on non-Drive days the account waits for the first noise-area breach at HH:00/HH:30 marks (GC from 09:00, CL from 09:30, NQ from 10:00, last marks 13:00 / 14:00 / 15:30), so the trading day runs longer; σ by time of day needs a script.
|
||||
|
||||
### 8.12 Implementable fallbacks (27 Nov; log #210–212; 15 seeds)
|
||||
Book, ruin / profit per year:
|
||||
|
||||
| Bank | Play | 2015–19 | 2020–24 | 2025–26 |
|
||||
|---|---|---|---|---|
|
||||
| $5k | **D1i** Drive, else coin at open+3 | 32.4%, $45k | 14.6%, $100k | 17.5%, $93k |
|
||||
| $5k | **D3s** Drive, else NA, else no trade | 13.8%, $53k | 3.8%, $105k | 4.3%, $74k |
|
||||
| $10k | D1i | 14.7%, $64k | 4.1%, $123k | 6.2%, $112k |
|
||||
| $10k | D3s | 8.4%, $63k | 0.0%, $119k | 0.0%, $88k |
|
||||
| $20k | D1i | 5.8%, $79k | 1.5%, $138k | 0.3%, $127k |
|
||||
| $20k | D3s | 1.0%, $73k | 0.0%, $133k | 0.0%, $112k |
|
||||
|
||||
- **Keep D1i** (pre-registered decision). It replaces D1 as the baseline; D1's figures in 8.9c used a 09:30 coin entry that can't be traded and overstate 2025–26 by ~$22–26k/yr (ruin at $5k 10.7% → really 17.5%). 2015–24 barely changes.
|
||||
- **D3s cuts ruin sharply** (at $5k: 32 → 14%, 15 → 4%, 18 → 4%) with about the same profit in 2015–24 but $15–23k/yr less in 2025–26: skipping no-signal days costs throughput, most in volatile markets. It beats D2 (Drive days only) everywhere. **Best survival mode found while the bankroll is small;** a cash-switched hybrid (D3s below some cash level, D1i above) is untested.
|
||||
- The look-ahead D3 of 8.11 overstated D3 by $15–60k/yr.
|
||||
|
||||
### 8.9 Recommendations given to the user
|
||||
1. Use the volatility-sized policy (k = 0.7) and aim exactly at the lock on lock day (no overshoot; adopted 27 Nov, 8.9b).
|
||||
2. Allocate 4 NQ / 3 GC / 3 CL (no NG) for books.
|
||||
@@ -463,12 +516,16 @@ See section 3. Measured with `scripts/open_slip2.py`; the 2025–26 prints were
|
||||
4. Hold a bankroll of at least $10k ($20k comfortable). $5k goes broke 28–36% of the time in every regime (15 seeds).
|
||||
5. When to request payout 5 depends on whether a live account is worth more than $900. If it is, request at once; if the user would take the buyout anyway, gating helps slightly.
|
||||
6. Test with 1.5 ticks (2.0 at 09:30); keep logging real fills.
|
||||
7. Use R2 (Drive) as the direction rule where it fires, especially on CL and NQ, as a free option. Drop R4. Log live R2 trades for forward validation.
|
||||
7. **Trade Drive where it fires (direction and the open+3 entry), coin flip at open+3 otherwise (D1i; confirmed by #210–212).** With a small bankroll (≈ $5k), consider the survival mode D3s (Drive, else noise-area breakout, else no trade): ruin 4–14% instead of 15–32% at $5k, similar profit in 2015–24, less in 2025–26 (8.12). Switching point not yet tested. Drop R4. Log live Drive trades for forward validation. Possible survival mode below ~$10k: Drive days only (D2), untested as a hybrid.
|
||||
|
||||
---
|
||||
|
||||
## 9. Open items / next steps
|
||||
- **Closed ideas, don't retest:** everything in 8.5, GEX/DIX direction (8.6), and the indicator idea (8.9a), apart from the noted 15-min equity lead.
|
||||
- **Next candidates:** (1) cash-switched hybrid: D3s while cash < X, D1i above (pre-register X from a small grid, e.g. $7.5k / $10k / $15k, and count it as several variants); (2) why the 09:30 coin entry beat 09:33 by ~$20k/yr in 2025–26 (opening-minutes resolution?) and whether an implementable play can capture it.
|
||||
- **Live signals:** user uses TradingView (no live data into Python). `tradingview/lucid_signals.pine` (Pine v5, 1-min chart, sigma from 10-min security, ATR from daily, labels + alert()) needs a compile check and a comparison with `scripts/signal_list.py` on past dates. Needs CME real-time data on TradingView.
|
||||
- **Lesson for composed plays:** a fallback for 'no signal' may only use information available at its own entry time; check every composed variant's fallback timing (as for features' 'known at' times).
|
||||
- **Leads for forward data only:** fade the 63-day trend (#205 secondary); CL fading after scheduled news (#203 secondary).
|
||||
- **Next: the user's further strategies** (dozens planned). Use the harness and protocol in sections 5 and 7: pre-register, per-bracket uplift, replicate in untouched markets and 2010–14, then per-account lifecycle (net per funded and per session).
|
||||
- **Forward validation:** monthly data updates from December 2026 (the new holdout) and the user's live-fill log per signal.
|
||||
- **R2 follow-ups (each a new, logged variant; don't tune on seen data):**
|
||||
@@ -481,4 +538,5 @@ See section 3. Measured with `scripts/open_slip2.py`; the 2025–26 prints were
|
||||
- **Verify with Lucid:** ES/SI/PL/BZ/6E commissions; whether staggered entry times within an instrument count as hedging (decorrelation).
|
||||
- **Not modelled:** the 30-day inactivity rule (matters for skip-day strategies and parked accounts), microscalping/HFT checks, live-phase trading, taxes, the operational load of about 800 evaluations a year, correlation between the user's strategy directions across groups, and the value of accounts still open at the end of a window (conservative).
|
||||
- **Parked by the user: payout-5 eligibility as an option** (needs the slot-day table).
|
||||
- **User's hardware:** 16-core MacBook for routine runs; high-end Threadripper desktops available for seriously heavy jobs.
|
||||
- **Possible heavy runs on the user's hardware:** a full DP or wider policy search, a bootstrap by year, and slippage sweeps.
|
||||
Reference in new issue
Block a user