In this recipe, we will learn how to predict future Bitcoin value with an RNN. The key idea is that the temporal sequence of values observed in the past is a good predictor of future values. For this recipe, we will use the code available at https://github.com/guillaume-chevalier/seq2seq-signal-prediction under the MIT license. The Bitcoin value for a given temporal interval is downloaded via an API from https://www.coindesk.com/api/ . Here is a piece of the API documentation:
We offer historical data from our Bitcoin Price Index through the following endpoint:
https://api.coindesk.com/v1/bpi/historical/close.json
By default, this will return the previous 31 days' worth of data. This endpoint accepts the following optional parameters:
?index=[USD/CNY]The index to return data for. Defaults to USD.
?currency=<VALUE>The currency to return the data in, specified in ISO 4217 format. Defaults to USD.
?start=<VALUE>&end=<VALUE> Allows data to be returned for a specific date range. Must be listed as a pair of start and end parameters, with dates supplied in the YYYY-MM-DD format, e.g. 2013-09-01 for September 1st, 2013.
?for=yesterday Specifying this will return a single value for the previous day. Overrides the start/end parameter.
Sample Request:
https://api.coindesk.com/v1/bpi/historical/close.json?start=2013-09-01&end=2013-09-05
Sample JSON Response:
{"bpi":{"2013-09-01":128.2597,"2013-09-02":127.3648,"2013-09-03":127.5915,"2013-09-04":120.5738,"2013-09-05":120.5333},"disclaimer":"This data was produced from the CoinDesk Bitcoin Price Index. BPI value data returned as USD.","time":{"updated":"Sep 6, 2013 00:03:00 UTC","updatedISO":"2013-09-06T00:03:00+00:00"}}
https://api.coindesk.com/v1/bpi/historical/close.json
By default, this will return the previous 31 days' worth of data. This endpoint accepts the following optional parameters:
?index=[USD/CNY]The index to return data for. Defaults to USD.
?currency=<VALUE>The currency to return the data in, specified in ISO 4217 format. Defaults to USD.
?start=<VALUE>&end=<VALUE> Allows data to be returned for a specific date range. Must be listed as a pair of start and end parameters, with dates supplied in the YYYY-MM-DD format, e.g. 2013-09-01 for September 1st, 2013.
?for=yesterday Specifying this will return a single value for the previous day. Overrides the start/end parameter.
Sample Request:
https://api.coindesk.com/v1/bpi/historical/close.json?start=2013-09-01&end=2013-09-05
Sample JSON Response:
{"bpi":{"2013-09-01":128.2597,"2013-09-02":127.3648,"2013-09-03":127.5915,"2013-09-04":120.5738,"2013-09-05":120.5333},"disclaimer":"This data was produced from the CoinDesk Bitcoin Price Index. BPI value data returned as USD.","time":{"updated":"Sep 6, 2013 00:03:00 UTC","updatedISO":"2013-09-06T00:03:00+00:00"}}