class_docstr: Arranging underlying volatility market in easier to read format. Also provides methods for calculating various
  volatility metrics, such as realized_vol volatility and volatility risk premium. Has extensive support for estimating
  implied_vol volatility addons.
class_docstr_tok: ["Arranging","underlying","volatility","market","in","easier","to","read","format",".","Also","provides","methods","for","calculating","various","volatility","metrics",",","such","as","realized_vol","volatility","and","volatility","risk","premium",".","Has","extensive","support","for","estimating","implied_vol","volatility","addons","."]
docstr: Calculates the implied volatility add on for specific tenors. The implied volatility addon can be seen as
  a proxy for the event weights of large scheduled events for that day, such as the US employment report.
  
  If there are multiple large events in the same period covered by the option, then this approach is not going
  to be able to disentangle this.
  
  Parameters
  ----------
  asset : str
      Asset to be traded (eg. EURUSD)
  
  tenor: str
      eg. ON
  
  Returns
  ------
  Implied volatility addon
docstr_tok: ["Calculates","the","implied","volatility","add","on","for","specific","tenors",".","The","implied","volatility","addon","can","be","seen","as","a","proxy","for","the","event","weights","of","large","scheduled","events","for","that","day",",","such","as","the","US","employment","report",".","If","there","are","multiple","large","events","in","the","same","period","covered","by","the","option",",","then","this","approach","is","not","going","to","be","able","to","disentangle","this",".","Parameters","--","--","--","--","--","asset",":","str","Asset","to","be","traded","(","eg",".","EURUSD",")","tenor",":","str","eg",".","ON","Returns","--","--","--","Implied","volatility","addon"]
code: def calculate_implied_vol_addon(
      self,
      asset,
      implied_vol=None,
      tenor_label="ON",
      model_window=20,
      model_algo="weighted-median-model",
      field="close",
      adj_ON_friday=True,
  ):
      """Calculates the implied volatility add on for specific tenors. The implied volatility addon can be seen as
      a proxy for the event weights of large scheduled events for that day, such as the US employment report.
  
      If there are multiple large events in the same period covered by the option, then this approach is not going
      to be able to disentangle this.
  
      Parameters
      ----------
      asset : str
          Asset to be traded (eg. EURUSD)
  
      tenor: str
          eg. ON
  
      Returns
      ------
      Implied volatility addon
      """
  
      part = "V"
  
      if implied_vol is None:
          implied_vol = self._market_df[
              asset + "V" + tenor_label + "." + field
          ]
  
      implied_vol = implied_vol.copy(deep=True)
      implied_vol = pd.DataFrame(implied_vol)
  
      # So we eliminate impact of holidays on addons
      if tenor_label == "ON" and adj_ON_friday:
          implied_vol = self.adjust_implied_ON_fri_vol(implied_vol)
  
      implied_vol = (
          implied_vol.dropna()
      )  # otherwise the moving averages get corrupted
  
      # vol_data_avg_by_weekday = vol_data.groupby(vol_data.index.weekday).transform(lambda x: pandas.rolling_mean(x, window=10))
  
      # Create a simple estimate for recent implied_vol volatility using multiple tenors
      # vol_data_20D_avg = time_series_calcs.rolling_average(vol_data,window1)
      # vol_data_10D_avg = time_series_calcs.rolling_average(vol_data,window1)
      # vol_data_5D_avg = time_series_calcs.rolling_average(vol_data, window1)
  
      if model_algo == "weighted-median-model":
          vol_data_20D_avg = self._calculations.rolling_median(
              implied_vol, model_window
          )
          vol_data_10D_avg = self._calculations.rolling_median(
              implied_vol, model_window
          )
          vol_data_5D_avg = self._calculations.rolling_median(
              implied_vol, model_window
          )
  
          vol_data_avg = (
              vol_data_20D_avg + vol_data_10D_avg + vol_data_5D_avg
          ) / 3
          vol_data_addon = implied_vol - vol_data_avg
      elif model_algo == "weighted-mean-model":
          vol_data_20D_avg = self._calculations.rolling_average(
              implied_vol, model_window
          )
          vol_data_10D_avg = self._calculations.rolling_average(
              implied_vol, model_window
          )
          vol_data_5D_avg = self._calculations.rolling_average(
              implied_vol, model_window
          )
  
          vol_data_avg = (
              vol_data_20D_avg + vol_data_10D_avg + vol_data_5D_avg
          ) / 3
          vol_data_addon = implied_vol - vol_data_avg
  
      # TODO add other implied vol addon models
  
      vol_data_addon = pd.DataFrame(vol_data_addon)
      implied_vol = pd.DataFrame(implied_vol)
  
      new_cols = implied_vol.columns.values
  
      new_cols = [
          w.replace(part + tenor_label, "ADD" + tenor_label)
          for w in new_cols
      ]
  
      vol_data_addon.columns = new_cols
  
      return vol_data_addon
  
file_path: finmarketpy/finmarketpy/curve/volatility/volstats.py
imports: import math
  import pandas
  from pandas.tseries.offsets import CustomBusinessDay
  from findatapy.timeseries import Calculations, Filter, Timezone
  from findatapy.timeseries import Calendar
label_desc: Use image node_id 4 for calling the VolStats obj's underlying member method code with example usage: obj.calculate_implied_vol_addon(asset, implied_vol, tenor_label, model_window, model_algo, field, adj_ON_friday) and returns: vol_data_addon