(1) get.hist.quote
example:
get.hist.quote(instrument = "^gdax", start, end,
quote = c("Open", "High", "Low", "Close"),
provider = c("yahoo", "oanda"), method = NULL,
origin = "1899-12-30", compression = "d",
retclass = c("zoo", "its", "ts"), quiet = FALSE, drop = FALSE)
instrument:a string that contact of the name of dataset you download.
quote: the variables that you want to download
start:the start time to download
end: the end time of time series
provider:'yahoo' or 'oanda'
compression:'d','m', monthly or daily.
something to remember:when you use the oanda, the max time span is 500 day.
(2) Use quantmod library to install the packages.
install.packages('quantmod')
library(quantmod)
# use this to extact data
getSymbols('^GSPC',from='1970-01-01',to='2009-09-15')
colnames(GSPC)<-c('Open','High','Low','Close','Volume','Adjcolse')
setSymbolLookup(IBM=list(name='IBM',src='yahoo'),USDEUR=list(name='USD/EUR'
,src='oanda'))
getSymbols(c('IBM','USDEUR'))