Option pricing using deep learning approach based on LSTM-GRU neural networks: Case of London stock exchange

: This study is a review of literature on machine learning to examine the potential of deep learning (DL) techniques in improving the accuracy of option pricing models versus the Black-Scholes model and capturingcomplex features in financial data. Neural networks and other machine learning models have been proposed for option pricing and have improved accuracy compared withtraditional models. However, such use of machine learning also presents practical challenges such as data availability and quality, computational resources, model selection and validation, interpretability and overfitting. This study discusses several of these challenges and highlights the need for careful evaluation and validation of machine learning models in London option pricing during the Coronavirus disease 2019 pandemic. Moreover, to investigate the quality of the models used, we compare the performances of these algorithms in option pricing through the application of significance statistical tests.


Introduction
Option pricing using deep learning (DL) is a relatively new and promising area of research that seeks to use artificial neural networks (ANN) to better model the complex dynamics of financial markets and price financial derivatives such as options. As a type of machine learning, DL uses neural networks with multiple layers to learn complex relationships between inputs and outputs.
Traditional methods of option pricing such as the Black-Scholes model (BSM), rely on a few assumptions about the underlying asset and market dynamics such as constant volatility and lognormal returns. These assumptions may not hold true in real-world markets, leading to inaccurate pricing and risk management (Huang, 2014).
By comparison, DL approaches have the potential to capture complex, nonlinear relationships between market variables that can affect option prices. By training a neural network on historical market data, the network can learn to generalise for new market conditions and thereby make more accurate predictions.
One approach to option pricing using DL is to train a neural network to predict the future price of an underlying asset and then use this prediction to price the option. Another approach is to directly train the neural network to predict the option price, given a set of market variables such as the current asset price, volatility and time to expiration (Li, 2023).
However, using DL for option pricing presents several challenges including the need for large amounts of training data, potential for over fitting to noisy data and the difficulty of interpreting the neural network internal representations. Researchers continue to explore and refine DL approaches to option pricing and remain active in the area of quantitative finance.
DL is an advanced technique of machine learning based on ANN algorithms. As a promising branch of artificial intelligence, DL has attracted considerable attention in recent years. Compared with conventional machine learning techniques such as support vector machine (SVM) and k-nearest neighbours (kNN), DL possesses the advantages of unsupervised feature learning, a strong capability of generalisation and robust training power for big data (Flórido, 2022) At present, modern advancements in mathematical analysis, computational hardware and software and availability of big data have allowed for the possibility of commoditised machines that can learn to operate as investment managers, financial analysts and traders. We briefly survey how and why artificial intelligence and DL can influence the field of finance in general. Revisiting original work from the 1990s, we summarise a framework within which machine learning may be used for this field, with specific application to option pricing. We train a fully-connected feedforward DL neural network to reproduce the Black and Scholes (1973) option pricing formula to a high degree of accuracy. We also offer a brief introduction to neural networks and details on the various choices of hyper-parameters that increase the model accuracy. This exercise suggests that DL nets may be used to learn option pricing models from the markets and can be trained to mimic option pricing traders who specialise in a single stock or index (Chang, 2022).
One hypothesis for using DL in option pricing is that its models can better capture the complex nonlinear relationships of the underlying asset's risk and uncertainty with the option price. Traditional option pricing models such as the BSM, assume that the underlying asset price follows a log-normal distribution and has constant volatility over time. However, in reality, the underlying asset price is influenced by a complex set of factors including market sentiment, news events and macroeconomic conditions that can lead to its non-normal distribution and time-varying volatility.
DL models, which are capable of learning complex relationships between input and output variables, have shown promise in capturing these complex dynamics and improving the accuracy of option pricing. DL models can also incorporate a wider range of input variables including unstructured data such as news articles and social media sentiment, which can provide additional insights into the underlying asset's risk and uncertainty.
Another hypothesis for using DL models in option pricing is their better adaptability to changing market conditions and capability to handle extreme events, such as market crashes or unexpected news events, than traditional option pricing models. DL models can be trained on large amounts of historical data including those from extreme market events, which can help better capture the tail risk associated with options.
Overall, the hypothesis is that DL models can provide more accurate and robust option pricing predictions by capturing the complex and dynamic relationships between the underlying asset's risk and uncertainty and the option price and by being more adaptive to changing market conditions and handling extreme events. However, DL models require large amounts of high-quality data, rigorous validation and careful interpretation. In addition, their performance may depend on the specific problem and data characteristics.

