This project implements some basic functionality needed to engage in algorithmic trading of cryptocurrencies. It can be regarded as a starting point for more complex trading bots, which implements / will implement the following features:
Code is contained in bot
. Tests are in tests
.
There is some basic functionality for plotting in bot/Plotter.py
At bot/Exchanges
.
contains some tests
At bot/Engine/Backtester.py
.
Backtester infrastructure currently supports
- stop loss, trailing stop loss &
- subsequent entries logic (DCA)
At bot/Indicators.py
.
Started implementing the Indicators module which currently contains some indicators from pyti
;.
The thinking is that this module should allow us to easily and quickly compute any of the hundreds of indicators out there and to use them in strategies & backtesting. Should seamlessly connect to the Strategies module.
At bot/Strategies
.
A base module which allows us to define buying & selling strategies for crypto assets. Each strategy will contain the following phases:
setup
(where the indicators are computed),
getIndicators
(to be used for plotting),
checkBuySignal
, checkSellSignal
,
getBuySignalsList
and getSellSignalsList
(the last two to be used for backtesting).
Currently contains a few basic strategies. More strategies will be added together with a build-your-own strategy template. Should seamlessly connect to the Backtesting & Order Management modules.
At bot/Strategies/StrategyOptimiser.py
.
Currently allows for optimising strategy parameters using a genetic algorithm.
Run them with the command nose2
At bot/Engine/OrderManagement.py
.
A module which will handle the buying and selling of assets, given simple or more advanced rules, allowing us to run a strategy indefinitely.
- Placing Entry (Buy) Orders on Signal
- Placing Exit Order when Entry Order was fulfilled
- Market & OCO orders
- Selling on signals
- Trading below/above signal by some %
- Stop loss & Trailing stop loss
- Multiple trade entries (in case trade goes against you)
The ability to save the current bot state for later use. We may use something like SQLAlchemy to easily port to multiple SQL based DBs, but also want to have an API for transforming data to JSON.
Binance Futures, Bitmex, Bitfinex, FTX, Bybit. Margin Trading, Market Making, Hyper Parameter Tuning.
To contribute simply fork the repo, write your desired feature in your own fork and make a pull request upon finishing. Please write tests!
Each exchange should extend the BaseExchange class and implement all functions there.