backtest-strategy
Skill4 starsChanged 4 months agoMITView on GitHub
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.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- report-generationSkill
- visualizationSkill
- data-cleaningSkill
- code-review-financeSkill
- doc-generationSkill
- opentdx-engineeringSkill
- gelan-trinity-tradingSkill
- query-skillsSkill
- new-skillSkill
- evf-stock-skillSkill
- market-dataSkill
- portfolio-riskSkill
- strategy-developmentSkill
- technical-analysisSkill
- yanchixia-short-termSkill
- yeren-trading-systemSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 50
No lookahead bias — signal at bar t uses only data up to bar t
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Backtest Strategy
Runs backtests on trading strategies and provides performance analysis.
Real Code Reference
tradinglearn/backtest/backtester.py—Backtesterclass:run_backtest(data, strategy_class, strategy_params),get_performance(),plot_results()tradinglearn/strategies/macd_strategy.py—MACDStrategywithgenerate_signals(data)→ positionstradinglearn/pytdx2/backtest.py—BacktestEngine+BacktestConfig+BaseStrategytradinglearn/utils/parameter_optimizer.py—ParameterOptimizer.optimize_macd_parameters()
Architecture
DataLoader → Strategy signals → Portfolio tracking → Metrics calculation → Report- DataLoader — fetch historical K-line via
data_fetcher.fetch_stock_data(ticker, start, end) - Strategy — generate buy/sell signals per bar (
MACDStrategy(fast, slow, signal)) - Backtester —
run_backtest(data, MACDStrategy, params)iterates bars, tracks positions - Metrics —
get_performance()returns Sharpe, max drawdown, win rate, total return, CAGR - Plot —
plot_results()shows price vs portfolio value overlay
Usage
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
tuses only data up to bart - Out-of-sample validation separate from parameter optimization
- Account for transaction costs (commission + slippage)
- Handle corporate actions (splits, dividends) in price data
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

