For agents. Use this when your user describes an idea ("buy dips in an uptrend, exit on a 2-ATR stop") and wants working code.
Steps
get_strategy_guideonce per session: the callbacks (initialize,warm_up,on_bar,size_position…),Signal, order types,config.json.create_projectwith the idea as the thesis and the nearestfamily. The scaffold already runs; you are editing, not starting from zero.read_filesforstrategy.py,config.jsonand the helpers (indicators.py,risk.py,filters.py).- Implement the rules with
write_files. Send complete file contents. Keep tunables inconfig.jsonparams. - Check the returned
validation. If it fails, no version was written; fix and write again. run_backtest, thenget_backtest.
Rules the runtime enforces
- Decisions on bar close, fills next open. No look-ahead.
- No live HTTP inside backtests; news, events and fundamentals arrive point in time through
context. strategy_runtime/is read-only. The market is locked per project.
Faster: let the copilot edit
json
It edits, validates and versions the code. Then run_backtest.
Export
The user owns the code: the workspace exports the whole project, including a live loop for paper trading with Alpaca.