Sensitivities#

class rateslib.instruments.Sensitivities#

Bases: object

Base class to add risk sensitivity calculations to an object with an npv() method.

Methods Summary

cashflows_table([curves, solver, fx, base])

delta([curves, solver, fx, base, local])

Calculate delta risk of an Instrument against the calibrating instruments in a Solver.

gamma([curves, solver, fx, base, local])

Calculate cross-gamma risk of an Instrument against the calibrating instruments of a Solver.

Methods Documentation

cashflows_table(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#
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 Curve or id or a list of such. A list defines the following curves in the order:

    • Forecasting Curve for leg1.

    • Discounting Curve for leg1.

    • Forecasting Curve for leg2.

    • Discounting Curve for leg2.

  • solver (Solver, optional) – The Solver that 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 FXRates or FXForwards object, converts from local currency into base.

  • base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if fx_rate is an FXRates or FXForwards object.

  • local (bool, optional) – If True will ignore base - this is equivalent to setting base to None. Included only for argument signature consistent with npv.

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 Curve or id or a list of such. A list defines the following curves in the order:

    • Forecasting Curve for leg1.

    • Discounting Curve for leg1.

    • Forecasting Curve for leg2.

    • Discounting Curve for leg2.

  • solver (Solver, optional) – The Solver that 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 FXRates or FXForwards object, converts from local currency into base.

  • base (str, optional) – The base currency to convert cashflows into (3-digit code), set by default. Only used if fx_rate is an FXRates or FXForwards object.

  • local (bool, optional) – If True will ignore base. This is equivalent to setting base to None. Included only for argument signature consistent with npv.

Return type:

DataFrame