| Literature DB >> 35187477 |
Alessio Staffini1,2.
Abstract
Stock market prices are known to be very volatile and noisy, and their accurate forecasting is a challenging problem. Traditionally, both linear and non-linear methods (such as ARIMA and LSTM) have been proposed and successfully applied to stock market prediction, but there is room to develop models that further reduce the forecast error. In this paper, we introduce a Deep Convolutional Generative Adversarial Network (DCGAN) architecture to deal with the problem of forecasting the closing price of stocks. To test the empirical performance of our proposed model we use the FTSE MIB (Financial Times Stock Exchange Milano Indice di Borsa), the benchmark stock market index for the Italian national stock exchange. By conducting both single-step and multi-step forecasting, we observe that our proposed model performs better than standard widely used tools, suggesting that Deep Learning (and in particular GANs) is a promising field for financial time series forecasting.Entities:
Keywords: Generative Adversarial Networks; deep learning; financial time series; forecasting; neural networks; stock price forecasting; time series forecasting
Year: 2022 PMID: 35187477 PMCID: PMC8856607 DOI: 10.3389/frai.2022.837596
Source DB: PubMed Journal: Front Artif Intell ISSN: 2624-8212
Figure 1Stylized architecture of the original GAN.
Figure 2Stylized architecture of our DCGAN.
The 10 selected stocks.
|
|
|
|
|---|---|---|
| Atlantia | ATL | Industrial Transportation |
| Azimut | AZL | Financial Services |
| Buzzi Unicem | BZU | Construction & Materials |
| Enel | ENEL | Electricity |
| Eni | ENI | Oil & Gas Producers |
| Exor | EXO | Financial Services |
| Generali | G | Non-life Insurance |
| Interpump Group | IP | Industrial Goods & Services |
| Mediobanca | MB | Banks |
| Recordati | REC | Pharmaceuticals & Biotechnology |
List of the variables we considered for the empirical analysis.
|
|
|
|---|---|
| Close | Closing price of the stock at the end of day |
| Closed | Difference in the stock price compared to the previous close |
| Closep | Percentage change in the stock price compared to the previous close |
| Ope | Opening price of the stock |
| Oped | Difference in the stock price compared to the previous opening |
| opep | Percentage change in the stock price compared to the previous opening |
| high | Highest price reached by the stock on the trading day |
| highd | Difference in the highest price reached by the stock compared to the previous day |
| highp | Percentage change in the highest price achieved by the stock compared to the previous day |
| low | Lowest price reached by the stock on the trading day |
| lowd | Difference in the lowest price reached by the stock compared to the previous day |
| lowp | Percentage change in the lowest price reached by the stock compared to the previous day |
| SMA5 | Simple Moving Average of the closing price calculated at 5 days |
| SMA10 | Simple Moving Average of the closing price calculated at 10 days |
| EMA12 | Exponential Moving Average of the closing price calculated at 12 days |
| EMA26 | Exponential Moving Average of the closing price calculated at 26 days |
| MACD | Moving Average Convergence/Divergence. It is a technical indicator to reveal changes in the strength, direction, momentum, and duration of a trend. It is calculated as the difference between the EMA26 and EMA12 |
| MACDsign | The exceeding of MACD values on MACDsign and vice versa are useful signals to identify possible trend reversals in prices. It is calculated as a 9-period exponential moving average of the MACD line |
| volume | Number of shares traded on the day |
| volumed | Difference in the number of traded shares compared to the previous day |
| volume | Percentage change in the number of traded shares compared to the previous day |
| RoC13 | Rate of Change. The ROC calculates the ratio of today's closing price to the closing price of (in our case) 13 previous days |
| K15 | Stochastic Oscillator. The Stochastic Oscillator compares the closing price of the stock with the range of prices in the considered time period (15 days, in our case) |
| D5 | Simple Moving Average of the values of the variable K15 calculated at 5 days |
| SMA20C | Simple Moving Average of the closing price calculated at 20 days |
| BOLlow | Bottom line of the Bollinger Bands |
| BOLup | Upper line of the Bollinger Bands |
| BOL | Percentage BOL, a volatility index of the stock. It is constructed as the ratio between the difference of close and BOLlow with the difference between BOLup and BOLlow |
| MOM12 | Momentum, an indicator that measures the change in closing prices. Unlike the ROC, the momentum is calculated as the difference between today's closing price and the closing price of the previous period (12 days, in our case) |
Figure 3Correlation matrix for EXO of the considered technical indicators.
Figure 4Contemporaneous and lagged correlation matrices for EXO of the selected variables.
Single-step forecast errors for ARIMAX, RF Regressor, LSTM, the benchmark GAN, and our GAN architecture.
|
| ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
| ||||
|
|
|
|
|
|
|
|
|
| ||
| ATL | RMSE | (5,1,0) | 0.990 | 0.814 (0.060) | 2 | 0.763 (0.015) | 2 | 0.890 (0.120) | 2 |
|
| MAE | 0.820 | 0.543 (0.022) | 0.501 (0.011) | 0.694 (0.118) |
| |||||
| MAPE | 4.871 | 3.034 (0.177) | 2.779 (0.052) | 3.821 (0.829) |
| |||||
| AZM | RMSE | (5,1,0) | 0.663 | 0.633 (0.084) | 2 | 0.582 (0.004) | 2 | 0.895 (0.149) | 2 |
|
| MAE | 0.530 | 0.460 (0.053) | 0.403 (0.004) | 0.788 (0.150) |
| |||||
| MAPE | 3.544 | 2.900 (0.329) | 2.603 (0.035) | 5.306 (1.050) |
| |||||
| BZU | RMSE | (4,1,0) | 0.899 | 0.639 (0.038) | 2 | 0.578 (0.006) | 2 | 0.700 (0.106) | 2 |
|
| MAE | 0.796 | 0.479 (0.023) | 0.426 (0.006) | 0.560 (0.124) |
| |||||
| MAPE | 4.128 | 2.496 (0.117) | 2.225 (0.032) | 2.951 (0.629) |
| |||||
| ENEL | RMSE | (2,1,0) | 0.427 | 0.467 (0.022) | 2 | 0.266 (0.023) | 2 | 0.352 (0.097) | 2 |
|
| MAE | 0.313 | 0.274 (0.021) | 0.179 (0.017) | 0.179 (0.017) |
| |||||
| MAPE | 4.488 | 3.582 (0.017) | 2.605 (0.213) | 4.863 (0.635) |
| |||||
| ENI | RMSE | (1,1,0) | 1.390 | 1.874 (0.016) | 2 | 1.231 (0.064) | 2 | 1.093 (0.260) | 2 |
|
| MAE | 1.124 | 1.152 (0.014) | 0.838 (0.033) | 0.951 (0.258) |
| |||||
| MAPE | 11.194 | 13.839 (0.144) | 9.568 (0.441) | 8.372 (2.065) |
| |||||
| EXO | RMSE | (1,1,0) | 3.533 | 4.410 (0.014) | 2 | 2.662 (0.186) | 2 | 2.749 (0.636) | 2 |
|
| MAE | 2.635 | 2.828 (0.011) | 1.945 (0.136) | 2.250 (0.565) |
| |||||
| MAPE | 4.719 | 4.438 (0.028) | 3.315 (0.214) | 3.907 (0.975) |
| |||||
| G | RMSE | (5,1,0) | 0.458 | 0.400 (0.022) | 2 | 0.390 (0.005) | 2 | 0.448 (0.168) | 2 |
|
| MAE | 0.324 | 0.283 (0.010) | 0.276 (0.007) | 0.344 (0.157) |
| |||||
| MAPE | 2.181 | 1.910 (0.069) | 1.888 (0.042) | 2.314 (1.013) |
| |||||
| IP | RMSE | (1,1,0) | 1.449 | 4.326 (0.012) | 2 | 1.464 (0.010) | 2 | 1.368 (0.193) | 2 |
|
| MAE | 1.096 | 2.179 (0.043) | 1.015 (0.074) | 1.078 (0.170) |
| |||||
| MAPE | 3.795 | 5.896 (0.074) | 3.286 (0.267) | 3.607 (0.663) |
| |||||
| MB | RMSE | (5,1,0) | 0.305 | 0.289 (0.009) | 2 | 0.282 (0.002) | 2 | 0.352 (0.107) | 2 |
|
| MAE | 0.240 | 0.212 (0.004) | 0.200 (0.003) | 0.283 (0.108) |
| |||||
| MAPE | 3.183 | 2.654 (0.081) | 2.624 (0.028) | 3.760 (1.485) |
| |||||
| REC | RMSE | (2,1,0) | 2.544 | 2.723 (0.014) | 2 | 1.843 (0.122) | 2 | 1.631 (0.452) | 2 |
|
| MAE | 2.223 | 1.725 (0.014) | 1.384 (0.092) | 1.250 (0.369) |
| |||||
| MAPE | 6.231 | 4.066 (0.093) | 3.559 (0.226) | 3.296 (0.966) |
| |||||
Text in bold denotes the best results (95% confidence level).
Multi-step (5 days) forecast errors for ARIMAX, RF Regressor, LSTM, the benchmark GAN, and our GAN architecture.
|
| ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
| ||||
|
|
|
|
|
|
|
|
|
| ||
| ATL | RMSE | (5,1,0) | 1.784 | 1.027 (0.015) | 5 | 1.080 (0.021) | 2 | 2.319 (0.543) | 2 |
|
| MAE | 1.377 | 0.694 (0.009) | 0.702 (0.014) | 1.782 (0.424) |
| |||||
| MAPE | 8.267 | 3.833 (0.052) | 3.920 (0.074) | 9.409 (2.393) |
| |||||
| AZM | RMSE | (5,1,0) | 1.776 | 0.977 (0.027) | 5 | 0.930 (0.018) | 2 | 2.274 (0.635) | 2 |
|
| MAE | 1.380 | 0.697 (0.013) | 0.647 (0.013) | 2.050 (0.540) |
| |||||
| MAPE | 9.394 | 4.444 (0.088) | 4.172 (0.083) | 14.026 (2.809) |
| |||||
| BZU | RMSE | (4,1,0) | 1.799 | 0.906 (0.016) | 5 | 0.886 (0.026) | 2 | 2.444 (0.651) | 2 |
|
| MAE | 1.549 | 0.669 (0.007) | 0.654 (0.018) | 1.984 (0.603) |
| |||||
| MAPE | 8.117 | 3.489 (0.039) | 3.443 (0.095) | 11.179 (4.202) |
| |||||
| ENEL | RMSE | (2,1,0) | 0.607 | 0.563 (0.005) | 5 | 0.388 (0.016) | 2 | 1.647 (0.622) | 2 |
|
| MAE | 0.449 | 0.357 (0.005) | 0.267 (0.010) | 1.283 (0.472) |
| |||||
| MAPE | 6.379 | 4.829 (0.096) | 3.871 (0.113) | 20.652 (4.301) |
| |||||
| ENI | RMSE | (1,1,0) | 1.649 | 2.114 (0.013) | 5 | 1.325 (0.081) | 2 | 2.041 (0.624) | 2 |
|
| MAE | 1.200 | 1.366 (0.012) | 0.909 (0.053) | 1.418 (0.437) |
| |||||
| MAPE | 12.514 | 16.028 (0.121) | 10.288 (0.639) | 12.156 (3.720) |
| |||||
| EXO | RMSE | (1,1,0) | 5.201 | 4.840 (0.013) | 5 | 4.116 (0.071) | 2 | 5.721 (1.044) | 2 |
|
| MAE | 3.691 | 3.363 (0.013) | 3.047 (0.030) | 4.776 (0.870) |
| |||||
| MAPE | 6.664 | 5.461 (0.022) | 5.195 (0.034) | 9.061 (1.909) |
| |||||
| G | RMSE | (5,1,0) | 0.526 | 0.622 (0.018) | 5 | 0.564 (0.004) | 2 | 0.860 (0.338) | 2 |
|
| MAE | 0.369 | 0.441 (0.010) | 0.385 (0.006) | 0.721 (0.288) |
| |||||
| MAPE | 2.445 | 3.000 (0.007) | 2.641 (0.035) | 4.763 (1.879) |
| |||||
| IP | RMSE | (1,1,0) | 2.057 | 4.363 (0.017) | 5 | 2.557 (0.089) | 2 | 2.866 (0.716) | 2 |
|
| MAE | 1.674 | 2.350 (0.013) | 1.670 (0.033) | 2.404 (0.603) |
| |||||
| MAPE | 5.761 | 6.629 (0.028) | 5.178 (0.080) | 7.941 (1.989) |
| |||||
| MB | RMSE | (5,1,0) | 0.680 | 0.474 (0.020) | 5 | 0.419 (0.002) | 2 | 0.880 (0.566) | 2 |
|
| MAE | 0.508 | 0.335 (0.013) | 0.289 (0.004) | 0.665 (0.354) |
| |||||
| MAPE | 6.738 | 4.416 (0.183) | 3.836 (0.055) | 7.059 (2.086) |
| |||||
| REC | RMSE | (2,1,0) | 3.742 | 3.231 (0.096) | 5 | 2.356 (0.117) | 2 | 4.736 (1.196) | 2 |
|
| MAE | 3.278 | 2.191 (0.065) |
| 3.875 (1.047) |
| |||||
| MAPE | 9.320 | 5.295 (0.155) | 4.427 (0.174) | 10.886 (2.780) |
| |||||
Text in bold denotes the best results (95% confidence level).
Diebold-Mariano test for the single-step and multi-step forecasts.
|
|
|
|
|
|
|---|---|---|---|---|
|
| ||||
| ATL | 0 | 0 | 0 | 0 |
| AZM | 0 | 0 | 0.025 | 0 |
| BZU | 0 | 0 | 0 | 0 |
| ENEL | 0 | 0 | 0 | 0 |
| ENI | 0 | 0 | 0 | 0 |
| EXO | 0 | 0 | 0 | 0 |
| G | 0 | 0 | 0 | 0 |
| IP | 0 | 0 | 0 | 0 |
| MB | 0 | 0 | 0 | 0 |
| REC | 0 | 0 | 0 | 0 |
|
| ||||
| ATL | 0 |
| 0.0064 | 0 |
| AZM | 0 | 0 | 0.0085 | 0 |
| BZU | 0 | 0 | 0.0004 | 0 |
| ENEL | 0 | 0 | 0 | 0 |
| ENI | 0 | 0 | 0 | 0 |
| EXO | 0 | 0 | 0 | 0 |
| G | 0 | 0 |
| 0 |
| IP | 0 | 0 | 0.0012 | 0 |
| MB | 0 | 0 | 0.0081 | 0 |
| REC | 0 | 0 | 0 | 0 |
The forecasts obtained from each competitor model have been compared with those of our GAN. Text in bold denotes the non-rejection of the null hypothesis of the test (95% confidence level).
Figure 5Single-step forecasts on the ENEL test set for ARIMAX-SVR (left), LSTM (center), and our GAN architecture (right).
Figure 6Multi-step (5 days) forecasts on the ENEL test set for ARIMAX-SVR (left), LSTM (center), and our GAN architecture (right).
Train-test split results for one stock (EXO).
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|
|
| ||||||
| 60–40 | RMSE | 6.001 | 20.838 (0.012) | 12.237 (0.050) | 21.225 (2.372) | 19.987 (1.865) |
| MAE | 4.942 | 17.667 (0.013) | 9.941 (0.061) | 18.738 (2.695) | 16.912 (1.860) | |
| MAPE | 9.468 | 31.865 (0.025) | 17.776 (0.142) | 62.149 (8.831) | 54.734 (4.003) | |
| 70–30 | RMSE | 8.121 | 12.290 (0.020) | 4.562 (0.775) | 4.419 (1.831) | 3.936 (0.923) |
| MAE | 7.188 | 9.606 (0.011) | 3.154 (0.584) | 3.794 (1.495) | 2.783 (0.728) | |
| MAPE | 12.904 | 15.895 (0.029) | 5.235 (0.930) | 7.286 (2.951) | 4.415 (1.000) | |
|
| RMSE |
|
|
|
|
|
| MAE |
|
|
|
|
| |
| MAPE |
|
|
|
|
| |
|
| ||||||
| 60–40 | RMSE | 17.744 | 21.419 (0.008) | 12.931 (0.039) | 21.718 (2.617) | 20.446 (0.665) |
| MAE | 15.593 | 18.334 (0.009) | 10.415 (0.047) | 19.722 (2.807) | 17.553 (0.817) | |
| MAPE | 28.859 | 33.269 (0.018) | 18.541 (0.105) | 64.813 (15.432) | 53.491 (3.809) | |
| 70–30 | RMSE | 17.968 | 12.717 (0.018) | 6.098 (0.084) | 8.930 (3.041) | 4.135 (0.813) |
| MAE | 16.006 | 10.143 (0.013) | 4.368 (0.086) | 7.073 (2.595) | 3.285 (0.835) | |
| MAPE | 27.758 | 16.953 (0.025) | 7.254 (0.146) | 12.863 (4.591) | 6.131 (1.730) | |
|
| RMSE |
|
|
|
|
|
| MAE |
|
|
|
|
| |
| MAPE |
|
|
|
|
| |
Text in bold denotes the best performance (99% confidence level).
Average execution times of the considered models (10 runs on a single stock). We ran our experiments on a Microsoft Windows 10 (Version 21H1), with 11th Gen Intel(R) Core (TM) i7-1165G7 processor (2.80 GHz, 16.0 GB of RAM).
|
|
|
|
|---|---|---|
|
| ||
| ARIMAX-SVR | 2.30 | 0.34 |
| RF Regressor | 7.49 | 1.06 |
| LSTM | 71.72 | 1.37 |
| Benchmark GAN | 162.63 | 5.21 |
| Our GAN | 2,394.60 | 17.16 |
|
| ||
| ARIMAX-SVR | 2.38 | 0.05 |
| RF Regressor | 19.73 | 2.10 |
| LSTM | 113.71 | 2.11 |
| Benchmark GAN | 1,097.67 | 30.98 |
| Our GAN | 3,011.47 | 70.64 |