Build deterministic trading strategies, multi-agent LLM trading systems, and hybrid strategies that backtest, paper trade, and execute through real brokers. Lumibot is an open-source algorithmic trading framework for stocks, options, crypto, futures, forex, indexes, SEC fundamentals, macro data, technical indicators, and AI agents that can actually place orders.
Full docs: lumibot.lumiwealth.com · Managed cloud: BotSpot.trade · MCP: BotSpot for AI coding agents
Build on BotSpot · Browse marketplace strategies · Use BotSpot MCP · Read the docs
- Deterministic strategies: normal Python logic, indicators, if statements, scheduled rules, position sizing, and risk controls.
- AI-agent strategies: one or more agents that reason through evidence, call tools, write memory, and optionally place orders.
- Backtests: replay historical data and simulated orders with artifacts you can inspect.
- Paper or live trading: reuse the same strategy code with real broker state and real order routing.
Lumibot now includes a built-in AI agent runtime for financial research, reasoning, debate, risk review, and trade execution. Agents can inspect market data, read filings, query indicators, search memory, compare macro context, and submit orders through the same Lumibot strategy loop used by normal backtests and live trading.
Classic Python strategies are still first-class. The point is not to replace deterministic trading logic. The point is that Lumibot lets you choose the right level of intelligence: fixed rules, AI agents, or a hybrid where Python handles the hard gates and agents reason through evidence.
An investment committee is one example pattern:
In that pattern, read-only research agents gather evidence and a trading-enabled portfolio manager decides whether to place Lumibot orders. It is one pattern, not the only pattern. You can build a single-agent strategy, a specialist research flow, bull/bear/neutral committees, model-vs-model debates, deterministic execution gates, or agent reviewers layered on top of normal Python logic.
Built-in AI agent tools include market/account state, order inspection, DuckDB queries, documentation search, Alpaca news when credentials exist, technical indicators, SEC fundamentals and filings, FRED macro data, local memory, and Telegram notifications.
BotSpot is the managed product built on Lumibot. Use it when you want the strategy engine without maintaining servers, schedulers, broker credentials, monitoring, and deployment infrastructure yourself.
- AI strategy builder: describe an idea in plain English and generate production-ready Lumibot code.
- Hosted backtesting and deployment: run backtests, schedule bots, monitor logs, and connect real brokers without managing cloud infrastructure.
- BotSpot MCP: let AI coding agents create strategies, run backtests, inspect results, and work with BotSpot from tools like Cursor, Claude, and ChatGPT.
- Marketplace: browse strategy ideas, results, infographics, and examples you can clone or adapt when the author allows it.
Start here: Build on BotSpot · BotSpot MCP · Marketplace · AI Trading Bootcamp
pip install lumibotfrom datetime import datetime
from lumibot.strategies import Strategy
from lumibot.backtesting import YahooDataBacktesting
class MyStrategy(Strategy):
def on_trading_iteration(self):
if self.first_iteration:
aapl = self.create_order("AAPL", 10, "buy")
self.submit_order(aapl)
MyStrategy.backtest(
YahooDataBacktesting,
datetime(2023, 1, 1),
datetime(2024, 1, 1),
)python my_strategy.pyThat same strategy code works with live brokers. Just swap the broker class.
For full setup guides, broker tutorials, AI-agent docs, examples, and deployment notes, use the Lumibot documentation.
| Feature | Lumibot | Backtrader | Freqtrade | Zipline | Backtesting.py | Jesse |
|---|---|---|---|---|---|---|
| Same code: backtest + live | Yes | Yes | Yes (crypto) | No | No | Yes (paid) |
| Stocks | Yes | Yes | No | Yes | Yes | No |
| Options | Yes | No | No | No | No | No |
| Crypto | Yes | Limited | Yes | No | Yes | Yes |
| Futures | Yes | Limited | Crypto only | Partial | Yes | Crypto only |
| Forex | Yes | Outdated | No | No | Yes | No |
| AI agent runtime | Built-in | No | FreqAI (ML) | No | No | ML pipeline |
| Brokers | Alpaca, IBKR, Tradier, Schwab, Tradovate, TopstepX (via ProjectX), Bitunix, plus selected CCXT crypto paths | IB only (outdated) | 10+ crypto exchanges | None | None | 8+ crypto (paid) |
| Actively maintained | Yes (2026) | No (since 2023) | Yes | Minimal | Moderate | Yes |
| License | MIT | GPL-3.0 | GPL-3.0 | Apache-2.0 | AGPL-3.0 | MIT |
Switching from Backtrader? See our migration guide for a side-by-side comparison with code examples.
BotSpot runs Lumibot strategies on hosted infrastructure with scheduling, monitoring, broker connections, and live execution. Use it when you want deployment without managing servers.
- Generate strategies with AI or bring your own Lumibot code
- Backtest against historical data
- Deploy to paper or live trading
- Monitor runs, logs, trades, and performance
Deploy with BotSpot or browse the strategy marketplace.
Run Lumibot on your own machine with any supported broker:
from lumibot.brokers import Alpaca
from lumibot.traders import Trader
ALPACA_CONFIG = {
"API_KEY": "your-key",
"API_SECRET": "your-secret",
"PAPER": True,
}
broker = Alpaca(ALPACA_CONFIG)
strategy = MyStrategy(broker=broker)
trader = Trader()
trader.add_strategy(strategy)
trader.run_all()Lumibot supports stocks, options, crypto, futures, forex, and indexes across several broker integrations:
- Alpaca
- Interactive Brokers and Interactive Brokers REST
- Tradier
- Schwab
- Tradovate
- TopstepX futures (via ProjectX)
- Bitunix
- Selected CCXT crypto paths. Coinbase, Kraken, and WEEX have auto-detected credential paths; KuCoin, Binance, and BitMEX have documented manual CCXT setup paths; Kraken, Binance, KuCoin, BitMEX, Bybit, and OKX have documented backtesting examples. Lumibot does not claim blanket support for every CCXT exchange.
Lumibot can backtest from free daily data, broker data, premium market data, and your own files:
- Yahoo Finance
- Alpaca
- Interactive Brokers REST
- ThetaData
- Polygon/Massive
- DataBento
- Tradier
- Schwab
- CCXT backtesting examples: Kraken, Binance, KuCoin, BitMEX, Bybit, and OKX
- Pandas/CSV dataframes
For the deepest historical coverage (stocks, options, futures, indexes), we recommend ThetaData. Use promo code BotSpot10 for 10% off your first order.
Lumibot includes a built-in AI trading agent runtime. Build agents that run identically in backtests and live trading.
- Create agents with
self.agents.create(...) - Use a different model per agent with
model="openai/gpt-5.5"or any LiteLLM/ADK-supported provider string - Make research agents read-only with
allow_trading=False - Give agents built-in SEC fundamentals, filings, FRED macro data, indicators, memory, and notifications
- Use DuckDB for time-series analysis instead of dumping raw bars into prompts
- Mount external MCP servers for news, macro data, filings, or any domain-specific tools
- Replay identical agent decisions in backtests without paying for another model call
Use BotSpot MCP when you want an AI coding agent to generate Lumibot strategies, launch backtests, inspect artifacts, and iterate without leaving your editor.
Start here:
- Agent Documentation
- Agent Flow Design
- AI Investment Committee Example
- Standalone AI Committee Demo
- Discretionary Agent Example
- News Sentiment Agent Example
- Full Guide
AI strategies can record decisions, lessons, open theses, tool calls, and run artifacts as local files. This makes an AI backtest reviewable instead of a black box: you can inspect why the agent traded, which tools it used, and what it remembered for later iterations.
Browse and contribute open-source strategies: lumibot-strategies. For hosted strategy discovery with performance, descriptions, visuals, and deploy flows, use the BotSpot marketplace.
Lumibot includes 25+ example strategies covering stocks, options, crypto, futures, and forex:
# Run a simple buy-and-hold backtest
python -m lumibot.example_strategies.stock_buy_and_hold
# Or explore all examples
ls lumibot/example_strategies/Browse all examples: example_strategies/
External example repo: stock_example_algo shows a minimal strategy repository you can run yourself or adapt inside BotSpot.
Select a data source via environment variable (overrides code):
export BACKTESTING_DATA_SOURCE=thetadata # or yahoo, ibkr, polygonMulti-provider routing by asset type:
export BACKTESTING_DATA_SOURCE='{"default":"thetadata","option":"thetadata","crypto":"ibkr","crypto_future":"ibkr","future":"ibkr","cont_future":"ibkr"}'Crypto futures/perpetual backtests can route Asset.AssetType.CRYPTO_FUTURE through spot crypto history. USDT symbols such as BTCUSDT, ETHUSDT, and SOLUSDT use the matching USD spot proxy for prices.
| Data Source | OHLCV | Split Adjusted | Dividends | Dividend Adjusted Returns |
|---|---|---|---|---|
| Yahoo | Yes | Yes | Yes | Yes |
| Alpaca | Yes | Yes | No | No |
| Polygon | Yes | Yes | No | No |
| Tradier | Yes | Yes | No | No |
| Pandas* | Yes | Yes | Yes | Yes |
*Pandas loads CSV files in Yahoo dataframe format, which can contain dividends.
- Documentation: lumibot.lumiwealth.com
- Blog: lumiwealth.com/blog
- AI strategy builder and hosted deployment: BotSpot.trade
- BotSpot MCP for AI coding agents: botspot.trade/agents
- Strategy marketplace: botspot.trade/marketplace
Learn to build, backtest, and deploy trading strategies using AI. Join 2,400+ traders.
Learn more about the AI Bootcamp
We welcome contributions! Here's a video to help you get started: Watch The Video
Steps:
- Clone the repository
- Create a new branch:
git switch -c my-feature - Install dev dependencies:
pip install -r requirements_dev.txt && pip install -e . - Make your changes
- Run tests:
pytest - Create a pull request
pytest # Run all tests
pytest tests/test_asset.py # Run a specific test file
coverage run; coverage report # Show code coverageLumibot can mirror its local parquet caches to AWS S3. See docs/remote_cache.md for configuration.
- Backtesting Architecture - Data flow diagrams for Yahoo, ThetaData, Polygon
- Acceptance Backtests - End-to-end acceptance suite
- Environment Variables - All configurable env vars
- Changelog - Release notes
- AI Assistant Guide - Instructions for AI coding assistants
- Production Safety - ThetaData and production rules
This software is provided for educational and informational purposes only. It is not financial advice and does not constitute a recommendation to buy or sell any security. Lumibot and BotSpot are not registered broker-dealers or financial advisors. Algorithmic trading involves substantial risk of loss, including the possibility of losses greater than your initial investment. Software bugs and errors can lead to rapid financial losses. Past backtest performance does not guarantee future results. Use this software at your own risk. You are solely responsible for compliance with all applicable laws and regulations regarding the assets you choose to trade.
Affiliate disclosure: some provider links or promo codes, including ThetaData, may support continued Lumibot development.
MIT License - View License