Applied Sciences: An Intelligent Event-Sentiment-Based Daily Foreign Exchange Rate Forecasting System
Applied Sciences: An Intelligent Event-Sentiment-Based Daily Foreign Exchange Rate Forecasting System
sciences
Article
An Intelligent Event-Sentiment-Based Daily Foreign
Exchange Rate Forecasting System
Muhammad Yasir 1 , Mehr Yahya Durrani 2 , Sitara Afzal 2 , Muazzam Maqsood 2, * ,
Farhan Aadil 2 , Irfan Mehmood 3, * and Seungmin Rho 4, *
1 Department of Management Sciences, COMSATS University Islamabad, Attock Campus,
Attock 43600, Pakistan
2 Department of Computer Science, COMSATS University Islamabad, Attock Campus, Attock 43600, Pakistan
3 Department of Media Design and Technology, Faculty of Engineering & Informatics, University of Bradford,
Bradford BD7 1DP, UK
4 Department of Software, Sejong University, Seoul 05006, Korea
* Correspondence: [email protected] (M.M.); [email protected] (I.M.);
[email protected] (S.R.); Tel.: +92-346-5347133 (M.M.)
Received: 17 June 2019; Accepted: 20 July 2019; Published: 25 July 2019
Abstract: Financial time series analysis is an important research area that can predict various economic
indicators such as the foreign currency exchange rate. In this paper, a deep-learning-based model is
proposed to forecast the foreign exchange rate. Since the currency market is volatile and susceptible to
ongoing social and political events, the proposed model incorporates event sentiments to accurately
predict the exchange rate. Moreover, as the currency market is heavily dependent upon highly volatile
factors such as gold and crude oil prices, we considered these sensitive factors for exchange rate
forecasting. The validity of the model is tested over three currency exchange rates, which are Pak
Rupee to US dollar (PKR/USD), British pound sterling to US dollar (GBP/USD), and Hong Kong Dollar
to US dollar (HKD/USD). The study also shows the importance of incorporating investor sentiment
of local and foreign macro-level events for accurate forecasting of the exchange rate. We processed
approximately 5.9 million tweets to extract major events’ sentiment. The results show that this
deep-learning-based model is a better predictor of foreign currency exchange rate in comparison
with statistical techniques normally employed for prediction. The results present evidence that the
exchange rate of all the three countries is more exposed to events happening in the US.
Keywords: foreign exchange rate; forecasting; event sentiment; deep learning; regression; SVM
1. Introduction
The foreign exchange rate remains one of the important economic indicators for any country.
Any investment decision by multinational corporations or governments is based on the exchange
rates. Therefore, foreign exchange prediction is an important factor for investors and businesses.
However, foreign exchange forecasting is a very difficult task due to the nonlinear and volatile nature
of this problem. This notion is largely supported due to the research work published in [1,2]. In fact,
the papers [1,2] advocate that the forecast can only be predicted through the simple random walk.
Technically the currency exchange rate data are time series data, which are affected by various
socioeconomic and political factors. This makes it very difficult to predict the exchange rate. At the
same time, accurate currency forecasting has important economic benefits and, thus, it is the focus
of active economic research for many decades [3]. Normally, financial analysis is categorized into
fundamental and technical analysis, where the former deals with macroeconomic issues and the later
with historical data for prediction. Stock prices can be overestimated or underestimated when models
that consider optimistic and pessimistic fundamentals are used because stock markets are ambiguous [4].
The result of technical analysis is well-known statistical models such as autoregressive moving average
and generalized auto regressive conditional heteroscedasticity (GARCH) [5,6]. However, both these
methods do not deal with the nonlinearity of time series data.
In recent times, different advanced computing methods yield better results for time series
forecasting [7]. The success of artificial neural networks (ANNs) is largely due to the discovery of
a nonlinear relationship without prior knowledge of the information and self-training and self-prediction
ability. ANN is a mathematical technique intended for use in solving optimization problems. ANN is
a technique that works well with few assumptions and can tolerate noisy and nonlinear data [8], making
it an ideal candidate for financial time series data. ANN mimics the behavior of the human brain,
which utilizes previous knowledge for solving unseen problems. ANN is basically a network of nodes
arranged in different layers interconnected with some links with associated weights. The network
is trained by feeding some training data. This training helps in deciding about a decision function,
which is chosen from a group of functions represented by the structure of the ANN. This decision
function can be determined by assigning proper weights to the network. If the weights are chosen
optimally, the error is minimized [9]. A common technique for minimizing the error is known as
backpropagation Neural Network (NN), in which the error is fed backward to adjust the weights
resulting in minimizing the error [10]. High accuracy can be achieved using good features and a suitable
network pattern, i.e., forward or backward pattern. Various types of ANNs are employed for financial
forecasting as well as currency rate prediction. These include functional link ANN [11], quantile
regression ANN [12], backpropagation ANN [13], and radial basis function ANN [10] to name a few.
Recently, deep learning has seen immense growth in the field of pattern recognition and time
series analysis. This study focuses on designing a deep-learning-based model to forecast the exchange
rates. The main objective is to design an intelligent model by considering important factors such
as crude oil rate and gold price index. In this study, we intend to check the importance of these
factors for foreign exchange rates of any country. This study also focuses on checking the impact of
important global and local events on the foreign exchange rate of a country. For this purpose, some
important local and global events are considered for each country and sentiment analysis is performed.
The sentiment values are then used to train the deep learning model along with gold price index and
crude oil prices. The paper has the following contributions:
• Since time series models such as Auto regressive conditional heteroscedasticity (ARCH) and
GARCH do not yield significant prediction results, we use a deep learning approach that also
deals with nonlinear patterns of time series datasets.
• The exchange rate is considered as a highly volatile variable and can be affected by any information
floated in the market such as social media sentiments based on events at the macro level, therefore,
we also consider investor sentiment while making exchange rate predictions which is a significant
contribution to the existing body of knowledge.
• We consider three different economies namely, Hong Kong (emerging), Pakistan (developing), and
UK (developed) that belong to different regions which exhibit specific characteristics. Such a dataset
has remained unexplored in the existing literature.
The rest of the paper is organized as follows: Section 2 explains the related work, Section 3
presents the methodology, and Section 4 explains the results followed by the conclusion.
2. Related Work
The exchange rate predicting techniques can be categorized in three different classes that is time
series models, econometric approach, and the last one is machine-learning methods which include
artificial neural network (ANN) and deep-learning-based methods.
Appl. Sci. 2019, 9, 2980 3 of 15
the Brazilian currency exchange rate with the US dollar and it showed the strength of ANN over other
linear models. A similar kind of study was carried out to predict the exchange rate of the Turkish lira
with the euro and the US dollar [28], which showed high accuracy in comparison to other models.
Another study in [29] predicted the euro to US dollar exchange rate by using a multilevel perceptron
(MLP), a specialized ANN, applied to one-day-ahead forecasting of the currency exchange rate collected
from European Central Bank (ECB) time series data. The study showed that MLP outperformed other
techniques for the said problem. A similar kind of study was carried out in [30], which predicted the
exchange rate of the Indian rupee to the US dollar. It created a knowledge guided neural network with
integrated features of least mean square as an input. A study of prediction of the Australian dollar
against the currency of six other currencies was carried out in [31]. Historical data from over 500 weeks
were fed to the ANN and a prediction accuracy of about 87% was recorded. A general regression NN
is proposed in [32], which predicts the currency exchange rate on a month-by-month basis.
Dunis [33] utilized an ANN and compared it with three different models including
an autoregressive model, moving average technical frameworks, and at the end a logistic regressive
model. The artificial neural network outperformed all the standard models. Thinyane and Millin [20]
discovered that the greater the performance on the training dataset, the more complex the ANN.
Although these models lead to unsatisfactorily high generality errors and are predisposed to overfitting
on out-of-sample forecasts. To resolve the outdated artificial neural network model’s limitation,
Nag and Mitra [34] proposed an alternative method utilizing artificial neural network and genetic
algorithms for constructing predicting models for the rate of exchange. They concluded that in
comparison with traditional and statistical time series models, ANN gave considerably better results.
Galeshchuk [7] showed that the practical use of the single hidden layer of MLP can give high-enough
accuracy for the point estimates for the exchange rates, with 60% accuracy attained for the direction of
alteration by applying these predictions. For making cost-effective trading schemes, this renders the
technique less valuable as a bias. Therefore, this inspires us to examine the proficiency of the deep
learning networks to predict the direction of alteration in the forex rate.
3. Proposed Methodology
The proposed methodology is explained in Figure 1.
Appl. Sci. 2019, 9, 2980 5 of 15
Appl. Sci. 2019, 9, x FOR PEER REVIEW 5 of 15
Figure 1. The proposed methodology for the foreign exchange rate prediction.
Figure 1. The proposed methodology for the foreign exchange rate prediction.
The proposed system is based on a deep learning model that incorporates the sentiment of
The proposed system is based on a deep learning model that incorporates the sentiment of major
major local and global events. The sentiment analysis is carried out by calculating the percentage
local and global events. The sentiment analysis is carried out by calculating the percentage of positive
of positive and negative tweets rather than only considering the overall impact. This way, neutral
and negative tweets rather than only considering the overall impact. This way, neutral tweets are
tweets are neglected, and the sentiment is presented in a much better way. The details of deep learning
neglected, and the sentiment is presented in a much better way. The details of deep learning
architecture are presented below.
architecture are presented below.
3.1. Input Layer/First Layer
3.1. Input Layer/First Layer
This layer has the initial dataset, for this study, to predict stock data without the sentiment analysis,
This parameters
our input layer has the wereinitial
crude dataset, forgold
oil price, thisprice
study, to predict
index, stockexchange
and foreign data without the sentiment
rate. Whereas when
analysis, our input parameters were crude oil price, gold price index, and foreign
we study this stock prediction with respect to sentiment analysis, our input layer’s parameters were exchange rate.
Whereas when we study this stock
augmented by one, i.e., sentiment value. prediction with respect to sentiment analysis, our input layer’s
parameters were augmented by one, i.e., sentiment value.
3.2. Convolutional Layers
3.2. Convolutional Layers
In the framework of CNN, the core building layers are the convolutional layers, for extreme
In the framework
computational of CNN,
work is done the convolutional
by these core building layers.
layers are thelayers
These convolutional
execute alllayers, for extreme
the convolutional
computational work is done by these convolutional layers. These layers execute all the
operations on data from the input layer and forward that response to the next layers in the architecture. convolutional
operations
The on datalayer’s
convolutional from parameters
the input layer and forward
have learnable thatalso
kernels response
known to the nexthaving
as ‘filters’, layersa in the
slight
architecture. The convolutional layer’s parameters have learnable kernels also
respective area, but spread over the input data. In the forward pass of layers, every kernel convolvedknown as ‘filters’,
having athe
through slight respective
input area, but
and producing spread
a 1D over the
activation mapinput data.
of that In the forward pass of layers, every
kernel.
kernel convolved through the input and producing a 1D activation map of that kernel.
3.3. Pooling Layers
3.3. Pooling Layers
In between the convo layers, there are pooling layers. To reduce the computational cost for the
In between
next convo layersthe convo
these layers,
layers werethere are pooling
utilized. layers.independent
They operate To reduce the ofcomputational
the depth of the cost for the
output of
nextconvo
the convolayers,
layerswhich
these is
layers werefor
the input utilized. They operate
this pooling layer. We independent of the depth
utilized a pooling of thea output
layer with of
filter size
thetwo.
of convo
Thislayers, which
pooling layerisreduced
the input thefor this pooling layer.
computational cost ofWetheutilized
input. a pooling layer with a filter
size of two. This pooling layer reduced the computational cost of the input.
Appl. Sci. 2019, 9, 2980 6 of 15
Figure
Figure 2.2.The
Thedeep
deeplearning
learning architecture
architecture for
for the
the foreign
foreignexchange
exchangerate
rateforecasting.
forecasting.
4. Results and
4. Results andDiscussion
Discussion
4.1.4.1.
Dataset
Dataset
WeWeused
usedthethe
daily
dailydata
dataofofexchange
exchangerate rate ranging early2008
ranging from early 2008totolate
late2018.
2018.WeWe also
also considered
considered
crude oiloil
crude prices
pricesand
andgold
goldprice
price index
index asas explanatory
explanatoryfactors
factorsinin
thethe model
model for for prediction.
prediction. Daily Daily
data data
of
exogenous factors was used for all the countries. We used the same data
of exogenous factors was used for all the countries. We used the same data series of explanatory series of explanatory
variables
variables forfor
all all
thethe datasets.
datasets. TheThe variables/features
variables/features in the
in the dataset
dataset werewere
crudecrude oil price,
oil price, goldgold
priceprice
index,
andindex,
foreignand foreign rate.
exchange exchange
We alsorate. We sentiment
added also addedanalysis
sentiment analysis
values along values
with thealong with the
aforementioned
aforementioned
features. The events features. The events
were divided into were
globaldivided into
and local globalfor
events and local
each events The
country. for each
datacountry. The
were collected
for each event on a different number of days. The sentiment was collected for each event forfor
data were collected for each event on a different number of days. The sentiment was collected each
each
date event
and for eachwere
the values date added
and thewithvalues
thewere added
dataset with the
against the dataset against
same date. Tablethe1same
showsdate.
theTable 1
detailed
shows the detailed description of the datasets used in our study. The twitter dataset was used to
calculate the sentiment of the events [53]. The details of the events are given in Table 2.
Appl. Sci. 2019, 9, 2980 7 of 15
description of the datasets used in our study. The twitter dataset was used to calculate the sentiment of
the events [53]. The details of the events are given in Table 2.
Table 2. Dataset details along with local and global events for each country.
Table 4 shows the results of the ADF unit root test. We found all the data series to be stationary at
first difference except gold price index, which was stationary at level.
Figure 3 shows the graphical overview of the foreign exchange rate of Hong Kong, Pakistan,
and the UK. The plot considers 50 forecasted and actual values of the foreign exchange rate of Hong
Kong, Pakistan,
Appl. Sci. 2019, 9, x and
FOR the
PEERUK from top to bottom. All the predicted series were calculated using linear
REVIEW 9 of 15
regression, support vector regression, and deep learning models. The spread shows that, in the case of
of Pakistan
Pakistan and Hong
and Hong Kong,Kong, the results
the results of support
of support vector regression
vector regression and
and deep deep learning
learning model
model are are
close to
close
the to the
actual lineactual
of theline of the exchange
exchange rate series.
rate series.
Figure3.3.The
Figure Theplot
plotofof50
50forecasted
forecastedand
andactual
actualvalues
valuesofofthe
theforeign
foreignexchange
exchangerate
rateofofHong
HongKong,
Kong,
Pakistan,and
Pakistan, and
thethe UK considering
UK considering linear,linear,
supportsupport vector,
vector, and deepand deepmodel
learning learning model
(without (without
sentiment).
LR: Linear regression,
sentiment). LR: Linear SVR: SupportSVR:
regression, vector regression,
Support DL:
vector Deep learning.
regression, DL: Deep learning.
compared to the results calculated without sentiment, as a whole, the accuracy of exchange rate
prediction
when improved
sentiment because of sentiment.
was incorporated However,
in the model. Since the
MAE impact of the were
and RMSE 2014 Hong
lowerKong protest
compared to was
the
higher than that of the 2012 US election. Therefore, it is evident that the exchange rate
results calculated without sentiment, as a whole, the accuracy of exchange rate prediction improved of Hong Kong
is more of
because exposed to theHowever,
sentiment. local event.
theWhen
impacta comparison is made
of the 2014 Hong within
Kong the models
protest thenthan
was higher support vector
that of the
regression is more accurate in the case of MAE for both the events. Furthermore, the
2012 US election. Therefore, it is evident that the exchange rate of Hong Kong is more exposed to thedeep learning
model
local givesWhen
event. more areliable resultsisofmade
comparison RMSE in thethe
within case of Hong
models Kong
then protest
support sentiment.
vector regression is more
accurate in the case of MAE for both the events. Furthermore, the deep learning model gives more
Table 6. Results for Hong Kong (HK) with event sentiments.
reliable results of RMSE in the case of Hong Kong protest sentiment.
With
Mean Absolute Error (MAE) Root Mean Squared Error (RMSE)
Sentiment Table 6. Results for Hong Kong (HK) with event sentiments.
Support Support
With Linear Deep Linear Deep
Final HK Mean Absolute Error (MAE)
Vector Root Mean Squared
VectorError (RMSE)
Sentiment Regression Learning Regression Learning
Linear
Regression
Support Vector Deep Linear
Regression
Support Vector Deep
Final Kong
Hong HK 0.011 ± 0.013 ±
Regression Regression Learning Regression Regression Learning
0.010 ± 0.008 0.009 ± 0.010 0.013 ± 0.000 0.014 ± 0.000
protest
Hong Kong2014 0.007 0.000
0.010 ± 0.008 0.009 ± 0.010 0.011 ± 0.007 0.013 ± 0.000 0.014 ± 0.000 0.013 ± 0.000
US election
protest 2014 0.013 ± 0.015 ±
US election 0.010±±0.008
0.008 0.010
0.010 ± 0.009 0.013 ± 0.008
± 0.009 0.013± ±0.000
0.000 0.014
0.014 ± 0.000 0.015 ± 0.000
± 0.000
2012 2012 0.010 0.008 0.013 0.000
Figure4 shows
Figure 4 shows the graphical
the graphical overview
overview of the exchange
of the foreign foreign exchange
rate of Hongrate
Kongof by
Hong Kong by
incorporating
incorporating
the sentiments of the
thesentiments
Hong Kongofprotest
the Hong Kong
and the US protest
election.and
Thethe
plotUS election.50The
considers plot considers
forecasted and actual50
forecasted and actual values of the foreign exchange rate of Hong Kong with the
values of the foreign exchange rate of Hong Kong with the sentiment of the Hong Kong protest and US sentiment of the
Hong Kong
election fromprotest and US election
top to bottom. from top toseries
All the predicted bottom.
were All the predicted
calculated usingseries
linearwere calculated
regression, using
support
linear regression, and
vector supportdeepvector regression,
learning model. and
Sincedeep learningvalues
the plotted model.ofSince the plotted values of
deep-learning-forecasted
deep-learning-forecasted
points are close to the actual points are close
in both to the actual
the graphs of Hongin both
Kongthe graphs
protest of US
and Hong Kong protest
election, and
in the case
USHong
of election,
Kong,in the case of Hong
results of the Kong, the results
deep learning of the
model aredeep
morelearning
accuratemodel are more to
as compared accurate
those ofas
compared to those
linear regression. of linear regression.
Figure4.4. The
Figure The plot
plot of
of 50
50 forecasted
forecasted and
and actual
actual values
values of
of the
the foreign
foreign exchange
exchange rate
rate of
of Hong
Hong Kong
Kong
considering
consideringlinear,
linear,support
supportvector,
vector,and
anddeep
deeplearning
learningmodel
modelwith
withthe
thesentiment
sentimentof
ofHong
HongKong
Kongprotest
protest
and
andUS
USelection.
election.LR:
LR:Linear
Linearregression,
regression,SVR:
SVR:Support
Supportvector
vectorregression,
regression,DL:
DL:Deep
Deeplearning.
learning.
Table
Table77presents
presentsthe
theresults
resultsofofexchange
exchangeprediction
predictionin inthe
thepresence
presenceof ofsentiments
sentimentsof ofmega-events
mega-events
that
thatare
arerelated
relatedto to
Pakistan.
Pakistan.WeWe
considered the 2016
considered Lahore
the 2016 blast as
Lahore a local
blast as event
a localtoevent
predicttothe Pakistan
predict the
exchange rate. The 2012 US election was used as a global event to incorporate sentiment
Pakistan exchange rate. The 2012 US election was used as a global event to incorporate sentiment for for exchange
rate prediction.
exchange Results of all
rate prediction. the three
Results models
of all show
the three that MAE
models showandthatRMSE
MAE were lower were
and RMSE whenlower
sentiments
when
of mega-events
sentiments were incorporated
of mega-events were inincorporated in theMAE
the model. Since model. RMSEMAE
andSince wereand
lower compared
RMSE were to the
lower
results calculated without sentiment, as a whole, the accuracy of exchange rate
compared to the results calculated without sentiment, as a whole, the accuracy of exchange rate prediction improved
because
predictionof sentiment. The results
improved because indicate that
of sentiment. Thetheresults
deep learning model
indicate that theisdeep
morelearning
accuratemodel
as compared
is more
to linear regression
accurate as compared andto support vector regression
linear regression and support when the sentiment
vector regression of the the
when 2012sentiment
US election is
of the
considered in the model. The MAE was 3.250, 3.127, and 2.613 for linear, support vector
2012 US election is considered in the model. The MAE was 3.250, 3.127, and 2.613 for linear, support regression, and
deep
vectorlearning model,
regression, respectively.
and deep learningSimilarly,
model,the RMSE wasSimilarly,
respectively. 4.223, 4.590,theand
RMSE3.534
wasfor4.223,
linear,4.590,
support
and
Appl. Sci. 2019, 9, x FOR PEER REVIEW 11 of 15
3.534 for linear, support vector regression, and deep learning model, respectively. The impact of the
2016Sci.
Appl. Lahore
2019, 9, blast
was less significant than that of the 2012 US election. Therefore, it is evident
2980 11 ofthat
15
the exchange rate of Pakistan is more exposed to global events.
Figure55shows
Figure showsthe
thegraphical
graphicaloverview
overviewofofthetheforeign
foreignexchange
exchangerate
rateof ofPakistan
Pakistanbybyincorporating
incorporating
thesentiments
the sentimentsof ofthe
theUS
USelection
electionand
andthetheLahore
Lahoreblast.
blast.The
Theplot
plotconsiders
considers50 50forecasted
forecastedandandactual
actual
values of the foreign exchange rate of Pakistan with the sentiment of US election
values of the foreign exchange rate of Pakistan with the sentiment of US election and Lahore blast and Lahore blast
fromtop
from toptotobottom.
bottom.All
Allthe
thepredicted
predictedseries
serieswere
werecalculated
calculatedusing
usinglinear
linearregression,
regression,support
supportvector
vector
regression,and
regression, anddeep
deeplearning
learningmodel.
model.Since
Sincethetheplotted
plottedvalues
valuesof
ofdeep
deeplearning
learningforecasted
forecastedpoints
pointsare
are
close to the actual when the sentiment of US election was considered, it is evident that
close to the actual when the sentiment of US election was considered, it is evident that the exchange the exchange
rateofofPakistan
rate Pakistanisismore
moreexposed
exposedtotothe
theevents
eventsoccurring
occurringininthe
theUS.
US.However,
However,ininthe thecase
caseofofthe
theLahore
Lahore
blastsentiment,
blast sentiment,support
supportvector
vectorregression
regressionshows
showsaabetter
betterforecast
forecastpattern.
pattern.
Figure5.5.The
Figure The plot
plot of 50offorecasted
50 forecasted and values
and actual actual of
values of theexchange
the foreign foreign rate
exchange rate considering
of Pakistan of Pakistan
considering
linear, supportlinear,
vector,support
and deepvector, andmodel
learning deep learning model with
with the sentiment the election
of US sentimentandofLahore
US election and
blast. LR:
Lahoreregression,
Linear blast. LR: SVR:
LinearSupport
regression, SVR:
vector SupportDL:
regression, vector
Deepregression,
learning.DL: Deep learning.
Table
Table88presents
presentsthe theresults
resultsofofexchange
exchangeprediction
predictionininthethepresence
presenceofofsentiments
sentimentsofofmega-events
mega-events
that are related
that are related to the UK. We considered Brexit 2016 as a local event to predict
UK. We considered Brexit 2016 as a local event to predict the UK exchange the UK exchange
rate.
rate. The US
The 2012 2012 US election
election was used wasasused as aevent
a global globalto event to incorporate
incorporate sentimentsentiment
for exchangefor rate
exchange rate
prediction.
prediction.
Results of allResults of allmodels
the three the three models
show thatshow
MAEthat andMAERMSE and RMSE
were were
lower whenlower when sentiments
sentiments of mega-
of mega-events were incorporated in the model. Since MAE and RMSE were
events were incorporated in the model. Since MAE and RMSE were lower compared to the results lower compared to the
results calculated
calculated without without sentiment,
sentiment, as a whole,
as a whole, the accuracy
the accuracy of exchange
of exchange rate prediction
rate prediction improved improved
because
because of sentiment.
of sentiment.
Figure
Figure66shows
showsthe thegraphical
graphicaloverview
overviewof ofthe
theforeign
foreignexchange
exchangeraterateofofthe
theUK
UKby byincorporating
incorporating
the
thesentiments
sentimentsofofthe theUSUSelection
electionand
andBrexit.
Brexit.The
Theplot
plotconsiders
considers50 50forecasted
forecastedandandactual
actualvalues
valuesofofthe
the
foreign exchange rate of the UK with the sentiment of the US election and Brexit
foreign exchange rate of the UK with the sentiment of the US election and Brexit from top to bottom. from top to bottom.
All
Allthe
thepredicted
predictedseries
seriesare
arecalculated
calculatedusing
usinglinear
linearregression,
regression,support
supportvector
vectorregression,
regression,and anddeep
deep
learning
learningmodel.
model.Since
Sincethetheplotted
plottedvalues
valuesofofsupport
supportvector
vectorregression
regressionand
anddeepdeeplearning
learningforecasted
forecasted
points
pointsareareclose
closetotothe
theactual,
actual,ininthe
thecase
caseofofthe
theUK,
UK,thetheresults
resultsofofsupport
supportvector
vectorand
anddeep
deeplearning
learning
model are more accurate as compared to those of linear regression. However, the US election sentiment
shows more significant improvement in forecasted plots as compared to Brexit.
model are more accurate as compared to those of linear regression. However, the US election
sentiment shows more significant improvement in forecasted plots as compared to Brexit.
Figure 6. The plot of 50 forecasted and actual values of the foreign exchange rate of the UK considering
Figure 6. The plot of 50 forecasted and actual values of the foreign exchange rate of the UK considering
linear, support vector, and deep learning model with the sentiment of US election and Brexit. LR: Linear
linear, support vector, and deep learning model with the sentiment of US election and Brexit. LR:
regression, SVR: Support vector regression, DL: Deep learning.
Linear regression, SVR: Support vector regression, DL: Deep learning.
5. Conclusions
5. Conclusions
Foreign currency exchange rate is an economic indicator that indirectly impacts even those
Foreign
businesses whichcurrency
are notexchange rate is an
directly involved witheconomic indicatorofthat
imports/exports indirectly
goods. impacts even
Hence accurate those
prediction
businesses
of the exchangewhich areisnot
rate andirectly involved
issue related to awith
smallimports/exports
business as well of goods. Hence accurate
as the government of aprediction
country.
of the exchange rate is an issue related to a small business as well as the
The study is based on a dataset providing information about the exchange rate of currencies from government of a country.
April
The study is based on a dataset providing information about the exchange
2008 to January 2019. The paper proposes a deep-learning-based technique for the prediction of foreign rate of currencies from
April 2008
currency to January
exchange rate.2019.
We Thehavepaper proposes
calculated the asentiment
deep-learning-based
of some major technique for global
local and the prediction
events
for Hong Kong, UK, and Pakistan. The sentiment analysis values are used as an input alongglobal
of foreign currency exchange rate. We have calculated the sentiment of some major local and with
events
other for Hong Kong,
parameters. UK, and
The results Pakistan.
show that theThe sentiment
currency analysis
market values
is heavily are used as
dependent onan input along
sociopolitical
with other
issues parameters.
and higher accuracy The canresults
only beshow that ifthe
achieved currency
these events,market
known issentiments
heavily dependent
in this study, on
sociopolitical issues and higher accuracy can only be achieved if these events,
are taken into consideration while predicting the exchange rate. The results obtained through the known sentiments in
this study,
proposed are taken into
methodology are consideration
compared withwhile linearpredicting
and support theregression
exchange models,
rate. Theboth results obtained
well-known
through the proposed methodology are compared with linear and support
statistical techniques for the said problem. The results show that deep learning-based methods performregression models, both
well-known statistical techniques for the said problem. The results show
better than other methods. It has also been observed that the proposed model performed better with that deep learning-based
methods perform
sentiment analysis. better
Moreover,thanevents
other happening
methods. Itinhas thealso beenaobserved
US have significant that the proposed
impact model
on the currency
performed better with sentiment analysis. Moreover, events happening
exchange rate of Hong Kong, Pakistan, and the UK when social media sentiment is incorporated. in the US have a significant
impact
The on of
results the
thecurrency
prediction exchange
improved rate of Hong
when Kong,
sentiment wasPakistan,
consideredandinthe theUK when
model, social media
therefore these
sentiment is incorporated. The results of the prediction improved
countries are said to be more exposed to mega-events happening across borders. when sentiment was considered in
the model, therefore these countries are said to be more exposed to mega-events happening across
Author
borders.Contributions: Conceptualization, M.Y. and M.M.; formal analysis, M.Y., S.A., and M.M.; investigation,
S.A. and I.M.; methodology, M.M.; project administration, S.R.; visualization, F.A.; writing—original draft, M.Y.D.
and M.M.; writing—review and editing, I.M. and S.R.
Funding: This research was supported by the Basic Science Research Program through the National Research
Foundation of Korea (NRF) funded by the Ministry of Education (NRF-2016R1D1A1A09919551).
Conflicts of Interest: The authors declare no conflict of interest.
Appl. Sci. 2019, 9, 2980 13 of 15
References
1. Meese, R.A.; Rogoff, K. Empirical exchange rate models of the seventies: Do they fit out of sample? J. Int.
Econ. 1983, 14, 3–24. [CrossRef]
2. Meese, R.; Rogoff, K. The out-of-sample failure of empirical exchange rate models: Sampling error or
misspecification? In Exchange Rates and International Macroeconomics; University of Chicago Press: Chicago,
IL, USA, 1983; pp. 67–112.
3. Štěpnička, M.; Cortez, P.; Donate, J.P.; Štěpničková, L. Forecasting seasonal time series with computational
intelligence: On recent methods and the potential of their combinations. Expert Syst. Appl. 2013, 40,
1981–1992. [CrossRef]
4. Cavalli, F.; Naimzada, A.; Pireddu, M. An evolutive financial market model with animal spirits: Imitation
and endogenous beliefs. J. Evol. Econ. 2017, 27, 1007–1040. [CrossRef]
5. Contreras, J.; Espinola, R.; Nogales, F.J.; Conejo, A.J. ARIMA models to predict next-day electricity prices.
IEEE Trans. Power Syst. 2003, 18, 1014–1020. [CrossRef]
6. Bollerslev, T. Generalized autoregressive conditional heteroskedasticity. J. Econom. 1986, 31, 307–327.
[CrossRef]
7. Galeshchuk, S. Neural networks performance in exchange rate prediction. Neurocomputing 2016, 172, 446–452.
[CrossRef]
8. Khashei, M.; Bijari, M. An artificial neural network (p, d, q) model for timeseries forecasting. Expert Syst.
Appl. 2010, 37, 479–489. [CrossRef]
9. Yadav, A.K.; Chandel, S. Solar radiation prediction using Artificial Neural Network techniques: A review.
Renew. Sustain. Energy Rev. 2014, 33, 772–781. [CrossRef]
10. Agatonovic-Kustrin, S.; Beresford, R. Basic concepts of artificial neural network (ANN) modeling and its
application in pharmaceutical research. J. Pharm. Biomed. Anal. 2000, 22, 717–727. [CrossRef]
11. Majhi, R.; Panda, G.; Sahoo, G. Efficient prediction of exchange rates with low complexity artificial neural
network models. Expert Syst. Appl. 2009, 36, 181–189. [CrossRef]
12. Pradeepkumar, D.; Ravi, V. Forecasting financial time series volatility using particle swarm optimization
trained quantile regression neural network. Appl. Soft Comput. 2017, 58, 35–52. [CrossRef]
13. Tang, Z.; Fishwick, P. Back-propagation neural nets as models for time series forecasting. ORSA J. Comput.
1993, 5, 374–385. [CrossRef]
14. Mundell, R.A. Capital mobility and stabilization policy under fixed and flexible exchange rates. Can. J. Econ.
Political Sci. 1963, 29, 475–485. [CrossRef]
15. Dornbusch, R. Exchange rate expectations and monetary policy. J. Int. Econ. 1976, 6, 231–244. [CrossRef]
16. Engel, C. Exchange rates and interest parity. In Handbook of International Economics, Vol. 4; Gopinath, G.,
Helpman, E., Rogoff, K., Eds.; Elsevier: Amsterdam, The Netherlands, 2013.
17. Neely, C.J.; Sarno, L. How well do monetary fundamentals forecast exchange rates? In Federal Reserve Bank of
St. Louis Working Paper Series; Federal Reserve Bank of St. Louis: St. Louis, MO, USA, 2002.
18. Box, G.E.; Jenkins, G.M.; Reinsel, G.C.; Ljung, G.M. Time Series Analysis: Forecasting and Control; John Wiley &
Sons: Hoboken, NJ, USA, 2015.
19. Lam, M. Neural network techniques for financial performance prediction: Integrating fundamental and
technical analysis. Decis. Support Syst. 2004, 37, 567–581. [CrossRef]
20. Thinyane, H.; Millin, J. An investigation into the use of intelligent systems for currency trading. Comput.
Econ. 2011, 37, 363–374. [CrossRef]
21. Önder, E.; Bayır, F.; Hepsen, A. Forecasting macroeconomic variables using artificial neural network and
traditional smoothing techniques. J. Appl. Financ. Bank. 2013, 3, 73–104.
22. Ahmad, J.; Fatmi, H. Quadric neural network for the prediction of financial time series data. In Proceedings
of the 1994 IEEE International Conference on Neural Networks (ICNN’94), Orlando, FL, USA,
28 June–2 July 1994; pp. 3667–3670.
23. Swanson, N.R.; White, H. Forecasting economic time series using flexible versus fixed specification and
linear versus nonlinear econometric models. Int. J. Forecast. 1997, 13, 439–461. [CrossRef]
24. Kuan, C.-M.; White, H. Artificial neural networks: An econometric perspective. Econom. Rev. 1994, 13, 1–91.
[CrossRef]
Appl. Sci. 2019, 9, 2980 14 of 15
25. Qi, M.; Maddala, G. Economic factors and the stock market: A new perspective. J. Forecast. 1999, 18, 151–166.
[CrossRef]
26. Gencay, R. Linear, non-linear and essential foreign exchange rate prediction with simple technical trading
rules. J. Int. Econ. 1999, 47, 91–107. [CrossRef]
27. Santos, A.A.P.; da Costa, N.C.A., Jr.; dos Santos Coelho, L. Computational intelligence approaches and linear
models in case studies of forecasting exchange rates. Expert Syst. Appl. 2007, 33, 816–823. [CrossRef]
28. Ozkan, F. A comparison of the monetary model and artificial neural networks in exchange rate forecasting.
Bus. Econ. Res. J. 2012, 3, 1–27.
29. Dunis, C.L.; Huang, X. Forecasting and trading currency volatility: An application of recurrent neural
regression and model combination. J. Forecast. 2002, 21, 317–354. [CrossRef]
30. Jena, P.R.; Majhi, R.; Majhi, B. Development and performance evaluation of a novel knowledge guided
artificial neural network (KGANN) model for exchange rate prediction. J. King Saud Univ.-Comput. Inf. Sci.
2015, 27, 450–457. [CrossRef]
31. Kamruzzaman, J.; Sarker, R.A. ANN-based forecasting of foreign currency exchange rates. Neural Inf.
Process.-Lett. Rev. 2004, 3, 49–58.
32. Chen, A.-S.; Leung, M.T. Regression neural network for error correction in foreign exchange forecasting and
trading. Comput. Oper. Res. 2004, 31, 1049–1068. [CrossRef]
33. Dunis, C.L.; Laws, J.; Sermpinis, G. Higher order and recurrent neural architectures for trading the EUR/USD
exchange rate. Quant. Financ. 2011, 11, 615–629. [CrossRef]
34. Nag, A.K.; Mitra, A. Forecasting daily foreign exchange rates using genetically optimized neural networks.
J. Forecast. 2002, 21, 501–511. [CrossRef]
35. Hinton, G.E. Training products of experts by minimizing contrastive divergence. Neural Comput. 2002, 14,
1771–1800. [CrossRef] [PubMed]
36. Hinton, G.E.; Osindero, S.; Teh, Y.-W. A fast learning algorithm for deep belief nets. Neural Comput. 2006, 18,
1527–1554. [CrossRef] [PubMed]
37. Nasse, F.; Thurau, C.; Fink, G.A. Face detection using gpu-based convolutional neural networks.
In Proceedings of the International Conference on Computer Analysis of Images and Patterns, Münster,
Germany, 2–4 September 2009; pp. 83–90.
38. Osadchy, M.; Cun, Y.L.; Miller, M.L. Synergistic face detection and pose estimation with energy-based models.
J. Mach. Learn. Res. 2007, 8, 1197–1215.
39. Sukittanon, S.; Surendran, A.C.; Platt, J.C.; Burges, C.J. Convolutional networks for speech detection.
In Proceedings of the Eighth International Conference on Spoken Language Processing, Jeju Island, Korea,
4–8 October 2004.
40. Lee, H.; Pham, P.; Largman, Y.; Ng, A.Y. Unsupervised feature learning for audio classification using
convolutional deep belief networks. In Proceedings of the Advances in Neural Information Processing
Systems, Vancouver, BC, Canada, 7–10 December 2009; pp. 1096–1104.
41. Busseti, E.; Osband, I.; Wong, S. Deep learning for time series modeling. Tech. Rep. Stanf. Univ. 2012, 1–5.
42. Längkvist, M.; Karlsson, L.; Loutfi, A. A review of unsupervised feature learning and deep learning for
time-series modeling. Pattern Recognit. Lett. 2014, 42, 11–24. [CrossRef]
43. Ribeiro, B.; Lopes, N. Deep belief networks for financial prediction. In Proceedings of the International
Conference on Neural Information Processing, Shanghai, China, 13–17 November 2011; pp. 766–773.
44. Chao, J.; Shen, F.; Zhao, J. Forecasting exchange rate with deep belief networks. In Proceedings of the 2011
International Joint Conference on Neural Networks, San Jose, CA, USA, 31 July–5 August 2011; pp. 1259–1266.
45. Yeh, S.-H.; Wang, C.-J.; Tsai, M.-F. Corporate default prediction via deep learning. In Proceedings of the 34th
International Symposium on Forecasting (ISF’14), Rotterdam, The Netherlands, 29 June–2 July 2014.
46. Hinton, G.E.; Salakhutdinov, R.R. Reducing the dimensionality of data with neural networks. Science 2006,
313, 504–507. [CrossRef] [PubMed]
47. Schmidhuber, J. Deep learning in neural networks: An overview. Neural Netw. 2015, 61, 85–117. [CrossRef]
[PubMed]
48. Larochelle, H.; Bengio, Y.; Louradour, J.; Lamblin, P. Exploring strategies for training deep neural networks.
J. Mach. Learn. Res. 2009, 10, 1–40.
Appl. Sci. 2019, 9, 2980 15 of 15
49. Masci, J.; Meier, U.; Cireşan, D.; Schmidhuber, J. Stacked convolutional auto-encoders for hierarchical feature
extraction. In Proceedings of the International Conference on Artificial Neural Networks, Espoo, Finland,
14–17 June 2011; pp. 52–59.
50. Ranzato, M.A.; Huang, F.J.; Boureau, Y.-L.; LeCun, Y. Unsupervised learning of invariant feature 7hierarchies
with applications to object recognition. In Proceedings of the 2007 IEEE Conference on Computer Vision and
Pattern Recognition, Minneapolis, MN, USA, 17–22 June 2007.
51. Vincent, P.; Larochelle, H.; Bengio, Y.; Manzagol, P.-A. Extracting and composing robust features with
denoising autoencoders. In Proceedings of the 25th International Conference on Machine Learning, Helsinki,
Finland, 5–9 July 2008; pp. 1096–1103.
52. LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature 2015, 521, 436–444. [CrossRef]
53. Zubiaga, A. A longitudinal assessment of the persistence of twitter datasets. J. Assoc. Inf. Sci. Technol. 2018,
69, 974–984. [CrossRef]
54. Nazir, F.; Ghazanfar, M.A.; Maqsood, M.; Aadil, F.; Rho, S.; Mehmood, I. Social media signal detection using
tweets volume, hashtag, and sentiment analysis. Multimed. Tools Appl. 2019, 78, 3553–3586. [CrossRef]
55. Iqbal, M.; Ghazanfar, M.A.; Sattar, A.; Maqsood, M.; Khan, S.; Mehmood, I.; Baik, S.W. Kernel Context
Recommender System (KCR): A Scalable Context-Aware Recommender System Algorithm. IEEE Access
2019, 7, 24719–24737. [CrossRef]
56. Khan, S.; Khan, A.; Maqsood, M.; Aadil, F.; Ghazanfar, M.A. Optimized gabor feature extraction for mass
classification using cuckoo search for big data e-healthcare. J. Grid Comput. 2018, 17, 239–254. [CrossRef]
57. Kalsoom, A.; Maqsood, M.; Ghazanfar, M.A.; Aadil, F.; Rho, S. A dimensionality reduction-based efficient
software fault prediction using Fisher linear discriminant analysis (FLDA). J. Supercomput. 2018, 74, 4568–4602.
[CrossRef]
58. Ateeq, T.; Majeed, M.N.; Anwar, S.M.; Maqsood, M.; Rehman, Z.-U.; Lee, J.W.; Muhammad, K.; Wang, S.;
Baik, S.W.; Mehmood, I. Ensemble-classifiers-assisted detection of cerebral microbleeds in brain MRI. Comput.
Electr. Eng. 2018, 69, 768–781. [CrossRef]
© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access
article distributed under the terms and conditions of the Creative Commons Attribution
(CC BY) license (http://creativecommons.org/licenses/by/4.0/).