設定策略(I)

R 的金融交易

Ilya Kipnis

Professional Quantitative Analyst and R programmer

三個重要日期

  • quantstrat 需要 initDate、from 與 to 三個日期。

  • YYYY-MM-DD,例如「2000-01-01」

initdate <- "1999-01-01"
from <- "2003-01-01"
to <- "2015-12-31"
R 的金融交易

設定 quantstrat

# 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)
R 的金融交易

總覽

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)        
R 的金融交易

一起來練習吧!

R 的金融交易

Preparing Video For Download...