https://github.com/quarkfin/qf-lib
Modular Python library that provides an advanced event driven backtester and a set of high quality tools for quantitative finance. Integrated with various data vendors and brokers, supports Crypto, Stocks and Futures.
https://github.com/quarkfin/qf-lib
backtesting backtesting-frameworks backtesting-trading-strategies finance investment-analysis python quant quantitative-finance trading trading-simulator trading-strategies
Last synced: 25 days ago
JSON representation
Modular Python library that provides an advanced event driven backtester and a set of high quality tools for quantitative finance. Integrated with various data vendors and brokers, supports Crypto, Stocks and Futures.
- Host: GitHub
- URL: https://github.com/quarkfin/qf-lib
- Owner: quarkfin
- License: apache-2.0
- Created: 2019-08-16T09:10:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2026-01-26T16:46:39.000Z (about 2 months ago)
- Last Synced: 2026-01-27T04:16:40.014Z (about 2 months ago)
- Topics: backtesting, backtesting-frameworks, backtesting-trading-strategies, finance, investment-analysis, python, quant, quantitative-finance, trading, trading-simulator, trading-strategies
- Language: Python
- Homepage: https://quarkfin.github.io/qf-lib-info/
- Size: 130 MB
- Stars: 848
- Watchers: 18
- Forks: 124
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-quant - qf-lib - QF-Lib is a Python library that provides high quality tools for quantitative finance. (Python / Trading & Backtesting)
- awesome-systematic-trading - qf-lib - commit/quarkfin/qf-lib/master)  | Python | - Modular Python library that provides an advanced event driven backtester and a set of high quality tools for quantitative finance. Integrated with various data vendors and brokers, supports Crypto, Stocks and Futures. (Backtest + live trading / General purpose)
README
# QF-Lib
[](https://pypi.org/project/qf-lib/)
[](https://pepy.tech/project/qf-lib)
[](https://github.com/quarkfin/qf-lib/blob/master/LICENSE)

[](https://app.codecov.io/gh/quarkfin/qf-lib)
[](https://qf-lib.readthedocs.io/)
[](https://github.com/quarkfin/qf-lib/actions/workflows/tests.yml)


## What is QF-lib?
**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**.
Main features include:
* Flexible data sourcing - the project supports the possibility of an easy selection of the data source. Currently provides financial data from **Bloomberg**, **Quandl**, **Haver Analytics** or **Portara**. To check if there are any additional dependencies necessary for any of these data providers please visit [the installation guide](https://qf-lib.readthedocs.io/en/latest/installation.html#installing-optional-data-providers).
* Tools to prevent look-ahead bias in the backtesting environment.
* Adapted [data containers](https://qf-lib.readthedocs.io/en/latest/reference/structure.html#containers), which extend the functionality of pandas `Series'` and `Dataframes`.
* Summary generation - all performed studies can be summarized with a practical and informative document explaining the results. [Several document templates](https://qf-lib.readthedocs.io/en/latest/reference/structure.html#analysis) are available in the project.
* Simple adjustment of existing settings and creation of new functionalities.
## Installation
You can install `qf-lib` using the pip command:
```sh
pip install qf-lib
```
Alternatively, to install the library from sources, you can download the project and in the qf_lib directory
(same one where you found this file after cloning the repository) execute the following command:
```sh
python setup.py install
```
## Prerequisites
The library uses [WeasyPrint](https://weasyprint.readthedocs.io) to export documents to PDF. WeasyPrint requires additional dependencies, check the
[platform-specific instructions for Linux, macOS and Windows installation](https://weasyprint.readthedocs.io/en/stable/install.html).
In order to facilitate the GTK3+ installation process for Windows you can use
[following installers](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases). Download and run the latest
`gtk3-runtime-x.x.x-x-x-x-ts-win64.exe` file to install the GTK3+.
## Documentation
* Installation guide: https://qf-lib.readthedocs.io/en/latest/installation.html
* Configuration guide: https://qf-lib.readthedocs.io/en/latest/configuration.html
* API documentation: https://qf-lib.readthedocs.io/
## How to Contribute
We welcome all contributions - bug reports, fixes, documentation improvements, new features, or ideas! Here’s how you can get involved:
* Find an Issue: Check out the GitHub Issues tab. Look for labels like *documentation* or *good first issue* to get started.
* Triage Issues: Help by reproducing bugs, asking for missing details (e.g., version numbers, steps to reproduce), or clarifying discussions.
* Share Your Ideas: If you spot something missing or have an improvement in mind, open an issue or submit a pull request.
* Join the Discussion: Have questions or want to collaborate? Join our [Discord community](https://discord.gg/CfMf8zaeX9).
Code of Conduct: All participants are expected to follow our [Code of Conduct](https://github.com/quarkfin/qf-lib/blob/master/CODE_OF_CONDUCT.md).