class_docstr: Tests for methods for the asian pricing module.
class_docstr_tok: ["Tests","for","methods","for","the","asian","pricing","module","."]
docstr: Tests that a single sampling asian replicates vanilla prices.
docstr_tok: ["Tests","that","a","single","sampling","asian","replicates","vanilla","prices","."]
code: def test_single_sample_asian_matches_vanilla(self):
      """Tests that a single sampling asian replicates vanilla prices."""
      forwards = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
      strikes = np.array([3.0, 3.0, 3.0, 3.0, 3.0])
      volatilities = np.array([0.0001, 102.0, 2.0, 0.1, 0.4])
      expiries = 1.0
      computed_price_vanillas = self.evaluate(
          tff.black_scholes.option_price(
              volatilities=volatilities,
              strikes=strikes,
              expiries=expiries,
              forwards=forwards,
          )
      )
      sampling_times = np.array([[1.0, 1.0, 1.0, 1.0, 1.0]])
      computed_price_asians = self.evaluate(
          tff.black_scholes.asian_option_price(
              volatilities=volatilities,
              strikes=strikes,
              expiries=expiries,
              forwards=forwards,
              sampling_times=sampling_times,
          )
      )
      self.assertArrayNear(
          computed_price_vanillas, computed_price_asians, 1e-10
      )
  
file_path: tf-quant-finance/tf_quant_finance/black_scholes/asian_prices_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 3 for calling the AsianPriceTest obj's underlying member method code with example usage: obj.test_single_sample_asian_matches_vanilla() without return types