Submission Deadline-31st May 2024
May 2024 Issue : Publication Fee: 30$ USD Submit Now
Submission Deadline-20th May 2024
Special Issue of Education: Publication Fee: 30$ USD Submit Now

Short – Term Forecasting for Daily Stock Market Indices using Discrete Fourier Transforms

  • Kavishka T. Rajapaksha
  • Dinushiya S. Rodrigo
  • 2039-2044
  • Dec 26, 2023
  • Digital Marketing

Short – Term Forecasting for Daily Stock Market Indices using Discrete Fourier Transforms

Dinushiya S. Rodrigo and Kavishka T. Rajapaksha*

Department of Mathematics, Faculty of Applied Sciences, University of Sri Jayewardenepura, Nugegoda, Sri Lanka.

DOI: https://dx.doi.org/10.47772/IJRISS.2023.7011163

Received: 14 November 2023; Accepted: 23 November 2023; Published: 24 December 2023

ABSTRACT

The stock market indices are used to gauge the financial movements in the stock markets. If the index rises, the market is growing, and if it falls, the market is declining. The only stock exchange in Sri Lanka is operated by the Colombo Stock Exchange (CSE). Its two primary stock market indices are All Share Price Index (ASPI) and Standard & Poor’s Sri Lanka 20 (S&P SL20). Market indices provide information to investors. So, they can predict the risks and returns of their investments. While ASPI forecasts assist investors in understanding the future direction of the entire market, S&P SL20 forecasts help investors make investment decisions. Therefore, in order to make the correct investment decisions, it is crucial to identify appropriate forecasting methods for those two indices to meet investor expectations. The Discrete Fourier Transform (DFT) is a technique that can be used to convert a time-domain discrete signal into a frequency-domain discrete spectrum. In this study, the ASPI and S&P SL20 indexes were modeled as the Fast Fourier Transform amplitude spectrum using the daily stock values. The daily index data from the years 2017 to 2022 were used to formulate this model. The study also examined the periodic deviations of both indices during the considered period. Additionally, this research predicts the near future of both indices by modeling the daily indices values. To further verify the accuracy of the model, data from the SET (Thailand Stock Index) were employed. According to the results, the ASPI and S&P SL20 datasets show periodic patterns ranging from 4 days to 7 days and the SET datasets show periodic patterns between 5 and 6 days. The forecasting ability of the proposed Fourier model was assessed by using metrices such as Mean Squared Error (MSE), Mean Absolute Error (MAE) and Mean Absolute Percentage Error (MAPE).  Finally, it is concluded that the proposed Fourier model is capable of forecasting the daily ASPI and S&P SL20 indices for a short period of time equivalent to their periodicities.

Keywords: Discrete Fourier Transform, Trend patterns, ASPI, S&P SL20, SET

INTRODUCTION

Stock markets are places where buyers and sellers gather together to trade equity shares of public corporations. A stock index, sometimes known as a stock market index, is an index used in finance to evaluate the stock market or a segment of the stock market and assist investors in comparing current stock prices to historical prices to determine market performance. The index provider calculates and maintains each index according to its own methodology. Either price or market capitalization will often be weighted in index techniques (Young, 2022) [8]. Perhaps the most well-known and important statistics in the entire world of investing and finance are the daily results of stock market indices. They are strongly integrated into the investment management industry, and funds utilize them as performance standards to compare investments. Stock indexes help investors identify industry trends and make better investment decisions. Additionally, they facilitate passive investment (What are stock market indices? – edelweiss, n.d.) [7].

The Colombo Stock Exchange (CSE) operates Sri Lanka’s sole stock exchange and is in charge of creating an environment that is transparent and regulated where businesses and investors can interact (Colombo Stock Exchange – CSE, n.d.) [1]. The All Share Price Index (ASPI) and the Standard & Poor’s Sri Lanka 20 (S&P SL20) are the main market indices of the CSE. The ASPI is a price index that is calculated daily depending on the changes in normal share prices of all listed companies on the CSE. It was created to gauge fluctuations in the market as a whole. The ASPI is weighted based on float-adjusted market capitalization since the market opened on January 24, 2022, and it is calculated in real-time for all voting and non-voting common shares listed on the exchange. They had previously been weighted according to the full market capitalization of each constituent. The performance of 20 of the largest and most liquid companies on the CSE is gauged by the S&P SL 20. The CSE and the S&P Dow Jones Indices work together on its development. It is also calculated in real time and is weighted based on float-adjusted market capitalization, subject to a single stock cap of 15% (Colombo Stock Exchange, n.d.) [2].

