Add equities adapter for US stock trading#1
Open
zaycruz wants to merge 24 commits into
Open
Conversation
Adds an equities/ directory with a complete adapter for trading US stocks using the same autoresearch pattern as the crypto version. Changes from crypto version: - Data source: Yahoo Finance (free, no API key) instead of CryptoCompare/Hyperliquid - Bar interval: Daily instead of hourly - Removed funding_rate (crypto perp specific) - Removed BTC-ETH correlation filter - Symbols: SPY, QQQ, AAPL, MSFT, NVDA - Leverage: 2x instead of 20x - Fees: Commission-free The strategy logic (momentum, EMA, RSI, MACD, BB ensemble) remains unchanged and is asset-class agnostic.
|
well we should focus on crypto as of now because once its perfect it can easily be potted to other things right now is not the good time |
…or equities Make symbols configurable via --symbols CLI arg across all scripts (backtest.py, prepare.py, run_benchmarks.py) with auto-download of missing data. Tune strategy parameters for daily bars. Add 4 benchmark strategies and program.md for the autonomous experiment loop. Baseline score: 5.58 (Sharpe 5.58, +127% return, 1.8% max DD) on 10 diversified symbols over 2023-2024 validation period. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, ensemble integration Add scikit-learn GradientBoostingClassifier as confidence signal in the ensemble. - 28 features: momentum, trend, RSI, MACD, vol, volume, price action, BB, regression - Warmup training on first 150 bars, predict for remaining ~350 bars - ML acts as 6th vote in ensemble (currently score-neutral — foundation for evolution) - Backtest time: 10.1s (within 120s budget) Score unchanged at 9.288 — ML hyperparameters ready for autonomous evolution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Describe a trading strategy in natural language, Claude generates the code, backtests it automatically, and offers refine/evolve/restore options. Usage: uv run generate.py "pairs trading with z-score entry" --symbols SPY QQQ uv run generate.py --refine "tighten stops to 2x ATR" uv run generate.py --evolve --budget 5 uv run generate.py --restore Uses claude CLI (-p mode) for code generation with retry on failure. Zero new dependencies — stdlib only. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generate (fresh NL description) forces a new backup. Refine skips if backup already exists, preserving the original. This ensures --restore always returns to the pre-generation state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…te loop Convert while True to bounded for loop. Estimate ~$0.50/generation, so $5 budget = ~10 generations. Also add consecutive failure detection (stops after 3 in a row). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…timeout - Detect OAuth vs API key via ANTHROPIC_API_KEY env var - --generations N directly sets iteration count (OAuth/subscription users) - --budget $N estimates generations at ~$0.50/gen (API key users) - Default 10 generations when neither specified - Bump evolve Claude call timeout from 120s to 300s (large prompts) - Fix infinite while True → bounded for loop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add mirofish/ package that connects to MiroFish multi-agent simulation engine for generating synthetic market scenarios. Strategies are now evaluated across 8 predefined scenarios (fed hike, tech crash, energy crisis, recession, bull euphoria, flash crash, inflation, sector rotation). New CLI flags: backtest.py --scenario NAME Run on single MiroFish scenario backtest.py --stress-test Run on real data + all scenarios generate.py --evolve --stress-test Evolve for robustness Includes fallback mode — generates synthetic data from scenario seeds without requiring MiroFish to be running (uses sentiment modulation on historical prices). Full MiroFish Docker setup also included. Composite scoring: 0.6 * real_score + 0.4 * mean(scenario_scores) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
equities/directory with a complete adapter for trading US stocks using the same autoresearch pattern as the crypto version. This enables users to run the autonomous strategy discovery loop on equities instead of crypto.Key Changes from Crypto Version
What Remains Unchanged
Testing
First run results on validation data (2023-2024):
Files Added
equities/prepare.py— Yahoo Finance data download, daily OHLCVequities/strategy.py— 5-signal ensemble (removed crypto-specific logic)equities/backtest.py— Entry point (same as original)equities/pyproject.toml— Dependencies with yfinanceequities/README.md— Documentation for equities adapterequities/.gitignore— Ignore venv and cacheWhy Daily Bars?
Yahoo Finance provides unlimited daily data for free, but hourly data is limited to the last 60 days. Daily bars work well for equity swing trading and provide enough history for robust backtesting.
Future Enhancements
ACTIVE_SYMBOLSin strategy.py)