BaseCalendar

BaseCalendar#

class sigtech.framework.infra.calendar.calendar.BaseCalendar

Baseclasses: HistoricalFrameworkObject

Subclasses: HolidayCalendar, AuctionCalendar, EconomicCalendar

Class representing calendar objects as part of the instrument hierarchy within the framework.

Keyword arguments:

  • weekend - List of weekend days.

  • type - Indicate if the calendar is maintained by external provider or internal.

  • description: Calendar description.

Example of object creation:

from sigtech.framework.infra.calendar.calendar import BaseCalendar
from sigtech.framework.infra.data_adapter.identifier import Identifier

calendar = BaseCalendar(
              weekend=['saturday', 'sunday'],
              description='Test Calendar',
              identifier=Identifier.create('TESTCAL CALENDAR')
           )
property calendar_days: list

List of available calendar days.

data_point = 'EOD'

Data point.

description: str

Calendar description.

history_fields = ('HOLIDAY_DATE',)

Fields of history retrieved for this object.

use_price_factor: Optional[bool] = False

Base class parameter, not used in this class.

weekend: list[Literal['friday', 'saturday', 'sunday']]

List of weekend days.

business_days(start: date, end: date) list[datetime.date]

Return the list of Python dates for good business days including start date and end date.

Parameters:
  • start – Start date.

  • end – End date.

Returns:

list.

business_days_count(start: date, end: date) int

Return the number of calendar business dates in [start_date, end_date] inclusive.

Parameters:
  • start – Start date.

  • end – End date.

Returns:

int.

current_previous_business_day(day)

Return day if it is a business day, or the closest business day before day.

Parameters:

day – Input date.

Returns:

date.

first_calendar_day() date

First available calendar day in the supported range, i.e. no data is available prior to this date.

holiday_data() DataFrame

DataFrame containing holiday information.

is_business_day(day: date) bool

Check if a date day is a valid business day for the calendar.

Parameters:

day – Input date.

Returns:

bool.

is_holiday(day: date) bool

Check if a date day is a valid business day in the given calendar.

Parameters:

day – Input date.

Returns:

bool.

previous_business_day(day) date

Return the closest previous business day strictly before day.

Parameters:

day – Input date.

Returns:

date.