AI-Powered Financial Intelligence Engine โ 8 Master Strategies, 5 Markets, 100+ Tests.
Project description
๐ FinClaw
AI-Powered Financial Intelligence Engine โ 8 Master Strategies, 5 Markets, 100+ Tests
English | ไธญๆ | ๆฅๆฌ่ช | ํ๊ตญ์ด | Franรงais
ยฅ100ไธ โ ยฅ354ไธ (5 years, 29.1% annualized)
Tested on 100+ real stocks across US, China, Hong Kong
30/34 individual backtests outperform buy-and-hold
๐ฏ What is FinClaw?
FinClaw is a complete AI trading intelligence system that scans stocks, picks winners, manages risk, and validates everything with real data. Unlike most "AI trading" projects that stop at signal generation, FinClaw covers the full lifecycle: Selection โ Entry โ Position Management โ Exit โ Portfolio โ Validation.
โก Quick Start
Install from PyPI
pip install finclaw-ai
Install from Source
git clone https://github.com/NeuZhou/finclaw.git
cd finclaw
pip install -r requirements.txt
Your First Scan (30 seconds)
# Scan US market with Soros-style momentum strategy
python finclaw.py scan --market us --style soros
# Backtest NVIDIA over 5 years
python finclaw.py backtest --ticker NVDA --period 5y
# See all available strategies
python finclaw.py info
Run Tests
pip install pytest pytest-asyncio
python -m pytest tests/ -v
๐ Performance
5-Year Real Data Backtest (2020โ2025)
| Strategy | Annual Return | 5Y Total | Risk Level |
|---|---|---|---|
| v10 Unified Top-5 | +29.1%/y | +254% | High |
| LLM-Enhanced Top-10 | +24.8%/y | +202% | Medium-High |
| Balanced Top-10 | +19.5%/y | +142% | Medium |
| Conservative Top-15 | +11.8%/y | +74% | Low |
All tests run on real Yahoo Finance data. No synthetic data. No cherry-picking.
vs Competitor (AHF)
FinClaw wins: 30/34 stocks (88%)
Average alpha: +10.8% per year
๐ง 8 Built-in Strategies
| Strategy | Philosophy | Risk | Target |
|---|---|---|---|
druckenmiller |
Momentum โ "When you see it, bet big" | Very High | 25โ40%/y |
soros |
Reflexivity โ self-reinforcing trends | High | 25โ35%/y |
lynch |
Growth/vol ratio โ "boring" winners | High | 20โ27%/y |
buffett |
Quality + value โ buy fear, hold forever | Medium-High | 20โ30%/y |
dalio |
All-weather โ low correlation, risk parity | Medium | 15โ20%/y |
aggressive |
Top-5 by return | High | 25โ35%/y |
balanced |
Top-10 grade-weighted | Medium | 10โ15%/y |
conservative |
Top-15 low-vol โ capital preservation | Low | 8โ12%/y |
๐๏ธ Architecture
graph TB
subgraph CLI["๐ฅ๏ธ CLI / Interfaces"]
FC[finclaw.py]
MCP[MCP Server]
TG[Telegram Bot]
DA[Daily Alert]
end
subgraph Selection["๐ Stock Selection (3 Layers)"]
L1[Layer 1: Quantitative<br/>Momentum, EMA, RSI, Vol]
L2[Layer 2: Fundamental<br/>P/E, Growth, ROE]
L3[Layer 3: AI Disruption<br/>LLM Analysis]
end
subgraph Engine["โ๏ธ Signal Engine"]
RD[Regime Detection<br/>7 market regimes]
SG[Signal Generation<br/>Multi-timeframe]
PM[Position Management<br/>Trailing, pyramiding]
end
subgraph Validation["โ
Validation"]
BT[Backtester v7]
ST[Statistics<br/>Sharpe, Monte Carlo]
TS[Test Suite<br/>100+ tests]
end
subgraph Data["๐ก Data"]
YF[Yahoo Finance]
UV[Universe<br/>US, CN, HK, JP, KR]
MA[Macro Analyzer<br/>VIX, Rates, DXY]
end
FC --> Selection
MCP --> Selection
TG --> Selection
DA --> Selection
Selection --> Engine
Engine --> Validation
Data --> Selection
Data --> Engine
MA --> RD
Signal Engine โ 7 Market Regimes
| Regime | Max Position | Strategy |
|---|---|---|
| CRASH | 0% | Emergency exit |
| STRONG_BEAR | 10% | Defensive bounces only |
| BEAR | 15% | Small counter-trend |
| RANGING | 45โ68% | Mean reversion |
| VOLATILE | 65% | Direction-dependent |
| BULL | 80% | Trend following |
| STRONG_BULL | 92% | Maximum conviction |
๐ Project Structure
finclaw/
โโโ finclaw.py # CLI entry point (scan, backtest, info)
โโโ main.py # Alternative entry
โโโ agents/
โ โโโ signal_engine_v7.py # 6-factor signal engine, 7 regimes
โ โโโ signal_engine_v9.py # Asset scoring & grading (A+ โ F)
โ โโโ backtester_v7.py # Full lifecycle backtester
โ โโโ stock_picker.py # Multi-factor picker (quant + fundamental)
โ โโโ macro_analyzer.py # 6-layer macro environment analyzer
โ โโโ deep_macro.py # Deep macro with Kondratieff wave
โ โโโ llm_analyzer.py # LLM-powered AI disruption analysis
โ โโโ statistics.py # Sharpe, Monte Carlo, walk-forward
โ โโโ universe.py # Stock universes + sector linkage
โ โโโ registry.py # Agent profiles (Warren, Soros, etc.)
โ โโโ ...
โโโ strategies/
โ โโโ strategy_spec.py # Strategy template definitions
โโโ tests/ # 100+ pytest tests
โ โโโ test_signal_engine.py # Signal engine & regime tests
โ โโโ test_backtester.py # Backtester lifecycle tests
โ โโโ test_asset_selector.py # Asset scoring tests
โ โโโ test_stock_picker.py # Multi-factor picker tests
โ โโโ test_cli.py # CLI strategy & universe tests
โ โโโ test_engine.py # Golden threshold tests
โ โโโ test_strategy.py # Strategy integration tests
โ โโโ test_exhaustive.py # Exhaustive QA tests
โ โโโ ...
โโโ mcp_server.py # MCP protocol server (4 tools)
โโโ telegram_bot.py # Telegram bot interface
โโโ daily_alert.py # Daily scanner & alerts
โโโ .github/workflows/ci.yml # CI: Python 3.9โ3.12
โโโ pyproject.toml # PyPI package config
โโโ docs/ # Multi-language documentation
๐ API Reference
CLI Commands
# Scan a market with a strategy
python finclaw.py scan --market <us|china|hk|japan|korea|all> \
--style <strategy> \
--capital <amount> \
--period <1y|2y|5y|10y>
# Backtest a single ticker
python finclaw.py backtest --ticker <SYMBOL> --period <period> --capital <amount>
# Show available strategies and markets
python finclaw.py info
# Run test suite
python finclaw.py test
MCP Server (for AI assistants)
python mcp_server.py
Exposes 4 tools:
finclaw_scanโ Scan market with strategy โ JSONfinclaw_backtestโ Backtest a ticker โ JSONfinclaw_macroโ Current macro environment โ JSONfinclaw_infoโ List strategies โ JSON
Python API
import asyncio
from finclaw import scan_universe, run_strategy, fetch_data, UNIVERSES, STRATEGIES
from agents.backtester_v7 import BacktesterV7
from agents.signal_engine_v7 import SignalEngineV7
from agents.signal_engine_v9 import AssetSelector
# Score an asset
selector = AssetSelector()
prices = [100, 102, 105, 103, 108, ...] # daily prices
score = selector.score_asset(prices)
print(f"Grade: {score.grade}, Composite: {score.composite:.2f}")
# Generate a trading signal
engine = SignalEngineV7()
signal = engine.generate_signal(prices)
print(f"Signal: {signal.signal}, Regime: {signal.regime}")
# Backtest
bt = BacktesterV7(initial_capital=100_000)
history = [{"date": d, "price": p, "volume": v} for d, p, v in zip(dates, prices, volumes)]
result = asyncio.run(bt.run("NVDA", "v7", history))
print(f"Return: {result.total_return:+.1%}, MaxDD: {result.max_drawdown:+.1%}")
๐ Supported Markets
| Market | Stocks | Examples |
|---|---|---|
| US | 50+ | NVDA, AAPL, MSFT, TSLA, META |
| China (A-shares) | 80+ | ่ดตๅท่ ๅฐ, ๅฎๅพทๆถไปฃ, ๆฏไบ่ฟช |
| Hong Kong | 25+ | Tencent, Alibaba, Meituan |
| Japan | 8 | Toyota, Sony, SoftBank |
| Korea | 6 | Samsung, SK Hynix |
๐ ๏ธ Development
Prerequisites
- Python 3.9+
pip install -r requirements.txt(aiohttp, yfinance)pip install pytest pytest-asyncio(for testing)
Running Tests
# All tests
python -m pytest tests/ -v
# Specific test file
python -m pytest tests/test_signal_engine.py -v
# With coverage (if installed)
python -m pytest tests/ --cov=agents --cov-report=term-missing
Test Coverage
| Test Suite | Tests | What It Covers |
|---|---|---|
| test_signal_engine | 17 | Regime detection, signals, edge cases |
| test_backtester | 14 | Lifecycle, metrics, config, warmup |
| test_asset_selector | 10 | Asset scoring, grading, bounds |
| test_stock_picker | 5 | Multi-factor analysis, conviction |
| test_cli | 13 | Strategies, universes, selection |
| test_engine | 7 | Golden thresholds, alpha targets |
| test_strategy | 17 | Strategy integration |
| test_exhaustive | 6 | Exhaustive QA combos |
| + more | ... | Registry, universe, macro, MCP |
๐ Comparison with Alternatives
| Feature | FinClaw | ai-hedge-fund | FinRL | Freqtrade |
|---|---|---|---|---|
| Stock Selection | โ 3-layer | โ Manual | โ Manual | โ Manual |
| Backtesting | โ Full lifecycle | โ ๏ธ Basic | โ Train/test | โ Advanced |
| Risk Management | โ 7 regimes | โ None | โ ๏ธ Basic | โ ๏ธ Basic |
| AI Integration | โ LLM + Quant | โ LLM only | โ RL | โ None |
| Multi-market | โ 5 markets | โ US only | โ ๏ธ Limited | โ Crypto |
| Test Suite | โ 100+ tests | โ None | โ ๏ธ Few | โ Good |
| MCP Support | โ 4 tools | โ | โ | โ |
๐บ๏ธ Roadmap
Done โ
- 6-factor signal engine with 7 regimes
- Full lifecycle backtester
- Multi-factor stock picker (quant + fundamental + AI)
- 8 master strategy presets
- Multi-market support (US, CN, HK, JP, KR)
- MCP server for AI assistant integration
- 100+ automated tests
- PyPI package (
pip install finclaw-ai)
Next ๐จ
- Live market data streaming
- Paper trading mode
- Web dashboard
- Options/futures support
- Walk-forward validation
- QuantStats HTML report integration
โ FAQ
Q: Is this financial advice? A: No. This is a research and educational tool. Use at your own risk.
Q: Can it trade automatically? A: Not yet. Currently analysis and backtesting only. Paper trading is planned.
Q: What data does it need? A: Just an internet connection. Uses Yahoo Finance (free) for all price data.
Q: Can I add my own stocks?
A: Yes. Any ticker supported by Yahoo Finance works with backtest --ticker.
๐ License
AGPL-3.0 โ Free for open-source use. Contact for commercial licensing.
Disclaimer: Past performance does not guarantee future results. Not financial advice.
๐ Related Projects
| Project | Description |
|---|---|
| ClawGuard | ๐ก๏ธ AI Agent Security Scanner โ scan FinClaw for prompt injection risks |
| repo2skill | ๐ Convert any GitHub repo into an AI agent skill |
| AgentProbe | ๐งช AI Agent Testing Framework โ test FinClaw's MCP tools |
| awesome-llm-security | ๐ Curated LLM security resources |
Built by an engineer who believes trading systems should be engineered, not hoped. ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file finclaw_ai-1.4.0.tar.gz.
File metadata
- Download URL: finclaw_ai-1.4.0.tar.gz
- Upload date:
- Size: 154.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72d38295f0387759dad709fec3ef1331806a62b5019e7245ccd837d6344e727c
|
|
| MD5 |
c3285771350bbfedde03317571674327
|
|
| BLAKE2b-256 |
494b62a0788db8c85817a4a2a7fc1cf052fec4b8f95cef0990c3a7a0684cac2f
|
Provenance
The following attestation bundles were made for finclaw_ai-1.4.0.tar.gz:
Publisher:
publish.yml on NeuZhou/finclaw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
finclaw_ai-1.4.0.tar.gz -
Subject digest:
72d38295f0387759dad709fec3ef1331806a62b5019e7245ccd837d6344e727c - Sigstore transparency entry: 1109471575
- Sigstore integration time:
-
Permalink:
NeuZhou/finclaw@76de976866418f5387cf41d94073d3dda59c5c6a -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/NeuZhou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76de976866418f5387cf41d94073d3dda59c5c6a -
Trigger Event:
push
-
Statement type:
File details
Details for the file finclaw_ai-1.4.0-py3-none-any.whl.
File metadata
- Download URL: finclaw_ai-1.4.0-py3-none-any.whl
- Upload date:
- Size: 141.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f956f0847cac761d870169a75cdbab1d31bc41f4752fb2f073213353348bada
|
|
| MD5 |
25135b50f3143a60060ae94ac0bf173d
|
|
| BLAKE2b-256 |
115e68c0c38e318aff2bcab2a879cdecf98eb3f3f75c1098f82c7546df974a44
|
Provenance
The following attestation bundles were made for finclaw_ai-1.4.0-py3-none-any.whl:
Publisher:
publish.yml on NeuZhou/finclaw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
finclaw_ai-1.4.0-py3-none-any.whl -
Subject digest:
3f956f0847cac761d870169a75cdbab1d31bc41f4752fb2f073213353348bada - Sigstore transparency entry: 1109471597
- Sigstore integration time:
-
Permalink:
NeuZhou/finclaw@76de976866418f5387cf41d94073d3dda59c5c6a -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/NeuZhou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76de976866418f5387cf41d94073d3dda59c5c6a -
Trigger Event:
push
-
Statement type: