API reference¶
Generated from the live docstrings on every build, so a signature here cannot drift from the one in the code.
Most of what a metric means is written on the metric itself — the field docstrings in metrics.stats state each figure's basis, and Reading the report is the narrative version of the same material.
topstep_backtest— The public surface. Five names cover almost every script:Backtest,SymbolStrategy,AccountSize,ReportandSummaryStats.harness—Backtest— the two-line runner that assembles the simulation stack correctly — andReport, which is whatrun()hands back.strategy.symbol—SymbolStrategy: the single-instrument chassis you subclass. Owns indicator updates, the warmup gate, and position bookkeeping.strategy.base— The lower-levelStrategyprotocol andStrategyContext— the seam that lets one class run against the simulator or the live gateway.protocols— The structural types both the simulator and the live SDK satisfy.Barlives here, including what its two timestamps mean.indicators— Typed aliases for TA-Lib functions. No formula in this project is reimplemented, so none can drift from the reference.metrics.stats—SummaryStatsand its three nested blocks. Every field states its basis, because most metrics admit two honest answers.tearsheet—report.to_html()/report.show(): the interactive tearsheet — one self-contained HTML file with the tape, every fill marked, the equity curve against the MLL floor, and the text render's stats.replay—Backtest(record=True)'s bar-by-bar recording: every decision, event, indicator value and running-stats snapshot — what the tearsheet's replay scrubber steps through.metrics.montecarlo— Block-bootstrap the run's own days through the real rule kernel for a pass probability and — more usefully — an autopsy of the failures.metrics.confidence— How much to trust the Monte-Carlo number: a double-bootstrap CI, block-length sensitivity, per-year strata, and the cross-check against real windows.metrics.windows— Replay a long tape as consecutive independent Combine attempts — the empirical counterpart to the Monte-Carlo, biased the opposite way.metrics.walkforward—optimize(which keeps every trial, not just the winner) and anchoredwalk_forwardwith an efficiency ratio.metrics.overfitting— The guards that make a search defensible: deflated Sharpe against a trial ledger, and PBO by CSCV.metrics.economics— Turns a pass probability plus your own prices into an expected value per attempt, and the pass rate at which it turns positive.engine.backtest— The deterministic event loop and the frozenBacktestResultit returns. One loop, strict time order, no look-ahead.execution.sim_broker— The simulated broker: full order lifecycle, FIFO lots, OCO brackets, and flat-to-flatRoundTriprecords.rules.kernel— The prop-firm rule engine — trailing MLL, daily loss limit, consistency — enforced in real time, not scored afterwards.rules.params—AccountSizeand theCombineParamsbehind it: the cited constants for each account tier.fills.bar_fill— The Tier-0 fill model and its one pessimistic intrabar path — the assumption every fill price in a report rests on.fills.fees— Per-half-turn commissions and exchange fees. Charged on entry AND exit, which is why so many statistics here are per half-turn.data.wrangler— Turn candles into validatedBarstreams. Makes you declare whether your timestamps mean the bar's open or its close.data.loaders— Load a databento-data-playground Parquet export whose product, bar span and timestamp semantics ride in the file's own metadata.data.validator— What a bad bar stream looks like, and which defects are fatal versus merely worth knowing about.data.continuous— Stitching quarterly futures contracts into one continuous series without inventing P&L at the roll.data.synthetic— Deterministic seeded bars, for tests and for examples that must run without shipping a data file.core.instruments— Tick size, tick value and contract specifications — the numbers that convert a price move into dollars.core.time— Session boundaries and the trading-day definition. A Topstep day is not a calendar day, and this module is where that lives.core.sessions— Asia, London and New York — the regional windows that scope indicator data and tradable hours. A different axis from the Topstep day above.