business date and calendar libraries?

nn pruebauno at latinmail.com
Wed Sep 15 09:54:31 EDT 2010


On Sep 13, 3:02 pm, David Robinow <drobi... at gmail.com> wrote:
> On Mon, Sep 13, 2010 at 1:06 PM, Chris Withers <ch... at simplistix.co.uk> wrote:
> > I'm wondering what libraries people would use to answer the following
> > questions relating to business days:
>
> > - on a less-naive level; same question but taking into account public
> > holidays
>
>  This depends on which government is oppressing you.
>
> > - on a horrific level; same question, but taking into account business days
> > of a particular market (NYSE, LSE, etc)
>
>  This is just an instance of the public holiday case. You need to
> define the holidays.
>  If you read lisp you might want to look at the emacs calendar module
> for some hints on how they describe holidays, such as, for a US-biased
> example,  Martin Luther King day is the third Monday in January,
> Memorial Day is the last Monday in May, Good Friday is not a public
> holiday but some markets are closed.

A good way to do this IMHO is to keep a list of "holidays" for each
year in your program and check if a day is in the list to do your
calculations. The list could be automatically generated by an
algorithm that figures out all the weird holiday dates or -as is done
in many companies- some honcho adds them according to his preference
to a database.



More information about the Python-list mailing list