Ratio Mathematica Volume 42, 2022 Comparative study between local and global optimization for the Heston model Mohammed Bouasabah* Abstract The objective of this study is to estimate the calibration parameters of the Heston stochastic volatility model by the two optimization methods: local and global, then to compare their performances and finally to recommend one of the two methods. To predict the prices of EUR/USD currency options, we use the Heston stochastic volatility model. We will first present the model and the two optimization methods: local and global, then we will estimate the calibration parameters using the two optimization methods with MATLAB software, then compare the two and recommend the most efficient method. Results have shown that the local optimization provides excellent calibration parameters with a reduced computational time compared to the global optimization. Therefore, we can clearly recommend it for the Heston model. Keywords: Heston Model; Local calibration; Global calibration. 2010 AMS subject classification: 46N10, 91B60, 91B70, 91G20, 91G30 *National School of Business and Management, Ibn Tofail University, Kenitra, Morocco. mohammed.bouasabah@uit.ac.ma doi: 10.23755 / rm.v41i0.773. ISSN: 1592-7415. eISSN: 2282-8214. Β©The Authors. This paper is published under the CC-BY licence agreement. 217 Received on April 26th, 2022. Accepted on June 26th, 2022. Published on June 30th, 2022. M. Bouasabah 1. Introduction Calibration is the process of adjusting the parameters of a model by integrating the uncertainty of the parameters and/or the model to obtain a representation of the modeled system that satisfies a predefined criterion. The model used is the one proposed by Heston in 1993, which is a stochastic volatility model. The success of Heston's model lies in the calibration of its parameters and in the analytical form of its characteristic function. In this study, first, we will give the explicit form of call currency option prices based on the Heston model as well as the calibration parameters that must be computed. Then we will present the two optimization methods: local and global as well as the criterion according to which we look for its parameters. finally, we calculate the parameters of the model for each method and we do an analysis of the performances. This work will help the trader who seeks to estimate the prices of currency options on the EUR/USD parity using the Heston model, to choose the optimization method that provides a more accurate calibration of the model. 2. Theoretical principles of Heston model The present value of the expected payoff from a European currency option is given by: 𝐸[𝑆𝑑 𝑆⁄ ] = 𝑆0𝑒 (π‘Ÿπ‘‘βˆ’ π‘Ÿπ‘“)𝑑 (1) Under the equivalent martingale measure, Heston model is given by: [1]: 𝑑𝑆𝑑 = (π‘Ÿπ‘‘ βˆ’ π‘Ÿπ‘“ )𝑆𝑑 𝑑𝑑 + βˆšπ‘‰π‘‘ 𝑆𝑑 𝑑�̅�𝑑 (2) 𝑑𝑉𝑑 = πœ… βˆ—(πœƒβˆ— βˆ’ 𝑉𝑑 )𝑑𝑑 + πœŽβˆšπ‘‰π‘‘ 𝑑�̅�𝑑 Where 𝑑�̅�𝑑 𝑑�̅�𝑑 = πœŒπ‘‘π‘‘ 𝒓𝒅 and 𝒓𝒇 are the domestic and forgein interest rates respectively. 𝜽 is the long-term mean of variance. 𝜿 is the rate of mean reversion. 𝝈 is the coefficient of volatility. 𝑺𝒕 and 𝑽𝑑 are the price and volatility of the process. 𝑩𝒕 and 𝒁𝒕 are correlated Wiener process, and the correlation coefficients is 𝝆. according to feller the following condition will be satisfied (feller condition): 𝟐𝜿𝜽 > 𝝈² [3]. we assume that the rates 𝒓𝒅 and 𝒓𝒇 are constant. According to Heston and Nandi [8] currency call option at time t, given a strike price K, that expires at time T is given by: 𝐢(𝑆, 𝑣, 𝑑) = π‘†π‘’βˆ’π‘Ÿπ‘“ πœπ‘ƒ1 βˆ’ 𝐾𝑒 βˆ’π‘Ÿπ‘‘ πœπ‘ƒ2 (3) where 𝜏 = 𝑇 βˆ’ 𝑑 , 𝑃1 and 𝑃2 can be defined via the Fourier Inversion Transformation [2]: 𝑃𝑗 = 1 2 + 1 πœ‹ ∫ 𝑅𝑒[ 𝑒 βˆ’π‘–πœ“π‘™π‘›πΎπ‘“π‘—(π‘₯,𝑣,𝜏,πœ“) π‘–πœ“ ] ∞ 0 π‘‘πœ“ (4) 218 Comparative study between local and global optimization for Heston model Where j=1,2. And the characteristic function for the logarithm of the exchange rate, π‘₯ = 𝑙𝑛(𝑆𝑑 ) is given by [10]: 𝑓𝑗 (π‘₯, 𝑣, 𝜏, πœ“) = 𝑒 𝐢(𝜏,πœ™)+𝐷(𝜏,πœ™)𝑣𝑑+π‘–πœ™π‘₯ Where: 𝐢(𝜏, πœ™) = (π‘Ÿπ‘‘ βˆ’ π‘Ÿπ‘“ )πœ™π‘–πœ + π‘Ž 𝜎² [(𝑏𝑗 βˆ’ πœŒπœŽπœ™π‘– + 𝑑)𝜏 βˆ’ 2ln ( 1βˆ’π‘”π‘’ π‘‘πœ 1βˆ’π‘” )] 𝐷(𝜏, πœ™) = 𝑏𝑗 βˆ’ πœŒπœŽπœ™π‘– + 𝑑 𝜎2 ( 1 βˆ’ π‘’π‘‘πœ 1 βˆ’ π‘”π‘’π‘‘πœ ) 𝑔 = 𝑏𝑗 βˆ’ πœŒπœŽπœ™π‘– + 𝑑 𝑏𝑗 βˆ’ πœŒπœŽπœ™π‘– βˆ’ 𝑑 𝑑 = √(πœŒπœŽπœ™π‘– βˆ’ 𝑏𝑗 ) 2 βˆ’ 𝜎²(2𝑒𝑗 πœ™π‘– βˆ’ πœ™ 2) 𝑒1 = 1 2 ; 𝑒2 = βˆ’ 1 2 ; π‘Ž = πœ…πœƒ; 𝑏1 = πœ…πœ† βˆ’ 𝜌𝜎; 𝑏2 = πœ… + πœ† 3. Materials and methods 3.1 Calibration methods The parameters to be estimated are: 𝒗, 𝜿, 𝝈, 𝜽 and 𝝆. In this study, we use inverse problem method, which consists of collecting market data and then using it to search for the model parameters while minimizing the difference between the Heston model prices and the real market prices. In other words, we look for the parameters that minimize the squared error between the market prices of European currency options and those of the model. We assume that for a call option, there are several realizations of the parameters of the Heston model. Then we can write: 𝑀𝑖𝑛 𝑆(Ξ©) = min(Ξ©) βˆ‘ (𝐢𝑖 𝐻 (𝐾𝑖 , 𝑇𝑖 ) βˆ’ 𝐢𝑖 𝑀 (𝐾𝑖 , 𝑇𝑖 )) 2 𝑁 𝑖=1 (5) Ξ© is a vector of realizations 𝐢𝑖 𝐻 (𝐾𝑖 , 𝑇𝑖 ), π‘Žπ‘›π‘‘ 𝐢𝑖 𝑀 (𝐾𝑖 , 𝑇𝑖 ) are prices estimated by the model and the market prices of the option 𝑖 respectively, with strike 𝐾𝑖 and maturity 𝑇𝑖. 𝑁 is the number of options used for calibration. It is then a nonlinear optimization problem under the constraint: 2πœ…πœƒ βˆ’ 𝜎2 > 0 .[5] Since it is a nonlinear function then there are several local extrema depending on the initially estimated value, and even with a judicious choice of the initial value, convergence to the global optimum is not certain. Therefore, we will try both local and global optima. 3.1.1 Local optimization If there are multiple local minima of the objective function, we cannot know whether the minimum that is found is the optimal one. In other words, we cannot know if it is a local or global minimum and there is no easy way to measure the distance to the global solution. For this, we will define an acceptance threshold, if the minimum found is acceptable, we 219 M. Bouasabah can at least ensure that any solution found is consistent with our criteria and if no solution was found, we start the process again with another initial value [6]. In this work, we will consider the following set of acceptable solutions: βˆ‘|𝐢𝑖 𝐻 (𝐾𝑖 , 𝑇𝑖 ) βˆ’ 𝐢𝑖 𝑀 (𝐾𝑖 , 𝑇𝑖 )| ≀ 𝑁 𝑖=1 1 2 βˆ‘|𝑏𝑖𝑑𝑖 βˆ’ π‘Žπ‘ π‘˜π‘– | 𝑁 𝑖=1 (6) bid and ask are the market prices for buying and selling respectively. for local optimization, we use the lsqnonlin (least-squares non-linear) function in MATLAB [12], which uses a reflective trust-region minimization algorithm (see Yuan (1999) [9]. In addition, we will also define lower and upper bounds for the optimal parameters. These bounds allow us to reject solutions that are not economically acceptable. we will consider the following bounds [7]: β€’ We consider the [0,1] interval for both for 𝜽 and π‘½πŸŽ. β€’ 𝝆 takes values from -1 to 1. β€’ For 𝝈 an interval of 0 to 5 will be considered in the calibration. β€’ To have a mean reversion, the parameter 𝜿 must take positive values. the maximum values of ΞΊ will be set dynamically during calibration as a consequence of the non-negativity constraint. β€’ To this we add the feller condition which allows the model to avoid negative or zero values 2πœ…πœƒ βˆ’ 𝜎² > 0, [3]. 3.1.2 Global optimization Global optimization allows to search for the global optimum using stochastic methods, even if a local minimum is found the search process does not stop. However, stochastic methods also have some drawbacks. The mathematical properties of these algorithms are less easy to handle than those of local algorithms. Moreover, despite their name, their convergence to the global minimum is not guaranteed. Indeed, the output sequence being stochastically determined, the algorithm may decide to stop prematurely and, in some cases, the solution obtained may be inferior to that of a local search. In sum, even if global optimization is theoretically more efficient, when working with functions of unknown form, it is not easy to decide which calibration procedure will be the most powerful [6]. In order to compare the results of the global optimization with the local one, we use the Simulated Annealing framework. This algorithm proceeds by iteration taking into account the previous information but also introducing randomization. Initially, the algorithm starts with a high tolerance for random shocks, and different regions are examined during the first phase. As a result, even if a minimum is found, the algorithm continues to look for improved solutions. As time progresses, the algorithm reduces its tolerance until it eventually settles on the best optimum reached. 220 Comparative study between local and global optimization for Heston model In this work, we use the MATLAB function asamin which was developed by Professor Shinichi Sakata and involves the Adaptive Simulated Annealing (ASA) algorithm, with dynamic adjustment for random shock tolerance [4]. Goel and Stander (2009) showed that the ASA framework provides good results among a range of different global optimizers. For comparison purposes, we will use the same parameter bounds as outlined above. 4. Results and discussion For the calibration of the parameters of the Heston model, we use the EUR/USD parity as an underlying asset. To price the currency option, Eur Libor (US Libor) data is used to determine the domestic (foreign) interest rate and the following market data had to be taken from the forex market. This data includes: EUR/USD Exchange rate, Strike price, Bid and Ask [11] The currency call option prices have been obtained from the Bloomberg database. This data will be used to calibrate the model. The time period is from May 28, 2020 to May 7, 2021 and we use 5 maturities and for each maturity we consider 5 strike prices (25 currency options in all). The domestic and foreign risk-free interest rates are also provided by Bloomberg and the available maturities match those of the options. We use In-The- Money (ITM) currency call options sorted by 𝑆𝑑 𝐾 . 4.1 Local calibration results We have developed MATLAB scripts to obtain the following parameters: 𝝊 0 𝜽 0.0041 𝝈 0.3163 𝝆 0.9925 𝜿 12.4467 using these parameters to estimate the following currency option prices: [ 0.02332; 0.0206; 0.01800; 0.0155; 0.0132; 0.0506; 0.0456; 0.0408; 0.0363; 0.0321; 0.0501; 0.0463; 0.0427; 0.0393; 0.0361; 0.0556; 0.0521; 0.0487; 0.0455; 0.0424; 0.0560; 0.0527; 0.0496; 0.0466; 0.0437] By taking the difference between these estimated prices and the market price (the price considered is the median price i.e., 𝑀𝑖𝑑 π‘π‘Ÿπ‘–π‘π‘’ = bid+ask 2 ) and comparing this difference with the difference between the market bid and ask prices, we find that all the options considered meet the selection criteria chosen. 221 M. Bouasabah The table above shows that the calibrated Heston model gives an accurate match for all traded options. All currency options have a predicted value within the observed bid-ask spread. Moreover, the average deviation of the model from the average market price is 0.00068153, which is less than the average deviation of the bid-ask spreads (0.003978) when evaluated against our acceptance criterion. The time elapsed for the local calibration is 2.377027 seconds. 4.2 Global calibration results We have developed MATLAB scripts to obtain the following parameters: 𝝊 0 𝜽 0.0051 𝝈 0.2898 𝝆 1 𝜿 12.5445 𝜿 12.4467 using these parameters to estimate the following currency option prices: [0.0234; 0.0208; 0.0183; 0.0161; 0.0139; 0.0509; 0.0463; 0.0419; 0.0378; 0.0340; 0.0524; 0.0488; 0.0453; 0.0421; 0.0390; 0,0587; 0.0553; 0.0521; 0.0490; 0.0460; 0.0597; 0.0565; 0.0534; 0.0505; 0.0477] By calculating the difference between these estimated prices and the market price (the price considered is the median price i.e., 𝑀𝑖𝑑 π‘π‘Ÿπ‘–π‘π‘’ = bid+ask 2 ) by comparing this difference with the difference between the market bid and ask prices, we find that 21 options out of the 25 options considered meet the selection criterion. As can be noticed, the parameters found with the ASA algorithm are somewhat different from those found in the local optimization case. Moreover, in the global calibration, 21 out of 25 satisfied the chosen selction criterion and the average deviation from the average market price is 0.00252278. Therefore, the quality of the ASA solution is less accurate than the results obtained by MATLAB's lsqnonlin. In addition, the main drawback of ASA is its significantly higher computation time (590.013684 seconds in ASA versus 6.5 seconds in MATLAB's lsqnonlin). Based on these analyses, we can confirm that MATLAB's lsqnonlin provides excellent calibration results (the average distance to the average market price is 0.00068153 versus 0.00252278 for ASA and all currency call option prices are within the observed bid-ask spreads), and also uses lower computation times. However, these results depend on the complexity of the objective function; it is possible that this function is not complicated enough to take advantage of the ASA algorithm. In particular, since we generally do not know whether the objective function can have 222 Comparative study between local and global optimization for Heston model multiple local minima, a prudent choice would be to use both calibration approaches. The drawback is that a global search does not necessarily improve the results delivered by a local search. However, progress in computing capacity and numerical methods is reducing the time required for global calibration. In our calibration, the execution time of ASA was less than 10 minutes, which for many practical applications is worth testing better solutions. 5. Conclusion In this study, we used local and global optimization to look for the calibration parameters of the Heston stochastic volatility model used to estimate the prices of EUR/USD currency options. Our results showed that local optimization provides excellent calibration parameters with reduced computational time compared to global optimization. Therefore, we can clearly recommend the local optimization for the Heston model. References [1] Heston, Steven L. "A closed-form solution for options with stochastic volatility with applications to bond and currency options." The review of financial studies 6.2: 327-343. 1993. [2] Carr, Peter & Stanley, Morgan & Madan, Dilip. Option Valuation Using the Fast Fourier Transform. J. Comput. Finance. 2. 10.21314/JCF.1999.043. DOI:10.21314/JCF.1999.043. 2001. [3] Gikhman, Ilya I., A Short Remark on Feller's Square Root Condition .2011. Available at: http://dx.doi.org/10.2139/ssrn.1756450. [4] Goel, T. and Stander, N. Adaptive Simulated Annealing for Global Optimization in LS-OPT. 7th European LS-DYNA Conference. 2009. [5] Jahn, Johannes. Introduction to the theory of nonlinear optimization. Springer Nature, 2020. [6] Milan MrΓ‘zek and Jan PospΓ­Ε‘il, Calibration and simulation of Heston model , Open Mathematics, https://doi.org/10.1515/math-2017-0058. 2017. [7] Ricardo Crisostomo. "An Analysis of the Heston Stochastic Volatility Model: Implementation and Calibration using Matlab," ,SSRN Electronic Journal 2015. DOI:10.2139/ssrn.2527818. [8] S. Heston and S. Nandi, β€œA Closed-Form GARCH Option Valuation Model”. The Review of Financial Studies, Volume 13, Issue 3, July 2000, Pages 585–625. 2000. https://doi.org/10.1093/rfs/13.3.585. [9] Yuan, Ya-xiang. A Review of Trust Region Algorithms for Optimization. ICM99: Proceedings of the Fourth International Congress on Industrial and Applied Mathematics. 1999. 223 http://dx.doi.org/10.21314/JCF.1999.043 https://doi.org/10.1515/math-2017-0058 M. Bouasabah [10] Wu, L. From Characteristic Functions and Fourier Transforms to PDFs/CDFs and Option Prices. Zicklin School of Business, Baruch College. 2007. [11] Chicago Board Options Exchange, S and P 500 Index Options Specications on the CBOE Website, Accessed at http://www.cboe.com [12] The Mathworks, Help Files on the Mathworks Website-lsqnonlin, Accessed at http://www.mathworks.com. 224