class_docstr: Represents a batch of Forward Rate Agreements (FRA).
  
  An FRA is a contract for the period [T, T+tau] where the holder exchanges a
  fixed rate (agreed at the start of the contract) against a floating payment
  determined at time T based on the spot Libor rate for term `tau`. The
  cashflows are exchanged at the settlement time T_s, which is either equal to T
  or close to T. See, e.g., [1].
  
  The ForwardRateAgreement class can be used to create and price multiple FRAs
  simultaneously. However all FRAs within an FRA object must be priced using
  a common reference and discount curve.
  
  #### Example:
  The following example illustrates the construction of an FRA instrument and
  calculating its price.
  
  ```python
  RateIndex = instrument_protos.rate_indices.RateIndex
  
  fra = fra_pb2.ForwardRateAgreement(
      short_position=True,
      fixing_date=date_pb2.Date(year=2021, month=5, day=21),
      currency=Currency.USD(),
      fixed_rate=decimal_pb2.Decimal(nanos=31340000),
      notional_amount=decimal_pb2.Decimal(units=10000),
      daycount_convention=DayCountConventions.ACTUAL_360(),
      business_day_convention=BusinessDayConvention.MODIFIED_FOLLOWING(),
      floating_rate_term=fra_pb2.FloatingRateTerm(
          floating_rate_type=RateIndex(type="LIBOR_3M"),
          term = period_pb2.Period(type="MONTH", amount=3)),
      settlement_days=2)
  date = [[2021, 2, 8], [2022, 2, 8], [2023, 2, 8], [2025, 2, 8],
          [2027, 2, 8], [2030, 2, 8], [2050, 2, 8]]
  discount = [0.97197441, 0.94022746, 0.91074031, 0.85495089, 0.8013675,
              0.72494879, 0.37602059]
  market_data_dict = {
      "rates": {
          "USD": {
              "risk_free_curve": {
                  "dates": dates,
                  "discounts": discounts,
              },
              "LIBOR_3M": {
                  "dates": dates,
                  "discounts": discounts,
              }
          }
      },
      "reference_date": [(2020, 2, 8)],
  }
  market = market_data.MarketDataDict(market_data_dict)
  fra_portfolio = forward_rate_agreement.ForwardRateAgreement.from_protos([fra])
  fra_portfolio[0].price(market)
  # Expected result: [4.05463257]
  ```
  
  #### References:
  [1]: Leif B.G. Andersen and Vladimir V. Piterbarg. Interest Rate Modeling,
      Volume I: Foundations and Vanilla Models. Chapter 5. 2010.
docstr: Returns the present value of the stream on the valuation date.
  
  Args:
    market: An instance of `ProcessedMarketData`.
    name: Python str. The name to give to the ops created by this function.
      Default value: `None` which maps to 'price'.
  
  Returns:
    A `Tensor` of shape `batch_shape`  containing the modeled price of each
    FRA contract based on the input market data.
docstr_tok: ["Returns","the","present","value","of","the","stream","on","the","valuation","date",".","Args",":","market",":","An","instance","of","`","ProcessedMarketData","`",".","name",":","Python","str",".","The","name","to","give","to","the","ops","created","by","this","function",".","Default","value",":","`","None","`","which","maps","to","'price","'",".","Returns",":","A","`","Tensor","`","of","shape","`","batch_shape","`","containing","the","modeled","price","of","each","FRA","contract","based","on","the","input","market","data","."]
code: def price(
      self, market: pmd.ProcessedMarketData, name: Optional[str] = None
  ) -> types.FloatTensor:
      """Returns the present value of the stream on the valuation date.
  
      Args:
        market: An instance of `ProcessedMarketData`.
        name: Python str. The name to give to the ops created by this function.
          Default value: `None` which maps to 'price'.
  
      Returns:
        A `Tensor` of shape `batch_shape`  containing the modeled price of each
        FRA contract based on the input market data.
      """
      name = name or (self._name + "_price")
      with tf.name_scope(name):
          discount_curve = cashflow_streams.get_discount_curve(
              self._discount_curve_type, market, self._mask
          )
          reference_curve = cashflow_streams.get_discount_curve(
              self._reference_curve_type, market, self._reference_mask
          )
          # Shape batch_shape + [1]
          daycount_fractions = tf.expand_dims(
              self._daycount_fractions, axis=-1
          )
          # Shape batch_shape + [1]
          fwd_rate = reference_curve.forward_rate(
              self._accrual_start_date.expand_dims(axis=-1),
              self._accrual_end_date.expand_dims(axis=-1),
              day_count_fraction=daycount_fractions,
          )
          # Shape batch_shape + [1]
          discount_at_settlement = discount_curve.discount_factor(
              self._accrual_start_date.expand_dims(axis=-1)
          )
          # Shape batch_shape + [1]
          discount_at_settlement = tf.where(
              daycount_fractions > 0.0,
              discount_at_settlement,
              tf.zeros_like(discount_at_settlement),
          )
          # Shape `batch_shape`
          discount_at_settlement = tf.squeeze(
              discount_at_settlement, axis=-1
          )
          fwd_rate = tf.squeeze(fwd_rate, axis=-1)
          return (
              self._short_position
              * discount_at_settlement
              * self._notional_amount
              * (fwd_rate - self._fixed_rate)
              * self._daycount_fractions
              / (1.0 + self._daycount_fractions * fwd_rate)
          )
  
imports: from typing import Any, Optional, List, Dict, Union
  import dataclasses
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  from tf_quant_finance.experimental.pricing_platform.framework.core import instrument
  from tf_quant_finance.experimental.pricing_platform.framework.core import processed_market_data
  from tf_quant_finance.experimental.pricing_platform.framework.core import rate_indices
  from tf_quant_finance.experimental.pricing_platform.framework.core import types
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import utils
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import cashflow_streams
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments.forward_rate_agreement import proto_utils
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import forward_rate_agreement_pb2
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import period_pb2
label_desc: Use image node_id 5 for calling the ForwardRateAgreement obj's underlying member method code with example usage: obj.price(market, name) and returns: unknown