class_docstr: Tests for methods for the vanilla pricing module.
class_docstr_tok: ["Tests","for","methods","for","the","vanilla","pricing","module","."]
docstr: Computes test barrier option prices for the parameterized inputs.
docstr_tok: ["Computes","test","barrier","option","prices","for","the","parameterized","inputs","."]
code: def test_barrier_option(
      self,
      *,
      volatilities,
      strikes,
      expiries,
      spots,
      discount_rates,
      barriers,
      rebates,
      is_barrier_down,
      is_knock_out,
      is_call_options,
      expected_price,
      dividend_rates=None,
  ):
      """Computes test barrier option prices for the parameterized inputs."""
      # The input values are from examples in the following textbook:
      # The Complete guide to Option Pricing Formulas, 2nd Edition, Page 154
      price = tff.black_scholes.barrier_price(
          volatilities=volatilities,
          strikes=strikes,
          expiries=expiries,
          spots=spots,
          discount_rates=discount_rates,
          dividend_rates=dividend_rates,
          barriers=barriers,
          rebates=rebates,
          is_barrier_down=is_barrier_down,
          is_knock_out=is_knock_out,
          is_call_options=is_call_options,
      )
      self.assertAllClose(price, expected_price, 10e-3)
  
imports: import functools
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tensorflow_probability
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 16 for calling the VanillaPrice obj's underlying member method code with example usage: obj.test_barrier_option() without return types