Rolling swap strategy

Primer on the RollingSwapStrategy class.

Introduction

The purpose of this primer is to show how to work with the building block RollingSwapStrategy.

A notebook containing all the code used in this page can be accessed in the research environment: Example notebooks.

Environment

Setting up your environment takes three steps:

  • Import the relevant internal and external libraries

  • Configure the environment parameters

  • Initialise the environment

import sigtech.framework as sig

import datetime as dtm
import seaborn as sns

sns.set(rc={'figure.figsize': (18, 6)})
sig.config.init();

Creating RollingSwapStrategy objects

The RollingSwapStrategy object allows for automatic rolling of IMM Interest Rate Swaps.

An example of building a rolling IRS strategy is given below.

roll_swap = sig.RollingSwapStrategy(
    currency='EUR',
    swap_currency='EUR',
    forward_start_months=12, 
    rolling_frequency_months=3 ,
    start_date=dtm.date(2020, 1, 4),
    tenor='5Y',
    roll_offset='-2',
    pv01_target=200e3, # optional 
    pv01_target_type='Fixed' # optional
)
roll_swap.swap_pv01(dtm.datetime(2020, 5, 2))
roll_swap.history().tail()
roll_swap.history().plot() # returns PV history
roll_swap.roll_dates

The RollingSwapStrategy will create each individual swap throughout the life of the strategy. Each of which can be called and explored in more detail.

irs_positions = roll_swap.inspect.positions_df().columns.to_list()
irs = sig.obj.get(irs_positions[-1])
irs
irs.carry_roll_down(d=dtm.date(2021, 6, 15),
                    dates=[dtm.date(2021, 6, 30),
                           dtm.date(2021, 12, 15),
                           dtm.date(2022, 6, 30)])

API Documentation

For more information on the RollingBondStrategy class, see the API documentation.

Last updated

© 2023 SIG Technologies Limited