Predicting the Kijang Emas Bullion Price using LSTM Networks

- This study investigates the potential of Deep Learning techniques, specifically LSTM networks, in forecasting Kijang Emas future value over a long period. Six LSTM models comprising of Simple LSTM, Bidirectional LSTM, and Stacked LSTM architecture were built and trained against a 15-year historical price data for Kijang Emas. The models’ performance was then measured against ARIMA (5,1,0) as a baseline reference and evaluated against the RAE, MSE and RMSE metric. The results revealed that LSTM networks models performed well in forecasting Kijang Emas price based on the test dataset where the average RMSE was between 49.9 to 50.3 while the Bidirectional LSTM was found to exhibit better performance as compared to the other LSTM models.


Introduction
Kijang Emas is a gold bullion investment coin issued by the Bank Negara Malaysia. Functioning primarily as an investment instrument, the Kijang Emas actual price is determined by the international gold market, despite having a RM200 face value. The Bank Negara Malaysia publishes Kijang Emas' daily trading price on its official website alongside a time-series of its historical price dated as far back as 2005.
While the forecasting of gold bullion price is a well-researched area (Alameer et al., 2019;Hadavandi et al., 2010;He et al., 2019;Livieris et al., 2020;Pandey et al., 2019;Ping et al., 2013;Vidal & Kristjanpoller, 2020;Zhang & Liao, 2014), studies that specifically predicts the Kijang Emas gold coin price remains limited. Miswan et al., (2013) used the Box-Jenkins methodology to develop an ARIMA-based model to predict the Kijang Emas value while Ping et al., (2013) produced a GARCH model which can provide a better prediction than the ARIMA-based models. Subsequently, Yussof et al. (2016) combined the GARCH model with a three-layer feed-forward Artificial Neural Network (ANN) that improved forecasting accuracy.
An emerging trend involves Deep Learning, where the Long Short-Term Memory (LSTM), a form of Recurrent Neural Network (RNN) is used to predict future values of time-series data. In studies conducted by Siami-Namini et al. (2018), LSTM-based algorithms show significant improvement in the accuracy of future prediction as compared to ARIMA. He et al., (2019) supported this in their finding where LSTM-based models performed significantly better than ARIMA in forecasting precious metal prices. Wu et al., (2018) proposed LSTM forecasting framework in the forecast of Bitcoin volatility concluded that values projected by LSTM are nearer to the actual values on a non-stationary time series data. Furthermore, Baughman et al., (2018) utilised LSTM networks to predict the spot price of Amazon computing instances. The three-layer LSTM network was trained on 10,000 historical data points of Amazon computing instances spot price in their study. In contrast, Althelaya et al., (2018) evaluated Bidirectional LSTM, Unidirectional LSTM and Stacked LSTM for stock market prediction and concluded that Bidirectional LSTM attained higher performance on both short-term and long-term predictions.
Although GARCH-based models were thoroughly studied in the financial market forecasting, Deep Learning solutions using LSTM-based models have emerged as great alternatives in the same field. Thus, this study explores the effectiveness of LSTM-models for Kijang Emas coin bullion forecast by building several LSTM-based to predict the Kijang Emas prices besides evaluating model performance based on previously seen seven-day data points.
This paper is structured as follows: The Methodology section describes the training and test datasets used in this study alongside time series data properties. Model Design provides explanations on LSTM architectures trained to predict Kijang Emas in this study. The Results and Discussions outlined the models' performance by comparing the LSTM models prediction performance to a baseline while the Conclusion section contains the concluding remarks alongside potential future research.

Dataset Preparation
The Kijang Emas gold bullion price dataset for this study is extracted from Bank Negara Malaysia which is available from Ismail (2020). The dataset used in this study consist of the selling price of one ounce of the Kijang Emas from 3 January 2005 to 5 May 2020, with 3730 data points. Table 1 presents the sample data used in this study. To ensure the neural network training efficiency, the dates will be represented as time index, an integer value to denote the specific coin price point in the sequence. Figure 1 illustrates the Kijang Emas selling price obtained from the dataset plotted against time index. The Augmented Dickey-Fuller (ADF) unit root test was applied to the time series to determine whether the series is stationary. This identification is crucial as a non-stationary time-series requires some transformation before the LSTM neural network can be utilised. The ADF test yielded a p-value result of 0.92744, indicating that the time series is nonstationary. The MinMax scaler was employed for transformation where the time series undergoes first differencing to prepare it for training. Figure 2 presents the transformed time series.

Model Design
Six LSTM networks were developed based on three different LSTM structures: 1) the Unidirectional LSTM, 2) Bidirectional LSM and 3) Stacked LSTM. All networks were trained using 100 epochs with a batch size of one. The Sigmoid activation function was employed in all LSTM blocks in the networks.

Unidirectional LSTM (Model 1 and Model 2)
Two unidirectional LSTM network were developed in this study. The first model consists of a one input layer, where a hidden LSTM layer with 32 neurons and a dense output layer formed a single value prediction. In contrast, the hidden layer Model 2 contains 64 neurons. Figure 3 presents the design of the Unidirectional LSTM network.

Stacked LSTM (Model 3 and Model 4)
In the Stacked LSTM network of this, two LSTM network hidden layers were stacked together in a dense layer. The first LSTM layer is configured with 64 neurons, while the second LSTM layer is configured with 32 neurons for Model 3 and 64 neurons for Model 4. Figure 4 depicts the design of the Stacked LSTM

Bidirectional LSTM (Model 5 and Model 6)
The Bidirectional LSTM is a modification of the Unidirectional LSTM where instead of a single recurrent layer, two recurrent layers exist side-by-side in the Bidirectional LSTM. The Bidirectional LSTM layers are fed with two input sequence: 1) the original sequence and 2) the reverse copy of the original sequence. In this study, the designed Bidirectional LSTM network comprises of a single hidden layer with 32 neurons for Model 5 and 64 neurons for Model 6. The hidden layer is followed by a dense layer of a single neuron for output. Figure  5 presents the implementation of the Bidirectional LSTM.

Model Training and Forecasting Evaluation
These models were trained on a computer with GPU acceleration (utilising Nvidia CUDA with GTX 1660 Ti graphic card) employing the Keras deep learning library with mean absolute error as its loss function and "Adam" optimizer algorithm. The dataset is split into 80:20 training and validation ratio, where the model is trained on 2,984 datapoint samples and validated against 746 samples of 20 epochs with a batch size of one. The mean squared error (MSE), root mean square error (RMSE) and mean absolute error (MAE) were utilised to evaluate model performance. A seed value of 8192 was established to ensure the consistency of results between (re)training runs. Table 2 outlines the result of the computational training and evaluation on six LSTM networks in this study where ARIMA is a baseline comparison. The models' prediction performance is compared using MAE, MSE and RMSE, where the lowest value denotes that the mean predicted value is the closest to the actual value.

Conclusion
This study explored the possibility of using LSTM networks in predicting Kijang Emas bullion coin value in which, six different LSTM networks were built, and their performance contrasted. From the results, it can be concluded that LSTM is a potential robust alternative in predicting future gold values accurately as compared to baseline model.
Future research can concentrate more on hyperparameters tuning (learning rate, dropout rate, batch size, optimizers) to improve prediction accuracy, especially when it comes to distinguishing the performance between the Unidirectional LSTM and the Bidirectional LSTM in the Kijang Emas prediction task. Furthermore, a multi-step prediction of Kijang Emas forecast would prove beneficial to gold investors as LSTM can potentially predict the movement of gold prices several days in advance.

Disclosure Statement
No potential conflict of interest was reported by the authors.