business date and calendar libraries?

Ian hobson42 at gmaiil.com
Thu Sep 16 06:06:15 EDT 2010


  On 13/09/2010 18:06, Chris Withers wrote:
> Hi All,
>
> I'm wondering what libraries people would use to answer the following 
> questions relating to business days:
>
> - on a naive level; "what's give me the last business day" (ie: 
> skipping weekends)
>
> - on a less-naive level; same question but taking into account public 
> holidays
>
> - on a horrific level; same question, but taking into account business 
> days of a particular market (NYSE, LSE, etc)
Hi Chris,

Having written one of these for UK holidays,  it was easy once I 
obtained a routine to calculate the date of Easter :)

We decided that editing a list of holidays each year was "too hard" and 
so they would always be calculated so..

I had a "isWorkday()" routine that returned false for everything below, 
and true otherwise:
     Every Sat and Sun
     Jan 1st, and the first Monday in Jan
     The day after Easter day
     The first Monday in May   (Month = May and day <= 7 and dow = Monday)
     The last Monday in May   (day >= 25 ....
     The last Monday in August (day >= 25 ....
     Every day from 23rd Dec to the end of the year.  (unique to company).

I believe that officially, Christmas holiday is the first week-day on or 
after 25th Dec.
Boxing Day/St Stephens holiday is the week-day after the Christmas 
holiday date above.

Hope this helps.

Ian






More information about the Python-list mailing list