QF-Lib Guide

QF-Lib is a Python library that provides high quality tools for quantitative finance. A large part of the project is dedicated to backtesting investment strategies. The Backtester uses an event-driven architecture and simulates events such as daily market opening or closing. It is designed to test and evaluate any custom investment strategy. For more details check the Projects Website.

Getting started


How to install this library.


Library configuration and customization options.

How to backtest your strategy

Step by step guide on how to implement and backtest a strategy.

Create an Alpha Model based strategy

Step by step guide on how to implement and backtest an Alpha model strategy.

Customize your backtest

Enhance your backtest by adding commission and slippage models.

Reference guides

Backtest flow

Understand the event-driven architecture of the Backtester and compare different types of Events.

Modules structure

Description of the main modules and components of the library

API Reference


Code of the Backtester, which uses an event-driven architecture.


Data providers whose purpose is to download the financial data from various vendors such as Bloomberg or Quandl.


Data structures that extend the functionality of pandas Series, pandas DataFrame and numpy DataArray containers and facilitate the computations performed on time-indexed structures of prices or price returns.


Various generic tools.


Analyze strategy progress and generate files containing the analysis results


Chart templates along with some easy-to-use decorators.


Templates, styles and components used to export the results and save them.


Market indicators that can be implemented in strategies or used for the analysis.


Components which facilitate the process of portfolio construction. The construction process involves covariance matrix optimization with one of the implemented optimizers.

Indices and tables