library(jsonlite)
url <- "https://min-api.cryptocompare.com/data/v2/histoday?fsym=BTC&tsym=USD&limit=100"
url
## [1] "https://min-api.cryptocompare.com/data/v2/histoday?fsym=BTC&tsym=USD&limit=100"
jsonfile <- fromJSON(url)
data <- jsonfile$Data$Data
head(data)
## time high low open volumefrom volumeto close
## 1 1769299200 89203.31 86008.64 89107.75 19788.52 1730278902 86581.03
## 2 1769385600 88787.86 86429.64 86581.03 28600.46 2509845962 88274.70
## 3 1769472000 89447.82 87212.27 88274.70 24324.97 2147188639 89136.28
## 4 1769558400 90481.33 88729.36 89136.28 27525.65 2461353227 89182.72
## 5 1769644800 89229.19 83243.73 89182.72 45122.46 3865349822 84528.58
## 6 1769731200 84612.31 81047.62 84528.58 53884.23 4468762184 84135.11
## conversionType conversionSymbol
## 1 direct
## 2 direct
## 3 direct
## 4 direct
## 5 direct
## 6 direct
max_close <- max(data$close, na.rm = FALSE)
max_close
## [1] 89182.72
cat("The maximum daily close price for Bitcoin over the last 100 days is", max_close, "USD.")
## The maximum daily close price for Bitcoin over the last 100 days is 89182.72 USD.