| name | pybroker-strategy-creator |
| description | Create, adapt, review, and debug PyBroker algorithmic trading strategy and backtest code using the bundled PyBroker wiki references generated from the local docs. Use when an agent needs to turn trading rules into PyBroker Strategy/ExecContext logic, add indicators, models, stops, ranking, rotation, position sizing, rebalancing, custom data sources, walkforward analysis, bootstrap metrics, parameter optimization, multiple time intervals, slippage modeling, margin trading, parallelization, or dynamic symbol selection, or to answer PyBroker usage questions. |
PyBroker Strategy Creator
Overview
Create practical PyBroker strategy code from user intent while preserving backtest hygiene, including no lookahead leakage, explicit sizing, clear risk controls, and locally valid PyBroker API usage.
Workflow
- Extract the strategy spec: universe, data source, date range, timeframe, long/short permissions, entry and exit rules, sizing, stops, ranking, rebalancing cadence, model training needs, and desired output file/notebook.
- Ask only for missing blockers. If details are absent but noncritical, make conservative assumptions and state them in the final answer or code comments.
- Read
references/wiki-index.md to choose the smallest relevant wiki page. For nontrivial strategy work, also read references/pybroker-patterns.md.
- Build a complete runnable strategy surface:
- start scripts with
pybroker.disable_progress_bar() and pybroker.enable_data_source_cache("<name>")
- create a
StrategyConfig when cash, fees, delays, exits, margin, or returned signals/stops/positions matter
- define indicators with
highest, lowest, returns, the built-in factories in pybroker.indicator (such as atr), or indicator with vectorized NumPy/Numba functions