Market indices give investors knowledge that they can use to forecast the risks and returns of their investments. So, in order to make the correct investment decisions, it is very important to predict the behaviour of stock market indices. While S&P SL 20 forecasts aid investors in making investment decisions, ASPI forecasts aid investors in understanding the future direction of the whole market. Therefore, it is important to find suitable forecasting techniques for ASPI and S&P SL20 to fulfill the expectations of investors.

Hence, the main objective of the study is to forecast the ASPI and S&P SL20 indices using Discrete Fourier Transforms (DFT). In addition, this study is focused on identifying the trending patterns of both indices and analyzing the economic crisis impact on both indices. Due to COVID-19 and the economic crisis situation in Sri Lanka, both indices highly fluctuated during the 2020–2022 period. Since Thailand has the second-largest economy in Southeast Asia, data from the Thailand stock index, which is called SET, was used to further check the model’s validity. The scope of the research study is confined to the daily prices of the ASPI, S&P SL20, and SET indices during the 2017–2022 period.

Literature revealed that Samadder, Ghosh and Basu (2015) [3] conducted a study to investigate the periodicity of the two prime Indian stock market indices: SENSEX and NIFTY and the prime American stock market indices: DOW-JONES and S&P 500. It was done using a date-compensated discrete Fourier transform and revealed significant periodicities for each index. Also, Stadnik, Raudeliuniene and Davidaviciene (2016) [5] analyzed the assumptions and evidence of Fourier analysis for stock price forecasting and concluded that the Fourier analysis basically failed when forecasting signals with trends (noises). It was done using US stock data. Therefore, this research will be carried out for modeling and evaluating the future behavior of the daily ASPI and S&P SL20 values with trending patterns using DFT techniques.

METHODOLOGY

  • Data Collection

