psysky
psysky

Reputation: 3195

Getting financial history using R

I want to take minute-long history of the usd/btc exchange rate interactively, I found this site http://www.coindesk.com/price/

Note: ( if you think there is a more convenient site for this task, I'll be glad if you share it. I don't want every time download csv. Moreover it is incorrect.) But I don't know how to use R to collect information.

Is it possible using R to connect and collect minute data on the exchange rate of USD / BTC?

Ideal output. 1h button for minutes exchange rate

dmy mm             exchange
12.09.2018 13:45    6200
12.09.2018 13:46    6300
12.09.2018 13:46    6400

Collection must be continuous, my server is very rarely turned off.

exchange

Upvotes: 0

Views: 79

Answers (1)

Eugene Brown
Eugene Brown

Reputation: 4362

You can get raw data from coindesk using their API: https://www.coindesk.com/api/

For example, you can get the current price of bitcoin in USD by visiting this URL: https://api.coindesk.com/v1/bpi/currentprice/USD.json. I suggest you set up a script to retrieve this data once every minute.

Or you can get a recent history of the price at this endpoint: https://api.coindesk.com/v1/bpi/historical/close.json, though note this only the daily price.

To learn how to retrieve data from an API using R I suggest you follow a tutorial such as this one: https://www.programmableweb.com/news/how-to-access-any-restful-api-using-r-language/how-to/2017/07/21.

Upvotes: 3

Related Questions