getSymbols {rtsdata} | R Documentation |
Download historical data
Description
Overwrite the getSymbols function from 'quantmod' package to efficiently load historical data
Usage
getSymbols(
Symbols = NULL,
env = parent.frame(),
reload.Symbols = FALSE,
verbose = FALSE,
warnings = TRUE,
src = "yahoo",
symbol.lookup = TRUE,
auto.assign = TRUE,
from = "1990-01-01",
to = Sys.time(),
calendar = NULL,
check.update = NULL,
full.update = NULL
)
Arguments
Symbols |
list symbols to download historical data |
env |
environment to hold historical data, defaults to parent.frame() |
reload.Symbols |
flag, not used, inherited from the getSymbols function from 'quantmod' package, defaults to FALSE |
verbose |
flag, inherited from the getSymbols function from 'quantmod' package, defaults to FALSE |
warnings |
flag, not used, inherited from the getSymbols function from 'quantmod' package, defaults to TRUE |
src |
source of historical data, defaults to 'yahoo' |
symbol.lookup |
flag, not used, inherited from the getSymbols function from 'quantmod' package, defaults to TRUE |
auto.assign |
flag to store data in the given environment, defaults to TRUE |
from |
start date, expected in yyyy-mm-dd format, defaults to 1900-01-01 |
to |
end date, expected in yyyy-mm-dd format, defaults to today's date |
calendar |
RQuantLib's holiday calendar, for example: calendar = 'UnitedStates/NYSE', defaults to NULL |
check.update |
flag to check for updates, defaults to NULL |
full.update |
flag to force full update, defaults to NULL |
Value
xts object with data
Examples
# small toy example
# register data source to generate fake stock data for use in rtsdata examples
register.data.source(src = 'sample', data = ds.getSymbol.fake.stock.data)
# Full Update till '2018-02-13'
data = getSymbols('test', src = 'sample', from = '2018-01-01', to = '2018-02-13',
auto.assign=FALSE, verbose=TRUE)
# No updated needed, data is loaded from file
data = getSymbols('test', src = 'sample', from = '2018-01-01', to = '2018-02-13',
auto.assign=FALSE, verbose=TRUE)
# Incremental update from '2018-02-13' till today
data = getSymbols('test', src = 'sample', from = '2018-01-01',
auto.assign=FALSE, verbose=TRUE)
# No updated needed, data is loaded from file
data = getSymbols('test', src = 'sample', from = '2018-01-01',
auto.assign=FALSE, verbose=TRUE)
# data is stored in the 'sample_Rdata' folder at the following location
ds.default.location()
ds.getSymbol.yahoo('AAPL',from='2018-02-13')