add-strategy

Generate ai-trader strategy files with registration and backtest scaffolding.

993|137|Updated Jun 18, 2024
One-click install
npx skills add https://github.com/whchien/ai-trader --skill add-strategy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-strategy
Source: https://github.com/whchien/ai-trader/tree/main/skills/add-strategy
Command: npx skills add https://github.com/whchien/ai-trader --skill add-strategy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates the boilerplate work of adding new trading strategies to ai-trader by generating strategy files, docstrings, registration code, and backtest scaffolding according to established conventions.

Core Features & Use Cases

  • Automatic file creation with PascalCase class to snake_case filename mapping.
  • Comprehensive module and class docstrings with Entry/Exit/Parameters sections.
  • Automatic registration in the appropriate init.py and alphabetical all maintenance.
  • Standalone backtest scaffolding to verify syntax and importability.
  • Pre-flight validation (name, type, parameters, custom indicators) and post-creation checks (git status, import viability).

Quick Start

Provide the strategy type, name, and parameters when prompted to generate files, register the strategy, and create a runnable backtest scaffold.

Frequently Asked Questions about add-strategy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new trading strategy to ai-trader without writing boilerplate code?

To add a new trading strategy to ai-trader, you provide the strategy type, name, and parameters. The tool automatically generates the strategy file with proper naming, docstrings, backtest scaffolding, and registration code, eliminating manual boilerplate creation.

How are strategy class names mapped to filenames when generating ai-trader strategy files?

Strategy class names in PascalCase are automatically mapped to snake_case filenames. This convention ensures consistent file naming across both classic single-strategy and portfolio multi-asset rotation strategies during the generation process.

Does the strategy generation tool handle registration in __init__.py files?

Yes, the strategy generation tool handles registration by automatically updating the appropriate __init__.py file. It maintains alphabetical order in the __all__ list and ensures the new strategy class is properly imported and registered for use.

What validation checks are performed when creating an ai-trader strategy?

When creating an ai-trader strategy, pre-flight validation checks the name, type, parameters, and custom indicators. Post-creation verification includes syntax import checks, git tracking status, and import viability tests to ensure reliable integration.

Can I generate both classic single-strategy and portfolio multi-asset rotation strategies?

Yes, you can generate both classic single-strategy and portfolio multi-asset rotation strategies. The tool handles parameter defaults, imports, and registration conventions specific to each strategy type, creating appropriate backtest scaffolding for both.

What's included in the backtest scaffolding for newly generated trading strategies?

The backtest scaffolding included for newly generated trading strategies provides a standalone script to verify syntax and importability. This allows you to immediately test that the generated strategy file integrates correctly without additional setup.