Primer on bonds.


The purpose of this notebook is to show functionality related to bonds on the platform.

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


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 QuantLib as ql
import datetime as dtm
import seaborn as sns

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

Government Bond Instrument

Government bonds are objects that can be retrieved by the object name constructed by the Country code, coupon, maturity date and 'GOVT' key.

bond_sig = sig.obj.get('US 2.625 2029/02/15 GOVT')

Each bond has various data elements accessible through their objects. The available time series for bond instruments are stored in the properties .history_fields and .extra_fields and are the following:

bond_sig.history_fields, bond_sig.extra_fields

For querying the listed time series, the name of the time series can be passed in as the field parameter in the method .history(field = ) as shown below:


Furthermore, the bond also holds relevant static data as seen below:


Every single bond is part of a bond group, where a bond group contains all bonds issued by an issuer.

bond_group =

As shown above, the bond group also acts as an object, therefore it holds functionality and data on its own. An example of the functionality is to query all bonds in a bond group which is shown below:


All coupons can be retrieved by the method .cashflows() as shown below:

bond_sig.cashflows(, 2, 1))


The z-spread is calculated using the Python QuantLib library. Below is an example of when calculating the z-spread on a given date. For more information on the Python QuantLib library, see the Python QuantLib documentation.

bond_sig.z_spread(, 2, 28))

The z-spread can also be retrieved as a time series as shown below:


Asset swap spread

The asset swap spread is also calculated using the Python QuantLib library. The asset swap spread can be retrieved for a given date with the following method:

bond_sig.asw_spread(, 2, 28))


ql_bond = bond_sig._quant_library_bond


Modified duration

bond_sig.modified_duration(, 1, 4),

Creating Strategies

To create strategies of forward contract, users can easily make use of the building block RollingBondStrategy object. For further information on RollingBondStrategy, see Rolling Bond Strategy.

Last updated

© 2023 SIG Technologies Limited