class_docstr: Represents a batch of European Swaptions.
  
  A European Swaption is a contract that gives the holder an option to enter a
  swap contract at a future date at a prespecified fixed rate. A swaption that
  grants the holder to pay fixed rate and receive floating rate is called a
  payer swaption while the swaption that grants the holder to receive fixed and
  pay floating payments is called the receiver swaption. Typically the start
  date (or the inception date) of the swap concides with the expiry of the
  swaption [1].
  
  The Swaption class can be used to create and price multiple swaptions
  simultaneously. However all swaptions within an object must be priced using
  common reference/discount curve.
  
  ### Example:
  The following example illustrates the construction of an European swaption
  and calculating its price using the Hull-White One Factor Model.
  
  ```python
  import tensorflow_quant_finance as tff
  core = tff.experimental.pricing_platform.framework.core
  dates = tff.datetime
  market_data = tff.experimental.pricing_platform.framework.market_data
  rates_instruments =
  tff.experimental.pricing_platform.framework.rate_instruments
  
  instrument_protos = tff.experimental.pricing_platform.instrument_protos
  date_pb2 = instrument_protos.date
  decimal_pb2 = instrument_protos.decimal
  swap_pb2 = instrument_protos.interest_rate_swap
  period_pb2 = instrument_protos.period
  rate_indices_pb2 = instrument_protos.rate_indices
  swaption_pb2 = instrument_protos.swaption
  
  swapproto = swap_pb2.InterestRateSwap(
      effective_date=date_pb2.Date(year=2022, month=2, day=10),
      maturity_date=date_pb2.Date(year=2025, month=2, day=10),
      currency=core.currencies.Currency.USD(),
      pay_leg=swap_pb2.SwapLeg(
          fixed_leg=swap_pb2.FixedLeg(
              currency=core.currencies.Currency.USD(),
              coupon_frequency=period_pb2.Period(type='MONTH', amount=6),
              notional_amount=decimal_pb2.Decimal(units=100),
              fixed_rate=decimal_pb2.Decimal(nanos=11000000),
              daycount_convention=core.daycount_conventions
              .DayCountConventions.ACTUAL_365(),
              business_day_convention=core.business_days.BusinessDayConvention
              .NO_ADJUSTMENT(),
              settlement_days=0)),
      receive_leg=swap_pb2.SwapLeg(
          floating_leg=swap_pb2.FloatingLeg(
              currency=core.currencies.Currency.USD(),
              coupon_frequency=period_pb2.Period(type='MONTH', amount=3),
              reset_frequency=period_pb2.Period(type='MONTH', amount=3),
              notional_amount=decimal_pb2.Decimal(units=100),
              floating_rate_type=rate_indices_pb2.RateIndex(type='LIBOR_3M'),
              daycount_convention=core.daycount_conventions
              .DayCountConventions.ACTUAL_365(),
              business_day_convention=core.business_days.BusinessDayConvention
              .NO_ADJUSTMENT(),
              settlement_days=0)))
  swaption_proto = swaption_pb2.Swaption(
      swap=swapproto, expiry_date=date_pb2.Date(year=2022, month=2, day=10))
  
  hull_white_config = core.models.HullWhite1FactorConfig(
        mean_reversion=[0.03], volatility=[0.01])
  config = rates_instruments.swaption.SwaptionConfig(
      model_params=hull_white_config)
  
  curve_dates = self._valuation_date + dates.years(
      [1, 2, 3, 5, 7, 10, 30])
  
  curve_discounts = np.exp(-0.01 * np.array([1, 2, 3, 5, 7, 10, 30]))
  
    dates = [[2021, 2, 8], [2022, 2, 8], [2023, 2, 8], [2025, 2, 8],
             [2027, 2, 8], [2030, 2, 8], [2050, 2, 8]]
    discounts = [0.97197441, 0.94022746, 0.91074031, 0.85495089, 0.8013675,
                 0.72494879, 0.37602059]
    libor_3m_config = {
        "interpolation_method": interpolation_method.InterpolationMethod.LINEAR
    }
    self._market_data_dict = {
        "rates": {
            "USD": {
                "risk_free_curve": {
                    "dates": dates,
                    "discounts": discounts,
                },
                "LIBOR_3M": {
                    "dates": dates,
                    "discounts": discounts,
                    "config": libor_3m_config,
                }
            }
        },
        "reference_date": [(2020, 2, 10)],
    }
  
  market = market_data.MarketDataDict(market_data_dict)
  
  swaption = rates_instruments.swaption.Swaption.from_protos(
      [swaption_proto], config=config)
  price = swaption[0].price(market)
  
  # Expected result: 1.38594754
  ```
  
  ### References:
  [1]: Leif B.G. Andersen and Vladimir V. Piterbarg. Interest Rate Modeling,
      Volume I: Foundations and Vanilla Models. Chapter 5. 2010.
