FloatLeg#
- class rateslib.legs.FloatLeg(schedule, *, notional=NoInput.blank, amortization=NoInput.blank, currency=NoInput.blank, pair=NoInput.blank, fx_fixings=NoInput.blank, mtm=LegMtm.Initial, convention=NoInput.blank, initial_exchange=False, final_exchange=False, float_spread=NoInput.blank, rate_fixings=NoInput.blank, fixing_method=NoInput.blank, spread_compound_method=NoInput.blank, fixing_frequency=NoInput.blank, fixing_series=NoInput.blank, zero_periods=NoInput.blank, index_base=NoInput.blank, index_lag=NoInput.blank, index_method=NoInput.blank, index_fixings=NoInput.blank)#
Bases:
_BaseLeg,_WithExDivA Leg containing
FloatPeriod.Examples
In [1]: fl = FloatLeg( ...: schedule=Schedule( ...: effective=dt(2000, 2, 1), ...: termination=dt(2002, 2, 1), ...: frequency="S", ...: ), ...: convention="Act360", ...: float_spread=25.0, ...: notional=10e6, ...: ) ...: In [2]: fl.cashflows() Out[2]: Type Ccy Payment Notional Period Convention DCF Acc Start Acc End DF Cashflow NPV FX Rate Base Ccy NPV Ccy Collateral Rate Spread 0 FloatPeriod USD 2000-08-03 10000000.0 Regular Act360 0.505556 2000-02-01 2000-08-01 None None None 1.0 USD None None None 25.0 1 FloatPeriod USD 2001-02-03 10000000.0 Regular Act360 0.511111 2000-08-01 2001-02-01 None None None 1.0 USD None None None 25.0 2 FloatPeriod USD 2001-08-03 10000000.0 Regular Act360 0.502778 2001-02-01 2001-08-01 None None None 1.0 USD None None None 25.0 3 FloatPeriod USD 2002-02-03 10000000.0 Regular Act360 0.511111 2001-08-01 2002-02-01 None None None 1.0 USD None None None 25.0
- Parameters:
schedule (Schedule, required) –
The
Scheduleobject which structures contiguous Periods. The schedule object also contains data for payment dates, payment dates for notional exchanges and ex-dividend dates for each period.Note
The following define generalised settlement parameters.
currency (str, optional (set by ‘defaults’)) – The local settlement currency of the leg (3-digit code).
notional (float, Dual, Dual2, Variable, optional (set by ‘defaults’)) – The initial leg notional, defined in units of reference currency.
amortization (float, Dual, Dual2, Variable, str, Amortization, optional (set as zero)) – Set a non-constant notional per Period. If a scalar value, adjusts the
notionalof each successive period by that same value. Should have sign equal to that of notional if the notional is to reduce towards zero.initial_exchange (bool, optional (set as False)) – Whether to also include an initial notional exchange. If True then
final_exchangewill also be set to True.final_exchange (bool, optional (set as initial_exchange)) –
Whether to also include a final notional exchange and interim amortization notional exchanges.
Note
The following define non-deliverable parameters. If the Leg is directly deliverable then do not set a non-deliverable
pairor anyfx_fixings.pair (FXIndex, str, optional) – The
FXIndexforFXFixingdefining the currency pair that determines Period settlement. The reference currency is implied frompair. Must includecurrency.fx_fixings (float, Dual, Dual2, Variable, Series, str, 2-tuple or list, optional) –
The value of the
FXFixingfor each Period according to non-deliverability. Review the notes section non-deliverability on aFixedLeg, and see also fixings. This should only ever be entered as either:scalar value: 1.15,
fixings series: “Reuters_ZBS”,
tuple of transaction rate and fixing series: (1.25, “Reuters_ZBC”)
mtm (LegMtm or str, optional (set to ‘initial’)) –
Define how the fixing dates are determined for each
FXFixingSee Notes regarding non-deliverability.Note
The following are period parameters combined with the
schedule.convention (str, optional (set by ‘defaults’)) –
The day count convention applied to calculations of period accrual dates. See
dcf().Note
The following define rate parameters.
fixing_method (FloatFixingMethod, str, optional (set by ‘defaults’)) – The
FloatFixingMethoddescribing the determination of the floating rate for each period.fixing_frequency (Frequency, str, optional (set by ‘frequency’ or ‘1B’)) – The
Frequencyas a component of theFloatRateIndex. If not given is assumed to match the frequency of the schedule for an IBOR typefixing_methodor ‘1B’ if RFR type.fixing_series (FloatRateSeries, str, optional (implied by other parameters)) – The
FloatRateSeriesas a component of theFloatRateIndex. If not given inherits attributes given such as thecalendar,convention,fixing_methodetc.float_spread (float, Dual, Dual2, Variable, optional (set as 0.0)) – The amount (in bps) added to the rate in each period rate determination.
spread_compound_method (SpreadCompoundMethod, str, optional (set by ‘defaults’)) – The
SpreadCompoundMethodused in the calculation of the period rate when combining afloat_spread. Used only with (non-averaged) RFR typefixing_method, and whenzero_periodsis False.rate_fixings (float, Dual, Dual2, Variable, Series, str, optional) – See Fixings. The value of the rate fixing. If a scalar, is used directly. If a string identifier, links to the central
fixingsobject and data loader.zero_periods (bool, optional (set as False)) –
If True a
ZeroFloatPeriodis used as the regular period instead of aFloatPeriod. See notes.Note
The following parameters define indexation. The Period will be considered indexed if any of
index_method,index_lag,index_base,index_fixingsare given.index_method (IndexMethod, str, optional (set by ‘defaults’)) – The interpolation method, or otherwise, to determine index values from reference dates.
index_lag (int, optional (set by ‘defaults’)) – The indexation lag, in months, applied to the determination of index values.
index_base (float, Dual, Dual2, Variable, optional) – The specific value applied as the base index value for all Periods. If not given and
index_fixingsis a string fixings identifier that will be used to determine the base index value.index_fixings (float, Dual, Dual2, Variable, Series, str, 2-tuple or list, optional) – The index value for the reference date. Best practice is to supply this value as string identifier relating to the global
fixingsobject.index_only (bool, optional (set as False)) – A flag which indicates that the nominal amount is deducted from the cashflow leaving only the indexed up quantity.
Notes
The various combinations of amortisation, non-deliverability, indexation, and notional exchanges are identical to, and demonstrated in the documentation for, a
FixedLegobject.Classifications
There are generally five types of index classification that can be constructed with this Leg.
To construct a standard RFR (otherwise known as OIS) type leg, use any of the non-averaging ‘RFR’ variants of the
FloatFixingMethodfor thefixing_methodparameter.Using this
fixing_methodthefixing_frequencyis always assumed to be ‘1B’ for overnight (o/n) rates.Any
spread_compound_methodcan be used in combination with thesefixing_method.Each
FloatPeriodhas an RFR classification.Below is an example of the conventional float leg on a USD-SOFR IRS.
In [3]: rfr_standard = FloatLeg( ...: schedule=Schedule( ...: effective=dt(2026, 1, 22), ...: termination="2Y", ...: frequency="A", ...: calendar="nyc", ...: payment_lag=2 ...: ), ...: convention="Act360", ...: fixing_method="rfr_payment_delay", ...: ) ...: In [4]: rfr_standard.cashflows(rate_curve=curve) Out[4]: Type Ccy Payment Notional Period Convention DCF Acc Start Acc End DF Cashflow NPV FX Rate Base Ccy NPV Ccy Collateral Rate Spread 0 FloatPeriod USD 2027-01-26 1000000.0 Regular Act360 1.013889 2026-01-22 2027-01-22 0.948024 -51223.140636 -48560.744608 1.0 USD -48560.744608 None 5.052145 0.0 1 FloatPeriod USD 2028-01-26 1000000.0 Regular Act360 1.019444 2027-01-22 2028-01-24 0.901829 -51510.923595 -46454.047432 1.0 USD -46454.047432 None 5.052843 0.0
Warning
Do not use
zero_periodsin the construction of RFR type legs. Although it is, technically, possible to construct this type of Leg usingzero_periods. Doing so creates an individualFloatPeriodfor every single overnight RFR fixing making up eachZeroFloatPeriod. This is inefficient and removes other features.To construct an RFR averaged type use an ‘average’ type variant of the
FloatFixingMethodfor thefixing_methodparameter.Each
FloatPeriodhas an average RFR classification.Below is an example of the conventional float leg on an averaged USD-SOFR IRS.
In [5]: rfr_averaged = FloatLeg( ...: schedule=Schedule( ...: effective=dt(2026, 1, 22), ...: termination="2Y", ...: frequency="A", ...: calendar="nyc", ...: payment_lag=2 ...: ), ...: convention="Act360", ...: fixing_method="rfr_payment_delay_avg", ...: ) ...: In [6]: rfr_averaged.cashflows(rate_curve=curve) Out[6]: Type Ccy Payment Notional Period Convention DCF Acc Start Acc End DF Cashflow NPV FX Rate Base Ccy NPV Ccy Collateral Rate Spread 0 FloatPeriod USD 2027-01-26 1000000.0 Regular Act360 1.013889 2026-01-22 2027-01-22 0.948024 -49961.322740 -47364.511503 1.0 USD -47364.511503 None 4.927692 0.0 1 FloatPeriod USD 2028-01-26 1000000.0 Regular Act360 1.019444 2027-01-22 2028-01-24 0.901829 -50235.007899 -45303.389589 1.0 USD -45303.389589 None 4.927685 0.0
Warning
Rates are calculated directly from the provided
rate_curve. There are no convexity adjustments applied to account for the difference between compounded numéraire and averaged result.To construct a standard IBOR type leg use the ‘ibor’ variant of the
FloatFixingMethodfor thefixing_methodparameter. Thefixing_frequencydefining tenor of the index will default to that of the schedule.Each
FloatPeriodhas an IBOR or IBOR Stub classification. Stubs can only appear at the front or back of the Leg and depend upon thescheduledirectly identifying those periods as stubs.Below is an example of a standard EURIBOR 3M float leg.
In [7]: ibor_standard = FloatLeg( ...: schedule=Schedule( ...: effective=dt(2026, 1, 22), ...: termination="1Y", ...: frequency="Q", ...: calendar="tgt", ...: payment_lag=0 ...: ), ...: currency="eur", ...: convention="Act360", ...: fixing_method="ibor(2)", ...: fixing_series="eur_ibor", ...: ) ...: In [8]: ibor_standard.cashflows(rate_curve=curve) Out[8]: Type Ccy Payment Notional Period Convention DCF Acc Start Acc End DF Cashflow NPV FX Rate Base Ccy NPV Ccy Collateral Rate Spread 0 FloatPeriod EUR 2026-04-22 1000000.0 Regular Act360 0.250000 2026-01-22 2026-04-22 0.984923 -12393.691930 -12206.834762 1.0 EUR -12206.834762 None 4.957477 0.0 1 FloatPeriod EUR 2026-07-22 1000000.0 Regular Act360 0.252778 2026-04-22 2026-07-22 0.972733 -12532.258949 -12190.537660 1.0 EUR -12190.537660 None 4.957817 0.0 2 FloatPeriod EUR 2026-10-22 1000000.0 Regular Act360 0.255556 2026-07-22 2026-10-22 0.960562 -12670.844935 -12171.126321 1.0 EUR -12171.126321 None 4.958157 0.0 3 FloatPeriod EUR 2027-01-22 1000000.0 Regular Act360 0.255556 2026-10-22 2027-01-22 0.948543 -12670.844935 -12018.837495 1.0 EUR -12018.837495 None 4.958157 0.0
To construct a Leg with a different tenor IBOR index to that of the schedule, specify the
fixing_frequencydirectly.Each
FloatPeriodhas an Misaligned IBOR or IBOR Stub classification. Stubs can only appear at the front or back of the Leg and depend upon thescheduledirectly identifying those periods as stubs. Stub Periods will have the usual tenor interpolation applied, as with regular IBOR Legs, and does not factor the misalignment into the calculation.Below is an example of a 1Y float leg with quarterly payments with each fixing to four distinct EURIBOR 6M rates.
In [9]: ibor_misaligned = FloatLeg( ...: schedule=Schedule( ...: effective=dt(2026, 1, 22), ...: termination="1Y", ...: frequency="Q", ...: calendar="tgt", ...: payment_lag=0, ...: ), ...: convention="Act360", ...: fixing_method="ibor(2)", ...: fixing_series="eur_ibor", ...: fixing_frequency="S", # <- frequency of fixing does not match schedule. ...: ) ...: In [10]: ibor_misaligned.cashflows(rate_curve=curve) Out[10]: Type Ccy Payment Notional Period Convention DCF Acc Start Acc End DF Cashflow NPV FX Rate Base Ccy NPV Ccy Collateral Rate Spread 0 FloatPeriod USD 2026-04-22 1000000.0 Regular Act360 0.250000 2026-01-22 2026-04-22 0.984923 -12471.350637 -12283.322624 1.0 USD -12283.322624 None 4.988540 0.0 1 FloatPeriod USD 2026-07-22 1000000.0 Regular Act360 0.252778 2026-04-22 2026-07-22 0.972733 -12611.654293 -12267.768104 1.0 USD -12267.768104 None 4.989226 0.0 2 FloatPeriod USD 2026-10-22 1000000.0 Regular Act360 0.255556 2026-07-22 2026-10-22 0.960562 -12751.120091 -12248.235548 1.0 USD -12248.235548 None 4.989569 0.0 3 FloatPeriod USD 2027-01-22 1000000.0 Regular Act360 0.255556 2026-10-22 2027-01-22 0.948543 -12749.367791 -12093.319777 1.0 USD -12093.319777 None 4.988883 0.0
To construct a Leg with multiple IBOR tenor indexes compounded over a single Period set
zero_periodsto True. Each Period will then be aZeroFloatPeriod.The sub-
Scheduleof each ZeroPeriod is defined by the start and end unadjusted accrual dates from the mainschedulewhose frequency is set byfixing_frequency.Note the
float_spreadis added to each individualFloatPeriodand then all resultant rates are compounded to yield the final rate for theZeroFloatPeriod.Two use cases of this have been identified;
Legacy US-LIBOR single currency basis swaps where the 3M-LIBOR was compounded over a 6M period to net cashflows with the 6M Leg. An example is below:
In [11]: float_leg = FloatLeg( ....: schedule=Schedule( ....: effective=dt(2026, 1, 22), ....: termination="1Y", ....: frequency="S", ....: calendar="nyc", ....: payment_lag=0 ....: ), ....: convention="Act360", ....: fixing_series="usd_ibor", ....: fixing_method="ibor(2)", ....: zero_periods=True, ....: fixing_frequency="Q", ....: float_spread=75.0, ....: ) ....: In [12]: float_leg.cashflows(rate_curve=curve) Out[12]: Type Ccy Payment Notional Period Convention DCF Acc Start Acc End DF Cashflow NPV FX Rate Base Ccy NPV Ccy Collateral Rate Spread 0 ZeroFloatPeriod USD 2026-07-22 1000000.0 Regular Act360 0.502778 2026-01-22 2026-07-22 0.972733 -28902.654216 -28114.555893 1.0 USD -28114.555893 None 5.748594 75.0 1 ZeroFloatPeriod USD 2027-01-22 1000000.0 Regular Act360 0.511111 2026-07-22 2027-01-22 0.948543 -29387.818698 -27875.600961 1.0 USD -27875.600961 None 5.749791 75.0
CNY IRS with quarterly payments setting to 7D tenor rate. Note that these periods are often not perfectly divisible, resulting in stub periods within each
ZeroFloatPeriod. The position and treatment of these stubs can be controlled under theFloatRateSeries.In [13]: float_leg = FloatLeg( ....: schedule=Schedule( ....: effective=dt(2026, 1, 21), ....: termination=dt(2027, 1, 21), ....: frequency="Q", ....: calendar="bjs", ....: ), ....: currency="CNY", ....: fixing_frequency="7d", ....: fixing_method="ibor(1)", ....: fixing_series=FloatRateSeries( ....: lag=1, ....: convention="Act365F", ....: calendar="bjs", ....: tenors=["7D"], ....: zero_float_period_stub="shortback", ....: modifier="F", ....: eom=False, ....: ), ....: zero_periods=True, ....: ) ....:
The individual fixing dates of each of these 7D periods are stored on each rate fixing of each
FloatPeriod.In [14]: for float_period in float_leg.periods[0].float_periods: ....: print(float_period.rate_params.rate_fixing.date) ....: 2026-01-20 00:00:00 2026-01-27 00:00:00 2026-02-03 00:00:00 2026-02-10 00:00:00 2026-02-14 00:00:00 2026-02-24 00:00:00 2026-03-03 00:00:00 2026-03-10 00:00:00 2026-03-17 00:00:00 2026-03-24 00:00:00 2026-03-31 00:00:00 2026-04-07 00:00:00 2026-04-14 00:00:00
Attributes Summary
The
Amortizationobject associated with the schedule.The float spread parameter of each composited
FloatPeriod.A list of all contained Periods.
The
_FloatRateParamsassociated with the firstFloatPeriod.The
Scheduleobject of Leg.The
_SettlementParamsassociated with the firstFloatPeriod.Methods Summary
analytic_delta(*[, rate_curve, index_curve, ...])Calculate the analytic rate delta of a Period expressed in a base currency.
cashflows(*[, rate_curve, disc_curve, ...])Return aggregated cashflow data for the Leg.
ex_div(settlement)Return a boolean whether the security is ex-div at the given settlement.
local_analytic_delta([rate_curve, ...])Calculate the analytic rate delta of a Period expressed in its local settlement currency.
local_analytic_rate_fixings(*[, rate_curve, ...])Return a DataFrame of financial sensitivity to published interest rate fixings, expressed in local settlement currency of the Period.
local_fixings(identifiers[, scalars, ...])Calculate the sensitivity to fixings of the Instrument, expressed in local settlement currency.
local_npv(*[, rate_curve, index_curve, ...])Calculate the NPV of the Leg expressed in local settlement currency.
npv(*[, rate_curve, index_curve, ...])Calculate the NPV of the Period converted to any other base accounting currency.
reset_fixings([state])Resets any fixings values of the Leg derived using the given data state.
spread(*, target_npv[, rate_curve, ...])Calculate a spread metric which when applied to the Leg allows it to attain the target value.
Attributes Documentation
- amortization#
The
Amortizationobject associated with the schedule.
- float_spread#
The float spread parameter of each composited
FloatPeriod.
- periods#
A list of all contained Periods.
- rate_params#
The
_FloatRateParamsassociated with the firstFloatPeriod.
- settlement_params#
The
_SettlementParamsassociated with the firstFloatPeriod.
Methods Documentation
- analytic_delta(*, rate_curve=NoInput.blank, index_curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, base=NoInput.blank, local=False, settlement=NoInput.blank, forward=NoInput.blank)#
Calculate the analytic rate delta of a Period expressed in a base currency.
- Parameters:
rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, anFXRatesobject purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
base (str, optional) – The currency to convert the local settlement NPV to.
local (bool, optional) – An override flag to return a dict of NPV values indexed by string currency.
settlement (datetime, optional) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional) – The future date to project the PV to using the
disc_curve.
- Return type:
- cashflows(*, rate_curve=NoInput.blank, disc_curve=NoInput.blank, index_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, base=NoInput.blank, settlement=NoInput.blank, forward=NoInput.blank)#
Return aggregated cashflow data for the Leg.
Warning
This method is a convenience method to provide a visual representation of all associated calculation data. Calling this method to extracting certain values should be avoided. It is more efficent to source relevant parameters or calculations from object attributes or other methods directly.
- Parameters:
rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, anFXRatesobject purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
base (str, optional) – The currency to convert relevant values into.
settlement (datetime, optional) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional) – The future date to project the PV to using the
disc_curve.
- Return type:
DataFrame
- ex_div(settlement)#
Return a boolean whether the security is ex-div at the given settlement.
- Parameters:
settlement (datetime) – The settlement date to test.
- Return type:
bool
Notes
Uses the UK DMO convention of returning False if
settlementis on or before the ex-div date for a regular coupon period.This is evaluated by analysing the attribute
pschedule3of the associatedScheduleobject of the Leg.
- local_analytic_delta(rate_curve=NoInput.blank, index_curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, settlement=NoInput.blank, forward=NoInput.blank)#
Calculate the analytic rate delta of a Period expressed in its local settlement currency.
- Parameters:
rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, anFXRatesobject purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
settlement (datetime, optional) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional) – The future date to project the PV to using the
disc_curve.
- Return type:
- local_analytic_rate_fixings(*, rate_curve=NoInput.blank, index_curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, settlement=NoInput.blank, forward=NoInput.blank)#
Return a DataFrame of financial sensitivity to published interest rate fixings, expressed in local settlement currency of the Period.
If the Period has no sensitivity to rates fixings this DataFrame is empty.
- Parameters:
rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, anFXRatesobject purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
settlement (datetime, optional) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional) – The future date to project the PV to using the
disc_curve.
- Return type:
DataFrame
- local_fixings(identifiers, scalars=NoInput.blank, rate_curve=NoInput.blank, index_curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, settlement=NoInput.blank, forward=NoInput.blank)#
Calculate the sensitivity to fixings of the Instrument, expressed in local settlement currency.
- Parameters:
indentifiers (Sequence of tuple[str, Series], required) – These are the series string identifiers and the data values that will be used in each Series to determine the sensitivity against.
scalars (Sequence of floats, optional (each set as 1.0)) – A sequence of scalars to multiply the sensitivities by for each on of the
identifiers.rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, an class:~rateslib.fx.FXRates object purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
settlement (datetime, optional (set as immediate date)) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional (set as
settlement)) – The future date to project the PV to using thedisc_curve.
- Return type:
DataFrame
- local_npv(*, rate_curve=NoInput.blank, index_curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, settlement=NoInput.blank, forward=NoInput.blank)#
Calculate the NPV of the Leg expressed in local settlement currency.
- Parameters:
rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, anFXRatesobject purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
settlement (datetime, optional) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional) – The future date to project the PV to using the
disc_curve.
- Return type:
- npv(*, rate_curve=NoInput.blank, index_curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, base=NoInput.blank, local=False, settlement=NoInput.blank, forward=NoInput.blank)#
Calculate the NPV of the Period converted to any other base accounting currency.
Hint
If the cashflows are unspecified or incalculable due to missing information this method will raise an exception. For a function that returns a Result indicating success or failure use
try_local_npv().- Parameters:
rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, anFXRatesobject purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
base (str, optional) – The currency to convert the local settlement NPV to.
local (bool, optional) – An override flag to return a dict of NPV values indexed by string currency.
settlement (datetime, optional) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional) – The future date to project the PV to using the
disc_curve.
- Return type:
float, Dual, Dual2, Variable or dict of such indexed by string currency.
Notes
If
baseis not provided then this function will return the value obtained fromtry_local_npv().If
baseis provided this then anFXForwardsobject may be required to perform conversions. AnFXRatesobject is also allowed for this conversion although best practice does not recommend it due to possible settlement date conflicts.
- reset_fixings(state=NoInput.blank)#
Resets any fixings values of the Leg derived using the given data state.
- Parameters:
state (int, optional) – The state id of the data series that set the fixing. Only fixings determined by this data will be reset. If not given resets all fixings.
- Return type:
None
- spread(*, target_npv, rate_curve=NoInput.blank, index_curve=NoInput.blank, disc_curve=NoInput.blank, fx=NoInput.blank, fx_vol=NoInput.blank, settlement=NoInput.blank, forward=NoInput.blank)#
Calculate a spread metric which when applied to the Leg allows it to attain the target value.
- Parameters:
target_npv (DualTypes, required) – The target value of the Leg measured using all of the other given arguments. Must be expressed in local settlement currency units.
rate_curve (_BaseCurve or dict of such indexed by string tenor, optional) – Used to forecast floating period rates, if necessary.
index_curve (_BaseCurve, optional) – Used to forecast index values for indexation, if necessary.
disc_curve (_BaseCurve, optional) – Used to discount cashflows.
fx (FXForwards, optional) – The
FXForwardsobject used for forecasting thefx_fixingfor deliverable cashflows, if necessary. Or, anFXRatesobject purely for immediate currency conversion.fx_vol (FXDeltaVolSmile, FXSabrSmile, FXDeltaVolSurface, FXSabrSurface, optional) – The FX volatility Smile or Surface object used for determining Black calendar day implied volatility values.
settlement (datetime, optional) – The assumed settlement date of the PV determination. Used only to evaluate ex-dividend status.
forward (datetime, optional) – The future date to project the PV to using the
disc_curve.
- Return type: