Run reproducible ziplime backtests from a constrained JSON schema.
This package is designed to work in Claude Code and other CLI agent environments.
SKILL.md: Skill-level workflow and reporting rulesreferences/schema.md: Schema reference and output contractreferences/example_oversold_schema.json: Oversold bounce examplereferences/example_sma_schema.json: SMA crossover examplereferences/example_trend_dip_single_schema.json: Trend-dip single-run examplereferences/example_trend_dip_grid_schema.json: Trend-dip grid-search examplescripts/run_backtest_from_schema.py: Main runnerscripts/ingest_yahoo_bundle.py: Optional Yahoo bundle ingestion helper
oversold_bounce_long_onlysma_crossover_long_onlytrend_dip_buy_long_only
Multi-symbol equal-weight portfolio mode is available for:
sma_crossover_long_onlytrend_dip_buy_long_only
oversold_bounce_long_only remains single-symbol logic.
Portfolio controls for the two multi-symbol templates:
params.max_positionsparams.rank_metricparams.rebalance_rule(daily|weekly|monthly)
- Validate a schema:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_single_schema.json --validate-only- Run a single backtest:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_single_schema.json- Run a grid search:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_grid_schema.jsonThe grid example includes validation_split, so each trial returns train and test blocks and ranking uses test metrics.
- Ingest Yahoo data when a bundle is missing:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_grid_schema.json --ingest-if-missingThe runner prints JSON.
Core fields:
modebacktest_windowmetricsperformance_metricstrade_summarycapacity_diagnosticsrisk_attributionpractical_assessmentdata_interfacelive_interface(whenlive_data.enabledis true)validation(when split is enabled)
Run-specific fields:
- single run:
params - grid run:
rank_by,total_trials,top_results
Grid-level diagnostics:
stability_diagnosticscapacity_diagnostics(from the best-ranked run)
Grid rows include rank_value for the active ranking metric.
When split is enabled:
- single run:
trainandtestblocks - grid run: each row includes
trainandtestblocks
practical_assessment always includes:
future_leakageslippage_commissionoverfitting_riskcapacity_liquidity
Default policy is small and fast grid search.
Use larger exhaustive grids only when explicitly requested.
- Keep strategy frequency and bundle frequency aligned.
- For daily strategies, use daily bundles and
frequency_minutes: 1440. - Keep
max_leverage=1.0for long-only templates. - Use
executionfields in schema to tune slippage, commission, leverage, and fill semantics.