IndexCashflow#

class rateslib.periods.IndexCashflow(*args, index_base, index_fixings=NoInput.blank, index_method=NoInput.blank, index_lag=NoInput.blank, index_only=False, end=NoInput.blank, **kwargs)#

Bases: IndexMixin, Cashflow

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

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

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

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

  • index_base (float, optional) – The base index to determine the cashflow. Required but may be set after initialisation.

  • 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, under the appropriate index_method.

  • index_method (str in {'daily', 'monthly', 'curve'}, 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) – The number of months by which the index value is lagged. Used to ensure consistency between curves and forecast values. Defined by default.

  • index_only (bool) – If True deduct the real notional from the cashflow and produce only the indexed component.

  • end (datetime, optional) – The registered end of a period when the index value is measured. If None is set equal to the payment date.

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

Notes

The real_cashflow is defined as follows;

\[C_{real} = -N\]

The cashflow is defined as follows;

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

The npv() is defined as;

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

The analytic_delta() is defined as;

\[A = 0\]

Example

In [1]: icf = IndexCashflow(
   ...:     notional=1e6,
   ...:     end=dt(2022, 8, 1),
   ...:     payment=dt(2022, 8, 3),
   ...:     currency="usd",
   ...:     stub_type="Loan Payment",
   ...:     index_base=100.25
   ...: )
   ...: 

In [2]: icf.cashflows(
   ...:     curve=Curve({dt(2022, 1, 1): 1.0, dt(2022, 12, 31): 0.99}, index_base=100.0),
   ...:     disc_curve=Curve({dt(2022, 1, 1): 1.0, dt(2022, 12, 31): 0.98}),
   ...: )
   ...: 
Out[2]: 
{'Type': 'IndexCashflow',
 'Period': 'Loan Payment',
 'Ccy': 'USD',
 'Payment': datetime.datetime(2022, 8, 3, 0, 0),
 'Notional': 1000000.0,
 'DF': 0.988192842226477,
 'Rate': None,
 'Cashflow': -1000816.7506948808,
 'NPV': -988999.9494170417,
 'FX Rate': 1.0,
 'NPV Ccy': -988999.9494170417,
 'Collateral': None,
 'Acc End': datetime.datetime(2022, 8, 1, 0, 0),
 'Real Cashflow': -1000000.0,
 'Index Base': 100.25,
 'Index Val': 100.33187925716182,
 'Index Ratio': 1.0008167506948809}

Attributes Summary

Methods Summary

analytic_delta(*args, **kwargs)

Return the analytic delta of the IndexCashflow.

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

Return the cashflows of the IndexCashflow.

npv(*args, **kwargs)

Return the NPV of the IndexCashflow.

Attributes Documentation

real_cashflow#

Methods Documentation

analytic_delta(*args, **kwargs)#

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

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

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

npv(*args, **kwargs)#

Return the NPV of the IndexCashflow. See BasePeriod.npv()