Data on daily ASPI and S&P SL20 indices for the period 1st of January 2017 to 31st of December 2022 were obtained from the official website of CSE (https://www.cse.lk/), https://countryeconomy.com/stock-exchange/sri-lanka and https://www.investing.com/indices/sp-sri-lanka-20-historical-data. The daily SET index data set for the same period were taken from the official website of Thailand stock exchange (https://www.set.or.th/en/market/index/set/overview) and https://www.investing.com/indices/thailand-set-historical-data.

  • Fourier Forecasting Model

Before formulate the forecasting model, it is essential to identify which data points will be used to build up the forecasting model from the given data set. Therefore, the first step is to plot the given data set. It is required that the given data set have at least thirty data points. Then the immediate trend pattern of the dataset was identified whether it is increasing or decreasing using the plot. After that, the data points which belong to the immediate trend pattern were chosen. It is required that at least ten data points belong to the immediate trend pattern to formulate the forecasting model. Then using Fast Fourier Transform (FFT), those obtained data points were converted to frequency domain components and these obtained FFT coefficients were used to plot the amplitude spectrum.

Considering the symmetric property, only half of the harmonics of the amplitude spectrum was selected. Next, the peak harmonics that have the highest amplitudes in the amplitude spectrum were selected and the periodicity for each peak harmonic was calculated.  Among those periodicity values have to select one periodicity value to formulate the model. For this purpose, it should be assumed that the periodicity of immediate trend is always less than or equal to seven. So, it is an assumption of our model. That periodicity value was considered as the original periodicity of the trending data set. To find the original periodicity the below two steps can be followed.

  1. The periodicity values among the calculated periodicity values were selected that have the highest multiple value that can choose the maximum number of data points among the trending data points.
  2. Among the selected values, the highest periodicity value was selected which is less than or equal to seven. It is considered as the original periodicity of the trending data set.

After selecting the maximum number of data points among the trending data set considering the original periodicity, these data points are considered as a discrete finite data sequence to formulate the forecasting model. Since it is a sequence with trend data, it is not suitable for applying the FT techniques directly. Because the Fourier model doesn’t offer good accuracy for series containing trend data. Therefore, to get the trend free series, the first differenced sequence was created using the obtained data sequence. That means getting the difference between two consecutive daily stock market index values.

If Xt denotes the stock market index value at time t, then the first differenced sequence of Xt is as follows:

Yt= Xt- Xt-1 ;t=1,2,…..,N-1

Where;

N:Number of data points

If there are any unexpected fluctuations among the data sequence, linear trendline regression techniques were used to eliminate them and replace them with new values. After the first differenced sequence was generated, it was transformed into frequency domain components using FFT. Then each FFT coefficient was divided by the sample size to obtain the normalized FFT coefficients. These normalized FFT coefficients were used to obtain the amplitude spectrum and phase spectrum. Only half of the harmonics in the amplitude spectrum were chosen because of the symmetric property (Tantrigoda & Rodrigo 2014) [6]. Next, choose the significant harmonics with the highest amplitudes in the amplitude spectrum. After that, create a function for Yt using the relevant amplitude and phase values of significant harmonics. Then, using the Yt and Xt-1 parameters, create a function on the time domain data set. Finally, use Y1 and various t values in the model to get a series of fitting and prediction data. In this model, can predict only the number of data points that equals to the original periodicity. Therefore, this is a short-term forecasting model.

  • Model Validation

The daily values of the ASPI and S&P SL20 indices normally fluctuated during the 2017-2018 period. Therefore, the model was first tested on those datasets for the period 2017-2018. But because of the easter bombing attack, Covid-19 and economic crisis situations in Sri Lanka, unexpectedly high fluctuations occurred among the daily values of the ASPI and S&P SL20 indices during the 2019-2022 period. Therefore, the model doesn’t work properly for some data sets that belong for this period. In Southeast Asia, Thailand has the second-largest economy (Shahabad 2014, p.21) [4] and its SET index values fluctuated normal manner during 2018-2022 period than Sri Lanka. Hence, then the model was tested on the SET index dataset for the period 2018-2022 to further check the model validity.

In order to evaluate the forecasting capability, three error metrics were used. They are Mean Squared Error (MSE), Mean Absolute Error (MAE) and Mean Absolute Percentage Error (MAPE). These were computed during the model fitting and forecasting processes.

RESULTS and DISCUSSION

The ASPI data set belonged to the 30th October 2017 to 13th December 2017 period was tested. Its immediate trend pattern was identified as a decreasing trend pattern from November 24th to December 13th, 2017. It included 13 data points. Using the peak harmonic values and amplitude values, the periodicity was identified as 6 days. Therefore, the data values from 24th November 2017 to 12th December 2017 were used to formulate the model.

According to Fig. 1 and TABLE 1, the deviations between actual and fit are very low. It means the pattern of the Fourier forecast model is very similar to the actual series. Also, the deviations between actual and forecast are less. Therefore, the fits and forecasts confirmed that the Fourier model is a suitable model to forecast short-term daily ASPI values.

As mentioned in section 2.3, the forecasting ability of our Fourier model cannot be guaranteed using the ASPI and S&P SL20 datasets during 2021–2022. Therefore, the SET index datasets in Thailand, which belong to the period 2021–2022, were used to measure the forecasting ability of our Fourier model.

So, the daily SET index values from 17th June 2022 to 8th August 2022 period was tested. Its immediate trend pattern was identified as an increasing trend pattern from 19th July 2022 to 8th August 2022. It included 13 data points. Using the peak harmonic values and amplitude values, the periodicity was identified as 6 days. Therefore, the data values from 19th July 2022 to 5th August 2022 were used to formulate the model.

According to Fig. 2 and TABLE 2, the deviations between actual and fit are very low. It means the pattern of the Fourier forecast model is very similar to the actual series. Also, the deviations between actual and forecast are less. Therefore, the fits and forecasts confirmed that the Fourier model is a suitable model to forecast short-term daily SET index values in Thailand during the period 2021-2022.

Table 1: Model Summary of Daily Aspi Values From 24th November 2017 to 20th December 2017

Fig. 1: Plots of Actual vs Fit and Actual vs Forecast for ASPI values from 24th November to 20th December 2017

Fig. 2: Plots of Actual vs Fit and Actual vs Forecast for SET values from 19th July to 16th August 2022

Table 2: Model Summary of Daily Aspi Values From 19th July 2022 to 16th August 2022

CONCLUSIONS

The immediate trend pattern, either increasing or decreasing, was identified for each selected dataset. The periodicity for each immediate trending dataset was calculated using their amplitude spectrums. During the 2017–2018 period, both the ASPI and S&P SL20 indices mostly had decreasing trends. The periodicities for both indices varied between 4 days and 7 days during that period. After the Easter bombing attack in April 2019, both indices had both increasing and decreasing trend patterns. Their periodicities varied between 5 and 6 days. During the 2020–2021 COVID-19 period, both indices mostly had increased trending and their periodicities varied between 5 and 7 days. But during the 2022 economic crisis period, unexpected fluctuations in both indices occurred. Therefore, suitable datasets that satisfied our model assumptions couldn’t be identified. During the 2021–2022 period, the SET index always had increasing trend patterns and its periodicities varied between 5 and 6 days. Therefore, we can conclude that the periodicity of fluctuations in the stock market index values is less than or equal to 7 days.

The findings demonstrate that for all the ASPI, S&P SL20, and SET indices datasets taken into consideration for the period 2017–2019, the Fourier forecast model pattern is very similar to the actual series. Furthermore, there were very few differences between the actual and forecast as well as between the actual and fit. There were some problems when forecasting the ASPI and S&P SL20 values during the 2021–2022 period. But when forecasting the SET values during the 2021–2022 period, the results show that the Fourier forecast model pattern is very similar to the actual series. The Fourier model is thus a suitable model for predicting daily stock market index values for the short-term period, according to fits and forecasts. The short-term forecasts will be helpful in making future investments and taking some short-term investment decisions, like what the direction of the price indices is and whether the market will go down or up. This method can only be used to forecast future values that are equal to the periodicity. Therefore, it is recommended to modify the model to forecast the number of values beyond the periodicity.

REFERENCES

  1. Colombo Stock Exchange – CSE, n.d., https://cdn.cse.lk/pdf/Index-Methodologies-of-Colombo-Stock-Exchanhge.pdf
  2. Colombo Stock Exchange, n.d., https://www.cse.lk/
  3. Samadder, S, Ghosh, K & Basu, T 2015, ‘Search for the periodicity of the prime Indian and American stock exchange indices using date-compensated discrete Fourier transform’. Chaos, Solitons & Fractals, no. 77, pp. 149-157.
  4. Shahabad, RD 2014, The impacts of political stability on economic growth: Evidence from panel data analysis (Master’s thesis, Eastern Mediterranean University (EMU)-Dogu Akdeniz Universitesi (DAU)).
  5. Stadnik, B, Raudeliunienė, J & Davidaviciene, V 2016, ‘Fourier analysis for stock price forecasting: assumption and evidence, Journal of Business Economics and Management, vol. 17, no. 3, pp. 365-380.
  6. Tantrigoda, DA & Rodrigo, DS 2014, ‘Numerical implementation of Fourier transforms and associated problems’, International Journal of Multidisciplinary Studies, vol. 1, no. 1.
  7. What are stock market indices? – edelweiss, n.d., https://www.nuvamawealth.com/investology/introduction-to-stock-markets-51c006/what-is-nifty-sensex-stock-market-indices-692d05
  8. Young, J 2022, Market index: Definition, how indexing works, types, and examples, Investopedia, https://www.investopedia.com/terms/m/marketindex.asp

Article Statistics

Track views and downloads to measure the impact and reach of your article.

4

PDF Downloads

[views]

Metrics

PlumX

Altmetrics

Paper Submission Deadline

Subscribe to Our Newsletter

Sign up for our newsletter, to get updates regarding the Call for Paper, Papers & Research.

    Subscribe to Our Newsletter

    Sign up for our newsletter, to get updates regarding the Call for Paper, Papers & Research.


    Track Your Paper

    Enter the following details to get the information about your paper