The purpose of this study is to design and develop a DNN based deep learning model for prediction of future bitcoin prices while examining if there is a correlation between social media and cryptocurrencies. Even though Long short-term memory models are popular for time series prediction, Deep Neural Network was chosen for model because to focus on how social media affects cryptocurrency prices, rather than other factors.
Open-source dataset "Bitcoin 17.7 million Tweets and price" is used to train the model. This dataset contains the average sentiment of all tweets about bitcoin from 01/08/2017 until 21/01/2019. It also contains the financial data of bitcoin for that same period. This dataset contains 14 different values to use, such as opening price of bitcoin, number of negative tweets. There was some missing data for some specific days, but I removed all of the values belonging to those days by hand. I also removed some columns that I thought were not needed for my project. In conclusion, I just used the columns of "Count_Negatives", "Count_Neutrals", "Count_Positives", "Open" and "Close.
This dataset can be found at: www.kaggle.com/jaimebadiola/bitcoin-tweets-and-price?select=Data_To_Hourervals_no_filter.csv
- Tensorflow
- Keras
- Sklearn
- Matplotlib
- Joblib
- Pandas
- Numpy
Train your own model by using "Training.ipynb". Just enter your dataset's path into the following code, and then execute. You can also skip this process. All you have to do is using "model.h5" and "scaler.bin" files from main.
dataset = pd.read_csv(
"/content/drive/MyDrive/TwitterBitcoinTahminSistemi/Dataset/TwitterDataset.csv" , delimiter=';')
dataset.head()
Use "Prediction.ipynb" to predict the bitcoin price after an hour. If you don't want to train your own model, you can use already trained model "model.h5" and "scaler.bin" from main.
def prediction(Negative, Neutral, Positive, Open ):
model = load_model(# Your model's path)
scaler=load(# Your scaling parameter's path)
# Please enter values in such way : prediction(Number of Negative Tweets, Number of Neutral Tweets, Number of Positive Tweets, Current Bitcoin Value)
prediction(148,200,200,2980.81)
The result:
1/1 [==============================] - 10s 10s/step
[[3000.3662]]
Two metrics used to measure accuracy in this project. Mean absolute error of the model is 98 and mean absolute percentage error is 1.47%. You can also examine model's training history from the following figure: