Live Trade Bench is a comprehensive platform for evaluating LLM-based trading agents in real-time market environments. Built with FastAPI, it provides a full-stack solution for running, monitoring, and benchmarking AI trading agents across multiple markets while avoiding backtest overfitting.
[October 2025] π We've released our technical report! Read the full paper: LiveTradeBench: Seeking Real-world Alpha with Large Language Models
- π€ Multiple LLMs Support: Run multiple LLM-powered trading agents simultaneously (GPT, Claude, Gemini, etc.)
 - π Dual Market Systems: Stock market (US equities) and Polymarket (prediction markets)
 - π Real-time Updates: Automated price updates, news feeds, and social sentiment analysis
 - πΎ Backtest Data: Load and analyze past trading performance
 - π RESTful API: Full API access for external integrations
 
# Install with pip
pip install live-trade-bench
# Or from source
git clone https://github.com/ulab-uiuc/live-trade-bench.git
cd live-trade-bench
poetry install# Required: Set your OpenAI API key
export OPENAI_API_KEY="your-openai-key"
# Optional: Set other LLM provider keys
export ANTHROPIC_API_KEY="your-anthropic-key"
export GOOGLE_API_KEY="your-google-key"from live_trade_bench.systems import StockPortfolioSystem
# Create a trading system
system = StockPortfolioSystem.get_instance()
# Add an LLM agent with $10,000 initial capital
system.add_agent(
    name="GPT-4o-mini Trader",
    initial_cash=10000.0,
    model_name="gpt-4o-mini"
)
# Initialize and run trading cycle
system.initialize_for_live()
system.run_cycle()
# Get agent performance
performance = system.get_all_agent_performance()
print(performance)live_trade_bench/
βββ fetchers/                   # Data crawlers and fetchers
β   βββ base_fetcher.py        # Base fetcher interface
β   βββ stock_fetcher.py       # Stock price & info (Yahoo Finance)
β   βββ polymarket_fetcher.py  # Polymarket data (CLOB API)
β   βββ news_fetcher.py        # Financial news (NewsAPI, Finnhub)
β   βββ reddit_fetcher.py      # Reddit sentiment (PRAW)
β   βββ constants.py           # Stock symbols and constants
β
βββ agents/                     # LLM trading agents
β   βββ base_agent.py          # Base LLM agent class
β   βββ stock_agent.py         # Stock trading agent
β   βββ polymarket_agent.py    # Prediction market agent
β
βββ accounts/                   # Portfolio & execution
β   βββ base_account.py        # Base account with portfolio tracking
β   βββ stock_account.py       # Stock portfolio management
β   βββ polymarket_account.py  # Polymarket portfolio management
β
βββ systems/                    # Complete trading systems
β   βββ stock_system.py        # Stock trading system
β   βββ polymarket_system.py   # Polymarket trading system
β
βββ backtest/                   # Backtesting framework
β   βββ backtest_runner.py     # Historical strategy evaluation
β
βββ mock/                       # Mock implementations for testing
β   βββ mock_agent.py          # Fake agent with random decisions
β   βββ mock_fetcher.py        # Fake fetcher with synthetic data
β   βββ mock_system.py         # Combined mock systems
β
βββ utils/                      # Utilities
    βββ llm_client.py          # LLM API wrapper (OpenAI, Anthropic, etc.)
    βββ logger.py              # Logging utilities
    βββ agent_utils.py         # Agent helper functions
from live_trade_bench.systems import StockPortfolioSystem
# Create stock trading system
system = StockPortfolioSystem()
# Add AI agent
system.add_agent("Portfolio_Manager", initial_cash=10000.0, model_name="gpt-4o-mini")
# Initialize system (fetches trending stocks)
system.initialize_for_live()
print(f"Trading {len(system.universe)} stocks: {system.universe}...")
# Run trading cycles
for i in range(5):
    system.run_cycle()
print("Demo finished.")from live_trade_bench.systems import PolymarketPortfolioSystem
# Create polymarket system (auto-initializes)
system = PolymarketPortfolioSystem()
# Add AI agent for predictions
system.add_agent("Predictor", initial_cash=2000.0, model_name="gpt-4o-mini")
print(f"Trading {len(system.universe)} prediction markets")
# Run prediction cycles
for i in range(5):
    system.run_cycle()
print("Demo finished.")from datetime import datetime, timedelta
from live_trade_bench.fetchers.stock_fetcher import (
    fetch_trending_stocks,
    fetch_stock_price_with_history,
)
from live_trade_bench.fetchers.news_fetcher import fetch_news_data
# Fetch trending stocks
trending = fetch_trending_stocks(limit=10)
print(f"Trending stocks: {trending}")
# Fetch stock price data
stock_data = fetch_stock_price_with_history("AAPL")
print(stock_data)
# Fetch financial news
today = datetime.now().strftime("%Y-%m-%d")
start_date = (datetime.now() - timedelta(days=7)).strftime("%Y-%m-%d")
news = fetch_news_data(query="stock market", start_date=start_date, end_date=today)
for article in news[:5]:
    print(f"- {article['title']}")For more examples, see the examples/ directory.
from live_trade_bench.mock import (
    MockAgentStockSystem,
    MockFetcherStockSystem,
    MockAgentFetcherStockSystem
)
# Option 1: Mock agents only (no LLM API calls)
system = MockAgentStockSystem.get_instance()
# Option 2: Mock fetchers only (no real market data)
system = MockFetcherStockSystem.get_instance()
# Option 3: Mock both (fastest for testing)
system = MockAgentFetcherStockSystem.get_instance()We welcome contributions! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the PolyForm Noncommercial License 1.0.0 - see the LICENSE file for details.
For commercial licensing, please see LICENSE.COMMERCIAL.
