Transform stock selection into complete trading strategies in < 5 minutes through autonomous AI agents
Traditional quantitative trading requires:
- Extensive Domain Expertise: Years of experience in strategy development
- Manual Research Process: Time-intensive coding and testing cycles
- Limited Strategy Exploration: Human bias restricts discovery space
- Fragmented Workflows: Separate tools for data, backtesting, and analysis
- Static Approaches: Inability to adapt to changing market conditions
The Gap: No unified platform that can autonomously transform a simple stock universe into complete, mathematically-formulated, backtested trading strategies.
AgentQuant is the first truly autonomous quantitative trading research platform that:
โ
Abstracts All Quant Work: Input stock symbols โ Output complete strategies
โ
Mathematical Formulation: Auto-generates strategy equations and logic
โ
Real-World Data: Backtests using live market data via yfinance API
โ
Visual Results: Professional-grade plots and performance analytics
โ
Zero Manual Coding: No programming knowledge required
INPUT: ["AAPL", "MSFT", "GOOGL"] โ AGENT PROCESSING โ OUTPUT: Complete Trading System
- You provide: Stock universe in
config.yaml
- Agent handles: Data fetching, feature engineering, regime detection, strategy formulation, backtesting, visualization
- You receive: Ready-to-use strategies with mathematical formulas and performance metrics
flowchart TB
UI[๐ฅ๏ธ Streamlit Interface] --> AGENT[๐ค LangChain Agent Brain]
CONFIG[๐ config.yaml<br/>Stock Universe] --> AGENT
AGENT --> DL[๐ Data Layer<br/>yfinance + FRED]
AGENT --> FE[โ๏ธ Feature Engine<br/>Technical Indicators]
AGENT --> RD[๐ Regime Detection<br/>Market Analysis]
AGENT --> SG[๐ง Strategy Generation<br/>LLM-Powered]
SG --> BT[โก Backtest Engine<br/>vectorbt]
BT --> VIZ[๐ Visualization<br/>Interactive Charts]
VIZ --> RESULTS[๐ Strategy Reports<br/>Mathematical Formulas]
subgraph "๐ค Autonomous Agent Layer"
AGENT
SG
end
subgraph "๐ Processing Pipeline"
DL
FE
RD
BT
end
subgraph "๐ Output Layer"
VIZ
RESULTS
end
classDef agent fill:#ffd700,stroke:#333,stroke-width:3px
classDef process fill:#e1f5fe,stroke:#333,stroke-width:2px
classDef output fill:#c8e6c9,stroke:#333,stroke-width:2px
classDef input fill:#fff3e0,stroke:#333,stroke-width:2px
class UI,CONFIG input
class AGENT,SG agent
class DL,FE,RD,BT process
class VIZ,RESULTS output
- ๐ง LangChain + LangGraph: Structured agent workflows and reasoning
- ๐ค Google Gemini Pro: Large Language Model for strategy planning
- ๐ Autonomous Agents: Self-directed planning, execution, and analysis
- ๐ Python 3.10+: High-performance numerical computing
- ๐ vectorbt: Lightning-fast vectorized backtesting
- ๐ yfinance: Real-time market data integration
- ๐ฆ FRED API: Macroeconomic indicators
- ๐ pandas + numpy: Data manipulation and analysis
- ๐ฅ๏ธ Streamlit: Interactive web-based dashboard
- ๐ matplotlib + plotly: Professional trading charts
- ๐พ Parquet: Efficient data storage format
AgentQuant/
โโโ ๐ config.yaml # Stock universe configuration
โโโ ๐ run_app.py # Application entry point
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ src/
โ โโโ ๐ค agent/ # AI Agent Brain
โ โ โโโ langchain_planner.py # LLM-powered strategy generation
โ โ โโโ policy.py # Trading policies
โ โ โโโ runner.py # Agent execution engine
โ โโโ ๐พ data/ # Data Pipeline
โ โ โโโ ingest.py # Market data fetching
โ โ โโโ schemas.py # Data structures
โ โโโ โ๏ธ features/ # Feature Engineering
โ โ โโโ engine.py # Technical indicators
โ โ โโโ regime.py # Market regime detection
โ โโโ ๐ strategies/ # Strategy Library
โ โ โโโ momentum.py # Momentum strategies
โ โ โโโ multi_strategy.py # Advanced strategies
โ โ โโโ strategy_registry.py # Strategy catalog
โ โโโ โก backtest/ # Backtesting Engine
โ โ โโโ runner.py # Backtest execution
โ โ โโโ metrics.py # Performance analytics
โ โ โโโ simple_backtest.py # Basic backtesting
โ โโโ ๐ visualization/ # Charts & Reports
โ โ โโโ plots.py # Interactive visualizations
โ โโโ ๐ฅ๏ธ app/ # User Interface
โ โ โโโ streamlit_app.py # Web dashboard
โ โโโ ๐ง utils/ # Utilities
โ โโโ config.py # Configuration management
โ โโโ logging.py # System logging
โโโ ๐พ data_store/ # Market data cache
โโโ ๐ figures/ # Generated charts
โโโ ๐งช tests/ # Test suite
# Clone the repository
git clone https://github.com/onepunchmonk/AgentQuant.git
cd AgentQuant
# Install dependencies
pip install -r requirements.txt
Edit config.yaml
to specify your target stocks:
universe:
- "AAPL" # Apple
- "MSFT" # Microsoft
- "GOOGL" # Google
- "TSLA" # Tesla
- "NVDA" # NVIDIA
Create a .env
file:
# Required for AI agent
GOOGLE_API_KEY=your_gemini_api_key_here
# Optional for macro data
FRED_API_KEY=your_fred_api_key_here
# Start the Streamlit dashboard
python run_app.py
๐ That's it! Navigate to http://localhost:8501
and let the AI agents work their magic!
- Choose stocks from the sidebar
- Set date ranges for analysis
- Configure number of strategies to generate
- Data Fetching: Automatically downloads market data
- Feature Engineering: Computes 50+ technical indicators
- Regime Detection: Identifies current market conditions
- Strategy Generation: Creates 5-10 unique strategies using AI
- Backtesting: Tests each strategy on historical data
- Optimization: Fine-tunes parameters automatically
- Performance Charts: Interactive equity curves
- Mathematical Formulas: Exact strategy equations
- Risk Metrics: Sharpe ratio, max drawdown, volatility
- Portfolio Allocation: Dynamic asset weighting
- Comparison Analysis: Strategy vs benchmark performance
The main Streamlit interface where users configure stock universe and generate AI-powered trading strategies
Comprehensive performance metrics and equity curve visualization for generated strategies
Dynamic asset allocation charts showing portfolio weights and rebalancing over time
Detailed risk analysis including drawdown analysis, Sharpe ratios, and volatility metrics
Traditional Quant Workflow (Weeks/Months):
1. Data Collection โ ๐ Hours of setup
2. Feature Engineering โ ๐ง Days of coding
3. Strategy Development โ ๐ง Weeks of research
4. Backtesting โ โก Days of debugging
5. Optimization โ ๐ฏ Weeks of tuning
6. Visualization โ ๐ Hours of plotting
7. Documentation โ ๐ Hours of writing
AgentQuant Workflow (Minutes):
1. Input Stock Universe โ โฑ๏ธ 30 seconds
2. Click "Generate" โ ๐ฑ๏ธ 1 click
3. Get Complete Results โ ๐ 2-5 minutes
โ
Data Pipeline: Fetches real-time data from yfinance API
โ
Feature Engineering: 50+ technical indicators automatically computed
โ
Market Regime Analysis: Detects bull/bear/sideways markets
โ
Strategy Formulation: Creates mathematical trading rules
โ
Parameter Optimization: Finds optimal strategy parameters
โ
Risk Management: Applies position sizing and drawdown limits
โ
Backtesting: Full historical simulation with realistic costs
โ
Performance Analytics: Comprehensive risk/return metrics
โ
Visualization: Professional-grade charts and reports
โ
Mathematical Documentation: Exact formulas for each strategy
What Works Today:
- โ Complete strategy research automation
- โ Real market data integration
- โ Professional backtesting results
- โ Mathematical strategy formulation
- โ Risk-adjusted performance metrics
- โ Publication-ready visualizations
Remaining Friction for Live Trading:
โ ๏ธ Broker Integration: Need APIs for live order executionโ ๏ธ Real-time Data: Currently uses daily data, needs intraday feedsโ ๏ธ Risk Controls: Production-grade position limits and stopsโ ๏ธ Regulatory Compliance: Trade reporting and audit trailsโ ๏ธ Latency Optimization: Sub-second execution for high-frequency strategies
- Multi-Asset Classes: Bonds, commodities, crypto, forex
- Intraday Strategies: Minute/hourly frequency trading
- Options Strategies: Covered calls, protective puts, spreads
- Sentiment Integration: News, social media, earnings calls
- ESG Scoring: Environmental and social impact metrics
- Reinforcement Learning: Self-improving agents through market feedback
- Portfolio Optimization: Modern portfolio theory with constraints
- Multi-Strategy Ensembles: Combine strategies with dynamic allocation
- Alternative Data: Satellite imagery, credit card transactions, weather
- Real-time Alerts: Strategy performance monitoring and notifications
- Broker Integration: Interactive Brokers, Alpaca, TD Ameritrade APIs
- Paper Trading: Risk-free live strategy testing
- Institutional Features: Prime brokerage, custody, compliance
- Multi-Language Support: R, Julia, C++ strategy implementation
- Cloud Deployment: Scalable infrastructure on AWS/GCP/Azure
universe: ["AAPL", "MSFT", "GOOGL"]
Strategy Type: Momentum Cross-Over
Mathematical Formula:
Signal(t) = SMA(Close, 21) - SMA(Close, 63)
Position(t) = +1 if Signal(t) > 0, -1 if Signal(t) < 0
Allocation = {AAPL: 40%, MSFT: 35%, GOOGL: 25%}
Performance Metrics:
- Total Return: 127.3%
- Sharpe Ratio: 1.84
- Max Drawdown: -12.7%
- Win Rate: 64.2%
Visual Output: Interactive charts showing equity curves, drawdown periods, and rolling metrics.
- Replace expensive fund managers with AI-powered strategies
- No coding knowledge required
- Professional-grade results
- Accelerate strategy development by 10x
- Focus on high-level ideas vs implementation
- Rapid prototyping and testing
- Generate alpha through systematic approaches
- Reduce human bias in strategy selection
- Scale research capabilities
- Teach quantitative concepts interactively
- Demonstrate strategy performance in real-time
- Hands-on learning without programming barriers
- README.md - Main project overview and quickstart guide
- DESIGN.md - Complete technical architecture and system design
- AGENT.md - Deep dive into AI agent architecture from GenAI engineering perspective
- INSTALLATION.md - Detailed installation and setup instructions
- Agent Architecture: Detailed LangGraph workflows, state management, and tool integration patterns
- Strategy Framework: Complete strategy development lifecycle and implementation details
- API Documentation: Function signatures, parameters, and usage examples
- Performance Tuning: Optimization guidelines and best practices
For developers interested in the internal agent reasoning loops, multi-agent orchestration, and GenAI engineering patterns, see docs/AGENT.md for comprehensive technical details.
We welcome contributions from the quantitative finance and AI communities:
# Fork the repository
git fork https://github.com/onepunchmonk/AgentQuant.git
# Create a feature branch
git checkout -b feature/amazing-new-feature
# Make your changes and commit
git commit -m "Add amazing new feature"
# Push to your fork and submit a pull request
git push origin feature/amazing-new-feature
- ๐ง AI Agents: Enhanced reasoning and planning capabilities
- ๐ Strategies: New trading algorithms and risk models
- ๐ Integrations: Additional data sources and broker APIs
- ๐จ Visualization: Advanced charting and analytics
- ๐งช Testing: Comprehensive test coverage and validation
This project is licensed under the MIT License - see the LICENSE file for details.
AgentQuant represents a paradigm shift from manual quant development to autonomous AI-driven research. By abstracting away the complexities of strategy development, we're democratizing access to institutional-grade quantitative trading capabilities.
Ready to transform your investment approach? Start with a simple stock list and let our AI agents do the rest.
AgentQuant: Where AI meets quantitative trading for unprecedented strategy discovery ๐