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 for methods for the asian pricing module.
docstr_tok: ["Tests","for","methods","for","the","asian","pricing","module","."]
code: def test_option_prices(self):
      """Tests for methods for the asian pricing module."""
      # Expected results come from tables (1)-(3) in
      # 'A Recursive Method for Discretely Monitored Geometric Asian Option
      # Prices', Bull. Korean Math. Soc. 53, 733-749 (2016)
      # by B. Kim, J. Kim, J. Kim & I. S. Wee (1y expiry, weekly sampling)
      variances = [0.09, 0.09, 0.09]
      mean_reversion = [1.15, 1.15, 1.15]
      volvol = [0.39, 0.39, 0.39]
      theta = [0.0348, 0.0348, 0.0348]
      rho = [-0.64, -0.64, -0.64]
      spots = [100.0, 100.0, 100.0]
      strikes = [90.0, 100.0, 110.0]
      discount_rates = [0.05, 0.05, 0.05]
      dividend_rates = [0.0, 0.0, 0.0]
  
      expiries = 1.0
      times = np.linspace(0, expiries, 52)[1:]
      expiries = [expiries, expiries, expiries]
      batch_shape = list(tf.constant(spots).shape)
      sampling_times = np.ones(
          shape=list(times.shape) + batch_shape
      ) * tf.expand_dims(times, 1)
  
      expected_prices = tf.constant(
          [13.6950, 7.2243, 2.9479], dtype=np.float64
      )
  
      computed_prices = 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,
          dtype=tf.float64,
      )
  
      self.assertAllClose(expected_prices, computed_prices, 1e-2)
  
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 1 for calling the AsianPriceTest obj's underlying member method code with example usage: obj.test_option_prices() without return types