What Backtrader does
Backtrader is an open-source Python framework for testing trading ideas on historical data. You write a strategy as a Python class, add one or more data feeds (CSV files, pandas dataframes, Yahoo Finance, Interactive Brokers or Oanda), and the Cerebro engine runs it bar by bar through a simulated broker that handles orders, commissions and slippage. Built-in analyzers such as SharpeRatio, TradeAnalyzer, SQN and TimeReturn report the results, and a single command plots the run with matplotlib. The project's features page also lists multiple timeframes, resampling and replay, pluggable position sizers and observers.
Install it with pip install backtrader (or pip install backtrader[plotting] to pull in matplotlib). The README says it runs on Python 3.2 or later and also on PyPy without plotting. Live trading uses the same strategy code with an Interactive Brokers (IbPy), Oanda (oandapy, REST only) or Visual Chart store; the features page adds that third-party packages connect it to Alpaca, Oanda v2 and ccxt. Development has been quiet for years: the latest PyPI release, 1.9.78.123, dates from April 19, 2023, and that is also the date of the most recent commit on the GitHub repository.
