class_docstr: Tests for methods for the Heston asian pricing module.
class_docstr_tok: ["Tests","for","methods","for","the","Heston","asian","pricing","module","."]
docstr: Tests that single sampling puts and calls both match vanilla prices.
docstr_tok: ["Tests","that","single","sampling","puts","and","calls","both","match","vanilla","prices","."]
code: def test_puts_and_calls_match_vanilla(self):
      """Tests that single sampling puts and calls both match vanilla prices."""
  
      variances = 0.09
      mean_reversion = 1.15
      volvol = 0.39
      theta = 0.0348
      rho = -0.64
      spots = 100.0
      strikes = [90.0, 100.0, 110.0]
      discount_rates = 0.05
      dividend_rates = 0.0
  
      is_call_options = [False, True, False]
  
      expiries = tf.constant([1.0, 1.0, 1.0])
      sampling_times = tf.constant([1.0, 1.0, 1.0])[:, tf.newaxis]
  
      computed_prices_asians = asian_option_price(
          variances=variances,
          mean_reversion=mean_reversion,
          theta=theta,
          volvol=volvol,
          rho=rho,
          strikes=strikes,
          expiries=expiries,
          spots=spots,
          sampling_times=sampling_times,
          discount_rates=discount_rates,
          dividend_rates=dividend_rates,
          is_call_options=is_call_options,
      )
  
      computed_price_europeans = european_option_price(
          strikes=strikes,
          expiries=expiries,
          spots=spots,
          discount_rates=discount_rates,
          dividend_rates=dividend_rates,
          variances=variances,
          mean_reversion=mean_reversion,
          theta=theta,
          volvol=volvol,
          rho=rho,
          is_call_options=is_call_options,
      )
  
      self.assertAllClose(
          computed_prices_asians, computed_price_europeans, 1e-4
      )
  
file_path: tf-quant-finance/tf_quant_finance/models/heston/approximations/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 5 for calling the AsianPriceTest obj's underlying member method code with example usage: obj.test_puts_and_calls_match_vanilla() without return types