Last updated: 2023-03-16.
tf_quant_finance.models.heston.approximations.asian_option_price#
Computes the Heston price for a batch of asian options.
tf_quant_finance.models.heston.approximations.asian_option_price(
*, variances, mean_reversion, theta, volvol, rho, strikes, expiries, spots=None,
forwards=None, sampling_times=None, past_fixings=None, discount_rates=None,
dividend_rates=None, discount_factors=None, is_call_options=None,
averaging_type=tf_quant_finance.black_scholes.AveragingType.GEOMETRIC,
averaging_frequency=tf_quant_finance.black_scholes.AveragingFrequency.DISCRETE,
integration_method=None, dtype=None, name=None, **kwargs
)
Discrete and continuous geometric asian options can be priced using a semi-analytical expression in the Heston model.
Example#
# Price a batch of seasoned discrete geometric asians in Heston model
# This example reproduces some prices from the reference paper
variances = 0.09
mean_reversion = 1.15
volvol = 0.39
theta = 0.0348
rho = -0.64
spots = 100.0
strikes = [90.0, 100.0, 110.0]
discount_rates = 0.05
T = 0.5
expiries = T
sampling_times = np.linspace(1/365, T, 182)[:, np.newaxis]
computed_prices_asians = 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
)
# Expected print output of computed prices:
# [[11.884178 ], [ 5.080889 ], [ 1.3527349]]
References:#
[1] B. Kim, J. Kim, J. Kim & I. S. Wee, “A Recursive Method for Discretely Monitored Geometric Asian Option Prices”, Bull. Korean Math. Soc. 53, 733-749 (2016)
Args:#
variances: RealTensorof any shape compatible with abatch_shapeand and any real dtype. The initial value of the variance.mean_reversion: A realTensorof the same dtype and compatible shape asvariances. Corresponds to the mean reversion rate.theta: A realTensorof the same dtype and compatible shape asvariances. Corresponds to the long run price variance.volvol: A realTensorof the same dtype and compatible shape asvariances. Corresponds to the volatility of the volatility.rho: A realTensorof the same dtype and compatible shape asvariances. Corresponds to the correlation between dW_dW_{V}`.strikes: A realTensorof the same dtype and compatible shape asvariances. The strikes of the options to be priced.expiries: A realTensorof same dtype and compatible shape asvariances. 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 thevariances. 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 ofvariances. The forwards to maturity. Either this argument or thespotsmust be supplied but both must not be supplied.sampling_times: A realTensorof same dtype as expiries and shape[n] + batch_shapewherenis the number of sampling times for the asian options Default value:None, which will raise an error for discrete sampling asian optionspast_fixings: A realTensorof same dtype as spots or forwards and shape[n] + batch_shapewhere n is the number of past fixings that have already been observed Default value:None, equivalent to no past fixings (ie. unseasoned)discount_rates: An optional realTensorof same dtype as thevariancesand of the shape that broadcasts withvariances. If notNone, discount factors are calculated as e^(-rT), where r are the discount rates, or risk free rates. At most one ofdiscount_ratesanddiscount_factorscan be supplied. Default value:None, equivalent to r = 0 and discount factors = 1 whendiscount_factorsalso not given.dividend_rates: An optional realTensorof same dtype as thevariancesand of the shape that broadcasts withvariances. Default value:None, equivalent to q = 0.discount_factors: An optional realTensorof same dtype as thevariances. If notNone, these are the discount factors to expiry (i.e. e^(-rT)). Mutually exclusive withdiscount_rates. 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 ofdiscount_ratesanddiscount_factorscan be supplied. Default value:None, which maps to e^(-rT) calculated from discount_rates.is_call_options: A booleanTensorof a shape compatible withvariances. Indicates whether the option is a call (if True) or a put (if False). If not supplied, call options are assumed.averaging_type: Enum value of AveragingType to select the averaging method for the payoff calculation Default value: AveragingType.GEOMETRICaveraging_frequency: Enum value of AveragingFrequency to select the averaging type for the payoff calculation (discrete vs continuous) Default value: AveragingFrequency.DISCRETEintegration_method: An instance ofmath.integration.IntegrationMethod. Default value:Nonewhich maps to Gaussian quadrature.dtype: Optionaltf.DType. If supplied, the dtype to be used for conversion of any supplied non-Tensorarguments toTensor. Default value:Nonewhich maps to the default dtype inferred by TensorFlow.name: str. The name for the ops created by this function. Default value:Nonewhich is mapped to the default nameasian_option_price.**kwargs: Additional parameters for the underlying integration method. If not supplied, uses boundslower=1e-9,upper=100.
Returns:#
option_prices: ATensorof the same shape asstrikes. The Heston price of the options.
Raises:#
ValueError: If bothforwardsandspotsare supplied or if neither is supplied.ValueError: If bothdiscount_ratesanddiscount_factorsis supplied.ValueError: If option is arithmetic.NotImplementedError: if option is continuous averaging.NotImplementedError: if any of the Heston model parameters are of type PiecewiseConstantFunc.