**Machine Learning to Compute Implied Volatility from European/American Options Considering Dividend Yield †**

#### **Shuaiqiang Liu 1, Álvaro Leitao 2,\* , Anastasia Borovykh <sup>3</sup> and Cornelis W. Oosterlee <sup>4</sup>**


Published: 15 September 2020

**Abstract:** Computing implied volatility from observed option prices is a frequent and challenging task in finance, even more in the presence of dividends. In this work, we employ a data-driven machine learning approach to determine the Black–Scholes implied volatility, including European-style and American-style options. The inverse function of the pricing model is approximated by an artificial neural network, which decouples the offline (training) and online (prediction) phases and eliminates the need for an iterative process to solve a minimization problem. Meanwhile, two challenging issues are tackled to improve accuracy and robustness, i.e., steep gradients of the volatility with respect to the option price and irregular early-exercise domains for American options. It is shown that deep neural networks can be used as an efficient numerical technique to compute implied volatility from European/American options. An extended version of this work can be found in [1].

**Keywords:** implied volatility; neural networks; dividend yield; European options; American options

#### **1. Problem Formulation**

The Black–Scholes model for pricing European options reads,

$$\frac{\partial V\_{\rm eu}}{\partial t} + \frac{1}{2}\sigma^2 S^2 \frac{\partial^2 V\_{\rm eu}}{\partial S^2} + (r - q)S \frac{\partial V\_{\rm eu}}{\partial S} - rV\_{\rm eu} = 0,\tag{1}$$

where *r* and *q* are the risk-less interest rate and continuous dividend yield, respectively.

For American options, the original Black–Scholes equation becomes a variational inequality,

$$\frac{\partial V\_{am}}{\partial t} + \frac{1}{2}\sigma^2 S^2 \frac{\partial^2 V\_{am}}{\partial S^2} + (r - q)S \frac{\partial V\_{am}}{\partial S} - rV\_{am} \le 0,\tag{2}$$

where the free boundary condition is *Vam*(*S*, *t*) ≥ *H*(*K*, *St*), and the terminal condition is *Vam*(*S*, *T*) = *H*(*K*, *ST*). We can employ a numerical method, here the COS method [2], to solve the American pricing model. In this work, we will focus on put options. The European/American Black–Scholes solution is denoted by *Veu*/*am* = *BSeu*/*am*(*σ*, *S*0, *K*, *τ*,*r*, *q*, *α*).

Given an observed market option price *Vmkt* (European or American), the Black–Scholes implied volatility *σ*∗ is defined by

$$BS(\sigma^\*; \mathbf{S}\_0, \mathbf{K}, \tau, r, q, a) = V^{mkt}. \tag{3}$$

There does not exist a closed-form expression of the inverse function for neither American-style or European-style options. A popular way is to formulate the above problem into a minimization problem,

$$\min\_{\sigma^\* \in \mathbb{R}^+} BS(\sigma^\*; S\_0, K, \tau, r, q, \alpha) - V^{mkt} \tag{4}$$

There are several root-finding numerical algorithms to solve (4), for example, Newton–Raphson,

$$
\sigma\_{k+1}^\* = \sigma\_k^\* - \frac{V(\sigma\_k^\*) - V^{mkt}}{BS'(\sigma\_k^\*)} = \sigma\_k^\* - \frac{V(\sigma\_k^\*) - V^{mkt}}{\text{Vega}(\sigma\_k^\*)}, \; k = 0, \dots \tag{5}
$$

However, some issues are likely to arise when using derivative-based algorithms, see Figure 1.

**Figure 1.** The Vega for American options: One tail is near zero, and the other tail is flat (zero value).

#### **2. Methodology**

In order to avoid an iterative algorithm, we provide a data-driven approach for directly approximating the inverse function of (3) via neural networks. Mathematically, an artificial neural network (ANN) can be represented as a composite function,

$$\mathbf{F}(\mathbf{x}|\boldsymbol{\Theta}) = f^{(L)}(\dots f^{(2)}(f^{(1)}(\mathbf{x};\boldsymbol{\theta}\_1);\boldsymbol{\theta}\_2);\dots,\boldsymbol{\theta}\_L),\tag{6}$$

where **x** stands for the input variables, **Θ** for the hidden parameters (i.e., weights and biases), *L* for the number of hidden layers.

The implied volatility defined by Equation (3) can be written as an inverse function of the pricing model,

$$
\sigma^\* = BS^{-1}(V^{\text{mkt}}; S, K, \tau, r, q, a),
\tag{7}
$$

where *BS*−1(·) denotes the inverse Black–Scholes function (European-style or American-style). Please note that the definition domain of (7) is the continuation region Ω*<sup>h</sup>* for American-style options. We use a deep neural network to approximate the inverse Black–Scholes function,

$$
\sigma^\* = BS^{-1}(V^{mkt}; S, K, \tau, r, q, \alpha) \approx \text{NN}(V^{mkt}; S, K, \tau, r, q, \alpha). \tag{8}
$$

Thus we do not need any iterative algorithm to solve (3).

#### *2.1. ANN for European Implied Volatility*

The inverse Black–Scholes function probably gives rise to steep gradients of the volatility with respect to the option price, especially for deep OTM/ITM options. It is known that the ANN has difficulties accurately representing such gradients. Here we employ the gradient-squashing technique, as in [3], to address this issue,

$$\hat{V}\_{\rm eu}^{P} = \log\left(V\_{\rm cu}^{P}(\mathcal{S}, t) - \max(\mathcal{K}e^{-r\tau} - \mathcal{S}\_{l}e^{-q\tau}, 0)\right). \tag{9}$$

#### *2.2. ANN for American Implied Volatility*

For training the ANN to compute implied volatility from American options, there are two steps, due to the early-exercise feature. First, we need to compute again the gradient-squashed time value of an American option,

$$\hat{V}\_{am}^P = \log\left(V\_{am}^P(S\_{l\prime}, t) - \max(K - S\_{l\prime}Ke^{-r\tau} - S\_l e^{-q\tau}, 0)\right). \tag{10}$$

Second, the effective definition domain Ω*<sup>h</sup>* of the inverse function (8) is numerically found based on the generated samples.

#### **3. Numerical Results**

In addition to being robust, the neural network (IV-ANN) solver is much faster than an iterative numerical solver to compute implied volatility from European/American options including dividends, see Tables 1–4.

**Table 1.** Artificial neural network (ANN) hyper-parameters.



**Table 2.** Model parameter ranges.

**Table 3.** Performance of IV-ANN.


**Table 4.** Computational cost based on 20,000 option prices.


#### **References**


c 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

MDPI St. Alban-Anlage 66 4052 Basel Switzerland Tel. +41 61 683 77 34 Fax +41 61 302 89 18 www.mdpi.com

*Proceedings* Editorial Office E-mail: proceedings@mdpi.com www.mdpi.com/journal/proceedings

MDPI St. Alban-Anlage 66 4052 Basel Switzerland

Tel: +41 61 683 77 34 Fax: +41 61 302 89 18