FixedPeriod#

class rateslib.periods.FixedPeriod(*args, fixed_rate=NoInput.blank, **kwargs)#

Bases: BasePeriod

Create a period defined with a fixed rate.

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

  • fixed_rate (float or None, optional) – The rate applied to determine the cashflow. If None, can be set later, typically after a mid-market rate for all periods has been calculated.

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

Notes

The cashflow is defined as follows;

\[C = -NdR\]

The npv() is defined as;

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

The analytic_delta() is defined as;

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

Examples

In [1]: fp = FixedPeriod(
   ...:     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,
   ...: )
   ...: 

In [2]: fp.cashflows(curve=Curve({dt(2022, 1, 1):1.0, dt(2022, 12, 31): 0.98}))
Out[2]: 
{'Type': 'FixedPeriod',
 '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,
 'Cashflow': -25000.0,
 'NPV': -24706.19225928831,
 'FX Rate': 1.0,
 'NPV Ccy': -24706.19225928831}

Attributes Summary

cashflow

The calculated value from rate, dcf and notional.

Methods Summary

analytic_delta(*args, **kwargs)

Return the analytic delta of the FixedPeriod.

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

Return the cashflows of the FixedPeriod.

npv([curve, disc_curve, fx, base, local])

Return the NPV of the FixedPeriod.

Attributes Documentation

cashflow#

The calculated value from rate, dcf and notional.

Type:

float, Dual or Dual2

Methods Documentation

analytic_delta(*args, **kwargs)#

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

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

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

npv(curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False)#

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