All Projects → abbass2 → Pyqstrat

abbass2 / Pyqstrat

Licence: bsd-3-clause
A fast, extensible, transparent python library for backtesting quantitative strategies.

Projects that are alternatives of or similar to Pyqstrat

Pysonar
Decentralized Machine Learning Client
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Machine Learning With Python Cookbook Notes
(Part of) Chris Albon's Machine Learning with Python Cookbook in .ipynb form
Stars: ✭ 197 (-1.5%)
Mutual labels:  jupyter-notebook
Ropsten
Ropsten public testnet PoW chain
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Neuralnetworks.thought Experiments
Observations and notes to understand the workings of neural network models and other thought experiments using Tensorflow
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Gpt 2 Colab
retrain gpt-2 in colab
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
Traffic Sign Detection
Traffic Sign Detection. Code for the paper entitled "Evaluation of deep neural networks for traffic sign detection systems".
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
Mgcnn
Multi-Graph Convolutional Neural Networks
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Allensdk
code for reading and processing Allen Institute for Brain Science data
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
Medium articles
Scripts/Notebooks used for my articles published on Medium
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Image To 3d Bbox
Build a CNN network to predict 3D bounding box of car from 2D image.
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
Rl Adventure
Pytorch Implementation of DQN / DDQN / Prioritized replay/ noisy networks/ distributional values/ Rainbow/ hierarchical RL
Stars: ✭ 2,505 (+1152.5%)
Mutual labels:  jupyter-notebook
Binpy
An electronic simulation library written in pure Python
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Vdom
🎄 Virtual DOM for Python
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
Food2vec
🍔
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Sdc Lane And Vehicle Detection Tracking
OpenCV in Python for lane line and vehicle detection/tracking in autonomous cars
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
Datascience
책) 파이썬으로 데이터 주무르기 - 소스코드 및 데이터 공개
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Pyspark And Mllib
Getting start with PySpark and MLlib
Stars: ✭ 199 (-0.5%)
Mutual labels:  jupyter-notebook
Rosetta
Tools, wrappers, etc... for data science with a concentration on text processing
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
Spark Practice
Apache Spark (PySpark) Practice on Real Data
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook
W Net
w-net: a convolutional neural network architecture for the self-supervised learning of depthmap from pairs of stereo images.
Stars: ✭ 200 (+0%)
Mutual labels:  jupyter-notebook

|PyVersion| |Status| |License|

Introduction

The pyqstrat package is designed for backtesting quantitative strategies. It was originally built for my own use as a quant trader / researcher, after I could not find a python based framework that was fast, extensible and transparent enough for use in my work.

This framework is designed for capable programmers who are comfortable with numpy and reasonably advanced Python techniques.

The goals are:

  • Speed - Performance sensitive components are written at the numpy level, or in C++, which can lead to performance improvement of several orders of magnitude over regular Python code. Where possible, we parrallelize work so you can take advantage of all the cores available on your machine.
  • Transparency - If you are going to commit money to a strategy, you want to know exactly what assumptions you are making. The code is written and documented so these are as clear as possible.
  • Extensibility - It would be impossible to think of all requirements for backtesting strategies that traders could come up with. In addition, traders will want to measure different metrics depending on the strategy being traded.

Using this framework, you can:

  • Construct a portfolio containing multiple strategies that run concurrently
  • Create indicators, trading signals, trading rules and market simulators and add them to a strategy
  • Add multiple symbols representing real or "virtual" instruments to a strategy
  • Reuse existing market simulation or build your own to simulate how and when orders are filled
  • Measure returns, drawdowns, common return metrics such as sharpe, calmar and also add your own metrics.
  • Explore historical market data to understand its characteristics and check for errors before using it in backtesting.
  • Simulate futures rolling.
  • Plot trades, market data, indicators and add custom subplots to give you insight into your strategy's behavior.
  • Optimize your strategy's parameters using all the CPU cores on your machine.
  • Process large market data files into quote and trade bars using all the CPU cores on your machine

** NOTE: This is beta software and the API will change **

Installation

I would strongly recommend installing anaconda and creating an anaconda environment. See installation instructions at https://docs.anaconda.com/anaconda/install/

pyqstrat relies on numpy, scipy, matplotlib and pandas which in turn use Fortran and C code that needs to be compiled. It uses boost C++ libaries. It uses HDF5 data format as its market data file format.

::

conda install --channel conda-forge boost-cpp hdf5 libzip

pip install pyqstrat

Requirements:

  • Python_ version 3.7 or higher;

Documentation

The best way to get started is to go through this Jupyter notebook: Building Strategies <https://github.com/abbass2/pyqstrat/tree/master/pyqstrat/notebooks/building_strategies.ipynb>_

Jupyter Notebooks <https://github.com/abbass2/pyqstrat/tree/master/pyqstrat/notebooks>_

API docs <https://abbass2.github.io/pyqstrat>_

Discussion

The pyqstrat user group <https://groups.io/g/pyqstrat>_ is the group used for pyqstrat discussions.

Acknowledgements

Before building this, I looked at the following. Although I ended up not using them, they are definitely worth looking at.

R quantstrat library <https://github.com/braverock/quantstrat>_

Python backtrader project <https://www.backtrader.com>_

Some of the ideas I use in this framework come from the following books

Trading Systems: A New Approach to System Development and Portfolio Optimisation - Tomasini, Emilio and Jaekle, Urban <https://www.amazon.com/gp/product/1905641796/ref=oh_aui_search_detailpage?ie=UTF8&psc=1>_

Machine Trading - Chan, Ernie <https://www.amazon.com/gp/product/1119219604>_

Algorithmic Trading: Winning Strategies and Their Rationale - Chan, Ernie <https://www.amazon.com/gp/product/1118460146>_

Disclaimer

The software is provided on the conditions of the simplified BSD license.

.. _Python: http://www.python.org

.. |PyVersion| image:: https://img.shields.io/badge/python-3.7+-blue.svg :alt:

.. |Status| image:: https://img.shields.io/badge/status-beta-green.svg :alt:

.. |License| image:: https://img.shields.io/badge/license-BSD-blue.svg :alt:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].