OpenFinClaw CLI
Enables quant research, strategy generation, backtesting, and paper trading from natural language prompts, integrating with AI agents via an MCP server.
README
<div align="center">
<img src="imgs/logo.svg" alt="OpenFinClaw" width="680">
Your quant research team, in one prompt.
Research · strategy · backtest · paper trade — ship a complete quant workflow from a single natural-language prompt, inside Claude Code, Cursor, and 20+ AI agents.
🚀 Try it in 60 seconds — zero install
Run a full research → strategy → backtest loop in your browser. No install, no API key, real market data.
Quick Start · Example Prompts · Community · Platforms · vs. other tools
</div>
What you get
| 🧠 DeepAgent analysis skills | 60+ built-in — technical · fundamental · sentiment · risk · timing · factor |
| 🌍 Markets covered | 5 — US equities · A-shares · HK · Crypto · Forex |
| 🤖 Works with | 20+ AI platforms — Claude Code · Cursor · VS Code · Hermes · Windsurf · Codex … |
| 🔄 End-to-end flow | research → strategy → backtest → paper trade → publish to the leaderboard |
| ⚡ How you interact | streaming token-by-token in the terminal · MCP tool calls · in-browser playground |
<p align="center"> <img src="imgs/deepagent-backtest-metrics.png" alt="DeepAgent backtest result — Tesla Bollinger Bands" width="620"> <br/> <sub><em>Live output from <code>openfinclaw deepagent research</code> — one prompt: research → strategy → backtest → metrics.</em></sub> </p>
Example Prompts
Copy-paste any of these into openfinclaw deepagent research "…" (or drop them straight into your AI agent). Each one runs the full research → strategy → backtest loop.
📈 Technical analysis
Find RSI divergence signals on NVDA in the last 6 months, then backtest them.Compare a Bollinger Bands strategy on TSLA vs AAPL over 1 year — which wins?Screen the S&P 500 for golden-cross signals this month.
📊 Fundamentals & macro
Pull Apple's last 8 quarters of revenue, margins, and guidance. Summarize the trend.What's driving the NVDA move this quarter — earnings, guidance, or narrative?Compare AMD / INTC / NVDA on growth, margin, and valuation.
🎯 Strategy generation
Design a momentum strategy on US mega-cap tech. Backtest 2y. Tell me where it breaks.Write a mean-reversion strategy on BTC and show drawdown behavior through 2022.A-shares 沪深 300 日内轮动策略,年化目标 15%,最大回撤 < 10%。
🧪 Backtest & stress-test
Backtest a 50/200 SMA crossover on SPY from 2015. Include costs and slippage.Stress-test my forked strategy against the 2020 and 2022 crashes.
Want a ready-made one? Run
openfinclaw leaderboardto browse the community's highest-ranked strategies, thenforkany of them.
Quick Start
💡 Want to see it in action before installing? Try DeepAgent in your browser first.
60-second onboarding
npx @openfinclaw/cli@latest install # wizard + MCP configs + Skill registration + doctor
openfinclaw deepagent +research "盘点 BTC 周线" # streaming research / strategy / backtest
install runs the interactive wizard, writes MCP configs to every detected AI agent, persists your fch_ key to ~/.openfinclaw/config.json (chmod 600 on Unix), drops a SKILL.md under ~/.claude/skills/openfinclaw/ so Claude Code / Cursor auto-trigger on keywords like quant / backtest / 量化, and finishes with a connectivity check.
Non-interactive / CI:
npx @openfinclaw/cli@latest install --yes \
--platforms cursor,claude-code --tool-groups deepagent,strategy \
--api-key fch_xxx --register-skill
Just the wizard, no SKILL.md registration, no doctor: npx @openfinclaw/cli init.
CLI quick reference
A single fch_ key drives both DeepAgent and the strategy group. Resolution order: --api-key → OPENFINCLAW_API_KEY → ~/.openfinclaw/config.json.
| Group | Commands |
|---|---|
| DeepAgent | deepagent +research "<query>", deepagent health, deepagent skills, deepagent threads, deepagent messages, deepagent backtests, deepagent packages, deepagent download |
| Strategy | leaderboard, strategy-info, fork, list-strategies, validate, publish, publish-verify |
| Raw | api GET <path> · api POST <path> --json '<body>' — direct Hub Gateway call, auth pre-attached |
| System | install · init · skill-install · serve · doctor · update · examples |
+verb (e.g. deepagent +research) is the human-friendly streaming path; the bare verbs and MCP-only atomic triplet research_submit / research_poll / research_finalize are for agents/scripts. Run openfinclaw --help for the full surface.
Sample DeepAgent output — one prompt → strategy definition + backtest metrics + per-trade P&L + improvement notes:
<p align="center"> <img src="imgs/deepagent-backtest-metrics.png" alt="DeepAgent — strategy definition & performance metrics" width="49%" /> <img src="imgs/deepagent-backtest-trades.png" alt="DeepAgent — trades, conclusions & optimization suggestions" width="49%" /> </p>
Community: leaderboard → fork → publish
OpenFinClaw ships with a community strategy exchange. Browse what others are running, copy any strategy locally, tweak it, and publish back — think of it as a Hugging Face for quant strategies.
openfinclaw leaderboard --limit 20 # Browse top-ranked strategies
openfinclaw strategy-info <id> # See how a strategy performs
openfinclaw fork <id> # Copy to ./strategies/<slug>
# ... edit strategy.py, tweak fep.yaml ...
openfinclaw validate ./strategies/<slug> # Pre-flight FEP v2.0 check
openfinclaw publish ./my-strategy.zip # Ship to the leaderboard
openfinclaw publish-verify --submission-id <id> # Track backtest progress
Every published strategy is backtested server-side and ranked by live-market-equivalent returns — no self-reported numbers.
Supported Platforms
OpenFinClaw works with any MCP-compatible agent platform:
| Category | Platforms |
|---|---|
| Chat | Claude Desktop, Claude.ai, ChatGPT, Chatbox, LM Studio |
| IDEs | Claude Code, VS Code (Copilot), Cursor, Windsurf, JetBrains Junie, Zed, Cline, Continue.dev |
| CLI Agents | Codex (OpenAI), OpenCode, Amazon Q CLI |
| Frameworks | Hermes Agent, BeeAI, Swarms |
| AI Agents | OpenClaw, NanoClaw |
| Other | v0 (Vercel), Postman, Roo Code, Amp (Sourcegraph) |
Platform Config Examples
<details> <summary><b>Claude Code</b> — <code>~/.claude/settings.json</code></summary>
{
"mcpServers": {
"openfinclaw": {
"command": "npx",
"args": ["@openfinclaw/cli", "serve", "--tools=deepagent,strategy"],
"env": {
"OPENFINCLAW_API_KEY": "fch_xxx"
}
}
}
}
</details>
<details> <summary><b>Cursor</b> — <code>.cursor/mcp.json</code></summary>
{
"mcpServers": {
"openfinclaw": {
"command": "npx",
"args": ["@openfinclaw/cli", "serve", "--tools=deepagent,strategy"],
"env": {
"OPENFINCLAW_API_KEY": "fch_xxx"
}
}
}
}
</details>
For other platforms (VS Code, Hermes, Windsurf, Zed, OpenClaw, Junie, Trae, …), see configs/ for ready-to-copy templates. The shape is the same — only the host key (servers vs mcpServers vs context_servers) and config path differ.
Tool Groups & Context Optimization
Load only what you need to save tokens: serve --tools=deepagent (~1,400 tk) or serve --tools=strategy (~1,000 tk), or omit --tools for both.
| Group | Tools |
|---|---|
deepagent |
14 remote-agent tools — fin_deepagent_health / _skills / _research_submit / _research_poll / _research_finalize / _status / _cancel / _threads / _messages / _backtests / _backtest_result / _packages / _package_meta / _download_package |
strategy |
7 local FEP v2.0 tools — strategy_publish / strategy_validate / strategy_fork / strategy_leaderboard / strategy_get_info / strategy_list_local / strategy_publish_verify |
Environment Variables
Only one is required:
| Variable | Description |
|---|---|
OPENFINCLAW_API_KEY |
Unified fch_ key. Drives both strategy (Hub) and deepagent (Hub Gateway). Falls back to ~/.openfinclaw/config.json if unset. Get a key at hub.openfinclaw.ai. |
Advanced overrides (rarely needed): OPENFINCLAW_CONFIG_PATH, HUB_API_URL, DEEPAGENT_API_URL, REQUEST_TIMEOUT_MS, DEEPAGENT_SSE_TIMEOUT_MS — see packages/core/src/config.ts.
Development
git clone https://github.com/mirror29/openfinclaw-cli.git && cd openfinclaw-cli && pnpm install && pnpm build
OPENFINCLAW_API_KEY=<fch_...> node packages/cli/dist/index.js doctor # smoke test
Monorepo: @openfinclaw/core (zero-dep business logic) + @openfinclaw/cli (MCP server + terminal CLI + install wizard).
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。