Last updated: 2023-03-16.
tf_quant_finance.black_scholes.approximations.adesi_whaley#
Computes American option prices using the Baron-Adesi Whaley approximation.
tf_quant_finance.black_scholes.approximations.adesi_whaley(
*, volatilities, strikes, expiries, spots=None, forwards=None,
discount_rates=None, dividend_rates=None, discount_factors=None,
is_call_options=None, max_iterations=100, tolerance=1e-08, dtype=None, name=None
)
Example#
spots = [80.0, 90.0, 100.0, 110.0, 120.0]
strikes = [100.0, 100.0, 100.0, 100.0, 100.0]
volatilities = [0.2, 0.2, 0.2, 0.2, 0.2]
expiries = 0.25
dividends = 0.12
discount_rates = 0.08
computed_prices = adesi_whaley(
volatilities=volatilities,
strikes=strikes,
expiries=expiries,
discount_rates=discount_rates,
dividend_rates=dividends,
spots=spots,
dtype=tf.float64)
# Expected print output of computed prices:
# [0.03, 0.59, 3.52, 10.31, 20.0]
References:#
[1] Baron-Adesi, Whaley, Efficient Analytic Approximation of American Option Values, The Journal of Finance, Vol XLII, No. 2, June 1987 https://deriscope.com/docs/Barone_Adesi_Whaley_1987.pdf
Args:#
volatilities: RealTensorof any shape and real dtype. The volatilities to expiry of the options to price.strikes: A realTensorof the same dtype and compatible shape asvolatilities. The strikes of the options to be priced.expiries: A realTensorof same dtype and compatible shape asvolatilities. The expiry of each option. The units should be such thatexpiry * volatility**2is dimensionless.spots: A realTensorof any shape that broadcasts to the shape of thevolatilities. The current spot price of the underlying. Either this argument or theforwards(but not both) must be supplied.forwards: A realTensorof any shape that broadcasts to the shape ofvolatilities. The forwards to maturity. Either this argument or thespotsmust be supplied but both must not be supplied.discount_rates: An optional realTensorof same dtype as thevolatilities. If notNone, discount factors are calculated as e^(-rT), where r are the discount rates, or risk free rates. Default value:None, equivalent to r = 0 and discount factors = 1 when discount_factors also not given.dividend_rates: An optional realTensorof same dtype as thevolatilities. The continuous dividend rate on the underliers. May be negative (to indicate costs of holding the underlier). Default value:None, equivalent to zero dividends.discount_factors: An optional realTensorof same dtype as thevolatilities. If notNone, these are the discount factors to expiry (i.e. e^(-rT)). Mutually exclusive with discount_rate. If neither is given, no discounting is applied (i.e. the undiscounted option price is returned). Ifspotsis supplied anddiscount_factorsis notNonethen this is also used to compute the forwards to expiry. At most one of discount_rates and discount_factors can be supplied. Default value:None, which maps to-log(discount_factors) / expiriesis_call_options: A booleanTensorof a shape compatible withvolatilities. Indicates whether the option is a call (if True) or a put (if False). If not supplied, call options are assumed.max_iterations: positiveint. The maximum number of iterations of Newton’s root finding method to find the critical spot price above and below which the pricing formula is different. Default value: 100tolerance: Positive scalarTensor. As withmax_iterations, used with the Newton root finder to find the critical spot price. The root finder will judge an element to have converged if|f(x_n) - a|is less thantolerance(wherefis the target function as defined in [1] andx_nis the estimated critical value), or ifx_nbecomesnan. When an element is judged to have converged it will no longer be updated. If all elements converge beforemax_iterationsis reached then the root finder will return early. Default value: 1e-8dtype: Optionaltf.DType. If supplied, the dtype to be used for conversion of any supplied non-Tensorarguments toTensor. Default value: None which maps to the default dtype inferred by TensorFlow.name: str. The name for the ops created by this function. Default value: None which is mapped to the default nameadesi_whaley.
Returns:#
A 3-tuple containing the following items in order:
(a) option_prices: A Tensor of the same shape as forwards. The Black
Scholes price of the options.
(b) converged: A boolean Tensor of the same shape as option_prices
above. Indicates whether the corresponding adesi-whaley approximation
has converged to within tolerance.
(c) failed: A boolean Tensor of the same shape as option_prices
above. Indicates whether the corresponding options price is NaN or not
a finite number. Note that converged being True implies that failed
will be false. However, it may happen that converged is False but
failed is not True. This indicates the search did not converge in the
permitted number of iterations but may converge if the iterations are
increased.
Raises:#
ValueError: (a) If bothforwardsandspotsare supplied or if neither is supplied.