RollingBondStrategy

RollingBondStrategy#

class sigtech.framework.strategies.rolling_bond_strategy.RollingBondStrategy

Baseclasses: RollingStrategyBase

Subclasses: RollingAssetSwapStrategy

Rolling bond strategy that rolls bonds according to a given run type. Invests in the underlying bonds using SingleBondStrategy, meaning coupons are reinvested.

Keyword arguments:

  • country: Two-letter country code, e.g. 'US' or 'CA'.

  • tenor: Tenor string in '[xx]Y' format, e.g. '10Y' or '5Y'.

  • roll_offset: Offsets the roll date by x days from when the roll schedule originally dated the roll.

  • roll_offset_from_data_start: If true, and the above offset is not enough, move to the first date the data for the bond is available

  • run_type: Run type: 'ON_THE_RUN', 'FIRST_OFF_THE_RUN', … 'THIRD_OFF_THE_RUN' supported, defaults to 'ON_THE_RUN'.

  • is_repo: Whether to trade the underlying bonds in repo format instead of outright.

  • repo_source: in case of repo financing, alternative source of repo rates to use. 'IHS_SF' is the only supported source at the moment.

  • raw_otr_series: Pass in a custom roll series as a pandas Series indexed by pandas Timestamp.

  • reduce_bond_histories: If True (default), set bonds histories to only periods relevant for holding the bond in the strategy (this speeds up the strategy, affects bonds even after the strategy is finished, unless individually reset). If False, full bond histories are pre-computed and cached.

Example usage:

import datetime as dtm
import sigtech.framework as sig

rbs = sig.RollingBondStrategy(
    start_date=dtm.date(2021, 1, 4),
    end_date=dtm.date(2023, 1, 4),
    country='US',
    tenor='5Y',
    run_type='ON_THE_RUN',
)
country: str
currency: Optional[str]
property holidays

List of known holiday calendars.

is_repo: Optional[bool]
raw_otr_series: Optional[Series]
reduce_bond_histories: Optional[bool]
repo_source: Optional[str]
roll_offset: Optional[int]
roll_offset_from_data_start: Optional[bool]
property rolling_table

Builds the strategy’s rolling table.

Returns:

Built rolling table as a pandas DataFrame.

run_type: Optional[str]
tenor: str
property trade_roll_schedule

Builds the strategy’s rolling table.

Returns:

Built rolling table as a pandas DataFrame.

ann01_series()

Return the modified duration timeseries.

bd_schedule()

Business days schedule for the strategy.

bond_field_series(field)

Timeseries of a field of the underlying bond.

Parameters:

field – History field.

Returns:

pandas Series.

roll_adjusted_yield()

Return the underlying bonds yields adjusted by the roll pick up (i.e. difference between rolled out bonds yield, and rolled in bond yield for each roll date).

rolling_schedule()

Compute the rolling bond schedule.

schedule_information()

Return the schedule information for this group.

strategy_initialization(dt)

Initial decision run on the start date of the strategy.

Parameters:

dt – Reference datetime.

yield_series(adjusted=True)

Return the yield timeseries.

Parameters:

adjusted – If False, the underlying bonds yield to maturity timeseries is returned. If True, the yields are adjusted by the roll pick up (i.e. difference between rolled out bonds yield, and rolled in bond yield).

Returns:

Yield timeseries.