validate_strategy
Validate a strategy spec before running it: check schema and warm-up fit against available history, and get actionable issues. Use when a spec is rejected or before an expensive backtest.
Instructions
Dry-run a strategy spec without executing it: checks the schema, the warm-up against available history, and reports actionable issues. Cheap. Call it when a spec has been rejected, or before an expensive run. Worked specs: {'primitive':'buy_and_hold','params':{}}; {'primitive':'sma_cross','params':{'fast':10,'slow':30}}; {'primitive':'threshold','params':{'lookback':15,'entry_pct':1.5,'exit_pct':0.25}}. A spec also carries optional top-level fields beside primitive and params, e.g. {'primitive':'sma_cross','params':{'fast':10,'slow':30},'warmup_bars':60,'rebalance':'weekly','sizing':'fixed_fraction','fraction':0.25}. Unknown fields are rejected rather than ignored. Examples: validate_strategy(spec={'primitive':'sma_cross','params':{'fast':10,'slow':30}}, symbol='SYN-02', as_of='2021-12-31'); validate_strategy(spec={'primitive':'buy_and_hold','params':{}}, symbol='SYN-09', as_of='2021-12-31'). as_of is required on this tool and the call fails without it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | A strategy spec object. See the strategy-primitives resource. | |
| as_of | Yes | REQUIRED point-in-time cutoff. There is no default and no safe guess. No bar dated after this is returned, ever. Set it to the decision date you are simulating, not to today: using a later as_of than the evaluation window is how a backtest accidentally sees the future. | |
| symbol | Yes | Symbol the spec would run against. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||