Skip to content

Autonomous quantitative trading research platform that transforms stock lists into fully backtested strategies using AI agents, real market data, and mathematical formulations, all without requiring any coding.

Notifications You must be signed in to change notification settings

OnePunchMonk/AgentQuant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AgentQuant: AI-Powered Autonomous Trading Research Platform

Project Status: Stable

๐Ÿš€ Revolutionizing Quantitative Finance with Agentic AI

Transform stock selection into complete trading strategies in < 5 minutes through autonomous AI agents


๐ŸŽฏ Problem Statement

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.

๐Ÿ’ก Our Solution: Complete Agentic Automation

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

The Magic: From Stocks to Strategies in Minutes

INPUT:  ["AAPL", "MSFT", "GOOGL"]  โ†’  AGENT PROCESSING  โ†’  OUTPUT: Complete Trading System
  1. You provide: Stock universe in config.yaml
  2. Agent handles: Data fetching, feature engineering, regime detection, strategy formulation, backtesting, visualization
  3. You receive: Ready-to-use strategies with mathematical formulas and performance metrics

๐Ÿ—๏ธ Architecture: Agentic AI at the Core

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
Loading

๐Ÿ› ๏ธ Technology Stack

Core AI & Agent Framework

  • ๐Ÿง  LangChain + LangGraph: Structured agent workflows and reasoning
  • ๐Ÿค– Google Gemini Pro: Large Language Model for strategy planning
  • ๐Ÿ”„ Autonomous Agents: Self-directed planning, execution, and analysis

Financial Computing Engine

  • ๐Ÿ 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

Visualization & Interface

  • ๐Ÿ–ฅ๏ธ Streamlit: Interactive web-based dashboard
  • ๐Ÿ“Š matplotlib + plotly: Professional trading charts
  • ๐Ÿ’พ Parquet: Efficient data storage format

๐Ÿ“ Repository Structure

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

๐Ÿš€ Quick Start Guide

Step 1: Setup Environment

# Clone the repository
git clone https://github.com/onepunchmonk/AgentQuant.git
cd AgentQuant

# Install dependencies
pip install -r requirements.txt

Step 2: Configure Your Stock Universe

Edit config.yaml to specify your target stocks:

universe:
  - "AAPL"    # Apple
  - "MSFT"    # Microsoft  
  - "GOOGL"   # Google
  - "TSLA"    # Tesla
  - "NVDA"    # NVIDIA

Step 3: Set Up API Keys

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

Step 4: Launch the Platform

# Start the Streamlit dashboard
python run_app.py

๐ŸŽ‰ That's it! Navigate to http://localhost:8501 and let the AI agents work their magic!

๐ŸŽฎ How to Use: From Stocks to Strategies

1. Select Your Universe (30 seconds)

  • Choose stocks from the sidebar
  • Set date ranges for analysis
  • Configure number of strategies to generate

2. Agent Takes Over (2-5 minutes)

  • 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

3. Review Results (Instant)

  • 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

๐Ÿ“ธ Platform Screenshots

Main Dashboard - Strategy Generation Interface

Dashboard Overview The main Streamlit interface where users configure stock universe and generate AI-powered trading strategies

Strategy Performance Analysis

Performance Analysis Comprehensive performance metrics and equity curve visualization for generated strategies

Portfolio Composition & Allocation

Portfolio Composition Dynamic asset allocation charts showing portfolio weights and rebalancing over time

Risk Analytics Dashboard

Risk Analytics Detailed risk analysis including drawdown analysis, Sharpe ratios, and volatility metrics

๐Ÿง  AI Agent Capabilities: The Complete Quant Researcher

Does AgentQuant Abstract All Quantitative Work? YES! โœ…

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

What the Agent Autonomously Handles:

โœ… 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

Ready for Production Use? Almost! โš ๏ธ

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

๐Ÿ’ก Suggested Future Features

๐ŸŽฏ Immediate Enhancements (Next 3 months)

  1. Multi-Asset Classes: Bonds, commodities, crypto, forex
  2. Intraday Strategies: Minute/hourly frequency trading
  3. Options Strategies: Covered calls, protective puts, spreads
  4. Sentiment Integration: News, social media, earnings calls
  5. ESG Scoring: Environmental and social impact metrics

๐Ÿš€ Advanced Capabilities (6-12 months)

  1. Reinforcement Learning: Self-improving agents through market feedback
  2. Portfolio Optimization: Modern portfolio theory with constraints
  3. Multi-Strategy Ensembles: Combine strategies with dynamic allocation
  4. Alternative Data: Satellite imagery, credit card transactions, weather
  5. Real-time Alerts: Strategy performance monitoring and notifications

๐ŸŒŸ Production Features (12+ months)

  1. Broker Integration: Interactive Brokers, Alpaca, TD Ameritrade APIs
  2. Paper Trading: Risk-free live strategy testing
  3. Institutional Features: Prime brokerage, custody, compliance
  4. Multi-Language Support: R, Julia, C++ strategy implementation
  5. Cloud Deployment: Scalable infrastructure on AWS/GCP/Azure

๐Ÿ“Š Example Output: From Code to Strategy

Input (config.yaml):

universe: ["AAPL", "MSFT", "GOOGL"]

Agent-Generated Strategy Example:

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.

๐ŸŽฏ Target Users

1. Individual Investors

  • Replace expensive fund managers with AI-powered strategies
  • No coding knowledge required
  • Professional-grade results

2. Quantitative Researchers

  • Accelerate strategy development by 10x
  • Focus on high-level ideas vs implementation
  • Rapid prototyping and testing

3. Portfolio Managers

  • Generate alpha through systematic approaches
  • Reduce human bias in strategy selection
  • Scale research capabilities

4. Financial Educators

  • Teach quantitative concepts interactively
  • Demonstrate strategy performance in real-time
  • Hands-on learning without programming barriers

๐Ÿ“š Documentation

Comprehensive Documentation Suite

  • 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

Developer Resources

  • 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.

๐Ÿค Contributing

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

Areas for Contribution:

  • ๐Ÿง  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

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐ŸŒŸ The Future of Quantitative Trading is Agentic

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 ๐Ÿš€

About

Autonomous quantitative trading research platform that transforms stock lists into fully backtested strategies using AI agents, real market data, and mathematical formulations, all without requiring any coding.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published