QSTrader
An institutional-shaped Python backtester whose last commit to master was June 2024.
by QuantStart
Last updated
What it is
QSTrader is a Python backtesting engine shaped like an institutional book rather than like a script. An alpha model emits signals, a portfolio construction model turns them into target weights, an order sizer converts weights to share counts, a risk model can veto, and a simulated broker fills the result against the next bar. Replacing one module and leaving the other four alone is the whole appeal — and the reason a twenty-line moving-average idea costs more setup here than in a vectorised backtester.
What it simulates is narrow: schedule-driven, daily-bar, long/short cash equities and ETFs. The bundled examples are buy-and-hold, 60/40, a long/short book and a momentum tactical asset allocation; output is a matplotlib tearsheet plus a JSON statistics dump.
The headline fact is maintenance. The repository is not archived and the README still calls the
software actively developed, but the last commit to master is 24 June 2024, release v0.3.0 went to
PyPI the same day, and nothing has been pushed to any branch since 30 June 2024 — development
stopped in May 2020 and advanced-algorithmic-trading in August 2020. Ten pull requests are open.
The oldest has been waiting since January 2017; the newest was opened in July 2026 and has had no
maintainer reply. Read it as a finished artefact with good bones, not a project you can file a bug
against.
Pricing
Free, MIT-licensed, nothing to buy. QuantStart's actual business is the content sold beside it:
the Advanced Algorithmic Trading ebook at $49, or $99 with source code, and the Quantcademy
membership forum at $35 a month or $350 a year. The ebook is the trap — it teaches the earlier
QSTrader parked on the advanced-algorithmic-trading branch, a different codebase from the
package pip installs.
Data & coverage
None of its own. CSVDailyBarDataSource reads a directory of daily OHLCV CSVs in Yahoo's column
layout, adjusting open and close for corporate actions — and since adjust_prices defaults to
True, a file with no Adj Close column raises rather than falling back. There is no vendor
adapter and no download helper.
Non-US data will load, but the simulation is US-shaped underneath. Each daily bar is split into an
open and a close timestamped 14:30 and 21:00 UTC, and SimulatedExchange hardcodes those same
hours with a standing TODO: Eliminate hardcoding of NYSE above them. There is no exchange
calendar of any kind.
Limitations
- Daily bars only.
DailyBusinessDaySimulationEnginewalks Monday to Friday and its own docstring admits it ignores regional holidays, US or UK. - Equities and cash are the only asset types; the data source's
asset_typeargument carries the comment "TODO: Unused at this stage and currently hardcoded to Equity". - Market orders and nothing else.
Ordercarries a quantity and an optional commission — no price, no order type, no time in force — andMarketOrderExecutionAlgorithmis the only execution algo shipped. Stops, limits and brackets are not expressible. - No slippage and no market impact.
SimulatedBrokeracceptsslippage_modelandmarket_impact_modelarguments and then assignsNoneto both, marked# TODO: Implement. Bid and ask are set to the same number by the data source, under its own comment that it is unable to distinguish them, so every fill crosses a zero spread. The defaultfee_modelisZeroFeeModel, which means a default backtest trades free. - Cash is not enforced. If the order exceeds the portfolio's cash, the broker prints a warning and transacts anyway, leaving a negative balance. Nothing is scaled down.
- No live trading, no paper trading, no broker integration of any kind. The community offered three — Interactive Brokers, Oanda and IG — as pull requests in 2017, and all three are still open.
- Python 3.9 to 3.12 declared. Nothing newer is claimed or tested.
- Four pages of documentation. The rest is reading the source.
Alternatives
For daily-bar research with a live maintainer, zipline-reloaded or Backtesting.py; for allocation and rebalancing in the same shape, bt; for event-driven work that reaches real execution, NautilusTrader. The fork trading-strategy-qstrader exists on PyPI precisely because the original was unmaintained — but it stopped in February 2022 and is staler than what it forked. The rest of the field is in the backtesting category.
Specs
- Interfaces
- Python, Python
- Export
- JSON
- Asset classes
- Stocks, ETF
- Markets
- Global
- Platforms
- Library
- AI features
- None
- Capabilities
- Backtesting
- Pricing verified
- Capabilities verified
- Coverage verified
Also worth comparing
- Backtrader — An event-driven Python backtester with 122 indicators, frozen since April 2023.
- bt — Python backtesting for allocation and rebalancing rules, not entries and exits.
- fastquant — A one-call wrapper over Backtrader, dormant since 2023 and broken on PyPI.
- Zipline-reloaded — The maintained fork of Quantopian's Zipline. Bring your own data — it ships almost none.
- AmiBroker — Windows portfolio backtester scripted in AFL, sold as a perpetual licence.
- Backtesting.py — A single-instrument Python backtester — one OHLC series, one strategy, no live trading.
FAQ
Is QSTrader still maintained?
No, on the evidence. The repository is not archived and the README still describes the project as under active development, but the last commit to master is dated 24 June 2024, release v0.3.0 reached PyPI the same day, and nothing has been pushed to any branch of the repository since 30 June 2024. Ten pull requests sit open, the oldest since January 2017 and the newest since July 2026. The code still runs; nobody is fixing it.
Can QSTrader place real orders?
No. The broker package contains one implementation, SimulatedBroker, and there is no adapter for Interactive Brokers, Alpaca or anything else. It is a backtester, not a trading system, and there is no paper-trading mode either.
Does QSTrader support intraday data?
Not as shipped. The simulation engine iterates daily business days and the only bundled data source reads daily OHLCV bars from CSV files, splitting each bar into an open and a close timestamped at 14:30 and 21:00 UTC. Intraday means writing your own SimulationEngine and DataSource, against a codebase nobody is patching.
How does QSTrader model commissions and slippage?
Commissions are a fee model you pass to the simulated broker, and the default is ZeroFeeModel — free trading unless you supply PercentFeeModel with your own commission and tax percentages. Slippage and market impact are not modelled at all. The broker constructor accepts slippage_model and market_impact_model arguments and then overwrites both with None, under a comment marking each one as still to be implemented.
Do I need to buy the QuantStart ebook to use QSTrader?
No, and the book is not about this version anyway. QSTrader is MIT-licensed and free. The Advanced Algorithmic Trading ebook ($49, or $99 with source code) targets the older QSTrader kept on a separate advanced-algorithmic-trading branch, not the engine you get from PyPI.