Sensitivities#
- class rateslib.instruments.Sensitivities#
Bases:
objectBase class to add risk sensitivity calculations to an object with an
npv()method.Methods Summary
delta([curves, solver, fx, base, local])Calculate delta risk of an Instrument against the calibrating instruments in a
Solver.exo_delta(vars[, curves, solver, fx, base, ...])Calculate delta risk of an Instrument against some exogenous user created Variables.
gamma([curves, solver, fx, base, local])Calculate cross-gamma risk of an Instrument against the calibrating instruments of a
Solver.Methods Documentation
- delta(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, **kwargs)#
Calculate delta risk of an Instrument against the calibrating instruments in a
Solver.- Parameters:
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.
- Return type:
DataFrame
- 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
- gamma(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, **kwargs)#
Calculate cross-gamma risk of an Instrument against the calibrating instruments of a
Solver.- Parameters:
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.
- Return type:
DataFrame