letianzj / quanttrader

Backtest and live trading in Python
Apache License 2.0
522 stars 114 forks source link
algo-trading algorithmic-trading algotrading backtesting-trading-strategies backtests interval-strategy quant-trader quant-trading quantitative-trading stock trading-algorithms trading-platform trading-strategies trading-systems

quanttrader

pypi python License Apache 2.0

Welcome to quanttrader, a pure python-based event-driven backtest and live trading package for quant traders.

The source code is completely open-sourced here on GitHub. The package is published here on pypi and is ready to be pip installed. The document is hosted here on readthedocs.

In most cases, a backtest strategy can be directly used for live trade by simply switching to live brokerage. A control window is provided to monitor live trading sessions for each strategy separately and the portfolio as a whole.

Backtest

Backtest code structure

Backtests examples

Reinforcement trader

Live trading

Live Trading demo video

Live Trading code structure

Prerequisite: download and install IB TWS or IB Gateway; enable API connection as described here.

Installation

Step 1

pip install quanttrader

Alternatively, download or git the source code and include unzipped path in PYTHONPATH environment variable.

step 2

Download live_engine.py, config_live.yaml, order_per_interval_strategy.py by clicking Raw button, right clicking save as, and then change the file extension to .py or .yaml.

step 3

cd where_the_files_are_saved
python live_engine.py

Instruments Supported and Example

Order Type Supported

Basic order types. See IB Doc for details.

gui

DISCLAIMER Open source, free to use, free to contribute, use at own risk. No promise of future profits nor responsibility of future loses.