Recipe: Create a Strategy¶
Goal¶
Create a custom strategy file and run it end-to-end.
Steps¶
- Create
my_strategy.pywith aBaseStrategysubclass. - Implement
transform_features,build_signals, and one intent hook. - Validate and backtest with CLI.
stacksats strategy validate --strategy my_strategy.py:MyStrategy --strict
stacksats strategy backtest --strategy my_strategy.py:MyStrategy --output-dir output
Expected output¶
- Validation summary line with pass/fail status.
- Backtest artifacts in
output/<strategy_id>/<version>/<run_id>/.
Common failure patterns¶
- Non-finite signal values (
NaN/inf). - Incorrect index alignment across feature and signal series.
- Strategy bypass attempts of framework-owned kernel behavior.