DateUtils
Calendar Definition
Bases:
objectThis module provides the interface for determining whether a date is business day or holiday via specifying a txt file with holiday list.
Specify holiday list with a txt file. If cannot find file given filename or filename is none, use remote url instead. The remote url is https://gitee.com/luluUCD/optshare/raw/master/src/optshare/dateutils/China.txt.
- Parameters:
filename (str or None) – a txt file with holiday list, use remote url instead if cannot find file or filename is None.
Count the number of business days between given start date and end date, specifying whether to include start date or end date
- Parameters:
start_date (datetime.date) – start date
end_date (datetime.date) – end date
include_start_date (bool) – determine whether to include start date
include_end_date (bool) – determine whether to include end date
- Returns:
the number of business days between start date and end date
- Return type:
A boolean value that determines whether d is business day
- Parameters:
d (datetime.date) – input date
- Returns:
True or False. True if d is business day, and vice versa.
- Return type:
A boolean value that determines whether d is holiday
- Parameters:
d (datetime.date) – input date
- Returns:
True or False. True if d is holiday, and vice versa.
- Return type:
Returns the following business day given input date d
- Parameters:
d (datetime.date) – input date
- Returns:
next business day
- Return type:
Returns previous business day given input date d
- Parameters:
d (datetime.date) – input date
- Returns:
previous business day
- Type: