13.08.2022 Views

advanced-algorithmic-trading

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 24

Introduction to QSTrader

In this chapter the freely-available open-source backtesting engine–QSTrader–will be introduced.

This software is used for nearly all of the trading strategy simulations within this book.

QSTrader is a full portfolio and order management system (OMS) containing modules for data

ingestion, event-driven backtesting, portfolio construction, position tracking, position sizing, risk

management, execution simulation and simulated brokerage connection.

The project homepage is currently hosted on GitHub at https://github.com/mhallsmoore/

qstrader. Please visit it for the latest project news.

24.1 Motivation for QSTrader

One of the most important moments in the development of a quantitative trading strategy occurs

when a backtested strategy is finally set to trade live. This usually involves a complex transition

from "research style" code (commonly written without proper software engineering methodology)

to deployment in a production environment, often on a remote server.

Unfortunately the actual performance of the deployed strategy can be significantly worse than

that of the same backtested system. There are many reasons for this:

• Overfit Models - The trading strategy was fit too heavily to historical data and was not

sufficiently validated.

• Transaction costs - These include spread, fees, slippage and market impact.

• Latency to liquidity provider - This is the time taken between issuing an order to a

brokerage and the brokerage executing it.

• Market regime change - A strategy or portfolio might have behaved well in previous

market conditions but fundamental changes to the market, such as a new regulatory environment

reduce the performance of the strategy.

• Strategy decay - The strategy eventually ends up being replicated by too many traders

and thus becomes "arbitraged away".

The most common reason for significant underperformance compared to a backtest, apart

from overfit models, is incomplete transaction cost handling in the simulation. Spread, slippage,

fees and market impact all contribute to reduced profitability when a strategy is traded live.

351

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!