class_docstr: Holds data for an FX vol surface and also interpolates vol surface,
  converts strikes to implied vols etc.
class_docstr_tok: ["Holds","data","for","an","FX","vol","surface","and","also","interpolates","vol","surface",",","converts","strikes","to","implied","vols","etc","."]
docstr: Initialises object, with market data and various market conventions
  
  Parameters
  ----------
  market_df : DataFrame
      Market data with spot, FX volatility surface, FX forwards and base depos
  
  asset : str
      Eg. "EURUSD"
  
  field : str
      Market data field to use
  
      default - "close"
  
  tenors : str(list)
      Tenors to be used (we need to avoid tenors, where there might be NaNs)
  
  vol_function_type : str
      What type of interpolation scheme to use
      default - "CLARK5" (also "CLARK", "BBG" and "SABR")
  
  atm_method : str
      How is the ATM quoted? Eg. delta neutral, ATMF etc.
  
      default - "fwd-delta-neutral-premium-adj"
  
  delta_method : str
      Spot delta, forward delta etc.
  
      default - "spot-delta"
  
  solver : str
      Which solver to use in FX vol surface calibration?
  
      default - "nelmer-mead"
  
  alpha : float
      Between 0 and 1 (default 0.5)
docstr_tok: ["Initialises","object",",","with","market","data","and","various","market","conventions","Parameters","--","--","--","--","--","market_df",":","DataFrame","Market","data","with","spot",",","FX","volatility","surface",",","FX","forwards","and","base","depos","asset",":","str","Eg",".","``","EURUSD","''","field",":","str","Market","data","field","to","use","default","-","``","close","''","tenors",":","str","(","list",")","Tenors","to","be","used","(","we","need","to","avoid","tenors",",","where","there","might","be","NaNs",")","vol_function_type",":","str","What","type","of","interpolation","scheme","to","use","default","-","``","CLARK5","''","(","also","``","CLARK","''",",","``","BBG","''","and","``","SABR","''",")","atm_method",":","str","How","is","the","ATM","quoted","?","Eg",".","delta","neutral",",","ATMF","etc",".","default","-","``","fwd-delta-neutral-premium-adj","''","delta_method",":","str","Spot","delta",",","forward","delta","etc",".","default","-","``","spot-delta","''","solver",":","str","Which","solver","to","use","in","FX","vol","surface","calibration","?","default","-","``","nelmer-mead","''","alpha",":","float","Between","0","and","1","(","default","0.5",")"]
code: def __init__(
      self,
      market_df=None,
      asset=None,
      field="close",
      tenors=market_constants.fx_options_tenor_for_interpolation,
      vol_function_type=market_constants.fx_options_vol_function_type,
      atm_method=market_constants.fx_options_atm_method,
      delta_method=market_constants.fx_options_delta_method,
      depo_tenor=market_constants.fx_options_depo_tenor,
      solver=market_constants.fx_options_solver,
      alpha=market_constants.fx_options_alpha,
      tol=market_constants.fx_options_tol,
  ):
      """Initialises object, with market data and various market conventions
  
      Parameters
      ----------
      market_df : DataFrame
          Market data with spot, FX volatility surface, FX forwards and base depos
  
      asset : str
          Eg. "EURUSD"
  
      field : str
          Market data field to use
  
          default - "close"
  
      tenors : str(list)
          Tenors to be used (we need to avoid tenors, where there might be NaNs)
  
      vol_function_type : str
          What type of interpolation scheme to use
          default - "CLARK5" (also "CLARK", "BBG" and "SABR")
  
      atm_method : str
          How is the ATM quoted? Eg. delta neutral, ATMF etc.
  
          default - "fwd-delta-neutral-premium-adj"
  
      delta_method : str
          Spot delta, forward delta etc.
  
          default - "spot-delta"
  
      solver : str
          Which solver to use in FX vol surface calibration?
  
          default - "nelmer-mead"
  
      alpha : float
          Between 0 and 1 (default 0.5)
      """
      self._market_df = market_df
      self._tenors = tenors
      self._asset = asset
      self._field = field
      self._depo_tenor = depo_tenor
      self._market_util = MarketUtil()
  
      self._dom_discount_curve = None
      self._for_discount_curve = None
      self._spot = None
  
      self._value_date = None
      self._fin_fx_vol_surface = None
      self._df_vol_dict = None
  
      for_name_base = asset[0:3]
      dom_name_terms = asset[3:6]
  
      field = "." + field
  
      # CAREFUL: need to divide by 100 for depo rate, ie. 0.0346 = 3.46%
      self._forCCRate = (
          market_df[for_name_base + depo_tenor + field].values / 100.0
      )  # 0.03460  # EUR
      self._domCCRate = (
          market_df[dom_name_terms + depo_tenor + field].values / 100.0
      )  # 0.02940  # USD
  
      self._spot_history = market_df[asset + field].values
      self._atm_vols = market_df[
          [asset + "V" + t + field for t in tenors]
      ].values
      self._market_strangle25DeltaVols = market_df[
          [asset + "25B" + t + field for t in tenors]
      ].values
      self._risk_reversal25DeltaVols = market_df[
          [asset + "25R" + t + field for t in tenors]
      ].values
      self._market_strangle10DeltaVols = market_df[
          [asset + "10B" + t + field for t in tenors]
      ].values
      self._risk_reversal10DeltaVols = market_df[
          [asset + "10R" + t + field for t in tenors]
      ].values
  
      if vol_function_type == "CLARK":
          self._vol_function_type = VolFunctionTypes.CLARK
      elif vol_function_type == "CLARK5":
          self._vol_function_type = VolFunctionTypes.CLARK5
      elif vol_function_type == "BBG":
          self._vol_function_type = VolFunctionTypes.BBG
  
      # Note: currently SABR isn"t fully implemented in FinancePy
      elif vol_function_type == "SABR":
          self._vol_function_type = VolFunctionTypes.SABR
      elif vol_function_type == "SABR3":
          self._vol_function_type = VolFunctionTypes.SABR3
  
      # What does ATM mean? (for most
      if (
          atm_method == "fwd-delta-neutral"
      ):  # ie. strike such that a straddle would be delta neutral
          self._atm_method = FinFXATMMethod.FWD_DELTA_NEUTRAL
      elif atm_method == "fwd-delta-neutral-premium-adj":
          self._atm_method = FinFXATMMethod.FWD_DELTA_NEUTRAL_PREM_ADJ
      elif atm_method == "spot":  # ATM is spot
          self._atm_method = FinFXATMMethod.SPOT
      elif atm_method == "fwd":  # ATM is forward
          self._atm_method = FinFXATMMethod.FWD
  
      # How are the deltas quoted?
      if delta_method == "spot-delta":
          self._delta_method = FinFXDeltaMethod.SPOT_DELTA
      elif delta_method == "fwd-delta":
          self._delta_method = FinFXDeltaMethod.FORWARD_DELTA
      elif delta_method == "spot-delta-prem-adj":
          self._delta_method = FinFXDeltaMethod.SPOT_DELTA_PREM_ADJ
      elif delta_method == "fwd-delta-prem-adj":
          self._delta_method = FinFXDeltaMethod.FORWARD_DELTA_PREM_ADJ
  
      # Which solver to use in FX vol surface calibration
      if solver == "nelmer-mead":
          self._solver = FinSolverTypes.NELDER_MEAD
      elif solver == "nelmer-mead-numba":
          self._solver = FinSolverTypes.NELDER_MEAD_NUMBA
      elif solver == "cg":
          self._solver = FinSolverTypes.CONJUGATE_GRADIENT
  
      self._alpha = alpha
      self._tol = tol
  
imports: import pandas
  import numpy
  from financepy.market.curves.discount_curve_flat import DiscountCurveFlat
  from financepy.utils.date import Date
  from financepy.market.volatility.fx_vol_surface_plus import FXVolSurfacePlus
  from financepy.market.volatility.fx_vol_surface_plus import FinFXATMMethod
  from financepy.market.volatility.fx_vol_surface_plus import FinFXDeltaMethod
  from financepy.market.volatility.fx_vol_surface_plus import vol_function
  from financepy.market.volatility.fx_vol_surface_plus import VolFunctionTypes
  from financepy.utils.global_types import FinSolverTypes
  from findatapy.util.dataconstants import DataConstants
  from finmarketpy.curve.volatility.abstractvolsurface import AbstractVolSurface
  from finmarketpy.util.marketconstants import MarketConstants
  from finmarketpy.util.marketutil import MarketUtil
label_desc: Use image node_id 1 to create a new FXVolSurface object from inherited base classes: AbstractVolSurface with example: obj = FXVolSurface(market_df, asset, field, tenors, vol_function_type, atm_method, delta_method, depo_tenor, solver, alpha, tol)