I'm attempting to export stock price data from the R program using the "quantmod" package. It provides me with data at a daily frequency, but I need to change it to a frequency of 10 minutes or 30 minutes. Unfortunately, I have not been successful in doing so. i tried the following code
`library(quantmod)
# symbol
symbol <- "GC=F"
# time range (last 100 days)
start_date <- Sys.Date() - 100
end_date <- Sys.Date()
getSymbols(symbol, from = start_date, to = end_date, interval = "10 mins")
gold_data <- Cl(get(symbol))
plot(gold_data)`
You need a new-ish version (from GitHub) but this should be on CRAN "soon" too.
As you see in the message, only up to 7 days can be retrieved for intra-day data. On the other hand it allows minute data so you can grow some intra-day archives on a rolling-forward basis if you archive the snapshots locally.