Search…
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
)
Python
Output
roll_swap.swap_pv01(dtm.datetime(2020, 5, 2))
201038.22420404755
Python
Output
roll_swap.history().tail()
2021-08-10 5.965495e+06
2021-08-11 6.198071e+06
2021-08-12 5.965723e+06
2021-08-13 6.241295e+06
2021-08-16 NaN
Name: (LastPrice, EOD, EUR D2BD8049 RSS STRATEGY), dtype: float64
Python
Output
roll_swap.history().plot() # returns PV history
Python
Output
roll_swap.roll_dates
[datetime.date(2017, 1, 5),
datetime.date(2017, 6, 14),
datetime.date(2017, 9, 13),
datetime.date(2017, 12, 13),
datetime.date(2018, 3, 14),
datetime.date(2018, 6, 13),
datetime.date(2018, 9, 12),
datetime.date(2018, 12, 12),
datetime.date(2019, 3, 13),
datetime.date(2019, 6, 12),
datetime.date(2019, 9, 11),
datetime.date(2019, 12, 11),
datetime.date(2020, 3, 11),
datetime.date(2020, 6, 10),
datetime.date(2020, 9, 9),
datetime.date(2020, 12, 9),
datetime.date(2021, 3, 10),
datetime.date(2021, 6, 9),
datetime.date(2021, 9, 8)]
The RollingSwapStrategy will create each individual swap throughout the life of the strategy. Each of which can be called and explored in more detail.
Python
Output
irs_positions = roll_swap.inspect.positions_df().columns.to_list()
irs = sig.obj.get(irs_positions[-1])
irs
EUR EURIBIMM A6M -0.001507 2021-06-14 M22X5Y IRS <class 'sigtech.framework.instruments.ir_otc.InterestRateSwap'>[140108985740752]
Python
Output
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

To read further on the RollingSwapStrategy class, please see the API documentation.