IndexFixedLeg#

class rateslib.legs.IndexFixedLeg(*args, index_base, index_fixings=NoInput.blank, index_method=NoInput.blank, index_lag=NoInput.blank, fixed_rate=NoInput.blank, **kwargs)#

Bases: _IndexLegMixin, _FixedLegMixin, BaseLeg

Create a leg of IndexFixedPeriod s and initial and final IndexCashflow s.

For more information see the Cookbook Article: “Using Curves with an Index and Inflation Instruments”.

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

  • 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 first period. If a datetime indexed Series, will use the fixings that are available in that object for relevant periods, and derive the rest from the curve.

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

  • 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.

  • fixed_rate (float or None) – The fixed rate applied to determine cashflows. Can be set to None and designated later, perhaps after a mid-market rate for all periods has been calculated.

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

Notes

Warning

An initial exchange is not currently implemented for this leg.

The final cashflow notional is set as the notional. The payment date is set equal to the final accrual date adjusted by payment_lag_exchange.

If amortization is specified an exchanged notional equivalent to the amortization amount is added to the list of periods. For similar examples see FloatLeg.

The NPV of a IndexFixedLeg is the sum of the period NPVs.

\[P = - R \sum_{i=1}^n N_i d_i v(m_i) I(m_i) - \sum_{i=1}^{n-1}(N_{i}-N_{i+1})v(m_i)I(m_i) - N_n v(m_n)I(m_n)\]

The analytic delta is defined as that of a FixedLeg.

\[A = \sum_{i=1}^n N_i d_i v(m_i) I(m_i)\]

Examples

In [1]: curve = Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.98})

In [2]: index_curve = Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.99}, index_base=100.0)

In [3]: index_leg_exch = IndexFixedLeg(
   ...:     schedule=Schedule(dt(2022, 1, 1), "9M", "Q"),
   ...:     notional=1000000,
   ...:     amortization=200000,
   ...:     index_base=100.0,
   ...:     initial_exchange=False,
   ...:     final_exchange=True,
   ...:     fixed_rate=1.0,
   ...: )
   ...: 

In [4]: index_leg_exch.cashflows(index_curve, curve)
Out[4]: 
               Type        Period  Ccy  Acc Start    Acc End    Payment Convention       DCF   Notional        DF Collateral  Rate  Spread  Real Cashflow  Index Base   Index Val  Index Ratio       Cashflow            NPV  FX Rate        NPV Ccy
0  IndexFixedPeriod       Regular  USD 2022-01-01 2022-04-01 2022-04-03     Act360  0.250000  1000000.0  0.994921       None   1.0     NaN   -2500.000000       100.0  100.000000     1.000000   -2500.000000   -2487.301885      1.0   -2487.301885
1     IndexCashflow  Amortization  USD        NaT 2022-04-03 2022-04-03        NaN       NaN   200000.0  0.994921       None   NaN     NaN -200000.000000       100.0  100.005693     1.000057 -200011.386061 -198995.479023      1.0 -198995.479023
2  IndexFixedPeriod       Regular  USD 2022-04-01 2022-07-01 2022-07-03     Act360  0.252778   800000.0  0.989922       None   1.0     NaN   -2022.222222       100.0  100.248124     1.002481   -2027.239837   -2006.809511      1.0   -2006.809511
3     IndexCashflow  Amortization  USD        NaT 2022-07-03 2022-07-03        NaN       NaN   200000.0  0.989922       None   NaN     NaN -200000.000000       100.0  100.253469     1.002535 -200506.937274 -198486.247859      1.0 -198486.247859
4  IndexFixedPeriod       Regular  USD 2022-07-01 2022-10-01 2022-10-03     Act360  0.255556   600000.0  0.984894       None   1.0     NaN   -1533.333333       100.0  100.499631     1.004996   -1540.994335   -1517.716135      1.0   -1517.716135
5     IndexCashflow      Exchange  USD        NaT 2022-10-01 2022-10-01        NaN       NaN   600000.0  0.985003       None   NaN     NaN -600000.000000       100.0  100.499631     1.004996 -602997.783174 -593954.669405      1.0 -593954.669405

In [5]: index_leg_exch.npv(index_curve, curve)
Out[5]: -997448.2238184361

Methods Summary

analytic_delta(*args, **kwargs)

Return the analytic delta of the Leg via summing all periods.

cashflows(*args, **kwargs)

Return the properties of the Leg used in calculating cashflows.

npv(*args, **kwargs)

Return the NPV of the Leg via summing all periods.

Methods Documentation

analytic_delta(*args, **kwargs)#

Return the analytic delta of the Leg via summing all periods.

For arguments see BasePeriod.analytic_delta().

cashflows(*args, **kwargs)#

Return the properties of the Leg used in calculating cashflows.

For arguments see BasePeriod.cashflows().

npv(*args, **kwargs)#

Return the NPV of the Leg via summing all periods.

For arguments see BasePeriod.npv().