FXSabrSurface#
- class rateslib.fx_volatility.FXSabrSurface(expiries, node_values, eval_date, weights=NoInput.blank, delivery_lag=NoInput.blank, calendar=NoInput.blank, pair=NoInput.blank, id=NoInput.blank, ad=0)#
Bases:
_WithState,_WithCache[datetime,FXSabrSmile]Create an FX Volatility Surface parametrised by cross-sectional Smiles at different expiries.
See also the FX Vol Surfaces section in the user guide.
Warning
This class is in beta status.
- Parameters:
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 alpha, beta, rho, nu node value on each cross-sectional Smile. Should be an array of size: (length of
expiries, 4).eval_date (datetime) – Acts as the initial node of a Curve. Should be assigned today’s immediate date.
weights (Series, optional) – Weights used for temporal volatility interpolation. See notes.
delivery_lag (int, optional) – The number of business days after expiry that the physical settlement of the FX exchange occurs. Uses
defaults.fx_delivery_lag. Used in determination of ATM forward rates for different expiries.calendar (calendar or str, optional) – The holiday calendar object to use for FX delivery day determination. If str, looks up named calendar from static data.
pair (str, optional) – The FX currency pair used to determine ATM forward rates.
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,
DualorDual2. It is advised against using this setting directly. It is mainly used internally.
Notes
See
FXSabrSmilefor a description of SABR parameters for Smile construction.Temporal Interpolation
Interpolation along the expiry axis occurs by performing total linear variance interpolation for a given strike measured on neighboring Smiles.
If
weightsare given this uses the scaling approach of forward volatility (as demonstrated in Clark’s FX Option Pricing) for calendar days (different options ‘cuts’ and timezone are not implemented). A datetime indexed Series must be provided, where any calendar date that is not included will be assigned the default weight of 1.0.See constructing FX volatility surfaces for more details.
Attributes Summary
Methods Summary
get_from_strike(k, f, expiry[, w_deli, w_spot])Given an option strike return the volatility.
Attributes Documentation
- ad#
Methods Documentation
- get_from_strike(k, f, expiry, w_deli=NoInput.blank, w_spot=NoInput.blank)#
Given an option strike return the volatility.
- Parameters:
f (float, Dual, Dual2) – The forward rate at delivery of the option.
expiry (datetime, optional) – The expiry of the option. Required for temporal interpolation between cross-sectional Smiles.
w_deli (DualTypes, optional) – Not used by SabrSurface
w_spot (DualTypes, optional) – Not used by SabrSurface
- Returns:
tuple of DualTypes
- Return type:
(placeholder, vol, k)
Notes
This function returns a tuple consistent with an
FXDeltaVolSmile, however since the FXSabrSmile has no concept of a delta index the first element returned is always zero and can be effectively ignored.