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.

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

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

  • index_fixings (float, list 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. If a list, will apply those values as the fixings for the first set of 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 = IndexCurve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.99}, index_base=100.0)

In [3]: index_leg_exch = IndexFixedLeg(
   ...:     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.25 1000000.00 0.99       None  1.00   None       -2500.00      100.00     100.25         1.00   -2506.23   -2493.50     1.00   -2493.50
1     IndexCashflow  Amortization  USD        NaT 2022-04-03 2022-04-03       None  NaN  200000.00 0.99       None   NaN   None     -200000.00      100.00     100.25         1.00 -200509.20 -199490.77     1.00 -199490.77
2  IndexFixedPeriod       Regular  USD 2022-04-01 2022-07-01 2022-07-03     ACT360 0.25  800000.00 0.99       None  1.00   None       -2022.22      100.00     100.50         1.01   -2032.35   -2011.87     1.00   -2011.87
3     IndexCashflow  Amortization  USD        NaT 2022-07-03 2022-07-03       None  NaN  200000.00 0.99       None   NaN   None     -200000.00      100.00     100.51         1.01 -201012.87 -198987.08     1.00 -198987.08
4  IndexFixedPeriod       Regular  USD 2022-07-01 2022-10-01 2022-10-03     ACT360 0.26  600000.00 0.98       None  1.00   None       -1533.33      100.00     100.76         1.01   -1544.92   -1521.58     1.00   -1521.58
5     IndexCashflow      Exchange  USD        NaT 2022-10-01 2022-10-01       None  NaN  600000.00 0.99       None   NaN   None     -600000.00      100.00     100.76         1.01 -604533.00 -595466.86     1.00 -595466.86

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

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().