business date and calendar libraries?
drobinow at gmail.com
Mon Sep 13 21:02:09 CEST 2010
On Mon, Sep 13, 2010 at 1:06 PM, Chris Withers <chris at simplistix.co.uk> wrote:
> 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
def is_weekend(year, month, day):
return datetime.date(year, month, day).weekday() in (5,6)
That should get you started.
> - on a less-naive level; same question but taking into account public
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.
More information about the Python-list