pybroker-strategy-creator

Installation
SKILL.md

PyBroker Strategy Creator

Overview

Create practical PyBroker strategy code from user intent while preserving backtest hygiene: no lookahead leakage, explicit sizing, clear risk controls, and locally valid PyBroker API usage.

Workflow

  1. 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.
  2. Ask only for missing blockers. If details are absent but noncritical, make conservative assumptions and state them in the final answer or code comments.
  3. Read references/wiki-index.md to choose the smallest relevant wiki page. For nontrivial strategy work, also read references/pybroker-patterns.md.
  4. Build a complete runnable strategy surface:
    • create a StrategyConfig when cash, fees, position limits, delays, exits, or returned signals/stops matter
    • define indicators with highest, lowest, returns, or indicator
    • define model sources with pybroker.model only when training or loading predictions is part of the request
    • write execution functions that use completed-bar arrays such as ctx.close[-1], guard lookbacks with ctx.bars or warmup, and set at most one order side per symbol per bar
    • add executions with Strategy.add_execution
    • run backtest for a single train/test pass or walkforward for model/walk-forward evaluation
  5. Validate the produced code as far as the environment allows. At minimum, run syntax checks for created Python files. Run tests or a small local-data backtest when the repo and data make that practical.
Installs
1
First Seen
Apr 28, 2026