class_docstr_tok: ["Represents","a","batch","of","European","Swaptions",".","A","European","Swaption","is","a","contract","that","gives","the","holder","an","option","to","enter","a","swap","contract","at","a","future","date","at","a","prespecified","fixed","rate",".","A","swaption","that","grants","the","holder","to","pay","fixed","rate","and","receive","floating","rate","is","called","a","payer","swaption","while","the","swaption","that","grants","the","holder","to","receive","fixed","and","pay","floating","payments","is","called","the","receiver","swaption",".","Typically","the","start","date","(","or","the","inception","date",")","of","the","swap","concides","with","the","expiry","of","the","swaption","[","1","]",".","The","Swaption","class","can","be","used","to","create","and","price","multiple","swaptions","simultaneously",".","However","all","swaptions","within","an","object","must","be","priced","using","common","reference\/discount","curve",".","#","#","#","Example",":","The","following","example","illustrates","the","construction","of","an","European","swaption","and","calculating","its","price","using","the","Hull-White","One","Factor","Model",".","``","`","python","import","tensorflow_quant_finance","as","tff","core","=","tff.experimental.pricing_platform.framework.core","dates","=","tff.datetime","market_data","=","tff.experimental.pricing_platform.framework.market_data","rates_instruments","=","tff.experimental.pricing_platform.framework.rate_instruments","instrument_protos","=","tff.experimental.pricing_platform.instrument_protos","date_pb2","=","instrument_protos.date","decimal_pb2","=","instrument_protos.decimal","swap_pb2","=","instrument_protos.interest_rate_swap","period_pb2","=","instrument_protos.period","rate_indices_pb2","=","instrument_protos.rate_indices","swaption_pb2","=","instrument_protos.swaption","swapproto","=","swap_pb2.InterestRateSwap","(","effective_date=date_pb2.Date","(","year=2022",",","month=2",",","day=10",")",",","maturity_date=date_pb2.Date","(","year=2025",",","month=2",",","day=10",")",",","currency=core.currencies.Currency.USD","(",")",",","pay_leg=swap_pb2.SwapLeg","(","fixed_leg=swap_pb2.FixedLeg","(","currency=core.currencies.Currency.USD","(",")",",","coupon_frequency=period_pb2.Period","(","type='MONTH","'",",","amount=6",")",",","notional_amount=decimal_pb2.Decimal","(","units=100",")",",","fixed_rate=decimal_pb2.Decimal","(","nanos=11000000",")",",","daycount_convention=core.daycount_conventions",".DayCountConventions.ACTUAL_365","(",")",",","business_day_convention=core.business_days.BusinessDayConvention",".NO_ADJUSTMENT","(",")",",","settlement_days=0",")",")",",","receive_leg=swap_pb2.SwapLeg","(","floating_leg=swap_pb2.FloatingLeg","(","currency=core.currencies.Currency.USD","(",")",",","coupon_frequency=period_pb2.Period","(","type='MONTH","'",",","amount=3",")",",","reset_frequency=period_pb2.Period","(","type='MONTH","'",",","amount=3",")",",","notional_amount=decimal_pb2.Decimal","(","units=100",")",",","floating_rate_type=rate_indices_pb2.RateIndex","(","type='LIBOR_3M","'",")",",","daycount_convention=core.daycount_conventions",".DayCountConventions.ACTUAL_365","(",")",",","business_day_convention=core.business_days.BusinessDayConvention",".NO_ADJUSTMENT","(",")",",","settlement_days=0",")",")",")","swaption_proto","=","swaption_pb2.Swaption","(","swap=swapproto",",","expiry_date=date_pb2.Date","(","year=2022",",","month=2",",","day=10",")",")","hull_white_config","=","core.models.HullWhite1FactorConfig","(","mean_reversion=","[","0.03","]",",","volatility=","[","0.01","]",")","config","=","rates_instruments.swaption.SwaptionConfig","(","model_params=hull_white_config",")","curve_dates","=","self._valuation_date","+","dates.years","(","[","1",",","2",",","3",",","5",",","7",",","10",",","30","]",")","curve_discounts","=","np.exp","(","-0.01","*","np.array","(","[","1",",","2",",","3",",","5",",","7",",","10",",","30","]",")",")","dates","=","[","[","2021",",","2",",","8","]",",","[","2022",",","2",",","8","]",",","[","2023",",","2",",","8","]",",","[","2025",",","2",",","8","]",",","[","2027",",","2",",","8","]",",","[","2030",",","2",",","8","]",",","[","2050",",","2",",","8","]","]","discounts","=","[","0.97197441",",","0.94022746",",","0.91074031",",","0.85495089",",","0.8013675",",","0.72494879",",","0.37602059","]","libor_3m_config","=","{","``","interpolation_method","''",":","interpolation_method.InterpolationMethod.LINEAR","}","self._market_data_dict","=","{","``","rates","''",":","{","``","USD","''",":","{","``","risk_free_curve","''",":","{","``","dates","''",":","dates",",","``","discounts","''",":","discounts",",","}",",","``","LIBOR_3M","''",":","{","``","dates","''",":","dates",",","``","discounts","''",":","discounts",",","``","config","''",":","libor_3m_config",",","}","}","}",",","``","reference_date","''",":","[","(","2020",",","2",",","10",")","]",",","}","market","=","market_data.MarketDataDict","(","market_data_dict",")","swaption","=","rates_instruments.swaption.Swaption.from_protos","(","[","swaption_proto","]",",","config=config",")","price","=","swaption","[","0","]",".price","(","market",")","#","Expected","result",":","1.38594754","``","`","#","#","#","References",":","[","1","]",":","Leif","B.G",".","Andersen","and","Vladimir","V.","Piterbarg",".","Interest","Rate","Modeling",",","Volume","I",":","Foundations","and","Vanilla","Models",".","Chapter","5",".","2010","."]
code: def from_protos(
      cls,
      proto_list: List[swaption_proto.Swaption],
      config: SwaptionConfig = None,
  ) -> List["Swaption"]:
      prepare_swaptions = proto_utils.from_protos(proto_list, config)
      instruments = []
      for kwargs in prepare_swaptions.values():
          kwargs[
              "swap"
          ] = interest_rate_swap.InterestRateSwap.from_protos(
              kwargs["swap"]
          )[
              0
          ]
          instruments.append(cls(**kwargs))
      return instruments
  
imports: import dataclasses
  from typing import Any, Dict, List, Optional, Union
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance.experimental.pricing_platform.framework.core import instrument
  from tf_quant_finance.experimental.pricing_platform.framework.core import models
  from tf_quant_finance.experimental.pricing_platform.framework.core import processed_market_data
  from tf_quant_finance.experimental.pricing_platform.framework.core import types
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import cashflow_streams
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import interest_rate_swap
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments.swaption import proto_utils
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import swaption_pb2
  from tf_quant_finance.models import hull_white
label_desc: Use image node_id 4 for calling the Swaption obj's underlying member method code with example usage: obj.from_protos(cls, proto_list, config) and returns: instruments