ZeroFixedLeg#

class rateslib.legs.ZeroFixedLeg(*args, fixed_rate=NoInput.blank, **kwargs)#

Bases: BaseLeg, FixedLegMixin

Create a zero coupon fixed leg composed of a single FixedPeriod .

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

  • fixed_rate (float, optional) – The IRR 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

The fixed_rate in this calculation is not a period rate but an IRR defining the cashflow as follows,

\[C = -N \left ( \left (1 + \frac{R^{irr}}{f} \right ) ^ {df} - 1 \right )\]

The NPV of a ZeroFixedLeg is:

\[P = -N v(m) \left ( \left (1+\frac{R^{irr}}{f} \right )^{df} - 1 \right )\]

The analytic delta of a ZeroFixedLeg is:

\[A = N d v(m) \left ( 1+ \frac{R^{irr}}{f} \right )^{df -1}\]

Examples

In [1]: zfl = ZeroFixedLeg(
   ...:     effective=dt(2022, 1, 1),
   ...:     termination="3Y",
   ...:     frequency="S",
   ...:     convention="1+",
   ...:     fixed_rate=5.0
   ...: )
   ...: 

In [2]: zfl.cashflows(curve)
Out[2]: 
           Type Period  Ccy  Acc Start    Acc End    Payment Convention  DCF   Notional    DF  Rate Spread   Cashflow   NPV  FX Rate NPV Ccy Collateral
0  ZeroFixedLeg   None  USD 2022-01-01 2025-01-01 2025-01-03         1+ 3.00 1000000.00  None  5.00   None -159693.42  None     1.00    None       None

Attributes Summary

dcf

The DCF of a ZeroFixedLeg is defined as DCF of the single FixedPeriod spanning the Leg.

fixed_rate

If set will also set the fixed_rate of contained FixedPeriod s.

Methods Summary

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

Return the analytic delta of the ZeroFixedLeg from all periods.

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

Return the cashflows of the ZeroFixedLeg from all periods.

npv(*args, **kwargs)

Return the NPV of the ZeroFixedLeg via summing all periods.

Attributes Documentation

dcf#

The DCF of a ZeroFixedLeg is defined as DCF of the single FixedPeriod spanning the Leg.

fixed_rate#

If set will also set the fixed_rate of contained FixedPeriod s.

Type:

float or None

Methods Documentation

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

Return the analytic delta of the ZeroFixedLeg from all periods.

For arguments see BasePeriod.analytic_delta().

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

Return the cashflows of the ZeroFixedLeg from all periods.

For arguments see BasePeriod.cashflows().

npv(*args, **kwargs)#

Return the NPV of the ZeroFixedLeg via summing all periods.

For arguments see BasePeriod.npv().