Background of the study
Options occupy a certain position in the derivatives market. Researchers, speculators and other traders all hope to obtain a reasonable price for each option. Yet we can only obtain accurate solutions to the price of limited options, most of which must be defined numerically. The classical method has poor processing skills and slow calculation of large data sets and high-dimensional data. With the development of artificial intelligence in recent years, such as machine learning methods, optimisation of target values has gradually become easier. Thus, several scholars, investors and traders began to apply artificial intelligence to different kinds of option pricing. This study is a review of the use of different methods in the pricing of different options in the past years, including a comparison of their pros and cons, accuracy and robustness (Li, 2022). To better understand these methods, we present recent research and count the number of articles that use various DL models in exchange rate forecasting, as shown in Table 1.
Nowadays, machine learning methods such as neural networks in financial market shave become a hot topic. Amongst these methods, derivatives pricing plays an important role in both academia and actual transactions. DL algorithms that keep pace with the times also have good model generalisation capabilities and their prediction accuracy has surpassed that of traditional financial models (Li, 2022 Based on previous studies, we conclude that the LSTM model, derived from recurrent neural network (RNN), is one of the best methods to learn financial time series data. We re-examine the original model and make corrections on this basis, and obtain a learning model that is also applicable to financial data. For American options, an additional question is how to find the optimal stopping time and provide a reasonable explanation, given that the optimal exercise time cannot be learned directly from market information.
Overall, these studies suggest that DL models have the potential to significantly improve option pricing accuracy and profitability, particularly when used in combination with large amounts of highquality data and careful validation and interpretation. However, we must note that DL models are still relatively new approaches to option pricing and their performance may depend on the specific problem and data characteristics.
However, in comparing the performance of DL in options pricing, this study is characterised using gated recurrent unit (GRU) model as a new contribution in the field of computational finance.

Black-Scholes model (BSM)
In the spring of 1973, Fisher Black and Myron Scholes published an academic paper based on empirical evidence to price options on given assets and suggested that the value of an option is derived from a few variables: the price of the underlying asset, strike price and maturity of the option, volatility of the asset and the risk-free interest rate.

Assumptions of the black-scholes-merton model
To use the BS formula, Black (1973) assumed ideal conditions for stocks: • Lognormal distribution: The Black-Scholes-Merton model assumes that stock prices follow a lognormal distribution based on the principle that asset prices cannot take a negative value. that is, they are bounded by zero. • No dividends: The model assumes that the stocks do not pay dividends or returns.
• Expiration date: The model assumes that the options can only be exercised on its expiration or maturity date and thus cannot accurately price American options. Rather, the modelis extensively used in the European options market. • Random walk: The stock market is highly volatile and a state of random walk is assumed as the market direction can never truly be predicted. • Frictionless market: No transaction costs, including commission and brokerage, is assumed in the model. • Risk-free interest rate: The interest rates are assumed to be constant and thus the underlying asset is considered risk-free. • Normal distribution: Stock returns are normally distributed, implying that the volatility of the market is constant over time. • No arbitrage: Without arbitrage, the opportunity of making a riskless profit is avoided.

Black-Scholes-Merton equation
The Black-Scholes-Merton model can be described as a second order partial differential equation.
A key financial insight behind the equation is that one can perfectly hedge the option by buying and selling the underlying asset and the bank account asset (cash) to eliminate risk. This hedge, in turn, implies that the option has only one right price, as returned by the Black-Scholes formula (see the next section).

Black-Scholes formula
The Black-Scholes formula calculates the price of Europeanput and call options. This price is consistent with the Black-Scholes equation, given that the formula can be obtained by solving for the corresponding terminal and boundary conditions (Chriss and Kawaller, 1997): The value of a call option for a non-dividend-paying underlying stock in terms of the Black-Scholes parameters is The price of a corresponding put option based on put-call parity with discount factoris [ Figure 1] Where N -Cumulative distribution function of the standard normal distribution; mean = 0 and standard deviation = 1 T-t -Time to maturity (in years) S t -Spot price of the underlying asset K -Strike price r -Risk-free rate σ -Volatility of returns of the underlying asset 3.1.4.

Limitations of the Black-Scholes-Merton model
Limited to the European market: As mentioned earlier, the Black-Scholes-Merton model is an accurate determinant of European option prices, but does not accurately value stock options in the United States. The assumption is that options can only be exercised on its expiration/maturity date.
Risk-free interest rates: The BSM assumes constant interest rates, which hardly ever occurs in reality. Assumption of a frictionless market: Trading generally comes with transaction costs such as brokerage fees and commission. However, the Black-Scholes-Merton model assumes a frictionless market, which implies no transaction costs that hardly ever occurs in the actual trading market.
No returns: The BSM assumes that no returns are associated with the stock options, no dividends and no interest earnings. However, these are similarly rare in the actual trading market. The buying and selling of options are primarily focused on the returns. 1

Deep learning (DL) models
This section is devoted to the brief description of the basic principle of four Non-linear machine learning models or DL models that are used later for exchange rate time-series forecasting, namely RNN, LSTM and gated recurrent unit (GRU).

3.2.1.
Recurrent neural networks (RNN) RNNs differe from traditional neural networks by introducing a transition weight to send information over time. This transition weight means that the next state is dependent on the previous one, indicating that the model now has memory. In RNNs, the hidden layers act as an internal storage of the information captured in the earlier stages. The term recurrent is derived from the fact that the model performs the same task to every element of the sequence using the previously obtained in formation to predict future values. RNN is represented in (Figure 2). Two powerful RNN models are efficient for time dependent in time-series data, namely, LSTM and GRU. These deep learning models have shown considerable success in modelling and forecasting compared with the classical time series models and traditional networks, demonstrating good results in many application domains with time series.

3.2.2.
Long short-term memory (LSTM) model LSTM is a sophisticated gated memory unit designed to mitigate the vanishing gradient problems limiting the efficiency of a simple RNN (Zeroual et al., 2020). Figure 3 shows a complete diagram of LSTM, similar to Figure 3 with RNN. The LSTM has four components: input gates, forget gate, cell state and output gate. The LSTM model is defined as follows. Let xt, ht and Ct be the input, control state and cell state at timestep t. Given a sequence of inputs (x1, x2,..., xm), the LSTM computes the h-sequence (h1 , h2,..., hm) and the C-sequence (C1 , C2,..., Cm) as follows: Input Gate: the goal is to take in new information xt by using two functions: rt and dt. The rt concatenates the previous hidden vector ht-1 with the new information xt. that is, [ht-1, xt] then multiplies it with the weight matrix Wr, plus a noise vector br. The dt has a similar function. Then, rt and dt are multiplied element-wise to obtain the cell state ct:

Forget Gate:
Looking very similar to rt in the input gate, the forget gate ft controls the limit up to which a value is retailed in memory: Cell State: An element-wise multiplication is calculated between the previous cell state Ct-1 and forget gate ft. Then, the cell state adds the results from the input gate rt times dt: t = f t . −1 + .

Output gate:
Here, ot is the output gate at time step t and Wo and bo are the weights and bias for the output gate. The hidden layer ht either moves to the next time step or up to output as yt, yt is obtained by applying another tanh to ht. Note that the output gate ot is not the output yt, but rather simply is the gate to control the output:

3.2.3.
Gated recurrent unit (GRU) model Cho et al., (2014) invented GRU in company with RNN and LSTM, with the expectation that more variations of recursive network may continue to emerge. GRU also aims to solve the vanishing gradient problem. Different from LSTM, GRU does not have the cell state and the output gate and thus has fewer parameters. GRU uses the hidden layers to transfer information and has two gates for reset and update.
The parameters of GRU include Wr, Wz and Wh. The reset signal rt determines if the previous hidden state must be ignored while the update signal zt determines if the hidden state ht needs updating with the new one hat (ht).
Reset Gate: This gate achieves a similar function of the input and forget gates of LSTM. The gate rt determines if the previous hidden state must be ignored. The gate zt is generated for the update gate with hat (ht). Wz and Wr are the weight parameters to be trained while bz and br are the noise vectors.
Update Gate: (Part 1): This part multiplies rt and ht-1. The multiplication means how much of ht-1 is retained or ignored. Thus, a temporal hat (ht) is created to be used for the update of ht. Wh and bh are weight parameters and the noise vectors, respectively.

Update Grade: (Part II):
This part computes the weighted average between ht-1 and hat (ht), according to the weight zt. If zt is close to zero, then the past information contributes little and new information contributes more.

Evaluation metrics
We used five different measures of forecast errors for evaluating the model performance and the accuracy of the methods: MAE, MSE, RMSE and MAPE, where ŷt are the forecasted values, yt the observed values, n is the number of forecasts andμis the average of measurements.

Data description
This study implements and compares the two models by using the Historical CSV Data Sample, which includes 10000 observations of put and call European options traded on the London Stock Exchange 2 . The sample includes all data recorded Table 3 on 1 January 2020-2031 December 2021, which fall during the Coronavirus disease 2019 (COVID-19) pandemic, with the following features: The models are implemented using Python 3.7 programming language. The choice has been made due to the simplicity of the language and all the pre-built libraries for machine learning, which allow for faster workflow and easier debugging. In particular, the libraries used throughout the empirical part of the study are: Matplotlib (Hunter, 2007) Used to make the graphs and plots to have a visual interpretation of the models; TensorFlow (Abadi et al., 2015) An interface from Google made to implement machine learning, particularly DL models. The name derives from the fact that data are imported in TensorFlow using tensors, which speeds up the model training.
Here is a sample correlation heatmap matrix created to understand the linear relationship between different variables in the dataset Figure 4.

Models used and their specifications
The standard BSM is used as the standard of comparison for the ML models. As we all know, BSM takes inputs of the price of the underlying asset, strike price of the option, time to maturity of said option, RF rate and the measure of volatility of the underlying asset. For the latter, we use the variable described in the model outputs an arbitrage-free price of an option.
Once we have a working deep learning stack, we start the development by creating a python script to train ANNs with Keras and Tensor Flow for simple regression problems. Many online resources can be used to achieve these first steps. In particular, the online documentation of TensorFlow is very clear and includes simple practical examples. The DL training and validating script, implemented for this project, is derived from a basic regression tutorial that can be found on https://www.tensorflow.org/tutorials/keras/regression. Similar to a class diagram for planning an OOP solution, flowcharts are tools used to describe procedural programs and processes. Figure 5 presents the iterative development that is implemented to create the DL option pricing solvers in this review.
Here is a general flowchart for developing a DL option pricing solver: Problem Formulation: Define the problem statement and determine the project scope. Data Collection: Collect historical data on the underlying asset's price, including any relevant market data such as interest rates, volatility and dividends.
Data Pre-processing: Clean, normalise and transform the data to prepare for use in the DL model.

Model Selection:
Choose an appropriate DL model architecture and design, considering the problem statement, data characteristics and available computational resources.
Model Training: Train the DL model using the pre-processed data, using techniques such as gradient descent and backpropagation to optimise the model parameters.
Model Evaluation: Evaluate the performance of the DL model using appropriate metrics such as RMSE or MAE and validate the predictions using test data.
Model Tuning: Based on the results of the evaluation and validation, adjust the DL model parameters and architecture to improve its performance.
Deployment: Deploy the DL option pricing solver in a production environment and test its performance under real-world conditions.
Monitoring and Maintenance: Continuously monitor the performance of the DL option pricing solver and maintain and update the model as needed to ensure its accuracy and reliability over time.
Note that the specific steps and details of the flowchart may vary depending on the specific requirements and objectives of the DL option pricing solver as well as the availability and quality of data. Additionally, the development of a DL model requires expertise in both finance and computer science, together with a solid understanding of the underlying data and market dynamics.
We train the neural network with the following hyperparameters   [200,200,200,200,200,1] [200,200,200,200,200,1] Learning rate 0.001 0.001 Optimiser Adam Adam Here, [200,200,200,200,200,1] represents the number of neurons from the first to the last network layer.

Pricing performance of benchmark models
To investigate the quality of the models used, we compare the performances of BSM and the deep learning models such as LSTM and GRU. In terms of pricing European call options errors, Python routines were used. These algorithms forecast the price London Stock Exchange (JSE) for European call options through the application of significance statistical tests (MSE, RMSE, MAE).
Results of benchmark models are measured with the metrics obtained on the dataset by using the BSM option pricing compared with the LSTM and GRU. The results are summarised to confirm the pricing performance of LSTM. Nevertheless, the results obtained with the benchmark machine learning models are used as an indicator of the possible error range.
The first conclusion is that the quality of pricing with the benchmark models varies considerably across different states of moneyness for options Figure 6.  In terms of the pricing accuracy of the LSTM model, Table 4 reveals that the LSTM model presents the most excellent pricing performance except for put and call options, with remarkable nonlinear fitting ability. The BSM provides the least reliable pricing due to the maximum values of metrics in terms of MAE, MSE, RMSE of call and put options with 2.84%, 16.39% and 4.05 for call options and close to 4.70%, 54.46%, 7.38% for put options, respectively. From the GRU model, prices decrease by2.65%, 15.21% and 3.90%for call options and close to 4.60%, 55.16%, 7.43% for put options. However, the LSTM model has the most accurate pricing quality regardless of the pricing model with minimum values of metrics in terms of MAE, MSE, RMSE, with 2.33%, 13.58%, 3.69% for call options and close to 4.44%, 54.30%, 7.37% for put options, respectively.
Finally, we confirm our hypothesis and the results achieved by previous studies to forecast option pricing (Appendices).
The COVID-19 pandemic has exerted significant impact on financial markets and option pricing in the United Kingdom (UK), including the pan increased uncertainty and volatility as well as changes in economic conditions and government policies that in turn affect the valuation of financial assets.
One of the key effects on option pricing is the increase in volatility across asset classes. The implied volatility of many options has increased significantly since the start of the pandemic, reflecting higher levels of uncertainty and risk in financial markets. Thus, accurately predicting price options and managing risk, particularly for complex options and structured products, has become more challenging.
The pandemic also caused changes in interest rates and monetary policy. To support the economy during this period, the Bank of England implemented a range of measures such as lowering interest rates and introducing quantitative easing. These measures have affected the pricing of options and other financial instruments, particularly those with longer maturities.
The pandemic has also led to changes in market structure and trading practices. Many financial institutions have shifted to remote working and electronic trading, which has affected market liquidity and trading volumes. This shift in turn affected the pricing of options and other financial instruments, particularly those with lower liquidity or trading volumes.
Overall, the COVID-19 pandemic has caused significant impact on option pricing in the UK, with increased volatility and changes in economic conditions and market structure affecting the valuation of financial assets. Financial institutions needed to adapt their pricing models and risk management practices to account for these changes and continued monitoring and analysis are required to manage the evolving market risks and uncertainties.

Conclusions
In this study, we focus on the forecast option pricing during the COVID-19 period by proposing an ensemble of deep learning approach, specifically LSTM and GRU versus BSM.
In conclusion, machine learning techniques have shown promise in improving option pricing accuracy and capturing complex features in financial data. Several studies have proposed neural network and other machine learning models for option pricing, achieving improved pricing accuracy compared with traditional models.
However, machine learning models can suffer from overfitting and other issues and their use in option pricing and other financial applications require careful evaluation and validation. Furthermore, the use of machine learning techniques in option pricing may require significant amounts of data and computational resources, which may pose practical challenges for certain applications.
Overall, machine learning has the potential to enhance option pricing models and provide more accurate pricing estimates, but further research and development is needed to fully realise its potential and address practical challenges.
However, this increased volatility translates into more challenging options market predictions. We confirm our fundamental hypothesis that DL models still perform well compared with Black-Scholes option pricing model in terms of the RMSE, MAE, MSE.
The highly competitive prediction capacity of the proposed model during theCOVID-19 period is beneficial for policymakers, entrepreneurs and foreign exchange brokers.
Finally, based on the current results, future research can predict a large performance improvement by optimizing the parameters of these algorithms for application in more common option pricing scenarios.

Use of AI tools declaration
The authors declare they have not used artificial intelligence (AI) tools in the creation of this article.

Conflict of interest
The authors declare that there is no conflict of interest.

Morales-Bañuelos P, Muriel N, Ferná ndez-Anaya G (2022) A Modified Black-Scholes-Merton
Model for Option Pricing.  Figure 8. Test vs training data using BSM and DL models.