Skip to main content
Quantdom
========

.. image:: https://img.shields.io/pypi/v/quantdom.svg?style=flat-square
:target: https://pypi.python.org/pypi/quantdom/
.. image:: https://img.shields.io/travis/constverum/Quantdom.svg?style=flat-square
:target: https://travis-ci.org/constverum/Quantdom
.. image:: https://img.shields.io/pypi/wheel/quantdom.svg?style=flat-square
:target: https://pypi.python.org/pypi/quantdom/
.. image:: https://img.shields.io/pypi/pyversions/quantdom.svg?style=flat-square
:target: https://pypi.python.org/pypi/quantdom/
.. image:: https://img.shields.io/pypi/l/quantdom.svg?style=flat-square
:target: https://pypi.python.org/pypi/quantdom/

Quantdom is a simple but powerful backtesting framework written in python, that strives to let you focus on modeling financial strategies, portfolio management, and analyzing backtests. It has been created as a useful and flexible tool to save the systematic trading community from re-inventing the wheel and let them evaluate their trading ideas easier with minimal effort. It's designed for people who are already comfortable with *Python* and who want to create, test and explore their own trading strategies.

.. image:: http://f.cl.ly/items/1z1t1T0A0P161f053i45/quantdom_v0.1a1.gif

Quantdom is in an early alpha state at the moment. So please be patient with possible errors and report them.


Features
--------

* Free, open-source and cross-platform backtesting framework
* Multiple data feeds: csv files and online sources such as Google Finance, Yahoo Finance, Quandl and more
* Investment Analysis (performance and risk analysis of financial portfolio)
* Charting and reporting that help visualize backtest results
.. * Multiple timeframes at once


Requirements
------------

* Python **3.6** or higher
* `PyQt5 <https://pypi.python.org/pypi/PyQt5>`_
* `PyQtGraph <http://www.pyqtgraph.org/>`_
* `NumPy <http://www.numpy.org/>`_
* See `requirements.txt <https://github.com/constverum/Quantdom/blob/master/requirements.txt>`_ for full details.


Installation
------------

Using the binaries
##################

You can download binary packages for your system (see the `Github Releases <https://github.com/constverum/Quantdom/releases>`_ page for available downloads):

* For `Windows <https://github.com/constverum/Quantdom/releases/download/v0.1a1/quantdom_0.1a1.exe>`_
* For `MacOS <https://github.com/constverum/Quantdom/releases/download/v0.1a1/quantdom_0.1a1.dmg>`_
* For `Linux <https://github.com/constverum/Quantdom/releases/download/v0.1a1/quantdom_0.1a1.zip>`_

Running from source code
########################

You can install last *stable release* from pypi:

.. code-block:: bash

$ pip install quantdom

And latest *development version* can be installed directly from GitHub:

.. code-block:: bash

$ pip install -U git+https://github.com/constverum/Quantdom.git

After that, to run the application just execute one command:

.. code-block:: bash

$ quantdom


Usage
-----

1. Run Quantdom.
2. Choose a market instrument (symbol) for backtesting on the ``Data`` tab.
3. Specify a file with your strategies on the ``Quotes`` tab, and select one of them.
4. Run a backtest. Once this is done, you can analyze the results and optimize parameters of the strategy.


Strategy Examples
-----------------

Three-bar strategy
##################

A simple trading strategy based on the assumption that after three consecutive bullish bars (bar closing occurred higher than its opening) bulls predominate in the market and therefore the price will continue to grow; after 3 consecutive bearish bars (the bar closes lower than its opening), the price will continue to down, since bears predominate in the market.

.. code-block:: python

from quantdom import AbstractStrategy, Order, Portfolio

class ThreeBarStrategy(AbstractStrategy):

def init(self, high_bars=3, low_bars=3):
Portfolio.initial_balance = 100000 # default value
self.seq_low_bars = 0
self.seq_high_bars = 0
self.signal = None
self.last_position = None
self.volume = 100 # shares
self.high_bars = high_bars
self.low_bars = low_bars

def handle(self, quote):
if self.signal:
props = {
'symbol': self.symbol, # current selected symbol
'otype': self.signal,
'price': quote.open,
'volume': self.volume,
'time': quote.time,
}
if not self.last_position:
self.last_position = Order.open(**props)
elif self.last_position.type != self.signal:
Order.close(self.last_position, price=quote.open, time=quote.time)
self.last_position = Order.open(**props)
self.signal = False
self.seq_high_bars = self.seq_low_bars = 0

if quote.close > quote.open:
self.seq_high_bars += 1
self.seq_low_bars = 0
else:
self.seq_high_bars = 0
self.seq_low_bars += 1

if self.seq_high_bars == self.high_bars:
self.signal = Order.BUY
elif self.seq_low_bars == self.low_bars:
self.signal = Order.SELL


Documentation
-------------

In progress ;)


TODO
----

* Add integration with `TA-Lib <http://ta-lib.org/>`_
* Add the ability to use TensorFlow/CatBoost/Scikit-Learn and other ML tools to create incredible algorithms and strategies. Just as one of the first tasks is Elliott Wave Theory(Principle) - to recognize of current wave and on the basis of this predict price movement at confidence intervals
* Add the ability to make a sentiment analysis from different sources (news, tweets, etc)
* Add ability to create custom screens, ranking functions, reports


Contributing
------------

* Fork it: https://github.com/constverum/Quantdom/fork
* Create your feature branch: git checkout -b my-new-feature
* Commit your changes: git commit -am 'Add some feature'
* Push to the branch: git push origin my-new-feature
* Submit a pull request!


Disclaimer
----------

This software should not be used as a financial advisor, it is for educational use only.
Absolutely no warranty is implied with this product. By using this software you release the author(s) from any liability regarding the use of this software. You can lose money because this program probably has some errors in it, so use it at your own risk. And please don't take risks with money you can't afford to lose.


Feedback
--------

I'm very interested in your experience with Quantdom.
Please feel free to send me any feedback, ideas, enhancement requests or anything else.


License
-------

Licensed under the Apache License, Version 2.0

Metadata

Release files for quantdom 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quantdom 0.1
File Size Uploaded
quantdom-0.1.tar.gz 35.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quantdom 0.1
File Interpreter ABI Platform
quantdom-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 174.6 kB

Release files / quantdom-0.1.tar.gz

Download URL quantdom-0.1.tar.gz
Size 35.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0b18d9e1e8cc906b2c2fd9616f8748378a66c2e149e339fef4792136406ad890
BLAKE2b-256 checksum
How to use checksums
b048344e2634c5bd09c5feb966483eb791cd5d10659ba757fdeaa8863ac23c9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.6.3 Linux/4.4.0-101-generic

Release files / quantdom-0.1-py3-none-any.whl

Download URL quantdom-0.1-py3-none-any.whl
Size 139.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52a40532c034306ab3fa4559b617bc221f7d52f4ba3756e6b79a1f82809bb4c8
BLAKE2b-256 checksum
How to use checksums
c7189d0d9e2e4b0ddc8b1d4426d767a1a7be0b63554bc5c6ebd960ed62e5193a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.6.3 Linux/4.4.0-101-generic

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page