Fly#
- class rateslib.instruments.Fly(instrument1, instrument2, instrument3)#
Bases:
SensitivitiesA butterfly instrument which is, mechanically, the spread of two spread instruments.
- Parameters:
instrument1 (Instrument) – The initial instrument, usually the shortest tenor, e.g. 5Y in 5s10s15s.
instrument2 (Instrument) – The second instrument, usually the mid-length tenor, e.g. 10Y in 5s10s15s.
instrument3 (Instrument) – The third instrument, usually the longest tenor, e.g. 15Y in 5s10s15s.
Notes
When using a
Flyeach Instrument must either have pricing parameters pre-defined using the appropriate pricing mechanisms or share common pricing parameters defined at price time.Examples
See examples for
Spreadfor similar functionality.Methods Summary
cashflows(*args, **kwargs)delta(*args, **kwargs)Calculate the delta of the Instrument.
exo_delta(vars[, curves, solver, fx, base, ...])Calculate delta risk of an Instrument against some exogenous user created Variables.
fixings_table([curves, solver, fx, base, ...])Return a DataFrame of fixing exposures on the Instruments.
gamma(*args, **kwargs)Calculate the gamma of the Instrument.
npv(*args, **kwargs)Return the NPV of the composited object by summing instrument NPVs.
rate(*args, **kwargs)Return the mid-market rate of the composited via the difference of instrument rates.
Methods Documentation
- cashflows(*args, **kwargs)#
- delta(*args, **kwargs)#
Calculate the delta of the Instrument.
For arguments see
Sensitivities.delta().
- exo_delta(vars, curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, vars_scalar=NoInput.blank, vars_labels=NoInput.blank, **kwargs)#
Calculate delta risk of an Instrument against some exogenous user created Variables.
See What are exogenous variables? in the cookbook.
- Parameters:
vars (list[str]) – The variable tags which to determine sensitivities for.
curves (Curve, str or list of such, optional) –
A single
Curveor id or a list of such. A list defines the following curves in the order:solver (Solver, optional) – The
Solverthat calibrates Curves from given Instruments.fx (float, FXRates, FXForwards, optional) – The immediate settlement FX rate that will be used to convert values into another currency. A given float is used directly. If giving a
FXRatesorFXForwardsobject, converts from local currency intobase.base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if
fx_rateis anFXRatesorFXForwardsobject.local (bool, optional) – If True will ignore
base- this is equivalent to settingbaseto None. Included only for argument signature consistent with npv.vars_scalar (list[float], optional) – Scaling factors for each variable, for example converting rates to basis point etc. Defaults to ones.
vars_labels (list[str], optional) – Alternative names to relabel variables in DataFrames.
- Return type:
DataFrame
- fixings_table(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, approximate=False, right=NoInput.blank)#
Return a DataFrame of fixing exposures on the Instruments.
For arguments see
XCS.fixings_table(), and/orIRS.fixings_table()- Return type:
DataFrame
- gamma(*args, **kwargs)#
Calculate the gamma of the Instrument.
For arguments see
Sensitivities.gamma().
- npv(*args, **kwargs)#
Return the NPV of the composited object by summing instrument NPVs.
- rate(*args, **kwargs)#
Return the mid-market rate of the composited via the difference of instrument rates.