|
Hello,
say you want to determine the number of trading days for DAX options on EUREX from now til day x. I am looking for a function for this task. Looked in package timeDate but found nothing for the german exchanges. Can somebody help, please? Joachim _______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. |
|
Hello Joachim,
Why not create a holidayEUREX yourself? Look at holidayNYSE for an example and it should not be too difficult. Regards, -Mark- 2011/12/30 Joachim Breit <[hidden email]> > Hello, > > say you want to determine the number of trading days for DAX options on > EUREX from now til day x. > > I am looking for a function for this task. > > Looked in package timeDate but found nothing for the german exchanges. > > Can somebody help, please? > > Joachim > > ______________________________**_________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/**listinfo/r-sig-finance<https://stat.ethz.ch/mailman/listinfo/r-sig-finance> > -- Subscriber-posting only. If you want to post, subscribe first. > -- Also note that this is not the r-help list where general R questions > should go. > [[alternative HTML version deleted]] _______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. |
|
Mark, I was hoping that somebody else had done that job already... :-)
After all, I should not be the only person interested in the problem. Besides, function holidayNYSE looks intimidating for an R newbie. Regards, Joachim Am 31.12.2011 10:37, schrieb Mark Breman: > Hello Joachim, > > Why not create a holidayEUREX yourself? Look at holidayNYSE for an > example and it should not be too difficult. > > Regards, > > -Mark- > > > 2011/12/30 Joachim Breit <[hidden email] <mailto:[hidden email]>> > > Hello, > > say you want to determine the number of trading days for DAX options > on EUREX from now til day x. > > I am looking for a function for this task. > > Looked in package timeDate but found nothing for the german exchanges. > > Can somebody help, please? > > Joachim > > _________________________________________________ > [hidden email] <mailto:[hidden email]> > mailing list > https://stat.ethz.ch/mailman/__listinfo/r-sig-finance > <https://stat.ethz.ch/mailman/listinfo/r-sig-finance> > -- Subscriber-posting only. If you want to post, subscribe first. > -- Also note that this is not the r-help list where general R > questions should go. > > _______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. |
|
Hi Joachim, I don't think you need much experience with R to count the days; but it may take some work to tabulate the holidays. You could do something like this: start <- as.Date("2012-01-01") end <- as.Date("2012-12-31") ## define a list of holidays holidays <- as.Date(c("2012-01-01","2012-12-25")) ## create date sequence allDates <- seq(start, end, by = "day") ## remove weekends dayofweek <- as.POSIXlt(allDates)$wday isweekend <- dayofweek==0L | dayofweek==6L allDates <- allDates[!isweekend] ## delete holidays allDates <- allDates[-match(holidays, allDates, nomatch = 0L)] ## count (including 'start' and 'end') length(allDates) Quite a lot of this seems already implemented in package RQuantLib. I say 'seems' because I do not use these functions, so I cannot guarantee that the package gives you what you need. Try this: require("RQuantLib") allDates <- seq(start, end, by = "day") istradingday <- !isHoliday("Germany/Eurex", allDates) length(allDates[istradingday]) ## or ... businessDaysBetween(calendar = "Germany/Eurex", from = start, to = end, includeFirst = 1, includeLast = 1) Regards, Enrico -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ Am 02.01.2012 09:08, schrieb Joachim Breit: > Mark, I was hoping that somebody else had done that job already... :-) > After all, I should not be the only person interested in the problem. > Besides, function holidayNYSE looks intimidating for an R newbie. > > Regards, > Joachim > > Am 31.12.2011 10:37, schrieb Mark Breman: >> Hello Joachim, >> >> Why not create a holidayEUREX yourself? Look at holidayNYSE for an >> example and it should not be too difficult. >> >> Regards, >> >> -Mark- >> >> >> 2011/12/30 Joachim Breit <[hidden email] <mailto:[hidden email]>> >> >> Hello, >> >> say you want to determine the number of trading days for DAX options >> on EUREX from now til day x. >> >> I am looking for a function for this task. >> >> Looked in package timeDate but found nothing for the german exchanges. >> >> Can somebody help, please? >> >> Joachim >> >> _________________________________________________ >> [hidden email] <mailto:[hidden email]> >> mailing list >> https://stat.ethz.ch/mailman/__listinfo/r-sig-finance >> <https://stat.ethz.ch/mailman/listinfo/r-sig-finance> >> -- Subscriber-posting only. If you want to post, subscribe first. >> -- Also note that this is not the r-help list where general R >> questions should go. >> >> > > _______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-finance > -- Subscriber-posting only. If you want to post, subscribe first. > -- Also note that this is not the r-help list where general R questions > should go. > -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ _______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. |
|
Thank you, Enrico. I wasn't aware of the RQuantLib functions. Looks good...
Regards, Joachim Am 02.01.2012 17:55, schrieb Enrico Schumann: > > Hi Joachim, > > I don't think you need much experience with R to count the days; but it > may take some work to tabulate the holidays. > > You could do something like this: > > start <- as.Date("2012-01-01") > end <- as.Date("2012-12-31") > > ## define a list of holidays > holidays <- as.Date(c("2012-01-01","2012-12-25")) > > ## create date sequence > allDates <- seq(start, end, by = "day") > > ## remove weekends > dayofweek <- as.POSIXlt(allDates)$wday > isweekend <- dayofweek==0L | dayofweek==6L > allDates <- allDates[!isweekend] > > ## delete holidays > allDates <- allDates[-match(holidays, allDates, nomatch = 0L)] > > ## count (including 'start' and 'end') > length(allDates) > > > Quite a lot of this seems already implemented in package RQuantLib. I > say 'seems' because I do not use these functions, so I cannot guarantee > that the package gives you what you need. Try this: > > > require("RQuantLib") > allDates <- seq(start, end, by = "day") > istradingday <- !isHoliday("Germany/Eurex", allDates) > length(allDates[istradingday]) > > ## or ... > businessDaysBetween(calendar = "Germany/Eurex", > from = start, > to = end, > includeFirst = 1, includeLast = 1) > > Regards, > Enrico > > _______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. |
| Powered by Nabble | Edit this page |
