Hypotheses
QuantRocket DemoMLStrategy port: pooled 25-horizon return features, numpy logistic 'beats the cross-sectional median over 22 open-to-open days' classifier, hold the top-3 probabilities, monthly equal-weight long-only rebalance at the next session open (USEQ 1-DAY, 9 Select Sector SPDRs)
Derived by the Research Lead from "DemoMLStrategy" by QuantRocket (quantrocket) https://github.com/quantrocket-codeload/moonshotml-intro/blob/2b3a8e382c2d4d7eb8da02eb8bc82fa165c684f4/intro_moonshotml/demo-ml.py: Kept…
Strategies
- QuantRocketDemoMLSectorSpdrUseq Abandoned
Hypothesis
Derived by the Research Lead from "DemoMLStrategy" by QuantRocket (quantrocket) https://github.com/quantrocket-codeload/moonshotml-intro/blob/2b3a8e382c2d4d7eb8da02eb8bc82fa165c684f4/intro_moonshotml/demo-ml.py: Kept from the source: the 25 return-horizon features, the 22-day open-to-open beats-the-median target, predict_proba ranking, TOP_N=3, the month-end signal carried forward, equal weights, next-open entry and open-to-open returns. Chosen by us: a numpy L2 logistic model (the source leaves the model open),……Show moreShow less
Derived by the Research Lead from "DemoMLStrategy" by QuantRocket (quantrocket) https://github.com/quantrocket-codeload/moonshotml-intro/blob/2b3a8e382c2d4d7eb8da02eb8bc82fa165c684f4/intro_moonshotml/demo-ml.py: Kept from the source: the 25 return-horizon features, the 22-day open-to-open beats-the-median target, predict_proba ranking, TOP_N=3, the month-end signal carried forward, equal weights, next-open entry and open-to-open returns. Chosen by us: a numpy L2 logistic model (the source leaves the model open), an expanding walk-forward with annual refits, the 9 Select Sector SPDRs in place of QuantRocket's free stock sample, and USEQ costs. Port of QuantRocket's Apache-2.0 'DemoMLStrategy' (moonshotml-intro/demo-ml.py, credit QuantRocket LLC) onto USEQ daily bars. The source's rules are kept as written; four things are adapted and named here. (1) UNIVERSE: the source runs on 'usstock-free', QuantRocket's small free sample of US stocks. A fixed list of today's large-cap stocks would add survivorship bias, so the port uses a small universe that has no survivorship problem: the nine original Select Sector SPDR ETFs (XLB, XLE, XLF, XLI, XLK, XLP, XLU, XLV, XLY), all listed since Dec 1998 and none ever delisted. They are US-listed, Open/Close daily bars, and TOP_N=3 of 9 keeps the source's 'hold a few of a small universe' shape. (2) MODEL: the source does not define the model. MoonshotML uses whatever scikit-learn classifier the user supplies and calls predict_proba. sklearn is not importable in our sandbox, so the developer writes a pooled L2-regularised LOGISTIC REGRESSION in numpy (features z-scored on the training set, fit by IRLS or gradient descent). This is the standard probabilistic classifier, a free choice registered as a parameter. (3) WALK-FORWARD TRAINING: the source's training schedule lives outside the file, in ml_walkforward. We use an expanding window: first fit after min_train_bars=756 sessions of labelled samples, then refit every retrain_months=12 months. Each refit uses only samples whose 22-day label is fully known at the refit close. The source quirk of filling the newest 22 unlabelled rows with 0 is dropped: the port drops those rows instead, because it would otherwise train on fabricated labels. (4) COSTS: the source charges USD 0.005 per share. USEQ is commission-free with modeled spread and impact, which is about 0.5-1 bp per side on these ETFs, roughly what the source charges. Execution: the source decides on day t's close, weights.shift() enters on day t+1, and returns run open-to-open. That is exactly the platform's supported next_open_fill on a session venue: a market order decided on bar t's close fills at the next session's open, so no substitution is needed. Per-trade arithmetic: the median one-month gap in return between the best and the median sector ETF is about 2-3%. If the classifier captures even 10-15% of that spread on the names it picks, that is about 0.3-0.5% per holding-month, against a USEQ round trip of about 0.04%, more than 7x cost. Risk control route (b): signal-based exit at the monthly rebalance, unlevered, each position 1/3 of equity (100% gross, no single position above 33%). The source has no stop and none is invented. This is a long-only, fully invested sector book. A 2008- or 2020-style market drawdown hits it in full, so the predicted drawdown is set honestly near the cap. Prior art: the KitchenSink ML ridge port and the UpMinusDown momentum port are different QuantRocket files. This is the first test of the demo-ml classifier.
Analysis
DemoMLStrategy
Backtest and paper results are hypothetical. Trading involves risk of loss.