Page 1 of 1

incorporating holiday calendar while generating business days

Posted: May 9th, 2014, 6:36 pm
by surya2cents
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.

incorporating holiday calendar while generating business days

Posted: May 9th, 2014, 6:57 pm
by Cuchulainn
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).

incorporating holiday calendar while generating business days

Posted: May 9th, 2014, 7:37 pm
by Hansi
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.

incorporating holiday calendar while generating business days

Posted: May 9th, 2014, 10:42 pm
by surya2cents
Thanks Cuch & Hansi. Will check out QL.

incorporating holiday calendar while generating business days

Posted: May 10th, 2014, 11:28 am
by Cuchulainn
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.

incorporating holiday calendar while generating business days

Posted: May 10th, 2014, 3:53 pm
by Cuchulainn
QuoteOriginally posted by: outrunforcing jan 1st to be on a monday?Iceland is brilliant!

incorporating holiday calendar while generating business days

Posted: May 11th, 2014, 10:47 am
by Hansi
Yeah I don't get that reference but January 1st is always a holiday.

incorporating holiday calendar while generating business days

Posted: May 11th, 2014, 11:28 am
by Cuchulainn
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?

incorporating holiday calendar while generating business days

Posted: May 11th, 2014, 6:04 pm
by Hansi
It might do that in some countries but it doesn't apply in Iceland.

incorporating holiday calendar while generating business days

Posted: May 11th, 2014, 7:07 pm
by Polter
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:

incorporating holiday calendar while generating business days

Posted: May 14th, 2014, 8:27 am
by Cuchulainn
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.

incorporating holiday calendar while generating business days

Posted: May 14th, 2014, 12:08 pm
by Hansi
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