Python Package to create a pipeline for price prediction using a keras neural network model.
View Test
·
Report Bug
·
Request Feature
This is a small package to produce pipelines to predict the btc price using keras neural networks.
This project was builded with the next technologies.
Follow the next steps:
- Setup the project:
python setup.py sdist
- Build the package:
python setup.py build
- Install the package
python setup.py install
- Install the package using pip.
pip install crypto_prediction
Just need to use pip with git command:
pip install git+https://github.com/estebanvz/crypto_prediction.git
Get the keys from API Binance:
You can use the package using the api_key and api_secret from binance API. Also you could download the package crypo_price to download data from Binance API. Crypto Price Package
import os
import keras
from crypto_prediction import CryptoPredictor
c_predictor = CryptoPredictor(time_interval="1d")
c_predictor.download_crypto_dataset()
c_predictor.calculate_metrics()
c_predictor.load_dataset(path="datasets/1d/BTCUSDT.csv")
c_predictor.lag_variables(n_lags=60)
c_predictor.calculate_labels(n_times_future=5)
## To train a new model you can use split and normalize dataset function
# x_train_n, x_test_n, y_train, y_test = c_predictor.normalize_split_dataset(split_data=100)
regressor = keras.models.load_model("btcusdt1d0.039mae.h5")
c_predictor.set_keras_model(keras_model=regressor)
c_predictor.draw_prediction(x_test_n=x_test_n,n_future_steps=2)
The black line is the real price and the green dotted lines are the prediction made by the algorithm.
The real price on tradingview show us that the prediction of the algorithm was accurate.
We can observe how the algorithm developed to test this pipeline produce a prediction of one day in the future that predict a range. The real price movement the next day was too close to the prediction of the algorithm.
It is needed more research in this algorithm to produce better results. The algorithm evaluated in this model produces a MAE of 0.021 in 100 days test dataset.
Distributed under the MIT License. See LICENSE
for more information.
Esteban Vilca - @ds_estebanvz - [email protected]
Project Link: https://github.com/estebanvz/crypto_prediction