FXDeltaVolSurface#

class rateslib.fx_volatility.FXDeltaVolSurface(delta_indexes=NoInput.blank, expiries=NoInput.blank, node_values=NoInput.blank, eval_date=NoInput.blank, delta_type=NoInput.blank, id=NoInput.blank, ad=0)#

Bases: object

Create an FX Volatility Surface parametrised by cross-sectional Smiles at different expiries.

Parameters:
  • delta_indexes (list[float]) – Axis values representing the delta indexes on each cross-sectional Smile.

  • expiries (list[datetime]) – Datetimes representing the expiries of each cross-sectional Smile, in ascending order.

  • node_values (2d-shape of float, Dual, Dual2) – An array of values representing each node value on each cross-sectional Smile. Should be an array of size: (length of expiries, length of delta_indexes).

  • eval_date (datetime) – Acts as the initial node of a Curve. Should be assigned today’s immediate date.

  • delta_type (str in {"spot", "spot_pa", "forward", "forward_pa"}) – The type of delta calculation that is used as the Smiles definition to obtain a delta index which is referenced by the node keys.

  • id (str, optional) – The unique identifier to label the Surface and its variables.

  • ad (int, optional) – Sets the automatic differentiation order. Defines whether to convert node values to float, Dual or Dual2. It is advised against using this setting directly. It is mainly used internally.

Notes

See FXDeltaVolSmile for a description of delta indexes and Smile construction.

Interpolation along the expiry axis occurs by performing total linear variance interpolation for each delta index and then dynamically constructing a Smile with the usual cubic interpolation.

See constructing FX volatility surfaces for more details.

Methods Summary

get_from_strike(k, phi, f[, w_deli, w_spot, ...])

Given an option strike and expiry return associated delta and vol values.

get_smile(expiry)

Construct a DeltaVolSmile with linear total variance interpolation over delta indexes.

Methods Documentation

get_from_strike(k, phi, f, w_deli=NoInput.blank, w_spot=NoInput.blank, expiry=NoInput.blank)#

Given an option strike and expiry return associated delta and vol values.

Parameters:
  • k (float, Dual, Dual2) – The strike of the option.

  • phi (float) – Whether the option is call (1.0) or a put (-1.0).

  • f (float, Dual, Dual2) – The forward rate at delivery of the option.

  • w_deli (DualTypes, optional) – Required only for spot/forward conversions.

  • w_spot (DualTypes, optional) – Required only for spot/forward conversions.

  • expiry (datetime) – Required to produce the cross-sectional Smile on the Surface.

Returns:

tuple of float, Dual, Dual2

Return type:

(delta index, vol, k)

Notes

This function will return a delta index associated with the FXDeltaVolSmile and the volatility attributed to the delta at that point. Recall that the delta index is the negated put option delta for the given strike k.

get_smile(expiry)#

Construct a DeltaVolSmile with linear total variance interpolation over delta indexes.

Parameters:

expiry (datetime) – The expiry for the Smile as cross-section of Surface.

Return type:

FXDeltaVolSmile