Skip to content
Agentmart
Submit a tool

backtest-strategy

Runs backtests on trading strategies using historical market data.

Skill by LisonEvf

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/lisonevf-backtest-strategy

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Runs backtests on trading strategies using historical market data. Calculates performance metrics including Sharpe ratio, maximum drawdown, win rate, total return, and generates equity curves. Trigger when the user requests backtesting, strategy simulation, or performance evaluation.

Use cases: data, finance

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/backtest-strategy

What's inside

Skill name
backtest-strategy
Description
Runs backtests on trading strategies using historical market data. Calculates performance metrics including Sharpe ratio, maximum drawdown, win rate, total return, and generates equity curves. Trigger when the user requests backtesting, strategy simulation, or performance evaluation.
License
MIT
Instructions
45 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Backtest Strategy

Runs backtests on trading strategies and provides performance analysis.

## Real Code Reference

- `tradinglearn/backtest/backtester.py` — `Backtester` class: `run_backtest(data, strategy_class, strategy_params)`, `get_performance()`, `plot_results()`
- `tradinglearn/strategies/macd_strategy.py` — `MACDStrategy` with `generate_signals(data)` → positions
- `tradinglearn/pytdx2/backtest.py` — `BacktestEngine` + `BacktestConfig` + `BaseStrategy`
- `tradinglearn/utils/parameter_optimizer.py` — `ParameterOptimizer.optimize_macd_parameters()`

## Architecture

```
DataLoader → Strategy signals → Portfolio tracking → Metrics calculation → Report
```

1. **DataLoader** — fetch historical K-line via `data_fetcher.fetch_stock_data(ticker, start, end)`
2. **Strategy** — generate buy/sell signals per bar (`MACDStrategy(fast, slow, signal)`)
3. **Backtester** — `run_backtest(data, MACDStrategy, params)` iterates bars, tracks positions
4. **Metrics** — `get_performance()` returns Sharpe, max drawdown, win rate, total return, CAGR
5. **Plot** — `plot_results()` shows price vs portfolio value overlay

## Usage

```python
from backtest.backtester import Backtester
from strategies.macd_strategy import MACDStrategy
from utils.data_fetcher import fetch_stock_data

data = fetch_stock_data("000001", start_date="2024-01-01", end_date="2025-01-01")
bt = Backtester(initial_capital=100000.0, transaction_cost=0.001)
bt.run_backtest(data, MACDStrategy, {"fast_period": 12, "slow_period": 26, "signal_period": 9})
bt.generate_detailed_report()
bt.plot_results()
```

## Key Checks

- No lookahead bias — signal at bar `t` uses only data up to bar `t`
- Out-of-sample validation separate from parameter optimization
- Account for transaction costs (commission + slippage)
- Handle corporate actions (splits, dividends) in price data

From LisonEvf/finance-skills, MIT.

More from LisonEvf/finance-skills

Signals

Stars
2
Forks
1
Open issues
0
Last commit (this folder)
May 15, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from LisonEvf

Cite this page

backtest-strategy skill. Agent Mart. https://agentmart.dev/skills/lisonevf-backtest-strategy (last updated 2026-10-24)