All Projects → europa502 → Rnn Based Bitcoin Value Predictor

europa502 / Rnn Based Bitcoin Value Predictor

A Recurrent Neural Network to predict Bitcoin value

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Rnn Based Bitcoin Value Predictor

Gdax Orderbook Ml
Application of machine learning to the Coinbase (GDAX) orderbook
Stars: ✭ 60 (+185.71%)
Mutual labels:  bitcoin, recurrent-neural-networks
Time Series Machine Learning
Machine learning models for time series analysis
Stars: ✭ 261 (+1142.86%)
Mutual labels:  bitcoin, recurrent-neural-networks
Deep Trading Agent
Deep Reinforcement Learning based Trading Agent for Bitcoin
Stars: ✭ 573 (+2628.57%)
Mutual labels:  bitcoin, recurrent-neural-networks
Raspibolt
Bitcoin & Lightning full node on a Raspberry Pi
Stars: ✭ 842 (+3909.52%)
Mutual labels:  bitcoin
Token Core Ios
a blockchain private key management library on iOS
Stars: ✭ 850 (+3947.62%)
Mutual labels:  bitcoin
Lightning App
An easy-to-use cross-platform Lightning wallet
Stars: ✭ 872 (+4052.38%)
Mutual labels:  bitcoin
Blockchain Papers
区块链相关的有价值的文献
Stars: ✭ 20 (-4.76%)
Mutual labels:  bitcoin
Finch
An Open Source Cryptocurrency Payment Processor.
Stars: ✭ 27 (+28.57%)
Mutual labels:  bitcoin
Rnn lstm gesture recog
For recognising hand gestures using RNN and LSTM... Implementation in TensorFlow
Stars: ✭ 14 (-33.33%)
Mutual labels:  recurrent-neural-networks
Wanx
Utility for making crosschain transactions on the Wanchain network
Stars: ✭ 12 (-42.86%)
Mutual labels:  bitcoin
Coin Ocd
Drive yourself insane by obsessively following cryptocurrency prices
Stars: ✭ 11 (-47.62%)
Mutual labels:  bitcoin
Autotrader
The sample of BTC FX trading software for bitFlyer.
Stars: ✭ 9 (-57.14%)
Mutual labels:  bitcoin
Odyn
A prototype anonymous proof-of-work blockchain
Stars: ✭ 13 (-38.1%)
Mutual labels:  bitcoin
Jekyll Paspagon
Sell your Jekyll blog posts in various formats for cryptocurrencies.
Stars: ✭ 8 (-61.9%)
Mutual labels:  bitcoin
Udacity Deep Learning Nanodegree
This is just a collection of projects that made during my DEEPLEARNING NANODEGREE by UDACITY
Stars: ✭ 15 (-28.57%)
Mutual labels:  recurrent-neural-networks
Awesome Blockchain
⚡️Curated list of resources for the development and applications of blockchain.
Stars: ✭ 937 (+4361.9%)
Mutual labels:  bitcoin
Bitcoin Php
Bitcoin implementation in PHP
Stars: ✭ 878 (+4080.95%)
Mutual labels:  bitcoin
Lightninglib
lightninglib is a fork of lnd which aims to be usable as a go library inside any application, including mobile apps.
Stars: ✭ 11 (-47.62%)
Mutual labels:  bitcoin
Classpy
GUI tool for investigating Java class files
Stars: ✭ 854 (+3966.67%)
Mutual labels:  bitcoin
Bitcoinexchangefh
Cryptocurrency exchange market data feed handler
Stars: ✭ 871 (+4047.62%)
Mutual labels:  bitcoin

RNN-based-Bitcoin-Value-Predictor

Introduction

Recurrent Neural Networks are excellent to use along with time series analysis to predict stock prices. What is time series analysis? Time series analysis comprises methods for analyzing time series data in order to extract meaningful statistics and other characteristics of the data. Time series forecasting is the use of a model to predict future values based on previously observed values.

An example is this. Would today affect the stock prices of tomorrow? Would last week affect the stock prices of tomorrow? How about last month? Last year? Seasons or fiscal quarters? Decades? Although stock advisors may have different opinions, recurrent neural networks uses every single case and finds the best method to predict.

Problem: Client wants to know when to invest to get largest return in Dec 2017.

Data: 7 years of Bitcoin prices. (2010-2017)

Solution: Use recurrent neural networks to predict Bitcoin prices in the first week of December 2017 using data from 2010-2017.

Data

You can get up-to-date bitcoin prices in proper csv format from https://finance.yahoo.com/quote/BTC-USD/history?p=BTC-USD

Prerequisits

  • Python 3.x.x
  • Training datasets
  • Libraries-
    • tensorflow
    • keras
    • matploitlib
    • numpy
    • pandas

Visualising The Data

#Importing preprocessing libraries

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd


training_set=pd.read_csv('BTCtrain.csv')      #reading csv file
training_set.head()                           #print first five rows

Preprocessing the data

training_set1=training_set.iloc[:,1:2]        #selecting the second column
training_set1.head()                          #print first five rows
training_set1=training_set1.values            #converting to 2d array
training_set1                                 #print the whole data

#Scaling the data

from sklearn.preprocessing import MinMaxScaler
sc = MinMaxScaler()                           #scaling using normalisation 
training_set1 = sc.fit_transform(training_set1)
xtrain=training_set1[0:2694]                  #input values of rows [0-2694]		   
ytrain=training_set1[1:2695]                  #input values of rows [1-2695]

today=pd.DataFrame(xtrain)               #assigning the values of xtrain to today
tomorrow=pd.DataFrame(ytrain)            #assigning the values of xtrain to tomorrow
ex= pd.concat([today,tomorrow],axis=1)        #concat two columns 
ex.columns=(['today','tomorrow'])
xtrain = np.reshape(xtrain, (2694, 1, 1))     #Reshaping into required shape for Keras

Building the RNN

#importing keras and its packages

from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM


regressor=Sequential()                                                      #initialize the RNN

regressor.add(LSTM(units=4,activation='sigmoid',input_shape=(None,1)))      #adding input layerand the LSTM layer 

regressor.add(Dense(units=1))                                               #adding output layers

regressor.compile(optimizer='adam',loss='mean_squared_error')               #compiling the RNN

regressor.fit(xtrain,ytrain,batch_size=32,epochs=2000)                      #fitting the RNN to the training set  

Making Predictions

# Reading CSV file into test set
test_set = pd.read_csv('BTCtest.csv')
test_set.head()


real_stock_price = test_set.iloc[:,1:2]         #selecting the second column

real_stock_price = real_stock_price.values      #converting to 2D array

#getting the predicted BTC value of the first week of Dec 2017  
inputs = real_stock_price			
inputs = sc.transform(inputs)
inputs = np.reshape(inputs, (8, 1, 1))
predicted_stock_price = regressor.predict(inputs)
predicted_stock_price = sc.inverse_transform(predicted_stock_price)

Visualising the result

plt.plot(real_stock_price, color = 'red', label = 'Real BTC Value')
plt.plot(predicted_stock_price, color = 'blue', label = 'Predicted BTC Value')
plt.title('BTC Value Prediction')
plt.xlabel('Days')
plt.ylabel('BTC Value')
plt.legend()
plt.show()

Results

screenshot from 2017-12-09 05-40-01

You can surely increase the accuracy up to a limit by increasing the epochs.

regressor.fit(xtrain,ytrain,batch_size=32,epochs=2000)                      #fitting the RNN to the training set 

Reference-

kimanalytics - Recurrent Neural Network to Predict Tesla's Stock Prices

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].