backtest-strategy

Guide agents through backtesting strategy ideas with automatic data fetching and performance analysis

Best use case

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

Guide agents through backtesting strategy ideas with automatic data fetching and performance analysis

Teams using backtest-strategy 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/backtest-strategy/SKILL.md --create-dirs "https://raw.githubusercontent.com/WayfinderFoundation/wayfinder-paths-sdk/main/.claude/skills/backtest-strategy/SKILL.md"

Manual Installation

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

How backtest-strategy Compares

Feature / Agentbacktest-strategyStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Guide agents through backtesting strategy ideas with automatic data fetching and performance analysis

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.

SKILL.md Source

## When to use

Use this skill when you are:
- Backtesting an existing strategy from `wayfinder_paths/strategies/`
- Validating a new trading strategy idea before production deployment
- Analyzing historical performance (Sharpe, drawdown, CAGR, funding PnL)
- Testing any strategy type: momentum, delta-neutral, yield rotation, carry trade
- Testing different leverage levels or parameter combinations

## How to use

**First, determine if you're backtesting an existing strategy or a new idea:**

### Backtesting an existing strategy (from `wayfinder_paths/strategies/`)

Load these rules:

1. **[rules/backtesting.md](rules/backtesting.md)** — **Always load first.** Config reference, stats format, gotchas.
2. **[rules/existing-strategies.md](rules/existing-strategies.md)** — **REQUIRED for existing strategies.** Workflow for reading strategy source code, extracting parameters, fetching real Delta Lab data, and faithfully reproducing signal logic. Never use generic helpers with default parameters for existing strategies.
3. Load the strategy-type-specific rule if applicable (yield-strategies.md).

### Backtesting a new strategy idea

Load these rules in order (most to least specific for your strategy type):

1. **[rules/backtesting.md](rules/backtesting.md)** — Strategy type → helper mapping, quick start examples, config reference, stats format, gotchas, production path. **Always load this first.**

2. **[rules/yield-strategies.md](rules/yield-strategies.md)** — Detailed patterns for lending/yield strategies: supply rate rotation, leveraged yield loops, carry trade, multi-venue benchmark. Load when the user's strategy involves lending protocols, supply APRs, or borrow rates.

## Examples

- [examples/basic_momentum.py](examples/basic_momentum.py) — Cross-sectional momentum using `quick_backtest`
- [examples/delta_neutral.py](examples/delta_neutral.py) — Delta-neutral basis carry using `backtest_delta_neutral`
- [examples/yield_rotation.py](examples/yield_rotation.py) — USDC rotation across lending venues using `backtest_yield_rotation`
- [examples/carry_trade.py](examples/carry_trade.py) — Borrow cheap / supply expensive using `backtest_carry_trade`

## Strategy type → helper cheat sheet

| Strategy | One-liner |
|---|---|
| Momentum/trend (perp) | `quick_backtest(strategy_fn, symbols, start, end)` |
| Delta-neutral basis carry | `backtest_delta_neutral(symbols, start, end)` |
| Yield rotation (lending) | `backtest_yield_rotation(symbol, venues, start, end)` |
| Carry trade (borrow/supply spread) | `backtest_carry_trade(symbol, start, end)` |
| Active perps / HIP-3 (deployable) | `backtest_perps_trigger(signal_fn, decide_fn, symbols, ...)` |
| Full control | `run_backtest(prices, target_positions, config)` |

All helpers are in `wayfinder_paths.core.backtesting`.

> **For actively-traded Hyperliquid strategies (perp or HIP-3), use `backtest_perps_trigger` and the trigger pattern.** The same `signal.py` and `decide.py` modules run in backtest, live, and reconcile — drift is architecturally impossible. See [rules/perps-trigger.md](rules/perps-trigger.md).

Related Skills

writing-wayfinder-scripts

14
from WayfinderFoundation/wayfinder-paths-sdk

How to write Python scripts under `.wayfinder_runs/` — `get_adapter()` patterns, `web3_from_chain_id()` usage, and the common gotchas (clients vs adapters return shapes, async/await, ERC20 helpers, wei vs human amounts, funding-rate sign).

using-visual-chart-annotations

14
from WayfinderFoundation/wayfinder-paths-sdk

How to read Wayfinder Shells frontend state, create chart panes, and add TradingView annotations or overlays to the default live chart or agent-created workspace charts.

using-uniswap-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use the Uniswap V3 adapter for concentrated liquidity on Base/Arbitrum/Ethereum (LP provisioning, position management, tick math, and common gotchas).

using-sparklend-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use the SparkLend adapter for the functionality implemented in this repo (market reads, user state, supply/withdraw, borrow/repay, collateral, rewards, and native-token flows).

using-polymarket-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use the Polymarket adapter in Wayfinder Paths for market discovery (Gamma), orderbooks/prices/history (CLOB), user positions/activity (Data API), and execution (buy/sell + redeem) using pUSD collateral on Polygon (including deposit / withdraw preparation flows).

using-pendle-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use the Pendle adapter in Wayfinder Paths for PTs (Principal Tokens), YTs (Yield Tokens), and Pendle limit orders: market discovery, historical data, Hosted SDK swap tx building, taker fills, maker orders, inputs/outputs, chain IDs, unit handling, and approvals.

using-notification-send

14
from WayfinderFoundation/wayfinder-paths-sdk

How to email or text the Wayfinder Shells instance owner from agents/scripts via the notify MCP tool or NotifyClient (Markdown body rendered to themed HTML for email, throttled).

using-morpho-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use the Morpho adapter for Morpho Blue markets + MetaMorpho vaults (market discovery, positions, collateral ops, rewards, and common gotchas).

using-moonwell-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use the Moonwell adapter for lending/borrowing on Base (market discovery, APYs, collateral management, and common gotchas).

using-hyperliquid-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use Hyperliquid adapter data (meta, funding, candles, orderbooks) and execution surfaces (orders/transfers) in Wayfinder Paths, including required executor wiring.

using-hyperlend-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to read Hyperlend markets/time-series and execute lend/withdraw flows in Wayfinder Paths (inputs/outputs, unit handling, and safety).

using-euler-v2-adapter

14
from WayfinderFoundation/wayfinder-paths-sdk

How to use the Euler v2 (EVK / eVault) adapter for vault market discovery, APYs, positions, and EVC-batched lend/borrow flows.