Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daytrader Lab

Infrastructure for honest day-trading backtests, plus pre-registered kill gates, built research-first. The premise: most retail day-trading backtests are wrong in the strategy's favor (lookahead, optimistic fills, ignored halts and short-sale rules, unmodeled costs), so before testing any strategy this repo builds a harness that is wrong in the strategy's disfavor, and pre-registers the criteria that kill a strategy before results are seen. Negative results are published on purpose; the first one is included.

The harness (engine/)

A pessimistic event-loop simulator for intraday equity strategies:

  • Pessimistic fills: every fill starts from a reference price (bar open or stop/limit trigger) and is made worse: half-spread by price band, adverse slippage (0.5% normal, 2% on stop-outs), doubled spreads in the first 15 minutes and for 10 minutes after halt reopens.
  • Halt traps: gaps of 5+ missing minutes are treated as halts; nothing fills during a halt, and pending stops fill at the reopen price, gap-through allowed. No teleporting out of a halted name at your stop.
  • SSR (short sale restriction): triggered when a bar trades 10% below the prior close; short entries then fill uptick-only with 50% probability.
  • Participation caps: fills limited to 5% of bar volume and positions to 1% of premarket volume; oversized orders are cut, not filled.
  • Explicit costs: per-share commissions plus locate fees for shorts; locates can be unavailable.
  • Strict event ordering: fills for bar t are processed before the strategy sees bar t; orders placed at t are eligible from t+1.

Two flagship integrity tests (Gate H):

  1. Lookahead shift-audit (engine/tests/test_lookahead.py): decisions at bar t must be identical when all bars after t are perturbed. If perturbing the future changes the past, the harness leaks.
  2. Zero-edge test (engine/tests/test_zero_edge.py): on 200 seeded random-walk tapes, a random-entry strategy must earn approximately zero at frictionless reference prices and strictly lose net of costs. A harness where random trading makes money is broken.
python -m pytest engine/tests data_pipeline/tests -q   # 38 tests: 17 engine + 21 pipeline
python engine/demo.py                                  # 50 synthetic days through the full runner

data_pipeline/ (21 tests) covers the data side: SEC point-in-time shares outstanding (filed-date joins for no-lookahead float filters), a daily Nasdaq halt/SSR archiver (these feeds only retain about a year), and downloader skeletons for Massive (ex-Polygon) flat files and Alpaca SIP bars/news, all normalized to one canonical bar schema.

First result: Kalshi spike-fade, refuted (kalshi/)

The first strategy through the methodology was a spike-fade on Kalshi prediction-market tick data (fade 5-15 cent moves within 15 minutes). Verdict: no edge, decisively.

  • All 12 pre-declared parameter combos were negative, in-sample and held-out.
  • Selected combo held-out: net -$65.64 over 33 trades, per-trade t-stat -7.99, 3% win rate.
  • Not just cost drag: gross P&L was also negative (-$37.23 gross vs -$28.41 fees). The fade direction itself loses.
  • It landed at the 1st percentile of 200 randomized-entry controls with identical costs and exits. Random direction beat fading: spikes continued rather than reverted.

Key caveat: the capture window was about 17 hours of tick data at 60-second cadence, so this refutes the edge on this sample and cadence; it says nothing about faster streaming fades. Full tables and caveats in kalshi/REPORT.md.

The methodology: a kill-gate ladder

Strategies advance through pre-registered gates (docs/PLAN.md); a miss means kill or redesign, not a re-run:

  • Gate H (harness integrity): lookahead audit, participation refusal, halt/SSR unit tests, zero-edge synthetic tapes. No strategy result counts before this passes.
  • Gate B (backtest): net of pessimistic costs, Sharpe >= 1.0, t >= 2, 100+ trades, positive in 3 of 4 regime splits, survives +/-20% parameter jitter.
  • Gate O (held-out): final 12 months untouched until Gate B passes; the held-out number is THE number.
  • Gate P (paper): a month of live paper trading with intended-vs-filled logging inside modeled slippage.

Research base (research/)

A four-report literature sweep sets the priors: the structural intraday edge in small-cap gappers is the short side (60-75% close below open, and the one published after-cost-positive backtest is a day-1 gap fade); the one replicated long result is opening-range breakouts restricted to stocks-in-play with relative volume and catalyst filters; and LLM agents that decide trades are consistently refuted once data leakage and fees are controlled, while LLMs as extractors (catalyst and dilution classification) remain useful. The research/ folder is a literature sweep compiled with LLM research agents (July 2026); citations are leads, not verified quotes.

Status

Harness ready (Gate H green). Equity strategy backtests (gap fade, ORB) pending minute-level data acquisition; the pipeline activates when API keys are added to data_pipeline/config.toml (see config.example.toml).

Disclaimer

This is research code. Nothing here has been traded live, nothing executes trades, and negative results are included by design. Nothing in this repository is financial advice.

About

Pessimistic backtest harness for day-trading research: halt traps, SSR, participation caps, lookahead audits, pre-registered kill gates. First result: a clean refutation.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages