Serving the Quantitative Finance Community

 
User avatar
surya2cents
Topic Author
Posts: 0
Joined: January 30th, 2009, 8:04 pm

incorporating holiday calendar while generating business days

May 9th, 2014, 6:36 pm

I am trying to produce realistic schedule generation using holiday calendars. Are there good sources of obtaining holiday calendars ? Anything to watch out for while implementing in C# or Python ? I will be implementing the following natural method - getNthBday which given a date and a holiday calendar and a N, will return the Nth business day per that calendar.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

incorporating holiday calendar while generating business days

May 9th, 2014, 6:57 pm

My guess is that C++ is well-developed here (QL) or Boost Date even. If they are suitable then it is not too difficult to link them up to C# via the Managed C++ (aka C++/CLI).
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

incorporating holiday calendar while generating business days

May 9th, 2014, 7:37 pm

Yes I agree quantlib is the best choice since it gets updated often enough when there is a change in holidays and covers most if not all countries with active trading being done there.Heck it even has Iceland which closed most foreign investments off in 2008.
 
User avatar
surya2cents
Topic Author
Posts: 0
Joined: January 30th, 2009, 8:04 pm

incorporating holiday calendar while generating business days

May 9th, 2014, 10:42 pm

Thanks Cuch & Hansi. Will check out QL.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

incorporating holiday calendar while generating business days

May 10th, 2014, 11:28 am

QuoteOriginally posted by: HansiYes I agree quantlib is the best choice since it gets updated often enough when there is a change in holidays and covers most if not all countries with active trading being done there.Heck it even has Iceland which closed most foreign investments off in 2008.Good to see the influence of Irish (Vestmenn) monks on Icelandic holidays.
Last edited by Cuchulainn on May 9th, 2014, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

incorporating holiday calendar while generating business days

May 10th, 2014, 3:53 pm

QuoteOriginally posted by: outrunforcing jan 1st to be on a monday?Iceland is brilliant!
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

incorporating holiday calendar while generating business days

May 11th, 2014, 10:47 am

Yeah I don't get that reference but January 1st is always a holiday.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

incorporating holiday calendar while generating business days

May 11th, 2014, 11:28 am

QuoteOriginally posted by: HansiYeah I don't get that reference but January 1st is always a holiday.Maybe it means if Jan 1 falls on a Sunday you get Monday free?
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

incorporating holiday calendar while generating business days

May 11th, 2014, 6:04 pm

It might do that in some countries but it doesn't apply in Iceland.
 
User avatar
Polter
Posts: 1
Joined: April 29th, 2008, 4:55 pm

incorporating holiday calendar while generating business days

May 11th, 2014, 7:07 pm

surya2cents, since you've mentioned you're also considering implementing in Python you may also be interested in PyQL (cleaner than SWIG-generated wrappers):http://dpinte.wordpress.com/2012/03/23/ ... k/Examples: https://github.com/enthought/pyql/tree/ ... lesThere's been a presentation about it at the New York Finance Python User's Group (NY FPUG):Slides: http://public.enthought.com/~kjordahl/F ... -2013Video:
Last edited by Polter on May 10th, 2014, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

incorporating holiday calendar while generating business days

May 14th, 2014, 8:27 am

IMO Python is OK for a prototype solution but lacks the robustness and efficiency of languages such as C# and C++. Correct me if I am wrong. How is the easiness of Python-Excel interop?One initial point is determining the provides-requires interfaces between your system and QL. This determines what you need to wrap in QL. See how R does itIn C#, you can do something similar 1. Wrapper C++/CLI class as in section 11.5 of our C# book. at the least I suppose you need isHoliday(Date) function?2. You will probably need to create a converter between QL Date and .NET DateTime. OK3. C# - Excel is an advantage (e.g. Excel-DNA)Of course, there are many other solutions and this is one of them. Choosing the one that best suits you is not diissimlar to a constrained optimisation problem in ISO 9126 space.
Last edited by Cuchulainn on May 13th, 2014, 10:00 pm, edited 1 time in total.
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

incorporating holiday calendar while generating business days

May 14th, 2014, 12:08 pm

QuoteOriginally posted by: CuchulainnIMO Python is OK for a prototype solution but lacks the robustness and efficiency of languages such as C# and C++. Correct me if I am wrong. How is the easiness of Python-Excel interop?I'd say they are now a days pretty similar in terms of ease of use and robustness. Speed is still an issue for Python though, but development speed somewhat offsets that.For normal interop there are COM wrappers and for an Excel-DNA "equivilent" there is PyXLL