| name | openfinclaw-ai-quant-research |
| description | AI-powered quantitative research, strategy backtesting, and paper trading through natural language prompts in Claude Code, Cursor, and 20+ AI agents via MCP |
| triggers | ["backtest a trading strategy","quantitative research on stocks","analyze stock with technical indicators","create a momentum strategy","fork a quant strategy from leaderboard","run deepagent research","validate trading strategy","publish strategy to openfinclaw"] |
OpenFinClaw AI Quant Research
Skill by ara.so — Devtools Skills collection.
OpenFinClaw is an AI-powered quantitative research platform that enables complete quant workflows—research, strategy design, backtesting, and paper trading—from natural language prompts. It works as an MCP server in Claude Code, Cursor, VS Code, and 20+ AI agents, providing 60+ built-in analysis skills across US equities, A-shares, HK, crypto, and forex markets.
What It Does
- DeepAgent Research: 60+ built-in analysis skills (technical, fundamental, sentiment, risk, timing, factor)
- Strategy Management: Browse, fork, validate, and publish strategies to a community leaderboard
- End-to-End Workflow: Single prompt → research → strategy → backtest → metrics → paper trade
- Market Coverage: US equities, A-shares, HK stocks, crypto, forex
- MCP Integration: Works natively in 20+ AI platforms via Model Context Protocol
Installation
Quick Install (Interactive Wizard)
npx @openfinclaw/cli@latest install
This runs an interactive wizard that:
- Writes MCP configs to detected AI agents
- Persists your
fch_ API key to ~/.openfinclaw/config.json
- Registers a SKILL.md file for auto-triggering
- Runs a connectivity check
Non-Interactive / CI Install
npx @openfinclaw/cli@latest install --yes \
--platforms cursor,claude-code \
--tool-groups deepagent,strategy \
--api-key ${OPENFINCLAW_API_KEY} \
--register-skill
API Key Setup
Get your API key from hub.openfinclaw.ai
The key can be provided via:
--api-key flag
OPENFINCLAW_API_KEY environment variable
~/.openfinclaw/config.json (auto-created by install wizard)
Configuration
MCP Server Configuration
Claude Code (~/.claude/settings.json):
{
"mcpServers": {
"openfinclaw": {
"command": "npx",
"args": ["@openfinclaw/cli", "serve", "--tools=deepagent,strategy"],
"env": {
"OPENFINCLAW_API_KEY": "fch_xxx"
}
}
}
}
Cursor (.cursor/mcp.json):
{
"mcpServers": {
"openfinclaw": {
"command": "npx",
"args": ["@openfinclaw/cli", "serve", "--tools=deepagent,strategy"],
"env": {
"OPENFINCLAW_API_KEY": "fch_xxx"
}
}
}
}
Tool Groups
Load only what you need to save context tokens:
--tools=deepagent (~1,400 tokens): Remote agent tools for research and analysis
--tools=strategy (~1,000 tokens): Local FEP v2.0 tools for strategy management
- Omit
--tools to load both groups
Key Commands
DeepAgent Research
Stream research, strategy generation, and backtesting in one command:
openfinclaw deepagent +research "Find RSI divergence signals on NVDA in the last 6 months, then backtest them"
openfinclaw deepagent +research "Pull Apple's last 8 quarters of revenue, margins, and guidance. Summarize the trend"
openfinclaw deepagent +research "Design a momentum strategy on US mega-cap tech. Backtest 2y"
openfinclaw deepagent +research "A-shares 沪深 300 日内轮动策略,年化目标 15%"
DeepAgent Management
openfinclaw deepagent health
openfinclaw deepagent skills
openfinclaw deepagent threads
openfinclaw deepagent messages --thread-id <id>
openfinclaw deepagent backtests
openfinclaw deepagent download --package-id <id> --output ./research
Strategy Management
openfinclaw leaderboard --limit 20
openfinclaw strategy-info <strategy-id>
openfinclaw fork <strategy-id>
openfinclaw validate ./strategies/my-strategy
openfinclaw publish ./my-strategy.zip
openfinclaw publish-verify --submission-id <id>
openfinclaw list-strategies
System Commands
openfinclaw doctor
openfinclaw init
openfinclaw skill-install
openfinclaw update
openfinclaw examples
Raw API Access
Direct Hub Gateway calls with pre-attached auth:
openfinclaw api GET /api/v1/strategies
openfinclaw api POST /api/v1/deepagent/research --json '{
"query": "Analyze TSLA momentum",
"market": "US"
}'
MCP Tools Available
When serving as an MCP server, OpenFinClaw exposes these tools:
DeepAgent Tools (14 tools)
fin_deepagent_health - Check service availability
fin_deepagent_skills - List available analysis skills
fin_deepagent_research_submit - Start research task
fin_deepagent_research_poll - Poll research progress
fin_deepagent_research_finalize - Finalize research and get results
fin_deepagent_status - Check task status
fin_deepagent_cancel - Cancel running task
fin_deepagent_threads - List research threads
fin_deepagent_messages - Get thread messages
fin_deepagent_backtests - List backtests
fin_deepagent_backtest_result - Get backtest details
fin_deepagent_packages - List research packages
fin_deepagent_package_meta - Get package metadata
fin_deepagent_download_package - Download research package
Strategy Tools (7 tools)
strategy_leaderboard - Browse ranked strategies
strategy_get_info - Get strategy details
strategy_fork - Fork strategy locally
strategy_list_local - List local strategies
strategy_validate - Validate FEP v2.0 compliance
strategy_publish - Publish to leaderboard
strategy_publish_verify - Check publication status
Code Examples
TypeScript: Using as a Library
import { OpenfincLawClient } from '@openfinclaw/core';
const client = new OpenfincLawClient({
apiKey: process.env.OPENFINCLAW_API_KEY,
});
const task = await client.deepagent.submitResearch({
query: 'Backtest Bollinger Bands strategy on TSLA for 1 year',
market: 'US',
});
let result;
while (true) {
result = await client.deepagent.pollResearch(task.taskId);
if (result.status === 'completed') break;
await new Promise(r => setTimeout(r, 2000));
}
console.log('Strategy:', result.strategy);
console.log('Backtest metrics:', result.backtest);
TypeScript: Streaming Research
import { streamDeepAgentResearch } from '@openfinclaw/cli';
const stream = streamDeepAgentResearch({
query: 'Compare AMD, INTC, NVDA on growth, margin, and valuation',
apiKey: process.env.OPENFINCLAW_API_KEY,
});
for await (const chunk of stream) {
if (chunk.type === 'content') {
process.stdout.write(chunk.data);
} else if (chunk.type === 'complete') {
console.log('\n\nBacktest result:', chunk.result);
}
}
TypeScript: Strategy Management
import { StrategyClient } from '@openfinclaw/core';
const client = new StrategyClient({
apiKey: process.env.OPENFINCLAW_API_KEY,
});
const leaderboard = await client.getLeaderboard({ limit: 10 });
leaderboard.strategies.forEach(s => {
console.log(`${s.name}: ${s.annualizedReturn}% return`);
});
const strategyId = 'momentum-mega-cap-v2';
await client.forkStrategy(strategyId, './strategies/my-momentum');
const validation = await client.validateStrategy('./strategies/my-momentum');
if (!validation.valid) {
console.error('Validation errors:', validation.errors);
}
const submission = await client.publishStrategy('./my-strategy.zip', {
name: 'Enhanced Momentum Strategy',
: ,
});
.(, submission.);
Common Patterns
Pattern: Research → Strategy → Backtest Loop
const prompt = `
Find stocks in S&P 500 with:
- RSI < 30 (oversold)
- Above 200-day moving average
- Volume spike > 2x average
Then backtest a mean-reversion strategy over 2 years
`;
const stream = streamDeepAgentResearch({ query: prompt });
for await (const chunk of stream) {
if (chunk.type === 'content') {
process.stdout.write(chunk.data);
} else if (chunk.type === 'complete') {
const { strategy, backtest, signals } = chunk.result;
console.log('\nAnnualized Return:', backtest.annualizedReturn);
console.log('Max Drawdown:', backtest.maxDrawdown);
console.log('Sharpe Ratio:', backtest.sharpeRatio);
}
}
Pattern: Fork, Modify, Validate, Publish
openfinclaw leaderboard --limit 20
openfinclaw fork momentum-mega-cap-v2
cd strategies/momentum-mega-cap-v2
openfinclaw validate .
cd .. && zip -r my-strategy.zip momentum-mega-cap-v2/
openfinclaw publish my-strategy.zip
openfinclaw publish-verify --submission-id <id>
Pattern: Multi-Market Analysis
const markets = ['US', 'CN', 'HK', 'CRYPTO'];
const analyses = await Promise.all(
markets.map(market =>
client.deepagent.submitResearch({
query: 'Screen for momentum signals in top 50 by market cap',
market,
})
)
);
for (const analysis of analyses) {
const result = await pollUntilComplete(analysis.taskId);
console.log(`${analysis.market} signals:`, result.signals.length);
}
Pattern: Custom Skill Composition
const skills = ['technical_analysis', 'fundamental_analysis', 'sentiment'];
const query = `
For NVDA:
1. Technical: Check for breakout patterns
2. Fundamental: Analyze P/E vs sector average
3. Sentiment: Social media and news sentiment
Then combine signals for a unified view
`;
const result = await client.deepagent.research({
query,
skills,
});
Troubleshooting
API Key Not Found
cat ~/.openfinclaw/config.json
export OPENFINCLAW_API_KEY=fch_xxx
openfinclaw --api-key fch_xxx deepagent health
MCP Server Not Starting
openfinclaw doctor
npx @openfinclaw/cli serve --tools=deepagent,strategy
echo $HOME/.claude/settings.json
echo $HOME/.cursor/mcp.json
Tool Not Recognized by AI Agent
- Restart your AI agent after running
openfinclaw install
- Check that MCP config points to correct CLI path
- Verify tool group is loaded:
serve --tools=deepagent,strategy
- Check Claude Code / Cursor logs for MCP initialization errors
Streaming Timeout
export DEEPAGENT_SSE_TIMEOUT_MS=300000
openfinclaw deepagent +research "complex multi-step analysis"
Validation Errors on Publish
openfinclaw validate ./strategies/my-strategy
Rate Limiting
openfinclaw deepagent health
Environment Variables
| Variable | Description | Default |
|---|
OPENFINCLAW_API_KEY | Your fch_ API key (required) | - |
OPENFINCLAW_CONFIG_PATH | Custom config file path | ~/.openfinclaw/config.json |
HUB_API_URL | Hub API base URL | https://hub.openfinclaw.ai |
DEEPAGENT_API_URL | DeepAgent API base URL | https://gateway.openfinclaw.ai |
REQUEST_TIMEOUT_MS | HTTP request timeout | 30000 |
DEEPAGENT_SSE_TIMEOUT_MS | SSE streaming timeout | 180000 |
Real-World Example Prompts
For Technical Analysis
Compare a Bollinger Bands strategy on TSLA vs AAPL over 1 year — which wins?
For Fundamental Research
What's driving the NVDA move this quarter — earnings, guidance, or narrative?
For Strategy Development
Design a momentum strategy on US mega-cap tech. Backtest 2y. Tell me where it breaks.
For Multi-Market
Screen A-shares (沪深 300) for golden-cross signals this month, then backtest with transaction costs.
For Stress Testing
Stress-test a 50/200 SMA crossover on SPY against 2020 and 2022 crashes. Include slippage.
Integration with AI Agents
When OpenFinClaw is installed as an MCP server, AI agents can automatically invoke tools based on user intent:
User: "Backtest a mean-reversion strategy on BTC for the last year"
Agent:
- Calls
fin_deepagent_research_submit with the query
- Polls with
fin_deepagent_research_poll until complete
- Finalizes with
fin_deepagent_research_finalize
- Presents strategy code, backtest metrics, and trade-by-trade P&L
User: "Show me the top 5 strategies on the leaderboard"
Agent:
- Calls
strategy_leaderboard with limit=5
- Formats and displays strategy names, returns, Sharpe ratios
User: "Fork the momentum strategy and show me the code"
Agent:
- Calls
strategy_fork with strategy ID
- Reads local files from
./strategies/<slug>/
- Displays
strategy.py and fep.yaml contents
This natural language → tool invocation flow is the core value proposition of OpenFinClaw as an MCP skill.