strategy-workflow

Comprehensive strategy development workflow from ideation to validation. Use when creating trading strategies, running backtests, parameter optimization, or walk-forward validation.

3,891 stars

Best use case

strategy-workflow is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Comprehensive strategy development workflow from ideation to validation. Use when creating trading strategies, running backtests, parameter optimization, or walk-forward validation.

Teams using strategy-workflow should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/strategy-workflow/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/ahuserious/strategy-workflow/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/strategy-workflow/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How strategy-workflow Compares

Feature / Agentstrategy-workflowStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Comprehensive strategy development workflow from ideation to validation. Use when creating trading strategies, running backtests, parameter optimization, or walk-forward validation.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Strategy Workflow

Comprehensive strategy development workflow for quantitative trading, from hypothesis to validated production deployment.

## Overview

This skill provides a complete framework for developing, testing, and validating trading strategies. It supports:

- Hypothesis-driven strategy development
- Multi-GPU backtesting on Vast.ai
- Bayesian hyperparameter optimization with Optuna
- Walk-forward validation and out-of-sample testing
- Automated tearsheet generation

## Entry Points

### Control Plane (Swarm Orchestration)

Always-on watchdog loops that manage hardware utilization and self-healing:

```bash
bash scripts/start_swarm_watchdogs.sh
```

For local environments, set explicit paths:

```bash
VENV_PATH=/path/to/.venv/bin/activate \
RESULTS_ROOT=/path/to/backtests \
STATE_ROOT=/path/to/backtests/state \
LOGS_ROOT=/path/to/backtests/logs \
bash scripts/start_swarm_watchdogs.sh
```

### Work Plane (Parallel Execution)

Unified wrapper that starts control plane and launches parallel work:

```bash
scripts/backtest-optimize --parallel
```

Multi-GPU, multi-symbol execution:

```bash
cd WORKFLOW && ./launch_parallel.sh
```

### Single-Symbol Pipeline

For focused optimization on a single asset:

```bash
scripts/backtest-optimize --single --symbol SYMBOL --engine native --prescreen 50000 --paths 1000 --by-regime
```

## Strategy Development

### 1. Hypothesis Formulation

Define your strategy hypothesis in measurable terms:

- What market inefficiency are you exploiting?
- What is the expected holding period?
- What are the entry/exit conditions?
- What is the target risk-adjusted return?

### 2. Feature Selection

Identify relevant features for signal generation:

- Price-based (OHLCV, returns, volatility)
- Technical indicators (EMA, RSI, Bollinger Bands)
- Multi-timeframe features (MTF resampling)
- Volume analysis (PVSRA, VWAP)
- Market microstructure (order flow, spread)

### 3. Signal Generation

Convert features into actionable signals:

- Directional bias (trend following, mean reversion)
- Entry conditions (threshold crossings, pattern recognition)
- Exit conditions (take-profit, stop-loss, trailing stops)
- Position sizing rules

### 4. Position Sizing

Implement risk-aware position sizing:

- Fixed fractional
- Kelly criterion
- Volatility-adjusted
- Regime-dependent scaling

## Backtesting

### Pre-Flight Validation

**MANDATORY** before every optimization run:

```bash
python validation.py --check-all --data-path DATA_PATH --symbol SYMBOL
```

Validation checks:
- Data >= 90 days with no gaps/NaN
- Min trades >= 30 for statistical significance
- MTF resampling implemented correctly
- No look-ahead bias

### Multi-GPU Execution on Vast.ai

Deploy to cloud GPU instances for large-scale parameter sweeps:

```bash
# Copy workflow files
scp -P PORT workflow_files root@HOST:/root/WORKFLOW/

# Run optimization
ssh -p PORT root@HOST "cd /root/WORKFLOW && python optimize_strategy.py \
  --data-path /root/data --symbol SYMBOL --mode aggressive \
  --prescreen 5000 --paths 200 --engine gpu"
```

### Prescreening with Vectorized Backtests

Phase 0: GPU-accelerated parameter screening:

