High(ish) frequency trading bot for cryptocurrencies, using Machine Learning for future price predic...
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
CryptoBot is an automated, high(ish) frequency trading bot for cryptocurrencies. It uses Machine Learning to decide when to trade. Currently it supports only Bitcoins, and trading on the BTCC exchange. In the future I intend on adding other currencies and exchanges.
This project is a very-hard-fork of Christopher Bynum's BitPredict which can be seen at: https://github.com/cbyn/bitpredict. The base code, and the idea, is modeled off the BitPredict project, so credit is due. However, CryptoBot has evolved immensely and looks very different than BitPredict, and have been taken several steps further.
The project is written entirely in Python, with the exception of some shell scripts.
Data is collected from BTCC using their JSON RPC API, and stored in MongoDB using scripts located in the app/collectdata folder: - Books snapshot collected every second - Latest trades collected every second - Ticks are collected every second - The runcollect_scripts.sh script can be used to launch it all
Features are created and saved to disk using the createlivefeatures.py script. The Machine Learning features include: - Width - Power Imbalance - Power Adjusted Price - Trade Count - Trade Average - Aggressor - Trend - These features were adapted from Christopher Bynum's BitPredict project. More details at: https://github.com/cbyn/bitpredict/ - Please feel free to suggest others!?
A target (named "final") is created using the future midpoint prices (at 5, 10, 15, 20, 25, 30 seconds in the future) of the midpoint between bids/asks for the books at those moments: - -1 means the average price of future midpoints went down below a certain threshold percentage, after 15 seconds - +1 means the average price of future midpoints went up above a certain threshold percentage, after 15 seconds - 0 means the average price did not go up or below the threshold percentage, after 15 seconds
Using the features, we train a Machine Learning classifier model (using the strategy.py script) against the target value to give us one of three options: - -1 means the price is predicted to go down, so trade accordingly - +1 means the price is predicted to go up, so trade accordingly - 0 means don't make a trade
I have tried it using the following classifiers: - XGBClassifier from the XGBoost project: https://xgboost.readthedocs.io/en/latest/ - RandomForestClassifier from the scikit-learn library: http://scikit-learn.org/ - GradientBoostingClassifier from the scikit-learn library - YMMV, try which one gives you the best results (strategy.py will back test and create the model)
predict.py is used to do the live trading.
The bot is fully functional. However, this was more of an exercise to teach myself Machine Learning. I have not be able to make a consistent profit. Neither should you expect to. Please be very careful in using this bot, and assume all responsibility yourself. Never use it for trading more than you're willing to lose (i.e. use it for fun only).
This is very much a work in progress. Contributions are welcome. If you can bring it to a consistent profitability, do share!
Licensed under the Apache License