Low activity

QSTrader guide

QSTrader approaches backtesting from the portfolio manager’s side: signals become target weights, rebalanced on a schedule.

Last reviewed

Quick answer

QSTrader is an open-source Python backtesting framework from QuantStart for systematic, portfolio-level strategies on equities and ETFs. Instead of reacting to every bar, it rebalances on a schedule using alpha models and risk models, then produces tear sheets. It suits allocation and rotation strategies rather than intraday trading.

QSTrader at a glance

Category
Backtest + live trading engines
Language
Python
License
MIT
Does
Backtesting, Performance analytics
Markets
Stocks, ETFs
Best for
Monthly or weekly ETF rotation, risk parity and other allocation strategies.
In AlgoGP
Use the exported strategy object from your own code

Pick it if

Monthly or weekly ETF rotation, risk parity and other allocation strategies.

Watch out for

Low recent activity.

QSTrader strengths and limitations

Strengths

  • Portfolio-construction mindset with alpha and risk models.
  • Clean, readable codebase from a well-known education site.

Limitations

  • Low recent activity.
  • No live trading; daily data only.

QSTrader example

pip install qstrader
Install
from qstrader.alpha_model.fixed_signals import FixedSignalsAlphaModel
alpha = FixedSignalsAlphaModel({"EQ:SPY": 0.6, "EQ:AGG": 0.4})
# pass alpha to BacktestTradingSession(..., rebalance="end_of_month") and run()
60/40 SPY/AGG rebalanced monthly (abridged).

Use QSTrader with AlgoGP

AlgoGP does not add QSTrader to projects automatically yet, but nothing stops you using them together. Every AlgoGP project exports plain Python with a framework-neutral strategy object, so you can call it from QSTrader yourself.

  1. 1

    Design and backtest in AlgoGP

    Describe the idea to the copilot and backtest it on AlgoGP’s normalized history.

  2. 2

    Add any bridge to get the adapter core

    Adding a bridged framework (for example Backtrader) writes frameworks/algogp_bridge.py, whose StrategyBridge.on_bar() returns the orders the strategy wants.

  3. 3

    Call it from QSTrader

    Feed QSTrader’s bars to StrategyBridge, place the returned orders with QSTrader, and report fills back with sync().

QSTrader: frequently asked questions

Can QSTrader trade live?

No, it is a backtesting framework.

QSTrader alternatives

Independent guide. AlgoGP is not affiliated with QSTrader. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.

Build a strategy