edgekit
v0.1.0 · a systematic-trading research toolkit

Prove the edge.

edgekit takes a trading idea from raw bars to a validated, sized, deployable strategy — with a prime directive baked in: assume every edge is fake until proven otherwise.

orb_gauntlet.py
import edgekit as ek

# load -> backtest -> PROVE -> (size -> ship, only if it survives)
bars   = ek.data.load_bars("US100_M1.csv")
rth    = bars[ek.data.rth_mask(bars.index)]            # Nasdaq cash session
trades = ek.strategy.ORB(or_bars=30, target_r=2.0).backtest(rth)
stats  = ek.trade_stats(trades.r, dates=trades.date)   # PF 0.71 · EV -0.21R

p = ek.validation.mcpt(trades.r.sum(), null_stat, n=1000)
print("REAL EDGE" if p < 0.01 else "rejected")         # -> rejected: dead after costs
monte_carlo — forward paths
monte_carlo — forward paths
14
modules
99
tests passing
9-step
validation gauntlet
numpy+pandas
lean core

The pipeline

01
Load
OHLC from CSV/parquet, resample, RTH sessions, integrity-checked.
02
Backtest
Causal, gap-aware fills, cost in R. One position, one loop.
03
Prove
The gauntlet: permutation, walk-forward, cost-stress, is-it-beta.
04
Size
Risk-parity, CPPI, DD-throttle — sized to a drawdown budget.
05
Ship
Prop-firm sim + cloud-safe tree export to a live cBot.

Causality is tested, not hoped

Indicators are returned unlagged; you lag explicitly. Property tests perturb future bars and assert the past never moves — the look-ahead class of bug fails CI.

🎲

The permutation gauntlet

Shuffle bar order to kill the trend, re-run, build a null. p < 0.01 = real edge. A no-edge strategy correctly scores non-significant — the test refuses to bless noise.

R

R-multiple is the currency

Strategies emit trades priced in units of their own risk. Dollars come once, later, from a single sizing scalar — never baked into the signal.

🎯

Prop-firm ready

Simulate FTMO / CryptoFundTrader / BrightFunded evaluations — pass-rate and days-to-pass by Monte-Carlo, sized to the exact drawdown rules.

🧠

Cloud-safe ML export

Triple-barrier labels, purged walk-forward, then serialize trees to pure-Python/C# inference that matches sklearn within 1e-6 — no sklearn at runtime.

📊

Self-contained reports

One call renders a themed HTML report with equity curve, Monte-Carlo fan, and monthly heatmap — every image base64-inlined, zero external requests.

Charts that go straight into a report

The viz module renders publication-quality charts in light or dark, and tear_sheet() assembles them into one self-contained HTML report. A few of them:

equity_with_drawdown
equity_with_drawdown
monthly_heatmap
monthly_heatmap
permutation_hist
permutation_hist
cost_sensitivity
cost_sensitivity
mc_terminal_hist
mc_terminal_hist
rolling_metrics
rolling_metrics
New · Tutorial series

Learn algorithmic trading, end to end

A complete, math-grounded course — from what a market is, through the probability and statistics that decide whether an edge is real, to building, testing, simulating, and shipping strategies. Every idea is made concrete with edgekit.

Part I
Foundations
Part II
The math
Part III
Building strategies
Part IV
Testing strategies
Part V
Simulation & advanced
Part VI
Mathematical toolkit
Part VII
Derivatives & microstructure
Part VIII
Advanced modeling & risk
Part IX
Capstone

Fourteen composable modules

One clean, tested package — replacing ~280 copy-pasted research scripts. Core is numpy + pandas; matplotlib, scikit-learn and friends are lazy extras.

Start with a backtest you can trust.

Ten minutes to your first causally-validated result, permutation p-value and all.