Fly#

class rateslib.instruments.Fly(instrument1, instrument2, instrument3)#

Bases: Sensitivities

A 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 Fly 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])

delta(*args, **kwargs)

Calculate the delta of the Instrument.

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)#
cashflows_table(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank)#
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(*args, **kwargs)#

Return the NPV of the composited object by summing instrument NPVs.

Parameters:
  • args – Positional arguments required for the npv method of both of the underlying Instruments.

  • kwargs – Keyword arguments required for the npv method of both of the underlying Instruments.

Return type:

float, Dual or Dual2

rate(*args, **kwargs)#

Return the mid-market rate of the composited via the difference of instrument rates.

Parameters:
  • args – Positional arguments required for the rate method of both of the underlying Instruments.

  • kwargs – Keyword arguments required for the rate method of both of the underlying Instruments.

Return type:

float, Dual or Dual2