FXOptionStrat#
- class rateslib.instruments.FXOptionStrat(options, rate_weight, rate_weight_vol)#
Bases:
object
Create a custom option strategy composed of a list of
FXOption
, or otherFXOptionStrat
objects.- Parameters:
options (list) – The FXOptions or FXOptionStrats which make up the strategy.
rate_weight (list) – The multiplier for the ‘pips_or_%’ metric that sums the options to a final rate. E.g. A RiskReversal uses [-1.0, 1.0] for a sale and a purchase. E.g. A Straddle uses [1.0, 1.0] for summing two premium purchases.
rate_weight_vol (list) – The multiplier for the ‘vol’ metric that sums the options to a final rate. E.g. A RiskReversal uses [-1.0, 1.0] to obtain the vol difference between two options. E.g. A Straddle uses [0.5, 0.5] to obtain the volatility at the strike of each option.
Attributes Summary
Methods Summary
analytic_greeks
([curves, solver, fx, base, vol])Return aggregated greeks of the FXOptionStrat.
npv
([curves, solver, fx, base, local, vol])Return the NPV of the FXOptionStrat.
rate
([curves, solver, fx, base, vol, metric])Return various pricing metrics of the FXOptionStrat.
Attributes Documentation
- periods#
Methods Documentation
- analytic_greeks(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, vol=NoInput.blank)#
Return aggregated greeks of the FXOptionStrat.
- Parameters:
curves (list of Curve) – Curves for discounting cashflows. List follows the structure used by IRDs and should be given as: [None, Curve for domestic ccy, None, Curve for foreign ccy]
solver (Solver, optional) – The numerical
Solver
that constructs Curves, Smiles or Surfaces from calibrating instruments.fx (FXForwards) – The object to project the relevant forward and spot FX rates.
base (str, optional) – Not used by analytic_greeks.
vol (float, Dual, Dual2, FXDeltaVolSmile or FXDeltaVolSurface, or Sequence of such, optional) – The volatility used in calculation.
- Return type:
dict
Notes
If the
vol
option is given as a Sequence of volatility values, these should be ordered according to each FXOption or FXOptionStrat contained on the Instrument. For nested FXOptionStrat use nested sequences.
- npv(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, local=False, vol=NoInput.blank)#
Return the NPV of the FXOptionStrat.
- Parameters:
curves (list of Curve) – Curves for discounting cashflows. List follows the structure used by IRDs and should be given as: [None, Curve for ccy1, None, Curve for ccy2]
solver (Solver, optional) – The numerical
Solver
that constructs Curves, Smiles or Surfaces from calibrating instruments.fx (FXForwards) – The object to project the relevant forward and spot FX rates.
base (str, optional) – 3-digit currency in which to express values.
local (bool, optional) – If True will return a dict identifying NPV by local currencies on each period.
vol (float, Dual, Dual2, FXDeltaVolSmile or FXDeltaVolSurface, or Sequence of such, optional) – The volatility used in calculation.
- Return type:
Notes
If the
vol
option is given as a Sequence of volatility values, these should be ordered according to each FXOption or FXOptionStrat contained on the Instrument. For nested FXOptionStrat use nested sequences.
- rate(curves=NoInput.blank, solver=NoInput.blank, fx=NoInput.blank, base=NoInput.blank, vol=NoInput.blank, metric=NoInput.blank)#
Return various pricing metrics of the FXOptionStrat.
- Parameters:
curves (list of Curve) – Curves for discounting cashflows. List follows the structure used by IRDs and should be given as: [None, Curve for ccy1, None, Curve for ccy2]
solver (Solver, optional) – The numerical
Solver
that constructs Curves, Smiles or Surfaces from calibrating instruments.fx (FXForwards) – The object to project the relevant forward and spot FX rates.
base (str, optional) – Not used by the rate method.
vol (float, Dual, Dual2, FXDeltaVolSmile or FXDeltaVolSurface, or Sequence of such, optional) – The volatility used in calculation. See notes.
metric (str in {"pips_or_%", "vol", "premium"}, optional) – The pricing metric type to return. See notes for
FXOption.rate
- Return type:
Notes
If the
vol
option is given as a Sequence of volatility values, these should be ordered according to each FXOption or FXOptionStrat contained on the Instrument. For nested FXOptionStrat use nested sequences.For example, for an FXBrokerFly, which contains an FXStrangle and an FXStraddle,
vol
may be entered as [[12, 11], 10] which are values of 12% and 11% on the Strangle options and 10% for the two Straddle options, or just “fx_surface1” which will determine all volatilities from an FXDeltaVolSurface associated with a Solver, with id: “fx_surface1”.