Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计提醒

backtestingbacktesting 自动化

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

2,027

周安装

82

GitHub Stars

4

下载量

636
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:backtesting(backtesting 自动化)
来源仓库:https://github.com/alphaonedev/openclaw-graph
仓库路径:skills/backtesting
安装命令:
npx skills add https://github.com/alphaonedev/openclaw-graph --skill backtesting
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/alphaonedev/openclaw-graph --skill backtesting

简介

backtesting 用于辅助测试设计、自动化测试、用例整理和回归验证,适合让 Agent 编写单元测试、端到端测试或根据失败日志定位问题。

  • 它支持历史金融数据的回测模拟,计算收益率、最大回撤和夏普比率等指标,适用于算法交易策略验证。
  • 使用时需确保有可用历史数据,并在开发或优化交易策略时调用此技能进行风险暴露评估。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

SKILL.md

backtesting

Purpose

This skill enables OpenClaw to perform backtesting on historical financial data, simulating trading strategies to measure metrics like returns, drawdowns, and Sharpe ratio. Use it to validate strategies before live trading, identifying potential flaws in logic or risk exposure.

When to Use

Apply this skill when developing or refining trading strategies, such as evaluating a moving average crossover on stock data. Use it for quantitative analysis in algorithmic trading, portfolio optimization, or risk assessment, especially when historical data is available and strategies need empirical validation.

Key Capabilities

  • Simulate trades using historical price data from CSV, JSON, or API sources.
  • Compute performance metrics including total return, volatility, maximum drawdown, and risk-adjusted returns.
  • Support for common indicators like SMA, RSI, and Bollinger Bands via integrated libraries.
  • Handle multiple assets or portfolios, with options for transaction costs, slippage, and position sizing.
  • Output results in JSON format for easy parsing and visualization.

Usage Patterns

To backtest a strategy, provide a Python script defining the strategy logic, historical data source, and parameters. Always set the API key via environment variable $OPENCLAW_API_KEY before running. For CLI, use flags to specify inputs; for API, send a POST request with a JSON payload. Validate data integrity first by checking for missing values or incorrect timestamps. Run tests iteratively, adjusting parameters based on initial results.

Common Commands/API

Use the OpenClaw CLI for quick tests or the REST API for programmatic integration. Authentication requires setting $OPENCLAW_API_KEY in your environment.

  • CLI Command: Run a backtest with a strategy file and data source. openclaw backtest --strategy strategy.py --data historical.csv --start-date 2020-01-01 --end-date 2023-01-01 --capital 10000 This executes the strategy on the specified date range with initial capital.
  • API Endpoint: POST to /v1/backtest with JSON body. curl -X POST https://api.openclaw.ai/v1/backtest \ -H "Authorization: Bearer $OPENCLAW_API_KEY" \ -d '{"strategy": "def trade(data): return buy if data['close'] > data['sma'] else sell", "data_source": "historical.csv", "params": {"start_date": "2020-01-01"}}' Expect a JSON response with keys like "returns" and "drawdown".
  • Config Format: Use YAML for strategy configurations, e.g., strategy: name: moving_average parameters: period: 20 threshold: 0.05 Load this via CLI with --config strategy.yaml.

Integration Notes

Integrate with data providers like Yahoo Finance or Alpha Vantage by specifying URLs in the data source flag (e.g., --data https://example.com/data.csv). For Python workflows, import OpenClaw as a library: import openclaw; result = openclaw.backtest(strategy_file='strategy.py', data='historical.csv'). Ensure compatibility by using Python 3.8+ and handling dependencies via pip install openclaw-finance. If combining with other skills, chain outputs; for example, use results from a "data-fetch" skill as input here.

Error Handling

Anticipate errors like invalid data formats, missing API keys, or strategy failures. Check for $OPENCLAW_API_KEY before execution; if absent, the command will exit with code 401. Handle runtime errors by wrapping calls in try-except blocks, e.g.,

try:
    openclaw.backtest(strategy='strategy.py', data='historical.csv')
except ValueError as e:
    print(f"Data error: {e} - Verify CSV columns match expected format.")

Common issues: Invalid dates return code 400; use --verbose flag for detailed logs. Always validate strategy code for syntax errors before running.

Concrete Usage Examples

  1. Backtest a simple SMA crossover strategy on Apple stock data: openclaw backtest --strategy examples/sma_crossover.py --data aapl_historical.csv --params '{"short_period": 10, "long_period": 30}' --capital 5000 This simulates buying when short SMA crosses above long SMA, outputting metrics like 15% annual return.
  2. Evaluate a portfolio strategy with multiple assets and fees: curl -X POST https://api.openclaw.ai/v1/backtest -H "Authorization: Bearer $OPENCLAW_API_KEY" -d '{"strategy": "portfolio_alloc.py", "data_source": ["aapl.csv", "goog.csv"], "params": {"fee_per_trade": 5.0}}' This assesses a diversified portfolio, calculating net returns after fees, e.g., 12% with 8% drawdown.

Graph Relationships

  • Related to: trading (dependency for strategy execution)
  • Related to: financial-analysis (provides input data and metrics)
  • Connected to: risk-management (outputs risk metrics for further analysis)
  • Links with: data-fetch (uses fetched historical data as input)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.34%
按下载量换算231

Claude

28.54%
按下载量换算182

Cursor

20.24%
按下载量换算129

Gemini CLI

9.14%
按下载量换算58

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills