Last updated: 2023-03-16.
tf_quant_finance.black_scholes.approximations.bjerksund_stensland#
Computes prices of a batch of American options using Bjerksund-Stensland.
tf_quant_finance.black_scholes.approximations.bjerksund_stensland(
*, volatilities, strikes, expiries, spots=None, forwards=None,
discount_rates=None, dividend_rates=None, discount_factors=None,
is_call_options=None, modified_boundary=True, dtype=None, name=None
)
Example#
import tf_quant_finance as tff
# Price a batch of 5 american call options.
volatilities = [0.2, 0.2, 0.2, 0.2, 0.2]
forwards = [80.0, 90.0, 100.0, 110.0, 120.0]
# Strikes will automatically be broadcasted to shape [5].
strikes = np.array([100.0])
# Expiries will be broadcast to shape [5], i.e. each option has strike=100
# and expiry = 0.25.
expiries = 0.25
discount_rates = 0.08
dividend_rates = 0.12
computed_prices = tff.black_scholes.approximations.bjerksund_stensland(
volatilities=volatilities,
strikes=strikes,
expiries=expiries,
discount_rates=discount_rates,
dividend_rates=dividend_rates,
forwards=forwards,
is_call_options=True
modified_boundary=True)
# Expected print output of computed prices:
# [ 0.03931201 0.70745419 4.01937524 11.31429842 21.20602005]
References:#
[1] Bjerksund, P. and Stensland G., Closed Form Valuation of American Options, 2002 https://core.ac.uk/download/pdf/30824897.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 thevolatilitiesand of the shape that broadcasts withvolatilities. If notNone, discount factors are calculated as e^(-rT), where r are the discount rates, or risk free rates. At most one of discount_rates and discount_factors can be supplied. 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 and cost_of_carry. 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 e^(-rT) calculated from discount_rates.is_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.modified_boundary: Pythonbool. Indicates whether the Bjerksund-Stensland 1993 algorithm (single boundary) if False or Bjerksund-Stensland 2002 algorithm (modified boundary) if True, is to be used.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 nameoption_price.
Returns:#
A Tensor of the same shape as forwards.
Raises:#
ValueError: If bothforwardsandspotsare supplied or if neither is supplied.ValueError: If bothdiscount_ratesanddiscount_factorsis supplied.