lumibot
Python framework for algorithmic trading: backtesting and live deployment for stocks, options, crypto, futures, and forex. Same code for backtest and live trading.
What it is and what it does
Lumibot is a framework that lets you write a single Python strategy class and run it in three modes: backtest against historical data, paper trade through a broker's simulation, or execute live orders—without rewriting your logic. It abstracts away broker APIs (Alpaca, Interactive Brokers, Tradier, Schwab, and others) and data sources (Yahoo Finance, Polygon, Alpha Vantage, Quandl) so you focus on strategy rules, position sizing, and risk controls.
The framework also includes a built-in AI agent runtime where you can define multiple agents with different roles—researcher, bull, bear, trader—that reason through market data, filings, indicators, and macro context before submitting orders. You can mix deterministic Python logic with AI reasoning, or use either approach alone. Backtests produce inspectable artifacts (orders, fills, equity curves), and the same strategy code transitions directly to paper or live trading once you swap the broker configuration.
Use it for:
- Backtest a multi-asset strategy (stocks, options, crypto, futures) against historical data to validate logic before risking capital.
- Paper-trade a strategy through Alpaca or another broker to test execution and slippage in real market conditions without live money.
- Deploy a deterministic trading bot that runs on a schedule, checking technical indicators and submitting orders through a live broker connection.
- Build an AI trading team where multiple agents debate market evidence and a trader agent decides whether to execute, all within the same Lumibot loop.
- Transition a backtest-validated strategy to live trading by changing only the broker configuration, keeping strategy code identical.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Lumibot is a Python framework for building, backtesting, and running algorithmic trading strategies and AI agents across stocks, options, crypto, futures, and forex using a single codebase that works identically in backtest and live trading.
Yes, if you are building algorithmic trading strategies or AI trading agents. Lumibot is actively maintained, permissively licensed, and solves the core problem of code reuse across backtest and live trading. The 50 runtime dependencies are substantial but reflect the breadth of brokers and data sources it supports; install friction is low. No known vulnerabilities. Start with backtest and paper trading to validate your logic before going live.
Install
lumibot on PyPI
pip
pip install lumibotuv
uv add lumibotpoetry
poetry add lumibotInstalling lumibot
Before you install
Installation is low-friction; the package ships as a wheel and is actively maintained with a recent release. The 50 runtime dependencies span data providers (yfinance, polygon-api-client, alpha_vantage), brokers (alpaca-py, ibapi), analysis tools (pandas, numpy, scipy, quantstats-lumi), and scheduling (apscheduler), which is typical for a multi-asset trading platform but adds complexity to your environment.
License in practice
MIT license is permissive; you can use, modify, and distribute Lumibot freely in commercial and private projects without restriction, though you must retain the license notice.
Quickstart
pip install lumibot
from 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:
order = self.create_order("AAPL", 10, "buy")
self.submit_order(order)
MyStrategy.backtest(
YahooDataBacktesting,
datetime(2023, 1, 1),
datetime(2024, 1, 1),
)
Requires Python 3.10 or later. Broker paper/live trading requires valid API credentials (e.g., Alpaca key/secret) set as environment variables.
Verify before relying
- Whether the 50 runtime dependencies are all required for basic backtest use or if many are optional broker/data-provider integrations.
- Performance characteristics and scalability limits for large strategy universes or high-frequency backtests.
- Whether AI agent functionality requires external LLM API keys and what the associated costs are.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 50 — polygon-api-client, alpaca-py, alpha_vantage, ibapi, yfinance, matplotlib, quandl, numpy, pandas, polars, pandas_market_calendars, pandas-ta-classic, plotly, sqlalchemy, bcrypt, pytest, yappi, scipy, quantstats-lumi, python-dotenv, ccxt, termcolor, jsonpickle, apscheduler, appdirs, pyarrow, tqdm, lumiwealth-tradier, py-clob-client-v2, pytz |
| Maintenance | actively maintained — 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 106,381/month — #12,654 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lumibot-4.5.83-py3-none-any.whl
Keywords: algorithmic-trading, backtesting, trading-bot, live-trading, stocks, options, crypto, cryptocurrency, futures, forex, quantitative-finance, alpaca, interactive-brokers, tradier, polymarket, schwab, trading-strategies, paper-trading, ai-trading, multi-asset, event-driven
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
backtestingBacktesting.py lets you define and test trading…
agpl · top 15,000 on PyPI
freqtradeFreqtrade is a Python-based cryptocurrency…
copyleft · top 15,000 on PyPI
backtraderBacktrader is a Python backtesting and live…
copyleft · top 15,000 on PyPI
investor-agentProvides financial research tools as an MCP…
permissive · top 15,000 on PyPI
finlabBacktest trading strategies on Taiwan stock…
copyleft · top 15,000 on PyPI
alpaca-pyAlpaca-py is the official Python SDK for…
permissive · top 5,000 on PyPI
nautilus_traderNautilusTrader is a Rust-native event-driven…
copyleft · top 15,000 on PyPI
vectorbtVectorized backtesting engine that packs…
unclear · top 15,000 on PyPI
metatrader5Connects Python to MetaTrader 5 Terminal to…
permissive · top 15,000 on PyPI
pandas-taProvides over 150 technical analysis indicators…
unclear · top 5,000 on PyPI