lballabio / quantlib-old

The QuantLib C++ library and extensions (warning: out of date)
http://quantlib.org
471 stars 405 forks source link

Improved Saudi Arabia calendar (no rename) #363

Closed jrvarma closed 8 years ago

jrvarma commented 8 years ago

The Saudi Arabian (Tadawul Exchange) calendar in QuantLib has not been updated since 2011 and does not reflect the change in the weekend (from Thu/Fri to Fri/Sat) that was made in 2013. Also, the data on the Eid holidays (which varies from year to year) are available sparsely for 2004-2011 only.

This patch is an attempt to improve the QuantLib implementation of the Saudi calendar. It implements the change in the weekend and also populates the Eid dates for about 30 years using public sources. This is still imperfect as it assumes that the Eid holidays are for a fixed number of days around the actual Eid dates, though in practice the duration of the holidays also varies. Also one-off holidays are ignored.

The Saudi Arabian (Tadawul Exchange) calendar in QuantLib has not been updated since 2011 and does not reflect the change in the weekend (from Thu/Fri to Fri/Sat) that was made in 2013. Also, the data on the Eid holidays (which varies from year to year) are available sparsely for 2004-2011 only.

This pull request is an attempt to improve the QuantLib implementation of the Saudi calendar. It implements the change in the weekend and also populates the Eid dates for about 30 years using public sources. This is still imperfect as it assumes that the Eid holidays are for a fixed number of days around the actual Eid dates, though in practice the duration of the holidays also varies. Also one-off holidays are ignored.

The Saudi calendar is not of much financial importance, but I find it very useful for educational purposes. I use it as a reminder to my students that even the most trivial assumptions (like weekend is Sat/Sun) should not be taken for granted. Hence an updated Saudi calendar even if imperfect would be useful.

lballabio commented 8 years ago

Ok, this worked. However, modifying an old version of the library and pasting the code on top of the new version is unsafe, since it might overwrite newer changes. For future pull requests, please consider pushing from your local repository instead.

jrvarma commented 8 years ago

Will do so in future. Sorry for all the mess over the last two days.

lballabio commented 8 years ago

No problem.

lballabio commented 8 years ago

Migrated to https://github.com/lballabio/QuantLib/pull/22