ZeroFloatLeg#

class rateslib.legs.ZeroFloatLeg(*args, float_spread=NoInput.blank, fixings=NoInput.blank, fixing_method=NoInput.blank, method_param=NoInput.blank, spread_compound_method=NoInput.blank, **kwargs)#

Bases: _FloatLegMixin, BaseLeg

Create a zero coupon floating leg composed of FloatPeriod s.

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

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

  • spread_compound_method (str, optional) – The method to use for adding a floating spread to compounded rates. Applies only to rates within Periods. This does not apply to compounding of Periods within the Leg. Compounding of Periods is done using the ISDA compounding method. Available options are {“none_simple”, “isda_compounding”, “isda_flat_compounding”}.

  • fixings (float, list, or Series optional) – If a float scalar, will be applied as the determined fixing for the first period. If a list of n fixings will be used as the fixings for the first n periods. If any sublist of length m is given, is used as the first m RFR fixings for that FloatPeriod. If a datetime indexed Series will use the fixings that are available in that object, and derive the rest from the curve.

  • fixing_method (str, optional) – The method by which floating rates are determined, set by default. See notes.

  • method_param (int, optional) – A parameter that is used for the various fixing_method s. See notes.

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

Notes

The NPV of a ZeroFloatLeg is:

\[P = -N v(m_n) \left ( \prod_{i=1}^n (1 + d_i r_i(r_j, z)) - 1 \right )\]

The analytic delta of a ZeroFloatLeg is:

\[A = N v(m_n) \sum_{k=1}^n d_k \frac{\partial r_k}{\partial z} \prod_{i=1, i \ne k}^n (1 + d_i r_i(r_j, z))\]

Warning

When floating rates are determined from historical fixings the forecast Curve calendar will be used to determine fixing dates. If this calendar does not align with the leg calendar then spurious results or errors may be generated. Including the curve calendar in the leg is acceptable, i.e. a leg calendar of “nyc,ldn,tgt” and a curve calendar of “ldn” is valid, whereas only “nyc,tgt” may give errors.

Examples

In [1]: zfl = ZeroFloatLeg(
   ...:     schedule=Schedule(dt(2022, 1, 1), "3Y", "S"),
   ...:     fixing_method="ibor",
   ...:     method_param=0,
   ...:     float_spread=100.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  ZeroFloatLeg   None  USD 2022-01-01 2025-01-01 2025-01-03     ACT360  3.044444  1000000.0  0.941036  3.119425   100.0 -94969.156121 -89369.369003      1.0 -89369.369003       None

Attributes Summary

dcf

Methods Summary

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

Return the analytic delta of the ZeroFloatLeg from all periods.

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

Return the properties of the ZeroFloatLeg used in calculating cashflows.

fixings_table(curve[, disc_curve, fx, base, ...])

Return a DataFrame of fixing exposures on a ZeroFloatLeg.

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

Return the NPV of the ZeroFloatLeg via summing all periods.

rate(curve)

Calculate a simple period type floating rate for the zero coupon leg.

Attributes Documentation

dcf#

Methods Documentation

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

Return the analytic delta of the ZeroFloatLeg 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 properties of the ZeroFloatLeg used in calculating cashflows.

For arguments see BasePeriod.npv().

fixings_table(curve, disc_curve=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, approximate=False, right=NoInput.blank)#

Return a DataFrame of fixing exposures on a ZeroFloatLeg.

Parameters:
  • curve (Curve, optional) – The forecasting curve object.

  • disc_curve (Curve, optional) – The discounting curve object used in calculations. Set equal to curve if not given and curve is discount factor based.

  • fx (float, FXRates, FXForwards, optional) – Only used in the case of FloatLegMtm to derive FX fixings.

  • base (str, optional) – Not used by fixings_table.

  • approximate (bool) – Whether to use a faster (3x) but marginally less accurate (0.1% error) calculation.

  • right (datetime, optional) – Only calculate fixing exposures upto and including this date.

Return type:

DataFrame

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

Return the NPV of the ZeroFloatLeg via summing all periods.

For arguments see BasePeriod.npv().

rate(curve)#

Calculate a simple period type floating rate for the zero coupon leg.

Parameters:

curve (Curve, LineCurve) – The forecasting curve object.

Return type:

float, Dual, Dual2