Portfolio#

class rateslib.instruments.Portfolio(instruments)#

Bases: Sensitivities

Create a collection of Instruments to group metrics

Parameters:

instruments (list) – This should be a list of Instruments.

Notes

When using a Portfolio each 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 Spread for similar functionality.

Methods Summary

cashflows(*args, **kwargs)

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

Aggregate the values derived from a cashflows() method on an Instrument.

delta(*args, **kwargs)

Calculate the delta of the Instrument.

gamma(*args, **kwargs)

Calculate the gamma of the Instrument.

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

Return the NPV of the Portfolio by summing instrument NPVs.

Methods Documentation

cashflows(*args, **kwargs)#
cashflows_table(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, **kwargs)#

Aggregate the values derived from a cashflows() method on an Instrument.

Parameters:
  • curves (CurveType, str or list of such, optional) – Argument input to the underlying cashflows method of the Instrument.

  • solver (Solver, optional) – Argument input to the underlying cashflows method of the Instrument.

  • fx (float, FXRates, FXForwards, optional) – Argument input to the underlying cashflows method of the Instrument.

  • base (str, optional) – Argument input to the underlying cashflows method of the Instrument.

  • kwargs (dict) – Additional arguments input the underlying cashflows method of the Instrument.

Return type:

DataFrame

delta(*args, **kwargs)#

Calculate the delta of the Instrument.

For arguments see Sensitivities.delta().

gamma(*args, **kwargs)#

Calculate the gamma of the Instrument.

For arguments see Sensitivities.gamma().

npv(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, **kwargs)#

Return the NPV of the Portfolio by summing instrument NPVs.

For arguments see BaseDerivative.npv().