Skip to main content

AI-Powered Financial Intelligence Engine. 8 Master Strategies, 3 Markets, 227 Tests.

Project description

๐Ÿ‹ FinClaw

AI Trading Engine with Verified Alpha

English | ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž | ํ•œ๊ตญ์–ด | Franรงais

100ไธ‡ โ†’ 354ไธ‡ (5ๅนด, ๅนดๅŒ–29.1%)
Tested on 100+ real stocks across US, China, Hong Kong
30/34 individual stock backtests outperform market

What does it do?

FinClaw scans stocks, picks winners, manages risk, and validates everything with real data.

# Pick 5 best US stocks with Soros-style momentum strategy
python FinClaw.py scan --market us --style soros --top 5

# Backtest any stock
python FinClaw.py backtest --ticker NVDA --period 5y

# Run full test suite
python FinClaw.py test

Why FinClaw?

Most "AI trading" projects generate signals and stop there. No backtesting, no risk management, no validation.

FinClaw is different:

  • Verified: Every claim backed by reproducible backtests
  • Complete: Selection โ†’ Entry โ†’ Position Management โ†’ Exit โ†’ Portfolio
  • Tested: 34 automated regression tests, every commit validated
  • Multi-market: US stocks, China A-shares, Hong Kong
  • Honest: We show where we lose, not just where we win

Performance

