Multi-agent macro trading bot: multi-factor stock scoring, momentum portfolio construction, backtesting vs SPY/Nasdaq, and live Alpaca execution.
๐ค Multi-Agent Quantitative Trading System
A macro buy-and-hold engine that orchestrates a team of specialized analysis agents โ technical, trend, macro, sentiment, and quantitative alpha โ into a single 0โ100 conviction score, then sizes and executes a live portfolio through Alpaca.
๐ Live Paper-Trading Performance
Real money-weighted Alpaca paper account, auto-generated from the broker API.
Account opened 2026-03-13. Snapshot 2026-06-04. Past performance โ future results.
| | Return (since inception) | |---|---:| | ๐ค This strategy (paper) | +53.6% | | S&P 500 (SPY) | +13.5% | | Nasdaq-100 (QQQ) | +24.8% |
Starting capital $100,000 โ peak equity $159,560, max drawdown โ8.4%, 32 open positions concentrated in semis/AI (MRVL +33%, ARM +18%, SNDK +12%).
๐ Full breakdown + equity curve โ docs/PAPERTRADING.md (refresh anytime with python scripts/fetchpaper_performance.py)
๐งช Backtest โ Strategy vs S&P 500 & Nasdaq-100
Per-calendar-year, point-in-time backtest with T+1 execution and 5 bps/side transaction costs (the same weighting code the live bot trades):
| Year | ๐ค Strategy | S&P 500 | Nasdaq-100 | |------|------------:|--------:|-----------:| | 2022 | โ45.4% | โ18.6% | โ33.2% | | 2023 | +92.4% | +26.7% | +55.9% | | 2024 | +60.1% | +25.6% | +27.7% | | 2025 | +24.2% | +18.0% | +21.0% | | 2026 (YTD) | +26.6% | +10.7% | +21.5% |
โ ๏ธ Honesty note: the universe is today's survivors held back through time (survivorship bias), so treat the raw alpha as an upper bound. The strategy is a high-beta amplifier โ it shines in up years and overshoots drawdowns in down years (see 2022). The full, self-critical analysis is in docs/BACKTEST_RESULTS.md โ including the strategy's edge over its own basket, which is small and noisy. We publish the warts on purpose.
๐ง Multi-Agent Architecture
The score for every stock is produced by a panel of independent analysis agents, each looking at the market through a different lens, then fused by a weighted scorer:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Market data โโโโโโโโโโถโ DATA LAYER โ yfinance: 2y daily + 1y hourly
(prices, news, SPY) โ data_fetcher / discovery โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ANALYSIS AGENTS โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโค
โ ๐ Technical โ ๐ Trend โ ๐ Macro โ ๐ฐ Sentiment โ
โ SMA/RSI/MACD โ rel-strength โ regime & โ news headline โ
โ ADX/Boll/OBV โ vs SPY โ risk on/off โ lexicon+decay โ
โ (35%) โ (30%) โ โ (15%) โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโค
โ ๐ Quantitative Alpha โ 30 factors (20%) โ โ core/ (private)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ SCORER โ 0โ100 score โ confidence- & regime-adjusted
โ ๐ STRATEGY โ target wts โ top-10 momentum, max 25%/name
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Alpaca executor + report โ T+1 rebalance, email digest
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Plus a layer of Claude research agents (in .claude/skills/) that enrich the macro view โ market-news-analyst, scenario-analyzer, market-environment-analysis, earnings-calendar, and economic-calendar-fetcher.
๐ The proprietary signal engine โ the 30 alpha factors, the scorer, and the position-sizing strategy โ lives in a private core/ package that is not included in this repository. Everything else (the harness, analyzers, backtester, executor) is open.
๐ฏ Scoring Model
| Agent | Weight | Signals | |-------|:------:|---------| | ๐ Technical | 35% | SMA 50/200, RSI, MACD, ADX, Bollinger, OBV | | ๐ Trend | 30% | Relative strength vs SPY, market regime | | ๐ Alpha | 20% | 30 quantitative factors (WorldQuant-style) | | ๐ฐ Sentiment | 15% | News headline analysis with recency decay |
Scores are confidence-adjusted and regime-aware (conservative in bear markets, a slight boost in bull markets).
| Score | Recommendation | Grade | |:-----:|----------------|:-----:| | 75+ | Strong Buy | A | | 60โ74 | Buy | B / B+ | | 45โ59 | Hold | C / C+ | | 30โ44 | Reduce | D | | <30 | Avoid | F |
๐ Quick Start
The privatecore/package is required to run end-to-end. Without it the harness imports the scorer/strategy/alpha modules fromcore/and will fail โ by design, the alpha is not published.
python -m venv .venvtrading && source .venvtrading/bin/activate
pip install -r requirements.txt
cp .env.example .env # then fill in your Alpaca keys
Analyze the full universe (157 US equities)
python main.py
Specific tickers, top 10, skip news for speed
python main.py --tickers AAPL,NVDA,MSFT --top 10 --quick
Daily report + paper trade
python daily_report.py --trade
Backtest vs SPY (a single recent year, verbose)
python backtest_strategy.py --tickers AAPL,MSFT,NVDA,GOOGL,AMZN,META,AVGO,TSLA,AMD,CRM,ORCL,ADBE
Multi-year sweep vs SPY & Nasdaq
python backtest_years.py
CLI options (main.py)
--tickers AAPL,MSFT Analyze specific stocks (default: full universe)
--top N Show top N results only
--quick Skip news sentiment (faster)
--no-alpha Skip alpha factor computation (faster)
--output-dir DIR Report output directory (default: reports/)
--no-report Console output only, skip report file
๐ Repository Layout
main.py daily_report.py Entry points (CLI + daily runner)
data_fetcher.py Prices, news, benchmarks (yfinance)
technical_analyzer.py Trend / momentum / volume / volatility
trend_analyzer.py Relative strength vs SPY, market regime
macro_analyzer.py Market regime & risk-on/off
sentiment_analyzer.py News headline sentiment
stock_discovery.py Weekly universe expansion
report_generator.py Markdown report output
email_sender.py Email digest
alpaca_trader.py Paper/live execution via Alpaca
backtest_strategy.py Strategy vs buy-and-hold (single window)
backtest_years.py Per-year sweep vs SPY & Nasdaq
core/ ๐ PRIVATE custom_alphas ยท scorer ยท strategy ยท configs
docs/ STRATEGY ยท BACKTESTRESULTS ยท PAPERTRADING
scripts/ fetchpaperperformance.py
.claude/skills/ Claude research agents
โ๏ธ Deployment
- Local daily agent (macOS):
./setupdaily.sh installrenders a git-ignored launchd plist from*.plist.templateand schedulesdailyreport.pyfor 8 AM on trading days. - Container:
docker build -t trading-bot .โ secrets are injected at runtime (--env), never baked into the image.
๐ Security & Privacy
- Secrets live only in
.env(git-ignored). No API keys, passwords, or personal emails are tracked โ see.env.examplefor the required variables. - The launchd plist is rendered locally and git-ignored; only the placeholder
*.plist.templateis tracked. - The proprietary
core/algorithm is git-ignored and absent from this public repo.
โ ๏ธ Disclaimer
This project is for research and educational purposes only. It is not investment advice. Markets carry risk; past and backtested performance does not guarantee future results. Trade live money at your own risk.
๐ License
MIT for the published harness. The private core/ signal engine is not licensed for use or distribution.