[R-SIG-Finance] How to calculate Trading Days

Noah Silverman noah at smartmediacorp.com
Sun Nov 7 02:35:13 CET 2010


Hi,

I'm working on some option value pricing models. Starting with the 
GBSvolatility for example.  All of the various formulas require a Time 
parameter (fraction of year) until expiration. Ideally, I want to 
compute it as:
"trading days until expiration" / 252

Give two days, I can use the difftimeDate to get the number of days 
between them, However I can't seem to find a way to get Trading Days 
(which excludes weekends and holidays.)  I've looked through rseek.org 
and many library's documentation, but can't find a way to do this.

One thought would be to generate a vector of dates between the start and 
end days.  Then test EACH date to see if it was a holiday or weekend.  
This could work, but seems very inefficient.

Does anyone know of a way to calculate Trading Days between two dates???
(Surely I can't be the only person here who needs this in R.)

Thanks!!!

--
Noah



More information about the R-SIG-Finance mailing list