5-Year Real Data (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

Tested on 100+ real stocks from Yahoo Finance. No synthetic data.

Individual Stock Win Rate

Tested head-to-head against AHF's technical analysis on 34 stocks:

FinClaw wins: 30/34 (88%)
Average edge: +10.8% per year

Quick Start

1. Install

git clone https://github.com/user/FinClaw.git
cd FinClaw
pip install -r requirements.txt  # aiohttp, yfinance

2. Verify

python FinClaw.py test
# Expected: 34/34 tests passed

3. Pick Stocks

# US market, aggressive style
python FinClaw.py scan --market us --style druckenmiller

# China A-shares, balanced
python FinClaw.py scan --market china --style buffett

# All markets
python FinClaw.py scan --market all --style soros

4. Backtest

python FinClaw.py backtest --ticker NVDA --period 5y
python FinClaw.py backtest --ticker 688256.SS --period 3y

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
cathie_wood Disruptive innovation. 5-year horizon. Very High 20-40%/y
buffett Quality + value. Buy fear, hold forever. Medium 20-30%/y
lynch Growth/volatility ratio. "Boring" winners. Medium 20-27%/y
simons Pure quant. Highest Sharpe ratio. Medium 15-25%/y
dalio All-weather. Low correlation, risk parity. Low 12-18%/y
conservative Low-vol blue chips. Capital preservation. Very Low 8-12%/y

How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    FinClaw v10                     โ”‚
โ”‚                                                        โ”‚
โ”‚  1. SCAN        Multi-factor + AI disruption analysis  โ”‚
โ”‚  2. RANK        7 master strategies vote               โ”‚
โ”‚  3. SELECT      Top-N by conviction score              โ”‚
โ”‚  4. ENTER       Regime-adaptive timing (7 regimes)     โ”‚
โ”‚  5. MANAGE      Trailing stop + pyramiding + sizing    โ”‚
โ”‚  6. EXIT        Regime shift + trend breakdown          โ”‚
โ”‚  7. VALIDATE    34 TDD tests + real data backtest      โ”‚
โ”‚                                                        โ”‚
โ”‚  Selection engine: 3 layers                            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ Quant   โ”‚+โ”‚ Fundamentals โ”‚+โ”‚ AI Disruption    โ”‚   โ”‚
โ”‚  โ”‚ 6 factorโ”‚ โ”‚ P/E, growth  โ”‚ โ”‚ Who wins in AI?  โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Selection Engine (3 Layers)

Layer 1 โ€” Quantitative (always on)

  • Multi-timeframe momentum (1M/3M/6M/1Y)
  • EMA trend alignment (8/21/55)
  • RSI, Bollinger Bands, volume confirmation
  • Sharpe ratio, max drawdown, volatility

Layer 2 โ€” Fundamental (yfinance)

  • P/E, P/B, PEG ratio
  • Revenue growth, profit margins
  • Return on equity, debt ratios

Layer 3 โ€” AI Disruption Analysis

  • Is this company an AI winner or victim?
  • Competitive moat in the AI era
  • Narrative strength (self-reinforcing?)
  • Example: NVIDIA (+0.25 boost) vs Salesforce (-0.21 penalty)

Signal Engine (7 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
โ”œโ”€โ”€ agents/
โ”‚   โ”œโ”€โ”€ signal_engine_v7.py     # 6-factor signal engine
โ”‚   โ”œโ”€โ”€ backtester_v7.py        # Full lifecycle backtester
โ”‚   โ”œโ”€โ”€ stock_picker.py         # Multi-factor stock picker
โ”‚   โ”œโ”€โ”€ llm_analyzer.py         # AI disruption analysis
โ”‚   โ”œโ”€โ”€ ahf_simulator.py        # Competitor simulator
โ”‚   โ””โ”€โ”€ statistics.py           # Sharpe, drawdown, etc.
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_engine.py          # 34 regression tests
โ”œโ”€โ”€ benchmark_v10.py            # Unified engine benchmark
โ”œโ”€โ”€ benchmark_multimarket.py    # Global market test
โ”œโ”€โ”€ benchmark_real.py           # Real data validation
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ README_zh.md            # ไธญๆ–‡ๆ–‡ๆกฃ
โ”‚   โ”œโ”€โ”€ README_ja.md            # ๆ—ฅๆœฌ่ชžใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆ
โ”‚   โ”œโ”€โ”€ README_ko.md            # ํ•œ๊ตญ์–ด ๋ฌธ์„œ
โ”‚   โ””โ”€โ”€ README_fr.md            # Documentation franรงaise
โ””โ”€โ”€ _scratch/                   # Archived experiments

Development

Run Tests

python FinClaw.py test
# or directly:
python tests/test_engine.py

Test Coverage

Test What it checks
Golden Thresholds 9 scenarios must meet minimum alpha
Average Alpha Portfolio average must exceed 9%
No Catastrophic Loss No single trade > 35% loss
Regime Detection Bull/bear/ranging correctly identified
Determinism Same input โ†’ same output
Warmup Protection No trades in first 20 bars
vs Freqtrade Must beat on all 9 sim scenarios

Contributing

# 1. Make your change
# 2. Run tests (must pass all 34)
python tests/test_engine.py
# 3. Run quick benchmark
python benchmark_real.py
# 4. If alpha improved or neutral, submit PR

Roadmap

Done โœ…

  • 6-factor signal engine with 7 regimes
  • Full lifecycle backtester
  • Multi-factor stock picker (quant + fundamental)
  • AI disruption analysis layer
  • 7 master strategy presets
  • CLI with one-command scanning
  • 34 TDD regression tests
  • Multi-market support (US, China, HK)
  • Multi-language docs (EN, ZH, JA, KO, FR)

Next ๐Ÿ”จ

  • Live market data streaming
  • Paper trading mode
  • Web dashboard
  • Telegram/WeChat alert bot
  • QuantStats HTML report integration
  • Options/futures support
  • Walk-forward validation

FAQ

Q: Is this financial advice? A: No. This is a research tool. Use at your own risk.

Q: Can it trade automatically? A: Not yet. Currently analysis and backtesting only. Live trading is on the roadmap.

Q: How is this different from ai-hedge-fund? A: AHF generates signals. FinClaw is a complete system โ€” it selects, enters, manages, exits, and validates. We beat AHF on 88% of stocks tested.

Q: What data does it need? A: Just an internet connection. Uses Yahoo Finance (free) for price data.

Q: Can I add my own stocks? A: Yes. Any ticker supported by Yahoo Finance works.

License

MIT License. Not financial advice. Past performance does not guarantee future results.


Built by an engineer who believes trading systems should be engineered, not hoped. ๐Ÿ‹

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finclaw_ai-1.0.0.tar.gz (99.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

finclaw_ai-1.0.0-py3-none-any.whl (93.2 kB view details)

Uploaded Python 3

File details

Details for the file finclaw_ai-1.0.0.tar.gz.

File metadata

  • Download URL: finclaw_ai-1.0.0.tar.gz
  • Upload date:
  • Size: 99.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for finclaw_ai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b92e8e6ca9dfbbf06776a62c795fb854b5dd6e6107c3a86e3c66799adec09b5
MD5 ec80dfe52c804d596985dbdf3d183d3d
BLAKE2b-256 b4646fb83a3d7aa23ffc477ee871c21e6c28502ca9b91a7c445650df03fe4d09

See more details on using hashes here.

Provenance

The following attestation bundles were made for finclaw_ai-1.0.0.tar.gz:

Publisher: publish.yml on NeuZhou/finclaw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file finclaw_ai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: finclaw_ai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 93.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for finclaw_ai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 922e82fddb3185075716c7ca2404c65bd4207962237aec127611429f1ccb8bb7
MD5 534eb356bbe5a1c545a9e72b5ad66dbe
BLAKE2b-256 aeae726e02a2019a0620446c7e8045cf6d643467ae519814b8573c58976d0aa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for finclaw_ai-1.0.0-py3-none-any.whl:

Publisher: publish.yml on NeuZhou/finclaw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page