06-reference/research

lumibot spike feasibility

2026-06-14·research-brief·source: deep-research
investingautoinvlumibotbacktest-validationbuild-vs-buy

Lumibot Spike — Reproducing One autoinv Strategy in Lumibot's Backtest to Greenlight Framework Adoption

The question

Spike: rewrite one autoinv strategy (the buy-and-hold benchmark or a small mechanical rule) as a Lumibot Strategy subclass, run it through Lumibot's backtest, and compare results to autoinv's Backtest engine. If equivalent within noise, greenlight the framework adoption. (Context: validation gate for the build-vs-buy recommendation made in the 2026-05-22 library-comparison brief; estimated 1-2 hour spike; unblocks 4-8 weeks of avoided execution-plumbing work.)

What we already know (from the vault)

What the web says

Convergences and contradictions

Synthesis for RDCO

Port the buy-and-hold benchmark first, not the momentum rule. Buy-and-hold has one fill event at the start and one mark-to-market at the end, so it isolates the two variables that actually matter for equivalence — data alignment and the entry fill price — without entangling them in signal-timing logic. The momentum rule (SPY MA100) is the better second fixture precisely because it generates many fills and will surface the next-bar-open offset; run it only after buy-and-hold passes, as the stress test. Use the same single liquid ticker (SPY), the same explicit date window, the same yfinance/Yahoo daily bars on both engines, fees set to zero on both, and slippage forced to zero on both. Hold all four knobs fixed so the only residual difference is each engine's internal fill-and-mark convention.

Define "equivalent within noise" operationally before running, not after. Three nested checks, in order of strictness: (1) final-return delta — absolute difference in total return over the window ≤ 25 bps for buy-and-hold and ≤ 50 bps for the momentum rule (buy-and-hold should be near-exact since it is one round-trip; a large delta there means a data-alignment bug, not noise); (2) equity-curve correlation — Pearson r ≥ 0.999 on the daily equity series after aligning timestamps, which catches drift that a single endpoint comparison hides; (3) trade-by-trade reconciliation for the momentum rule — same number of fills, same fill dates, fill prices matching within one bar's open-vs-close gap. Passing (1) and (2) on buy-and-hold plus (1) and (3) on momentum is the greenlight. Note explicitly: a known, explainable constant offset from the next-bar-open fill convention is not a fail — it is a convention difference to document and standardize on (Lumibot's is the more conservative, live-realistic choice), whereas an unexplained or drifting delta is a fail.

The top three places equivalence breaks, in priority order: (1) Fill timing — Lumibot's next-bar-open market fill vs autoinv's convention; this is the headline risk and the reason buy-and-hold goes first. (2) Bar/timestamp alignment — yfinance adjusted-close vs raw-close, dividend/split handling, and the exact first/last bar each engine includes in the window; an off-by-one bar at either boundary masquerades as a return delta. (3) Implicit costs — Lumibot's undocumented default slippage and any minimum-fee assumption must be forced to zero, or autoinv's frictionless benchmark will look like it "beats" Lumibot purely on costs. Cash handling (fractional vs whole shares, starting-cash defaults) is a fourth, lower-priority watch — pin starting cash and share-rounding identically on both.

Go/no-go framing for build-vs-buy. GREENLIGHT adoption if buy-and-hold reconciles near-exactly and the momentum rule's residual delta is fully attributable to the documented next-bar-open fill convention (i.e. the engines agree once conventions are aligned). NO-GO / escalate if there is an unexplained return or equity-curve divergence that survives zeroing fees and slippage and aligning data — that would mean Lumibot's backtest semantics are opaque or subtly different in a way that undermines the backtest-to-live parity that is the entire reason to adopt it. A middle outcome (equivalent only after convention alignment) is still a GREENLIGHT but with a required deliverable: a short "convention map" note documenting that autoinv standardizes on Lumibot's fill timing going forward, so historical autoinv backtests are re-run before they are trusted. This spike is genuinely 1-2 hours of work gating a 4-8 week plumbing decision — a high-leverage validation gate; the failure cost of a false greenlight is low (decision is reversible, autoinv is small) but the failure cost of a silent semantic mismatch is high (every future paper-trade inherits it), which is why the equity-curve correlation and trade-by-trade checks are non-negotiable, not just the headline return delta.

Open follow-ups

Related

Sources