tensorquant.timehandles package
Submodules
tensorquant.timehandles.daycounter module
tensorquant.timehandles.grid module
tensorquant.timehandles.schedule module
tensorquant.timehandles.targetcalendar module
tensorquant.timehandles.tqcalendar module
- class tensorquant.timehandles.tqcalendar.Calendar[source]
Bases:
ABCThe abstract class for calendar implementations.
- adjust(d: date, c: BusinessDayConvention)[source]
Adjust date based on the business day convention.
Parameters:
d (date): The date to adjust. c (BusinessDayConvention): The business day convention.
Returns:
date: The adjusted date.
- advance(start_date: date, period: int, time_unit: TimeUnit, convention: BusinessDayConvention, end_of_month: bool = False)[source]
Advance a given start date by a specified period using the given time unit and business day convention.
Parameters:
start_date (date): The starting date. period (int): The number of time units to advance the start date by. time_unit (TimeUnit): The unit of time to use for advancing the start date. convention (BusinessDayConvention): The business day convention to use for adjusting the dates. end_of_month (bool, optional): Whether to adjust to the end of the month if the original start date is at the end of the month. Defaults to False.
Returns:
date: The advanced date.
- end_of_month(d: date) int[source]
Get the last day of the month for a given date.
Parameters:
d (date): The date for which to find the last day of the month.
Returns:
int: The last day of the month.
- abstract is_business_day(d: date)[source]
Check if a given date is a business day.
Parameters:
d (date): The date to check.
Returns:
bool: True if the given date is a business day, False otherwise.
- is_end_of_month(d: date) bool[source]
Check if a given date is the end of the month.
Parameters:
d (date): The date to check.
Returns:
bool: True if the given date is the end of the month, False otherwise.
tensorquant.timehandles.utils module
- class tensorquant.timehandles.utils.BusinessDayConvention(value)[source]
Bases:
EnumEnumeration of business-day conventions.
- Following = 'Following'
- HalfMonthModifiedFollowing = 'Half-Month Modified Following'
- ModifiedFollowing = 'Modified Following'
- ModifiedPreceding = 'Modified Preceding'
- Nearest = 'Nearest'
- Preceding = 'Preceding'
- Unadjusted = 'Unadjusted'
- class tensorquant.timehandles.utils.CompoundingType(value)[source]
Bases:
EnumAn enumeration.
- Compounded = 'compounded'
- Continuous = 'continuous'
- Simple = 'simple'
- class tensorquant.timehandles.utils.DayCounterConvention(value)[source]
Bases:
EnumAn enumeration.
- Actual360 = 'Actual360'
- Actual365 = 'Actual365'
- ActualActual = 'ActualActual'
- Thirty360 = 'Thirty360'
- Thirty360E = 'Thirty360E'
- class tensorquant.timehandles.utils.Frequency(value)[source]
Bases:
EnumAn enumeration.
- Annual = 1
- Bimonthly = 6
- Biweekly = 26
- Daily = 365
- EveryFourthMonth = 3
- EveryFourthWeek = 13
- Monthly = 12
- NoFrequency = -1
- Once = 0
- OtherFrequency = 999
- Quarterly = 4
- Semiannual = 2
- Weekly = 52
- class tensorquant.timehandles.utils.Settings[source]
Bases:
objectA class to represent general settings
- evaluation_date = datetime.date(2026, 5, 26)