An AI-native backtesting skill for fast strategy idea evaluation. It provides a schema-driven workflow for AI agents and runs on top of Zipline.
- Fast idea-to-backtest flow for AI agents
- Reproducible runs from constrained JSON schema
- Structured diagnostics beyond raw return metrics
This project is not a full portfolio optimization platform.
Install from GitHub (project-local):
npx skills add https://github.com/garroshub/backtesting-skill -a opencode -yVerify the skill is installed:
npx skills list -a opencodeOptional checks and alternatives:
# Show available skills in this repo without installing
npx skills add https://github.com/garroshub/backtesting-skill --list
# Global install
npx skills add https://github.com/garroshub/backtesting-skill -g -a opencode -y
# Legacy alias (deprecated)
npx add-skill garroshub/backtesting-skillPython 3.11+ is recommended.
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtValidate a schema:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_single_schema.json --validate-onlyRun a single backtest:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_single_schema.jsonRun a grid search:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_grid_schema.jsonIf bundle data is missing and schema allows it:
python scripts/run_backtest_from_schema.py --schema references/example_trend_dip_grid_schema.json --ingest-if-missingPrimary output blocks include:
metricsperformance_metricstrade_summarycapacity_diagnosticsrisk_attributionpractical_assessment
Grid mode adds:
top_resultsstability_diagnostics
oversold_bounce_long_onlysma_crossover_long_onlytrend_dip_buy_long_only
Multi-symbol equal-weight mode is available for:
sma_crossover_long_onlytrend_dip_buy_long_only
oversold_bounce_long_only remains single-symbol strategy logic.
- Active runtime data source:
data.source = "bundle" - Reserved data interfaces:
csv,parquet,custom(replaceable by design) - Reserved live interface:
live_data(for exampleibkr) is validation-only and not production live trading
See references/schema.md for complete fields and output contract.
SKILL.md: skill behavior and workflowreferences/schema.md: schema and output referencereferences/example_*.json: runnable examplesscripts/run_backtest_from_schema.py: runnerscripts/ingest_yahoo_bundle.py: optional ingestion helper
MIT. See LICENSE.