SchedulePeriodic#
-
class sigtech.framework.schedules.schedule.SchedulePeriodic
Define a simple periodic schedule.
Keyword arguments:
start_date
: Schedule start date.end_date
: Schedule end date.holidays
: List of holiday calendars.frequency
:'1BD'
,'2BD'
,'1W'
,'2W'
,'1M'
,'2M'
,'3M'
,'1W-WED'
,'1W-FRI'
,'3M_IMM'
,'SOM'
,'EOM'
,'YEARLY'
,'1DOM'
(Day of Month),'15BDOM'
(15th Business Day of Month),'[X]M-[Y]DOM'
(e.g.'1M-10DOM'
,'6M-28DOM'
).offset
: Optional input to bump the final dates from the periodic schedule.offset_backwards
: If True, applied offset bump backwards otherwise forward.offset_sticky_month_end
: If True, applied month end rule in the offset bump.bdc
: Business day count convention applied in the periodic schedule ('FOLLOWING'
by default).delivery_kwargs
: As inScheduleBase
class.include_start_date
: IfTrue
, schedule includesstart_date
whenstart_date
is before the first date of the schedule (Default isTrue
).
Example of object creation:
import sigtech.framework.infra.calendar as cal import datetime as dtm from sigtech.framework.schedules.schedule import SchedulePeriodic weekly_schedule = SchedulePeriodic(dtm.date(2012, 2, 1), dtm.date(2012, 3, 28), 'NYM (T)', frequency='1W-WED', offset='1BD', offset_backwards=True, bdc=cal.BDC_MODIFIED_FOLLOWING)
-
get_holidays() str
Return the union of calendars
-
all_data_dates() list[datetime.date]
Return the timestamps of all data dates from
calculation_start_date
tocalculation_end_date
inclusive.
-
all_data_ts() DatetimeIndex
Return the timestamps of all data dates from
calculation_start_date
tocalculation_end_date
inclusive.
-
all_reference_datetimes()
Timeseries indexed by data dates between start and end with corresponding reference times for that date.
-
approximate_holidays() str
A possibly not exact holiday set for this schedule.
-
calculation_end_date() date
Return the date on which the calculation of all data dates ends.
-
calculation_end_ts() Timestamp
Date on which calculation of all data dates ends.
-
calculation_start_date() date
Return the date on which the calculation of all data dates starts.
-
calculation_start_ts() Timestamp
Date on which calculation of all data dates starts.
-
current_next_data_date(d: Union[date, datetime, Timestamp]) date
Returns the first data date on or after the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
date.
-
current_next_data_ts(d: Union[date, datetime, Timestamp]) Timestamp
Return the first data date on or after date
d
.- Parameters:
d – Input date, datetime or timestamp.
- Returns:
pandas
Timestamp
.
-
current_previous_data_date(d: Union[date, datetime, Timestamp]) date
Returns the first data date on or before the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
date.
-
current_previous_data_ts(d: Union[date, datetime, Timestamp]) Timestamp
Return the first data date on or before date
d
.- Parameters:
d – Input date, datetime or timestamp.
- Returns:
pandas
Timestamp
.
-
data_dates(start: Optional[Union[date, datetime, Timestamp]] = None, end: Optional[Union[date, datetime, Timestamp]] = None) list[Union[datetime.datetime, datetime.date]]
List of value dates for which data is published between start and end dates inclusive.
- Parameters:
start – Start date, datetime or timestamp.
end – End date, datetime ot timestamp.
- Returns:
date or datetime.
-
data_ts(start: Optional[Union[date, datetime, Timestamp]] = None, end: Optional[Union[date, datetime, Timestamp]] = None) DatetimeIndex
List of value dates for which data is published between start and end dates inclusive.
- Parameters:
start – Start date, datetime or timestamp.
end – End date, datetime ot timestamp.
- Returns:
pandas
DatetimeIndex
.
-
date_increment(d: date, n: int) Any
Move a given date
d
exactlyn
business days forward or backward.- Parameters:
d – Input date.
n – Number of business days for bump.
- Returns:
New bumped date from the input date.
-
delivery_kwargs()
Return a dict containing the class attributes.
-
dependencies(input_dependency: Dependency, valuation_currency: str = None, use_start: bool = False) list[sigtech.framework.internal.infra.mu.graph.registry.factory.Dependency]
Dependencies of this schedule
-
end_date() date
Return the last date on which data will be available, typically
date.max
if no end date is set.
-
end_ts() Timestamp
The last date on which data will be available, typically
date.max
if no end date is set.
-
get_exact_business_dates(d: date, n: int) list[datetime.date]
Return
n
business days after dated
.- Parameters:
d – Start date.
n – Number of days.
- Returns:
List of dates.
-
is_data_date(d: Union[date, datetime, Timestamp]) bool
Return True if the input date is part of the schedule, otherwise False.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
bool.
-
is_data_ts(d: Union[date, datetime, Timestamp]) bool
Return True if the input date is part of the schedule, otherwise False.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
bool.
-
next_data_date(d: Union[date, datetime, Timestamp]) date
Return the first data date after the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
date.
-
next_data_ts(d: Union[date, datetime, Timestamp]) Timestamp
Return the first data date after the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
pandas
Timestamp
.
-
prev_reference_date(d: date) date
Return the past delivery date for the input date.
- Parameters:
d – Input date.
- Returns:
date.
-
prev_reference_datetime(d: Union[date, datetime, Timestamp]) Timestamp
Return the past delivery datetime for the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
pandas
Timestamp
.
-
previous_data_date(d: Union[date, datetime, Timestamp]) date
Return the first data date prior to the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
date.
-
previous_data_ts(d: Union[date, datetime, Timestamp]) Timestamp
Return the first data date prior to the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
pandas
Timestamp
.
-
reference_datetime(d: Union[date, datetime, Timestamp]) Timestamp
Return the delivery datetime for the input date.
- Parameters:
d – Input date, datetime or timestamp.
- Returns:
pandas
Timestamp
.
-
reference_datetimes(start: Optional[Union[date, datetime, Timestamp]] = None, end: Optional[Union[date, datetime, Timestamp]] = None)
Return the reference datetimes restricted to data dates between start and end inclusive.
- Parameters:
start – Input date, datetime or timestamp (optional).
end – Input date, datetime or timestamp (optional).
- Returns:
pandas Series.
-
start_date() date
The first date on which data will be available.
-
start_ts() Timestamp
The first date on which data will be available.