Einstein Research — Backtest Engine
by DaVinci
Programmatic backtesting framework for trading strategies. Runs backtests with historical price data (yfinance or CSV), supports momentum/mean-reversion/factor/signal-based strategies, walk-forward optimization, out-of-sample testing, transaction cost modeling, regime-aware splits, and full performance metrics (Sharpe, Sortino, Calmar, max drawdown, CAGR, win rate, profit factor). Distinct from einstein-research-backtest (which provides methodology guidance). Use when a user wants to actually run a backtest, test a specific strategy on historical data, or generate performance metrics.
安装
claude skill add --url github.com/openclaw/skills/tree/main/skills/clawdiri-ai/einstein-research-backtest-engine-dv文档
Backtest Engine
This skill is the programmatic engine for running quantitative trading strategy backtests. It takes a machine-readable strategy definition (e.g., from the einstein-research-edge skill) and executes it against historical data, producing detailed performance metrics.
When to Use This Skill
- User wants to run a backtest on a specific strategy.
- User has a
strategy.yamlfile from theedge-generatorskill. - User wants to generate performance metrics for a trading idea.
- Triggers: "run a backtest," "test this strategy," "generate performance metrics."
This skill is for execution. For guidance on how to design a robust backtest, see the einstein-research-backtest methodology skill.
Workflow
Step 1: Provide Strategy Definition
The backtest engine requires a strategy.yaml file that defines the rules of the strategy.
strategy.yaml Format:
version: backtest-engine/v1
name: 52-Week High Momentum
universe: "sp500"
data:
source: yfinance
start_date: "2018-01-01"
end_date: "2023-12-31"
entry_signal:
- "price > high_52w"
- "volume > 2 * avg_volume_50d"
exit_signal:
- "hold_days == 5"
- "pct_change >= 0.10"
- "pct_change <= -0.05"
parameters:
hold_days: 5
profit_target: 0.10
stop_loss: -0.05
Step 2: Execute the Backtest
The backtest-engine CLI runs the simulation.
backtest-engine run --strategy-file path/to/strategy.yaml
Optional Flags:
--costs 0.0005: Apply a 0.05% transaction cost per trade.--out-of-sample-split 2022-01-01: Split data for out-of-sample testing.--walk-forward: Enable walk-forward optimization mode.
The script performs the following actions:
- Loads Data: Fetches historical price data via yfinance or from a local CSV.
- Generates Signals: Iterates through the historical data day-by-day, applying the
entry_signalandexit_signallogic. - Simulates Trades: Creates a trade log based on the generated signals.
- Calculates Equity Curve: Builds the portfolio's equity curve over time.
- Computes Metrics: Calculates a full suite of performance metrics.
Step 3: Analyze the Performance Report
The engine generates a detailed report in JSON and Markdown.
Key Performance Metrics (KPIs):
- CAGR: Compound Annual Growth Rate.
- Max Drawdown: The largest peak-to-trough drop.
- Sharpe Ratio: Risk-adjusted return (vs. risk-free rate).
- Sortino Ratio: Risk-adjusted return (vs. downside deviation only).
- Calmar Ratio: Return relative to max drawdown.
- Win Rate %: Percentage of trades that were profitable.
- Profit Factor: Gross profits / gross losses.
- Trades per Year: Frequency of the strategy.
Report Structure (backtest_report_YYYY-MM-DD.md):
- Strategy Summary: The input
strategy.yamldefinition. - Overall Performance: A table with the key performance metrics.
- Equity Curve: An ASCII or image chart of the portfolio's growth.
- Drawdown Periods: Highlights the worst drawdown periods.
- Trade Log: A sample of the individual trades made.
- Annual Returns: A bar chart of returns by year.
Step 4: Present Findings
Synthesize the report for the user, focusing on the most important metrics that answer their original question. Always contextualize the results by referencing the methodology from the einstein-research-backtest skill (e.g., "This is an initial backtest. The next step is to test for parameter robustness.").
相关 Skills
agent-browser
by chulla-ceja
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
接口规范
by alexxxiong
API 规范管理工具 - 跨项目 API 文档的初始化、更新、查询与搜索。Triggers: 'API文档', 'API规范', '接口文档', '路由解析', 'apispec', 'API lookup', 'API search'.
investment-research
by caijichang212
Perform structured investment research (投研分析) for a company/stock/ETF/sector using a repeatable framework: fundamentals (basic/财务报表与商业模式), technical analysis (技术指标与关键价位), industry research (行业景气与竞争格局), valuation (估值对比/情景), catalysts and risks, and produce a professional research report + actionable plan. Use when the user asks for: equity/ETF analysis, earnings/financial statement breakdown, peer/industry comparison, valuation ranges, bull/base/bear scenarios, technical trend/support-resistance, or a full research memo.
相关 MCP 服务
Puppeteer 浏览器控制
编辑精选by Anthropic
Puppeteer 是让 Claude 自动操作浏览器进行网页抓取和测试的 MCP 服务器。
✎ 这个服务器解决了手动编写 Puppeteer 脚本的繁琐问题,适合需要自动化网页交互的开发者,比如抓取动态内容或做端到端测试。不过,作为参考实现,它可能缺少生产级的安全防护,建议在可控环境中使用。
网页抓取
编辑精选by Anthropic
Fetch 是 MCP 官方参考服务器,让 AI 能抓取网页并转为 Markdown 格式。
✎ 这个服务器解决了 AI 直接处理网页内容时格式混乱的问题,适合需要让 Claude 分析在线文档或新闻的开发者。不过作为参考实现,它缺乏生产级的安全配置,你得自己处理反爬虫和隐私风险。
Brave 搜索
编辑精选by Anthropic
Brave Search 是让 Claude 直接调用 Brave 搜索 API 获取实时网络信息的 MCP 服务器。
✎ 如果你想让 AI 助手帮你搜索最新资讯或技术文档,这个工具能绕过传统搜索的限制,直接返回结构化数据。特别适合需要实时信息的开发者,比如查 API 更新或竞品动态。不过它依赖 Brave 的 API 配额,高频使用可能受限。