- Generate N random parameter combinations
- Batch evaluate on GPU
- Filter by minimum trades (30+)
- Return top K by Sharpe ratio

Performance baseline (RTX 5090, 730d lookback, 250k combos): ~4s per mode.

### Full Backtests with NautilusTrader

Phase 1: Event-driven backtesting for top candidates:

- High-fidelity simulation with realistic execution
- Slippage and commission modeling
- Multi-asset portfolio backtests

## Parameter Optimization

### Optuna for Hyperparameter Search

Phase 2: Bayesian optimization with warm-start from prescreening:

```python
import optuna

study = optuna.create_study(
    direction="maximize",
    sampler=optuna.samplers.TPESampler(seed=42),
    pruner=optuna.pruners.MedianPruner()
)

study.optimize(objective, n_trials=1000)
```

### Grid Search vs Bayesian Optimization

| Method | Use Case |
|--------|----------|
| Grid Search | Small parameter space, exhaustive coverage needed |
| Random Search | Large space, quick exploration |
| Bayesian (TPE) | Efficient optimization, exploitation/exploration balance |
| CMA-ES | Continuous parameters, smooth objective |

### Pruning Strategies

- **MedianPruner**: Prune if worse than median of completed trials
- **PercentilePruner**: Prune bottom X% of trials
- **HyperbandPruner**: Multi-fidelity optimization
- **SuccessiveHalvingPruner**: Aggressive early stopping

### Distributed Optimization

For large-scale runs, use persistent storage:

```python
# JournalStorage for multi-process
storage = optuna.storages.JournalStorage(
    optuna.storages.JournalFileStorage("journal.log")
)

# RDBStorage for distributed clusters
storage = optuna.storages.RDBStorage("postgresql://...")
```

## Walk-Forward Validation

### Rolling Window Validation

Slide the training/test window through time:

```
[Train 1][Test 1]
    [Train 2][Test 2]
        [Train 3][Test 3]
```

Parameters:
- `train_window`: Training period length
- `test_window`: Out-of-sample test length
- `step_size`: Window advancement increment

### Anchored Walk-Forward

Expand training window while sliding test window:

```
[Train 1      ][Test 1]
[Train 1 + 2      ][Test 2]
[Train 1 + 2 + 3      ][Test 3]
```

Use when historical regime diversity improves model robustness.

### Epoch Selection Criteria

Intelligent selection of training periods:

- **Regime-aware**: Match training regimes to expected deployment conditions
- **Volatility-adjusted**: Include both high and low volatility periods
- **Event-inclusive**: Ensure major market events are represented
- **Recency-weighted**: Emphasize recent data while maintaining diversity

### Out-of-Sample Testing

Final validation phase:
- Hold out 20-30% of data for final OOS test
- No parameter tuning on OOS data
- Monte Carlo stress testing
- Regime-conditional performance analysis

## SLOs and Guardrails

### Utilization Targets

- CPU utilization target: >= 70%
- GPU utilization target: >= 70%
- No silent GPU fallback for GPU sweeps

### Hardware Watchdog Hooks

Enforced by:
- `hooks/hardware_capacity_watchdog.py`
- `scripts/process_auditor.py`

### Capacity Monitoring

Control plane loops monitor:
- Worker health and liveness
- Progress artifact freshness
- Resource utilization
- Job queue depth

Self-healing actions:
- Automatic worker restart on crash
- Fill lanes for underutilized resources
- Cooldown guardrails to prevent thrashing

## Tearsheet Generation

Generate QuantStats-style performance reports:

```bash
scripts/generate-tearsheet STRATEGY_NAME \
  --trades /path/to/trades.csv \
  --capital 10000 \
  --output ./tearsheets
```

See `tearsheet-generator` skill for detailed visualization options.

## Multi-Provider Orchestration

### PAL MCP Integration

Attach PAL as an MCP server for research/consensus across multiple model providers:

- Config template: `config/mcp/pal.mcp.json.example`
- Docs: `docs/reference/PAL_MCP_INTEGRATION.md`
- Providers: OpenRouter, OpenAI, Anthropic, xAI, local models

