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

Installation

How to install this library.

Configuration

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

backtesting

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

data_providers

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

containers

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.

common

Various generic tools.

analysis

Analyze strategy progress and generate files containing the analysis results

plotting

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

document_utils

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

indicators

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

portfolio_construction

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

Indices and tables