create-strategy-lean

Use this skill when you need to add a new LEAN QCAlgorithm strategy in Python.

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 30, 2025

When & Why to Use This Skill

This Claude skill automates the creation of algorithmic trading strategies using the LEAN engine's QCAlgorithm framework in Python. It streamlines the development process by generating standardized strategy files, ensuring compliance with AERA-injected parameters, and adhering to LEAN-safe coding practices for robust financial backtesting and live execution.

Use Cases

  • Rapidly prototyping new quantitative trading strategies by generating boilerplate Python code for the LEAN engine.
  • Ensuring consistency across trading algorithms by following standardized templates and parameter handling for symbols, resolution, and slippage.
  • Developing backtest-ready strategies that comply with specific environment constraints, such as restricted network I/O and optimized logging to prevent system overhead.
nameCreate Strategy (LEAN)
descriptionUse this skill when you need to add a new LEAN QCAlgorithm strategy in Python.

Create Strategy (LEAN QCAlgorithm)

Use when adding a new strategy under the Strategy Lab strategies/ workspace.

Steps

  1. Create the strategy file
  • Path: server/strategies/<StrategyName>.py
  • Must define a QCAlgorithm class with Initialize and OnData.
  1. Use AERA-injected parameters
  • Read with GetParameter(...) and provide safe defaults:
    • symbol, resolution, cash, feeBps, slippageBps
  1. Keep it LEAN-safe
  • No network I/O.
  • Avoid writing files from the algorithm.
  • Keep logs short (no spam).
  1. Verify
  • Run from the app: Strategy Lab -> Run (LEAN) and inspect job logs/results.
  • Run standard validations: see skills/verify_changes/SKILL.md.

Template

Start from skills/create_strategy/template_strategy.py.