Stop writing trading strategies. Evolve them.
An open-source genetic algorithm engine that breeds and walk-forward tests trading strategies across 484 market factors. No manual rules, no API keys, no PhD required.
Demo · Results · 📊 Live Performance · Docker · Styles · Ensemble · Robustness · Contribute · Discord
pip install stratevo
stratevo analyze AAPL # Quick analysis with evolved strategies
stratevo evolve --quick # See evolution in ~2 minutesThat's it. No config files, no API keys, no exchange accounts, no LLM required. Pure Python + math.
Real evolution run: 9 crypto assets, 600 generations. Fitness goes from random noise to 33% annual return, 6.06 Sharpe, 5.6% max drawdown. (Backtest only, not live trading)
Zero-setup. No Python version issues, no dependency conflicts.
# See evolution in 30 seconds (built-in demo data)
docker compose up demo
# Run a quick evolution (~2 minutes)
docker compose up quick
# Full crypto evolution: auto-downloads data + evolves
docker compose up evolve-crypto
# Analyze any symbol
docker compose run --rm analyze analyze BTCManual install (without Docker)
pip install stratevo
stratevo evolve --demo # 30-second demo
stratevo evolve --quick # ~2 minute evolution
stratevo download-crypto # Download BTC/ETH/SOL data
stratevo evolve --market crypto # Full evolution runMost quant tools make you write the strategy. You pick indicators, set thresholds, run a backtest, tweak, repeat. It works — if you already know what to look for.
StratEvo takes the opposite approach: it evolves strategies. A genetic algorithm searches across 484 factors and finds weight combinations that actually work out-of-sample.
You don't pick the indicators. The algorithm does. You decide how long to let it search.
You write the rules → StratEvo discovers the rules
You tune parameters → GA tunes parameters
You test on one period → Walk-forward tests on multiple windows
You hope it generalizes → Monte Carlo measures if it does
GAs are good at problems where the search space is huge and the relationship between inputs isn't obvious — which is exactly what trading strategy design looks like. With 484 factors, the number of weight combinations is absurd. Grid search won't cut it. Manual tuning takes forever. GAs get around this by keeping what works and mutating what doesn't, generation after generation.
When StratEvo evolves a strategy, the resulting "DNA" (a vector of 484 factor weights) falls into a recognizable style based on which factors dominate:
| Style | Heavy Factors | What the Algorithm Found |
|---|---|---|
| Value Seeker | P/E, P/B, earnings yield | Buys cheap, holds patient. Benjamin Graham would recognize this DNA. |
| Momentum Rider | ROC, acceleration, trend strength | Chases what's moving, cuts what isn't. The DNA learned that trends persist. |
| Mean Reverter | Z-score, Keltner position, %B | Bets on bounce-backs. Statistical arbitrage without the PhD. |
| Flow Reader | OBV, smart money flow, Wyckoff VSA | Follows the money. Volume precedes price — the DNA figured that out. |
| Volatility Hunter | ATR squeeze, vol-of-vol | Profits from volatility expansion. Sits during calm, strikes during storms. |
| Crypto Native | Funding rate, liquidation cascade | 200 factors built for a 24/7 market that doesn't follow TradFi rules. |
These aren't made up — they're what the algorithm actually converged on.
Instead of betting on a single evolved strategy, run multiple DNAs and aggregate their signals:
stratevo analyze AAPL --ensemble 5 # 5 strategies vote on one stock Multi-DNA Analysis: AAPL
═══════════════════════════════════════
Strategy Votes:
Value Seeker → BUY (score: 0.72, confidence: high)
Momentum Rider → BUY (score: 0.85, confidence: high)
Mean Reverter → HOLD (score: 0.45, confidence: medium)
Flow Reader → BUY (score: 0.68, confidence: medium)
Volatility Hunter → HOLD (score: 0.51, confidence: low)
Consensus: BUY (3/5 bullish, 0/5 bearish)
Combined Score: 0.64
This is a research tool, not financial advice.
Each strategy was independently evolved. Agreement = stronger signal. Disagreement = mixed picture, worth looking closer.
Random DNA population (484 factor weights + risk parameters)
│
▼
┌──────────────────────┐
│ Walk-Forward Test │ Multi-window out-of-sample validation
│ each DNA candidate │ Real fees, slippage, position caps
└──────────┬───────────┘
│
▼
Keep the survivors (Sharpe × Return / MaxDD)
│
▼
Mutate + Crossover → next generation
│
▼
Repeat for N generations
Each DNA is a weight vector across 484 factors plus risk/position parameters — all evolvable:
| Parameter | Range | What it controls |
|---|---|---|
| Factor weights (×484) | 0.0–1.0 | Which factors matter and how much |
hold_days |
2–60 | Day trades through swing trades |
trailing_stop |
% | Lock in profits, trail below peak |
market_regime |
sensitivity | Auto-reduce exposure in bear markets |
kelly_fraction |
0–1 | Position sizing based on recent win rate |
The GA tries combinations you wouldn't. That's the point.
stratevo evolve --market crypto --generations 50
stratevo evolve --pareto # Multi-objective (NSGA-III)
stratevo evolve --logic-guided # Semantically guided mutationsWe learned the hard way. An early version showed 25,000% returns — it was a bug (look-ahead bias). Here's what prevents that now:
| Defense | What it does |
|---|---|
| Walk-Forward | Multi-window OOS validation. Must profit on data it never trained on. |
| Monte Carlo | 1,000 shuffled iterations. p-value < 0.05 or it's luck. |
| Arena Mode | Multiple strategies compete simultaneously. Crowded signals get penalized. |
| Correlation Guard | Rejects picks correlated above 0.85. No fake diversification. |
| Factor Diversity | HHI-based penalty for over-relying on one factor group. |
| Turnover Penalty | Excessive trading gets punished in fitness. Real transaction costs modeled. |
| Bias Detection | Look-ahead, snooping, survivorship — flagged automatically. |
stratevo check-backtest # Verify any result's integrityTransparency note: Our early versions had inflated returns from look-ahead bias. We fixed it, disclosed it publicly, and added check-backtest so you can verify results yourself. We'd rather show honest 50% returns than fake 25,000%.
Actual numbers from our running evolution engine. Not cherry-picked.
Fitness trajectory over 49 generations. The GA discovers profitable strategies from scratch — no manual tuning.
Crypto (9 assets, 49+ generations):
| Metric | Best DNA |
|---|---|
| Annual Return | 46.8% |
| Sharpe Ratio | 3.21 |
| Max Drawdown | 13.1% |
| Win Rate | 56.0% |
| Profit Factor | 5.64 |
Out-of-sample performance across 5 time windows. The DNA was never trained on these periods. 3 of 5 windows profitable.
Caveats: These are backtests, not live trades. Real results will differ. Paper trading mode is available for forward-testing strategies before committing capital.
Test strategies with real market data, simulated execution:
stratevo paper start --exchange okx --balance 100000
stratevo paper status
stratevo paper reportTrack P&L, win rates, and drawdowns before risking real money.
Click to expand full factor list
All normalized to [0, 1]:
| Category | Count | Examples |
|---|---|---|
| Crypto-Native | 200 | Funding rate, session effects, whale detection, liquidation cascade |
| Momentum | 14 | ROC, acceleration, trend strength |
| Volume & Flow | 13 | OBV, smart money, Wyckoff VSA |
| Volatility | 13 | ATR, Bollinger squeeze, vol-of-vol |
| Mean Reversion | 12 | Z-score, Keltner channel position |
| Trend Following | 14 | ADX, EMA golden cross, MA fan |
| Qlib Alpha158 | 11 | KMID, KSFT, CNTD (Microsoft Qlib compatible) |
| Risk Warning | 11 | Consecutive losses, death cross, gap-down |
| Quality Filter | 11 | Earnings momentum, relative strength |
| Price Structure | 10 | Candlestick patterns, support/resistance |
| Sentiment | 2 | EN/ZH keyword sentiment |
| DRL Signal | 2 | Q-learning buy probability |
All factor weights are discovered by evolution — no manual tuning required.
| Market | Source | API Key? |
|---|---|---|
| Crypto | ccxt (100+ exchanges) | No |
| US Stocks | Yahoo Finance | No |
| A-Shares | AKShare + BaoStock | No |
StratEvo exposes its tools to any MCP-compatible AI client (Claude Desktop, Cursor, etc.). The MCP server itself doesn't need an LLM — your AI client provides the intelligence, StratEvo provides the data and computation:
{
"mcpServers": {
"stratevo": {
"command": "stratevo",
"args": ["mcp", "serve"]
}
}
}10 tools: get_quote, run_backtest, analyze_portfolio, screen_stocks, and more.
StratEvo includes an optional AI copilot for natural-language strategy exploration. This is the only feature that requires an LLM API key — everything else (evolve, analyze, backtest, paper trading) works without one.
# Set any ONE of these — StratEvo auto-detects the provider
export OPENAI_API_KEY="sk-..." # OpenAI (GPT-4o-mini)
export GEMINI_API_KEY="AIza..." # Google Gemini
export ANTHROPIC_API_KEY="sk-ant-..." # Anthropic Claude
export DEEPSEEK_API_KEY="sk-..." # DeepSeek
export GROQ_API_KEY="gsk_..." # Groq (Llama 3)
# Or run local models — no API key needed:
# export OLLAMA_BASE_URL="http://localhost:11434/v1"
stratevo copilotSupported: OpenAI, Anthropic, Gemini, DeepSeek, Groq, Mistral, Moonshot, Azure OpenAI, Ollama (local).
StratEvo's plugin architecture makes contributing easy. Adding a new factor is often one file, one function, one PR:
stratevo scaffold factor --name my_signal --category momentum
# Edit the generated file, implement compute(), submit PR| Component | Difficulty |
|---|---|
| Factors | Easy |
| Fitness functions | Medium |
| Data sources | Medium |
| Strategy DNA configs | Advanced |
git clone https://github.com/NeuZhou/stratevo.git
cd stratevo && pip install -e ".[dev]" && pytestCONTRIBUTING.md · Discord · Issues
- 484-factor evolution engine
- Walk-forward + Monte Carlo + Arena mode
- Multi-DNA ensemble voting
- Strategy style classification
- Paper trading
- MCP server for AI tools
- Plugin architecture
- Streamlit dashboard (live evolution tracking)
- DEX execution (Uniswap V3)
- Multi-timeframe evolution
- Community strategy marketplace
AGPL-3.0 — Free to use, modify, and distribute. Derivatives must stay open source.



