API reference
Every public symbol in edgekit v0.1.0, module by module. Signatures, defaults, and return shapes are copied faithfully from the source — the pages below are generated against the same ground-truth reference the library is tested to.
edgekit is organised as fourteen submodules that map one-to-one onto the research pipeline: load → backtest → prove-or-kill → size → ship. Each has a focused job and a small public surface. The tables below link to the per-module reference; start with core if you want the vocabulary the rest of the library speaks.
The import convention#
There is exactly one supported way to reach everything: import edgekit as ek. The top-level package re-exports every submodule plus the handful of symbols you touch constantly, so you rarely write a deep import.
import edgekit as ek
# submodules hang off the package
bars = ek.data.load_bars("US100_M1.csv")
rth = bars[ek.data.rth_mask(bars.index)]
trades = ek.strategy.ORB(or_bars=30, target_r=2.0).backtest(rth, warmup=5, bars_per_day=390)
# hot symbols are re-exported at the top level
st = ek.trade_stats(trades.r, dates=trades.date) # == ek.metrics.trade_stats
p = ek.validation.mcpt(real_stat, null_fn, n=1000)The convenience re-exports available as edgekit.<name> are: the submodules challenge, core, costs, data, engine, indicators, metrics, ml, portfolio, report, sizing, strategy, validation, viz; and the symbols OHLC, Signal, Trade, as_ohlc, lag, trades_to_frame, EntryIntent, run_bar_loop, run_backtest, CostModel, cost_stress, trade_stats, equity_stats, max_drawdown, profit_factor, sharpe, sortino, dd_matched_size.
import edgekit needs only numpy + pandas. The heavy dependencies are optional extras, imported lazily inside the functions that use them, so importing the package never pays for a chart library you did not call: [viz] (matplotlib), [ml] (scikit-learn / xgboost / lightgbm), [io] (pyarrow). A missing extra raises a clear pip install edgekit[...] pointer, not an obscure ImportError at the top of a run.The fourteen modules#
| Module | What it does |
|---|---|
core | R-multiple + OHLC contract, the causal lag() primitive, Signal/Trade dataclasses, seeded RNG |
data | Load / fetch / resample bars, DST-correct sessions, integrity report, chronological split, parquet cache |
indicators | Vectorised, unlagged indicators: atr, adx, donchian, rsi, hawkes, rolling hedge, half-life, cross-sectional rank |
engine | Two causal backtest engines: run_bar_loop (research) + run_backtest (fixed-RR prop-firm) and the Strategy protocol |
costs | Transaction-cost models (fraction-of-price & pips) and the cost_stress harness |
metrics | trade_stats / equity_stats / dd_matched_size, plus profit_factor, drawdown, sharpe, sortino |
sizing | risk_parity, hrp, vol_target, size_to_dd, cppi, dd_throttle — R-streams to a dollar equity path |
validation | The gauntlet: permutation MCPT, PBO, deflated Sharpe, walk-forward, is-it-beta, block-bootstrap DD |
strategy | The strategy zoo: ORB, Keltner, RSI2MeanReversion, StatArbPairs, Hawkes |
portfolio | Combine validated books into one daily-R stream, correlation, allocation sweep |
challenge | Monte-Carlo prop-firm simulator: pass-rate + days-to-pass for FTMO / CFT / BrightFunded |
viz | matplotlib chart vocabulary + themes, base64-inlined |
report | Self-contained, zero-network HTML reports |
ml | Triple-barrier labels, purged/embargoed walk-forward, meta-labeling, cloud-safe tree export |
Dependency layering#
The modules form a strict layering — later layers import earlier ones, never the reverse. Reading in this order is also the fastest way to understand the library:
- Foundation. core defines the contracts; data, indicators, and costs all build on it and on nothing else in edgekit.
- Execution. engine consumes core + costs to run a strategy causally; strategy implements the interface the engine polls.
- Measurement. metrics summarises trade/equity streams; validation tries to break them.
- Deployment. sizing and portfolio turn R-streams into dollars; challenge stress-tests the sized path; viz and report present it.
See also#
- Quickstart — your first validated backtest end to end.
- The validation gauntlet — the reasoning behind the validation module.
- edgekit.core — start here for the shared vocabulary.