Momentum Strategy Example¶
This is an example strategy demonstrating explicit code capture using strategy.yaml.
Files¶
my_strategy.py- Main strategy implementationutils/indicators.py- Technical indicatorsutils/risk.py- Risk managementconfig/params.json- Strategy parametersstrategy.yaml- Code capture configuration
How It Works¶
When you run a backtest with this strategy, RustyBT will:
- Detect
strategy.yamlin the strategy directory - Copy all files listed in
strategy.yamlto the backtest output directory - Preserve the directory structure
The captured code will be stored in:
backtests/{backtest_id}/code/
├── my_strategy.py
├── utils/
│ ├── indicators.py
│ └── risk.py
├── config/
│ └── params.json
└── README.md
This ensures complete reproducibility of your backtest.