Sätta upp en strategi I

Finansiell handel i R

Ilya Kipnis

Professional Quantitative Analyst and R programmer

Tre viktiga datum

  • Quantstrat behöver ett initDate, ett from-datum och ett to-datum.

  • YYYY-MM-DD, t.ex. "2000-01-01"

initdate <- "1999-01-01"
from <- "2003-01-01"
to <- "2015-12-31"
Finansiell handel i R

Konfigurera 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)
Finansiell handel i R

Översikt

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)        
Finansiell handel i R

Nu kör vi en övning!

Finansiell handel i R

Preparing Video For Download...