Last updated: 2023-03-16.
tf_quant_finance.experimental.american_option_pricing.andersen_lake.exercise_boundary.boundary_numerator#
Calculates the numerator of the exercise boundary function of an American option.
tf_quant_finance.experimental.american_option_pricing.andersen_lake.exercise_boundary.boundary_numerator(
tau_grid, b, k, r, q, sigma, integration_num_points=32, dtype=None
)
Calculates the numerator part of the calculation required to get the exercise
boundary function of an American option. This corresponds to N in formula
(3.7) in the paper [1].
References#
[1] Leif Andersen, Mark Lake and Dimitri Offengenden. High-performance American option pricing. 2015 https://engineering.nyu.edu/sites/default/files/2019-03/Carr-adjusting-exponential-levy-models.pdf#page=54
Example#
dtype = tf.float64
tau_grid = tf.constant([[0., 0.5, 1.], [0., 1., 2.], [0., 3., 6.]],
dtype=dtype)
k = tf.constant([1, 2, 2], dtype=dtype)
r = tf.constant([0.01, 0.02, 0.04], dtype=dtype)
q = tf.constant([0.01, 0.02, 0.0], dtype=dtype)
sigma = tf.constant([0.1, 0.15, 0.05], dtype=dtype)
k_exp = k[:, tf.newaxis, tf.newaxis]
r_exp = r[:, tf.newaxis, tf.newaxis]
q_exp = q[:, tf.newaxis, tf.newaxis]
epsilon = machine_eps(dtype)
def b_0(tau_grid_exp):
one = tf.constant(1.0, dtype=dtype)
return tf.ones_like(tau_grid_exp) * k_exp_exp * tf.where(
tf.math.abs(q_exp_exp) < epsilon, one,
tf.math.minimum(one, r_exp_exp / q_exp_exp))
integration_num_points = 32
boundary_numerator(tau_grid, b_0, k, r, q, sigma, integration_num_points)
# Returns a tensor of shape [3, 3].
Args:#
tau_grid: Grid of values of shape[num_options, grid_num_points]indicating the time left until option maturity.b: Represents the exercise boundary function for the option. ReceivesTensorof ranktau_grid.rank + 1and returns aTensorof same shape.k: Same dtype astau_gridwith shapenum_optionsrepresenting the strike price of the option.r: Same shape and dtype askrepresenting the annualized risk-free interest rate, continuously compounded.q: Same shape and dtype askrepresenting the dividend rate.sigma: Same shape and dtype askrepresenting the volatility of the option’s returns.integration_num_points: The number of points used in the integration approximation method. Default value: 32.dtype: If supplied, the dtype for all input tensors. Result will have the same dtype. Default value: None which maps to dtype oftau_grid.
Returns:#
Tensor of shape [num_options, grid_num_points], containing a partial
result for calculating the exercise boundary.