IndexFixedPeriod#

class rateslib.periods.IndexFixedPeriod(*args, index_base=NoInput.blank, index_fixings=NoInput.blank, index_method=NoInput.blank, index_lag=NoInput.blank, **kwargs)#

Bases: IndexMixin, FixedPeriod

Create a period defined with a real rate adjusted by an index.

When used with an inflation index this defines a real coupon period with a cashflow adjusted upwards by the inflation index.

Parameters:
  • args (dict) – Required positional args to FixedPeriod.

  • index_base (float or None, optional) – The base index to determine the cashflow.

  • index_fixings (float, or Series, optional) – If a float scalar, will be applied as the index fixing for the settlement, or payment, date. If a datetime indexed Series will use the fixings that are available in that object, using linear interpolation if necessary.

  • index_method (str, optional) – Whether the indexing uses a daily measure for settlement or the most recently monthly data taken from the first day of month. Defined by default.

  • index_lag (int, optional) – The number of months by which the index value is lagged. Used to ensure consistency between curves and forecast values. Defined by default.

  • kwargs (dict) – Required keyword arguments to FixedPeriod.

Notes

The real_cashflow is defined as follows;

\[C_{real} = -NdR\]

The cashflow is defined as follows;

\[C = C_{real}I(m) = -NdRI(m)\]

The npv() is defined as;

\[P = Cv = -NdRv(m)I(m)\]

The analytic_delta() is defined as;

\[A = - \frac{\partial P}{\partial R} = Ndv(m)I(m)\]

Examples

In [1]: ifp = IndexFixedPeriod(
   ...:     start=dt(2022, 2, 1),
   ...:     end=dt(2022, 8, 1),
   ...:     payment=dt(2022, 8, 2),
   ...:     frequency="S",
   ...:     notional=1e6,
   ...:     currency="eur",
   ...:     convention="30e360",
   ...:     fixed_rate=5.0,
   ...:     index_lag=2,
   ...:     index_base=100.25,
   ...: )
   ...: 

In [2]: ifp.cashflows(
   ...:     curve=IndexCurve({dt(2022, 1, 1):1.0, dt(2022, 12, 31): 0.99}, index_base=100.0, index_lag=2),
   ...:     disc_curve=Curve({dt(2022, 1, 1):1.0, dt(2022, 12, 31): 0.98})
   ...: )
   ...: 
Out[2]: 
{'Type': 'IndexFixedPeriod',
 'Period': 'Regular',
 'Ccy': 'EUR',
 'Acc Start': datetime.datetime(2022, 2, 1, 0, 0),
 'Acc End': datetime.datetime(2022, 8, 1, 0, 0),
 'Payment': datetime.datetime(2022, 8, 2, 0, 0),
 'Convention': '30e360',
 'DCF': 0.5,
 'Notional': 1000000.0,
 'DF': 0.9882476903715324,
 'Collateral': None,
 'Rate': 5.0,
 'Spread': None,
 'Real Cashflow': -25000.0,
 'Index Base': 100.25,
 'Index Val': 100.5883005883006,
 'Index Ratio': 1.0033745694593577,
 'Cashflow': -25084.36423648394,
 'NPV': -24789.56502114352,
 'FX Rate': 1.0,
 'NPV Ccy': -24789.56502114352}

Attributes Summary

real_cashflow

The calculated real value from rate, dcf and notional.

Methods Summary

analytic_delta([curve, disc_curve, fx, base])

Return the analytic delta of the IndexFixedPeriod.

cashflows([curve, disc_curve, fx, base])

Return the cashflows of the IndexFixedPeriod.

npv(*args, **kwargs)

Return the cashflows of the IndexFixedPeriod.

Attributes Documentation

real_cashflow#

The calculated real value from rate, dcf and notional.

Type:

float, Dual or Dual2

Methods Documentation

analytic_delta(curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#

Return the analytic delta of the IndexFixedPeriod. See BasePeriod.analytic_delta()

cashflows(curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#

Return the cashflows of the IndexFixedPeriod. See BasePeriod.cashflows()

npv(*args, **kwargs)#

Return the cashflows of the IndexFixedPeriod. See BasePeriod.npv()