## Resources

### Documentation

- [VectorBT Documentation](https://vectorbt.dev/)
- [NautilusTrader Docs](https://nautilustrader.io/)
- [Optuna Documentation](https://optuna.readthedocs.io/)
- [QuantStats](https://github.com/ranaroussi/quantstats)

### Project References

- `config/workflow_defaults.yaml` - Default configuration
- `config/model_policy.yaml` - Model policy (advisory)
- `docs/guides/SWARM_OPTIMIZATION_RUNBOOK.md` - Detailed runbook
- `hooks/pipeline-hooks.md` - Hook contracts
- `docs/reference/VECTORBT_GRAPH_INGEST.md` - VectorBT PRO integration

### Results Structure

```
Backtests/optimizations/{SYMBOL}/{MODE}/
  best_sharpe/
    config.json      # Best Sharpe configuration
    metrics.json     # Performance metrics
  best_returns/
  lowest_drawdown/
  best_winrate/
  all_trials.json    # All Optuna trials
  phase0_top500.json # Prescreening results
```

Related Skills

Pricing Strategy Analyzer

3891
from openclaw/skills

Analyze and optimize pricing for any product or service. Covers value-based, cost-plus, competitive, and tiered pricing models.

Business Strategy & Growth

n8n Workflow Mastery — Complete Automation Engineering System

3891
from openclaw/skills

You are an expert n8n workflow architect. You design, build, debug, optimize, and scale n8n automations following production-grade methodology. Every workflow you create is complete, functional, and follows the patterns in this guide.

Workflow & Productivity

Go-to-Market Strategy Builder

3891
from openclaw/skills

Build a complete GTM plan for product launches, market entries, or expansion plays. Covers positioning, channel strategy, pricing, launch timeline, and success metrics.

Workflow & Productivity

Git Engineering & Repository Strategy

3891
from openclaw/skills

You are a Git Engineering expert. You help teams design branching strategies, implement code review workflows, manage monorepos, automate releases, and maintain healthy repository practices at scale.

DevOps & Infrastructure

Exit Strategy & Business Valuation Planner

3891
from openclaw/skills

You are an M&A and exit planning advisor. Help founders and business owners build a structured exit strategy — whether they're planning an acquisition, IPO, management buyout, or orderly wind-down.

Business Strategy & Growth

Brand Strategy Engine

3891
from openclaw/skills

Complete brand building and go-to-market system — from identity foundations through positioning, messaging, visual systems, and launch execution. Works for solopreneurs, startups, and established businesses rebranding.

Marketing Strategy

Business Automation Strategy — AfrexAI

3891
from openclaw/skills

> The complete methodology for identifying, designing, building, and scaling business automations. Platform-agnostic — works with n8n, Zapier, Make, Power Automate, custom code, or any combination.

API Monetization Strategy

3891
from openclaw/skills

Turn your internal APIs into revenue streams. This skill helps you evaluate, price, package, and launch API products — whether you're monetizing existing infrastructure or building API-first products from scratch.

Business Strategy & Growth

n8n-workflow-automation

3891
from openclaw/skills

Designs and outputs n8n workflow JSON with robust triggers, idempotency, error handling, logging, retries, and human-in-the-loop review queues. Use when you need an auditable automation that won’t silently fail.

Workflow & Productivity

swarm-workflow-protocol

3891
from openclaw/skills

Multi-agent orchestration protocol for the 0x-wzw swarm. Defines spawn logic, relay communication, task routing, and information flow. Agents drive decisions; humans spar.

Workflow & Productivity

agentic-workflow-automation

3891
from openclaw/skills

Generate reusable multi-step agent workflow blueprints. Use for trigger/action orchestration, deterministic workflow definitions, and automation handoff artifacts.

Workflow & Productivity

workflow-agent

3891
from openclaw/skills

选择并改写 ComfyUI 工作流模板,输出可直接提交到 ComfyUI API 的完整 JSON。当需要准备渲染任务、选择模型、调整参数时触发。