class_docstr: Tests for Binomial tree method prices.
docstr: Tests that the BS prices are correct.
code: def test_option_prices(
      self,
      spots,
      strikes,
      volatilities,
      is_call_options,
      is_american,
      discount_rates,
      dividend_rates,
      expiries,
      expected,
      dtype,
  ):
      """Tests that the BS prices are correct."""
      spots = tf.convert_to_tensor(spots, dtype=dtype)
      strikes = tf.convert_to_tensor(strikes, dtype=dtype)
      volatilities = tf.convert_to_tensor(volatilities, dtype=dtype)
      is_call_options = tf.convert_to_tensor(is_call_options)
      is_american = tf.convert_to_tensor(is_american)
      discount_rates = tf.convert_to_tensor(discount_rates, dtype=dtype)
      dividend_rates = tf.convert_to_tensor(dividend_rates, dtype=dtype)
      expiries = tf.convert_to_tensor(expiries, dtype=dtype)
  
      prices = self.evaluate(
          tff.black_scholes.option_price_binomial(
              volatilities=volatilities,
              strikes=strikes,
              expiries=expiries,
              spots=spots,
              discount_rates=discount_rates,
              dividend_rates=dividend_rates,
              is_call_options=is_call_options,
              is_american=is_american,
              dtype=dtype,
          )
      )
      expected_prices = np.array(expected)
      self.assertAllClose(expected_prices, prices, rtol=1e-5, atol=1e-5)
  
file_path: tf-quant-finance/tf_quant_finance/black_scholes/crr_binomial_tree_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 BinomialModelPrice obj's underlying member method code with example usage: obj.test_option_prices(spots, strikes, volatilities, is_call_options, is_american, discount_rates, dividend_rates, expiries, expected, dtype) without return types