Financial Trading in R
Ilya Kipnis
Professional Quantitative Analyst and R programmer
Quantstrat needs an initDate, a from date, and a to date.
YYYY-MM-DD, eg “2000-01-01”
initdate <- "1999-01-01"
from <- "2003-01-01"
to <- "2015-12-31"
# Set system environment timezone:
Sys.setenv(TZ = "UTC")
# Set currency (we’ll use USD for now):
currency("USD")
# Obtain financial data:
getSymbols("LQD", from = from, to = to,
src = "yahoo", adjust = TRUE)
# Treat as basic equity
stock("LQD", currency = "USD", multiplier = 1)
initDate = "1999-01-01"
from = "2003-01-01"
to = “2015-12-31"
Sys.setenv(TZ = "UTC")
currency("USD")
getSymbols("LQD", from = from, to = to, src = "yahoo",
adjust = TRUE)
Financial Trading in R