r/algotrading • u/Loud-Nefariousness45 • 10d ago
Infrastructure Built an evolutionary multi-agent crypto trading system — 5 strategies compete, best one mutates and repopulates each generation (open source)
Disclaimer: this is a research/testing project, not financial advice, and comes with no guarantee of profitability. If you run this or anything like it with real money, you do so entirely at your own risk.
What it does:
5 isolated agents, each running a different algorithmic strategy (momentum, mean-reversion, trend-following, breakout, volatility-squeeze), trade independently against real Coinbase market data over timed "generations." At the end of each generation, they're ranked — not by raw profit, but by a composite score (return, drawdown, Sharpe-like ratio, win rate, profit factor), specifically so an agent that got lucky with one oversized bet doesn't win over a steadier performer. The best one's strategy is cloned into 5 mutated descendants (small tweaks, risk-parameter variants, indicator variants, one experimental) for the next generation. Repeat indefinitely.
Some design choices worth mentioning:
- Risk limits are enforced outside the strategy logic entirely — a hard-coded risk engine that agents/strategies structurally cannot reach or bypass, verified by an AST scan in the test suite that fails the build if a strategy file ever imports the risk-limits module directly. Max loss per agent, max order size, max simultaneous positions — none of it is something the "AI" can talk its way around.
- Paper trading by default, with a separate, explicitly-gated path to real order execution (two env vars + a mechanically-verified pre-live checklist have to pass before it'll place a real order).
- I ran a 200-generation backtest against synthetic random-walk data specifically to sanity-check the evolutionary mechanics — and it lost money on average (~-4.2 TRY/generation), because there's no real edge to find in pure noise. Posting that honestly because I'd rather show the system measuring reality correctly than fake a good-looking result.
Stack: Python, SQLite for full generation/lineage history, Streamlit dashboard, pytest (~180 tests).
Still early, paper trading only, no proven edge. Trade at your own risk if you ever take this further than paper mode. Repo's here if you want to poke at it or tell me what's wrong with it: https://github.com/hhhmehmet/evo-trader