Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/letianzj/quanttrader
Backtest and live trading in Python
https://github.com/letianzj/quanttrader
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
Last synced: 1 day ago
JSON representation
Backtest and live trading in Python
- Host: GitHub
- URL: https://github.com/letianzj/quanttrader
- Owner: letianzj
- License: apache-2.0
- Created: 2020-07-27T22:08:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-20T13:57:28.000Z (5 months ago)
- Last Synced: 2024-10-28T16:45:16.304Z (11 days ago)
- Topics: 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
- Language: HTML
- Homepage:
- Size: 6.39 MB
- Stars: 520
- Watchers: 18
- Forks: 111
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
- awesome-systematic-trading - quanttrader - with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg) | (Backtesting and Live Trading / General - Event Driven Frameworks)
- awesome-systematic-trading - quanttrader - commit/letianzj/quanttrader/master) ![GitHub Repo stars](https://img.shields.io/github/stars/letianzj/quanttrader?style=social) | Python | - Backtest and live trading in Python. Event based. Similar to backtesting.py. (Backtest + live trading / General purpose)
README
# quanttrader
[![pypi](https://img.shields.io/pypi/v/nseazy.svg)](https://pypi.python.org/pypi/quanttrader)
[![python](https://img.shields.io/pypi/pyversions/nseazy.svg)](https://pypi.python.org/pypi/quanttrader)
[![License Apache 2.0](https://badgen.net/badge/license/apache2.0/blue)](https://opensource.org/licenses/MIT)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](https://github.com/letianzj/quanttrader). The package is published [here on pypi](https://pypi.org/project/quanttrader/) and is ready to be pip installed. The document is hosted [here on readthedocs](https://quanttrader.readthedocs.io/).
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](https://letianzj.github.io/quanttrading-backtest.html)
[Backtests examples](https://github.com/letianzj/QuantResearch/tree/master/backtest)
[Reinforcement trader](https://github.com/letianzj/QuantResearch/blob/master/ml/reinforcement_trader.ipynb)
### Live trading
[Live Trading demo video](https://youtu.be/CrsrTxqiXNY)
[Live Trading code structure](https://letianzj.github.io/live-trading-ib-native-python.html)
__Prerequisite__: download and install IB TWS or IB Gateway; enable API connection as described [here](https://interactivebrokers.github.io/tws-api/initial_setup.html).
__Installation__
Step 1
```shell
pip install quanttrader
```Alternatively, download or git the source code and include unzipped path in PYTHONPATH environment variable.
step 2
Download [live_engine.py](https://github.com/letianzj/quanttrader/blob/master/examples/live_engine.py), [config_live.yaml](https://github.com/letianzj/quanttrader/blob/master/examples/config_live.yaml), [order_per_interval_strategy.py](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
```shell
cd where_the_files_are_saved
python live_engine.py
```__Instruments Supported and Example__
* __Stock__: AMZN STK SMART
* __Foreign Exchange__: EURGBP CASH IDEALPRO
* __Futures__: ESM9 FUT GLOBEX
* __Options on Stock__: AAPL OPT 20201016 128.75 C SMART
* __Options on Futures__: ES FOP 20200911 3450 C 50 GLOBEX
* __Comdty__: XAUUSD CMDTY SMART__Order Type Supported__
Basic order types. See [IB Doc](http://interactivebrokers.github.io/tws-api/basic_orders.html) for details.
* Auction
* Auction Limit
* Market
* Market If Touched
* Market On Close
* Market On Open
* Market to Limit
* Limit Order
* Limit if Touched
* Limit on Close
* Limit on Open
* Stop
* Stop Limit
* Trailing Stop
* Trailing Stop Limit![gui](https://github.com/letianzj/quanttrader/blob/master/examples/gui.png)
**DISCLAIMER**
Open source, free to use, free to contribute, use at own risk. No promise of future profits nor responsibility of future loses.