It is my first project of more extensive scope. This is where I acknowledged my interest in both Machine learning and algorythmic trading. This project consists of a rather simple LSTM recurrent neural network builder (using Keras). The goal of the neural network is to predict cryptocurenncy price movements - preferrably short term. And it succeeded to do so.
How do I know how well the model will perform when utilized for trading in the future? I don't. I can only look on historical data and try to determine whether it has potential to be effective and make money regardless of market behavior. A big part of my work on this project was to construct tools that best describe model's performance and robustness. Using plotly I made charts that visualise model's prediction pattern and it's accuracy. Also, I made a backtesting simulation of a simple strategies that can be based on model's prediction - and visualisation of how profitable they would be over time. Lastly, I implemented a simple trading bot that can preprocess data, run predictions and send orders to the exchange (Binance) via API.
The project's code and overall structure may seem messy. It is not a suprise since it's my first work of that kind and I was just a high school student. I've learnt a lot since and I will put my work into imporving the structure, code readability and speed along with ease of use . To be honest, while I'm still passionate about machine learning and its applications for algorithmic trading, I probably won't be maintaining and updating this particular project.
-
- getdata.py - tool used to download historical data from the exchange
- new_preprocess.py - front to data preprocessing
- compile.py - model training
- vars.py - some constant variables
- utils.py - utilities
- data_processing.py - data processing functions - used by new_preprocess.py, dist_acc_graph.py, predictions_graph.py
-
- dist_acc_graph.py - model's distribution of accuracy chart
- predictions_graph.py - model's chart of predictions plotted along price chart
-
- backtesting/brain.py - place to set a strategy and run a backtest
- backtesting/heart.py - 'inner' processies of backtest
- backtesting/statistics.py - analisys and saving trades
- backtesting/chart.py - visualisation of strategy's performance over time
- backtesting/chart_all.py - visualisation of multiple strategies' performance over time
-
- realtime/BRAIN.py - place to set a strategy and run a bot
- realtime/HEART.py - account endpoint, placing and monitoring orders
- realtime/GENERAL.py - ulitities
LEVERAGE = 7
ORDER_SIZE = 0.1
PYRAMID_MAX = 1
THRESHOLD = 0.08
thresholds = [0.04, 0.06, 0.08, 0.1, 0.12, 0.16]
leverages = [7]
order_sizes = [0.1]
pyramid_maxes = [1]