1 / 8

LondonR 18 th September 2012

LondonR 18 th September 2012. SPONSORED BY. R TRAINING, CONSULTING & APPLICATION DEVELOPMENT. From Back-test to Trade using R Parallelization in OneTick. jjames@mango-solutions.com andrew.diamond@onetick.com. What the presentation shows. EURJPY FX tick data

lotta
Download Presentation

LondonR 18 th September 2012

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LondonR18th September 2012 SPONSORED BY R TRAINING, CONSULTING & APPLICATION DEVELOPMENT

  2. From Back-test to Trade using R Parallelization in OneTick jjames@mango-solutions.com andrew.diamond@onetick.com

  3. What the presentation shows • EURJPY FX tick data • Take a small section of historic tick data • Look at rugarch analyses • Ability to use parallelisation effectively • How? • 5 minute architectural overview of OneTick • Questions around tick data management • Q & A?

  4. OneTick

  5. Deal with idiosyncrasies of tick data > setClass("TK", representation="POSIXct") > TK <- function(x)new("TK", as.POSIXct(x, format="%Y%m%d %H:%M:%OS")) > setOldClass("TK", S4Class="TK", where=.GlobalEnv) > > as.TK <- function(from)TK(as.POSIXct(from, format="%Y%m%d %H:%M:%OS", tz="GMT")) > setAs("character", "TK", as.TK) > setAs("TK", "POSIXct", function(from)as.POSIXct(as.numeric(from), origin="1970-01-01", tz="GMT")) [1] "coerce<-" > as.TK <- function(from)TK(as.POSIXct(from, format="%Y%m%d %H:%M:%OS", tz="GMT")) > setAs("character", "TK", as.TK) > setAs("TK", "POSIXct", function(from)as.POSIXct(as.numeric(from), origin="1970-01-01", tz="GMT")) [1] "coerce<-" > print.TK <- function(x, ...)print(format(as(x,"POSIXct"), format="%Y%m%d %H:%M:%OS3",...)) > setGeneric("print.TK", print.TK) [1] "print.TK" > setMethod("show", signature(object="TK"), function(object)print(format(object, format="%Y%m%d %H:%M:%OS3"))) [1] "show"

  6. perform (arbitrarily) garch ####### require(rugarch) spec = ugarchspec() ## Assume that the points are distributed fit = ugarchfit(data = diff(EURJPY[select,3]), spec = spec) plot(fit,which="all") # return just to the rate data fit = ugarchfit(data = EURJPY[select,3], spec = spec) plot(fit,which="all") forc = ugarchforecast(fit, n.ahead=20) plot(forc, which="all")

  7. Look for rolling values ctrl = list(rho = 1, delta = 1e-9, outer.iter = 100, tol = 1e-7) spec = ugarchspec(variance.model = list(model = "eGARCH"), distribution.model = "jsu") bktest <- ugarchroll(spec, data = EURJPY[select,3], n.ahead = 1, # parallel = TRUE, parallel.control = list(pkg = c("snowfall"), cores = 4), forecast.length = 100, refit.every = 25, refit.window = "recursive", solver = "solnp", fit.control = list(), solver.control = ctrl, calculate.VaR = TRUE, VaR.alpha = c(0.01, 0.025, 0.05)) plot(bktest, which="all")

  8. Look for rolling values ## BID=BID_PRICE,ASK=ASK_PRICE len<- length(BID) mu=NA alpha1=NA bktest <- NA if(len>110){ tryCatch({bktest <- ugarchroll(spec, data = BID, n.ahead = 1, forecast.length = 100, refit.every = 25, refit.window = "recursive", parallel = TRUE, parallel.control = list(pkg = "snowfall", cores = 4), solver = "solnp", fit.control = list(), solver.control = ctrl, calculate.VaR = TRUE, VaR.alpha = c(0.01, 0.025, 0.05)) mu=bktest@roll["coefs"][[1]][1,"mu"] alpha1=bktest@roll["coefs"][[1]][1,"alpha1"]}, error=function(e)cat("Error\n")) } ## OneTick outputs ## MU=mu,ALPHA1=alpha1, LEN=len

More Related