finpricing.utils.date#

Module Contents#

Classes#

TimeInterval

Date

class finpricing.utils.date.TimeInterval(value: int, period: str)[source]#
classmethod from_string(interval_string)[source]#
__neg__()[source]#
__repr__() str[source]#

Return repr(self).

__mul__(other: int)[source]#
__rmul__(other: int)[source]#
class finpricing.utils.date.Date(year: int, month: int, day: int)[source]#
property is_weekend: bool#

Return True if the date is a weekend, False otherwise

Monday is 0 and Sunday is 6.

MON = 0#
TUE = 1#
WED = 2#
THU = 3#
FRI = 4#
SAT = 5#
SUN = 6#
to_tuple() tuple[source]#

Return a tuple of (year, month, day)

classmethod convert_from_datetime(date: datetime.date | Date) Date[source]#

Return a Date object from a datetime.date object

classmethod convert_from_datetimes(dates: list[datetime.date | Date]) list[Date][source]#

Return a list of Date objects from a list of datetime.date objects

classmethod from_datetime(date: datetime.date) Date[source]#

Return a Date object from a datetime.date object

classmethod from_tuple(date_tuple: tuple) Date[source]#

Return a Date object from a tuple of (year, month, day)

__sub__(other: object) int[source]#
__add__(days: int) Date[source]#
__eq__(other: object) bool[source]#

Return self==value.

__lt__(other: object) bool[source]#

Return self<value.

__repr__() str[source]#

Return repr(self).

add_days(days: int) Date[source]#

Return a new Date object by adding days to self

add_months(months: int) Date[source]#

Return a new Date object by adding months to self

add_weeks(weeks: int) Date[source]#

Return a new Date object by adding weeks to self

add_years(years: int) Date[source]#

Return a new Date object by adding years to self

add_tenor(tenor: str) Date[source]#

Return a new Date object by adding tenor to self

add_interval(time_interval: TimeInterval) Date[source]#
strftime(fmt: str) str[source]#

Return a string representing the date, controlled by an explicit format string

__hash__() int[source]#

Return hash(self).