« Differential Privacy Mini-series from Win-Vector | Main | Using the wakefield package to easily generate reproducible sample data »

November 04, 2015

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Very nice post as usual just a quick comment on loading json into R. RJSONIO is a great package and was (probably) the first but I usually find the jsonlite quite handy for such task (turning json to data.frame).

library(jsonlite)
Sys.time()
## [1] "2015-11-04 21:30:01 GMT"

url <- "https://www.bitstamp.net/api/transactions/"
bs_data <- fromJSON(url)
head(bs_data)
## date tid price type amount
## 1 1446672036 9705951 447.06 0 0.23835325
## 2 1446672033 9705950 446.81 1 2.00813949
## 3 1446672033 9705949 447.07 1 1.90280000
## 4 1446672033 9705948 448.01 1 0.08906051
## 5 1446672033 9705947 449.99 0 0.01990086
## 6 1446672033 9705946 449.99 0 0.05703000

url_m <- "http://api.bitcoincharts.com/v1/markets.json"
mkt_data <- fromJSON(url_m)
head(mkt_data)
## volume latest_trade bid high currency
## 1 4636.68 1446672236 6201100.00 6799000.00 IDR
## 2 2858.32 1446671681 231017.04 1988.64 USD
## 3 0.00 1415135720 342.87 NA USD
## 4 0.00 1444487795 383.61 NA SGD
## 5 437.26 1446672097 417.97 438.27 EUR
## 6 0.00 1414593608 25000.00 NA XRP
## currency_volume ask close avg symbol
## 1 2.8185e+10 6299900.00 6169000.00 6078724.21 btcoidIDR
## 2 1.3805e+06 231.48 641.85 482.97 localbtcUSD
## 3 0.0000e+00 347.87 327.42 NA rippleUSD
## 4 0.0000e+00 409.25 341.73 NA anxhkSGD
## 5 1.8746e+05 418.40 417.97 428.70 zyadoEUR
## 6 0.0000e+00 74998.00 64001.00 NA justXRP
## low
## 1 5150100.00
## 2 298.90
## 3 NA
## 4 NA
## 5 414.36
## 6 NA

Hi, Rbitcoin author here. I've made one more package worth to mention. https://github.com/jangorecki/rbitcoind - is used to "speak" with bitcoin daemon and so accept/process payments, manage wallet etc. Example of shiny app accepting bitcoin payments is here https://github.com/jangorecki/shinyPay
Cheers

Hello Dickoah,

Thank you for the kind words and the example from jsonlite.
Very nice!
Best regards,
JR

This is great information. I can use this data for real world purposes that are completely unrelated to bitcoin mining, buying or selling.

I would really be interested in changing:
"dyRangeSelector(dateWindow = c("2011-09-13","2015-11-02"))"

so that the second value in the dateWindow is "today - 1 day"

I tried:
"dyRangeSelector(dateWindow = c("2011-09-13",Sys.Date()))"

but get:
"Error in as.POSIXlt.character(x, tz, ...) :
character string is not in a standard unambiguous format"

The comments to this entry are closed.

Search Revolutions Blog




Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr
‚Äč