Applying Genetic Algorithm in the Prediction of Foreign Currency Exchange Rate

DOI : 10.17577/IJERTV11IS040255

Download Full-Text PDF Cite this Publication

Text Only Version

Applying Genetic Algorithm in the Prediction of Foreign Currency Exchange Rate

Dwaipayan Saha

Department of Computer Science and Engineering JIS College of Engineering

Kalyani, Nadia, West Bengal, India

Indrani Mukherjee

Department of Computer Science and Engineering JIS College of Engineering

Kalyani, Nadia, West Bengal, India

Jesmin Roy

Department of Computer Science and Engineering JIS College of Engineering

Kalyani, Nadia, West Bengal, India

Dr. Sudipta Sahana

Department of Computer Science and Engineering JIS College of Engineering

Kalyani, Nadia, West Bengal, India

Dr. Amit Majumder

Department of Computer Science and Engineering JIS College of Engineering

Kalyani, Nadia, West Bengal, India

Abstract Foreign Currency Exchange Rates have always been an area of interest for several economists, businessmen, and many more. And presently, prediction of accurate exchange rates has become the need of the hour, after the worldwide pandemic, and turmoil across the globe. The importance of this has grown exponentially so as to get exact record of past as well as future rates, which in turn decides the economic status. An accurate prediction of exchange rates can turn out to be very crucial in the economic growth of an individual and also of the state. On the other hand inaccuracy of the same can result huge losses. There are various methods by which we can predict the currency exchange rate, but the performances of those techniques are questionable. After researching we have found that Genetic Algorithm is such a technique which can be implemented in this process of prediction of currency exchange rates. In this is research work we have also tried to implement other methods to predict the foreign currency exchange rate and have drawn inferences, which have been discussed in the later part of this paper.

Keywords – Foreign currency exchange rate, genetic algorithm, chromosomes, fitness function, prediction

  1. INTRODUCTION

    The foreign exchange market is very much complex as well as resilient within itself. It is often recognized as to be extremely adaptive in nature. The foreign exchange market is persistently affected by many externals factors and these external factors are very much important to be taken into consideration as these external things will only help to predict the foreign exchange rate precisely. As the foreign exchange market is constantly getting impacted by the external components, so as the currency exchange rate. The currency exchange rate also fluctuates with the fluctuations of these external components and thus the prediction of these exchange rates differs.

    The foreign currency exchange rate prediction plays an important role in trading market as it determines the countrys economic relationship health. Exchange rate is often perceived as the economic relation between two countries. When exchange rates fluctuate, the imported goods will also cost more or less in value based on the changes of exchange rate, which also includes the domestic products that are dependent on imported parts and raw materials. Exchange rates also have a huge impact on investment performance, interest rates, and inflation and sometime exchange rate fluctuations extend its impact to influence the job market and real estate sector. In this era of globalization, many goods are imported from other countries and even more imported goods are used compared to domestic products produced in the country itself. Exchange rates have a significant impact on the prices that we pay for the imported products. A weaker domestic currency means that the price we pay for foreign goods will generally be higher. As a consequence, a stronger domestic currency can reduce the prices of foreign goods to some extent. So, basically the exchange rate controls the import export trade and have a huge impact all over the world. Analysing, the flow of the external factors and using the knowledge of the trading in an appropriate way can help several traders to have profit. Thus, exchange rate prediction will help the countries to make stable economic relation with other countries.

    There are many approaches used by several researchers to predict the exchange rate precisely and many are still working on it as exchange rate is vast area and predicting it precisely will be boon to this globalization. Here in our work, we have put up our approach to study in detail about the features and opted for feature selection techniques to predict the exchange rate. We have applied polynomial regression

    within genetic algorithm using the best possible features combination to predict the exchange rate. The idea of applying regression with genetic algorithm is very much appealing as it will give us the best possible combination of features which in future can be used and scaled according to the requirement to establish a good and impactful economic relation between two countries. Literature survey is done properly and we have explained the methodology thoroughly and the results are discussed properly about what we observed and obtained in the coming sections of this paper.

  2. LITERATURE REVIEW

    Many studies have been published to cover the Foreign currency exchange rate prediction. Puja Aggarwal et al. [1] focussed on comparing long short term memory (LSTM), gated recurrent unit (GRU), and simple recurrent neural networks (SRNN) to predict the currency exchange rate for

    22 different currencies of countries against United States Dollar(USD) simultaneously. The models designed by the aforementioned authors can predict the exchange rate for 30 consecutive days by taking the latest data of 365 days as input to their model. It worked with the similar number of neural network layers, input, targeted output, optimizer, and learning rate. This mainly deals with comparing various neural networks and concluding the comparison based on various factors. Swagat Ranjit et al. [2] presents different machine learning techniques like Artificial Neural Network (ANN), Recurrent Neural Network (RNN) to develop prediction model between Nepalese Rupees against three major currencies Euro, Pound Sterling and US dollar. Different ANN architecture models like Feed forward neural network, Simple Recurrent Neural Network (SRNN), Gated Recurrent Unit (GRU) and Long Short Term Memory (LSTM) were used. Input parameters were taken open, low, high and closing prices for each currency. Authors have found that LSTM networks provided better results than SRNN and GRU networks.

    Wuttichow Choengtong et al. [3] has predicted Thai baht using Hidden Markov Models (HMM) with which the prediction model has used four factors like, dollar index, inflation rate, interest rate, and economic growth. The main idea behind this work was a technique by which they can encode four factors into one observation sequence to train the HMM. One of the prediction result data has four factors after decoding. The experiment was done by using the data-by-day from 2002 to 2013 which showed that the technique has the mean percentage error of 0.167% to predict Thai currency exchange. Mercedeh AmirAskari et al. [4] stated that Foreign Exchange market is the largest and most liquid currency market of international financial market. In this paper the authors presented a modified fuzzy relational model for currency exchange rates forecasting. The performance of this model was compared with different approaches including multi-layer perceptrons, radial basis function neural networks and artificial fuzzy interface systems; and all these methods' performances for one-step-ahad predictions were evaluated using real exchange daily rate values of the US Dollar versus Switzerland Franc. R.A. Sarker et al. [5] used Support Vector Machine (SVM) for forecasting forex market and

    demonstrated that it has better performance than other methods, e.g., neural network or ARIMA based model. The necessary for using SVM-based forecasting model is that, the selection of appropriate kernel function and values of free parameters: regularization parameter and loss function. The prediction of six different foreign currency exchange rates against Australian dollar has been performed and analyzed.

    Colin G. Johnson et al. [6] has presented a genetic programming (GP) algorithm that uses equations that express linear and non-linear relationships between the length of directional change (DC) and overshoot (OS) events in a given dataset. The authors evaluated the efficiency of the modified trading strategy on 250 different DC datasets from five different thresholds and five different currency pairs, consisting of intraday data from the foreign exchange (Forex) spot market. The results obtained showed that the algorithm was able to return profitable trading strategies and statistically outperform state-of-the-art financial trading strategies, such as technical analysis, and other DC-based trading strategies. Daijin Kim et al. [7] proposed a genetic fuzzy predictor ensemble (GFPE) for accurate prediction of the future in the chaotic or nonstationary time series. Applications to both the Mackey-Glass chaotic time series and the nonstationary foreign currency exchange rate prediction problem were presented. The prediction accuracy of the proposed method was compared with that of other fuzzy and neural network predictors in terms of the root mean squared error (RMSE).

    Ruhaidah Samsudin et al. [8] proposed in their research work that applies a combination of sentiment-based support vector machine that was optimized by the whale optimization algorithm for predicting the daily price of a digital currency. The model was found robust to be used in other fields of study. Zhao Xu [9] wrote the paper that attempts to exam the relation between FDI and trade export and exchange rate volatility in China by vector autoregressive model and Granger causal test. Hua Zhang et al. [10] proposed in this paper that genetic algorithms were used to generate the most profitable trading strategy based on technical indicators on the foreign exchange market. The trading strategies with neutral position generated by genetic algorithms have an annualized return of 3.7% during test period which is better than the trading strategies without neutral position. Ruoen Ren et al. [11] viewed from the perspective of microstructure of the foreign exchange market, and made a detailed analysis of the order flow which is the core variable of the foreign exchange rate determination. They employed the approaches of co-integration and error correction model to test the relationship between the order flow time series and the foreign exchange rate time series.

    In this paper, Pei-Wei Tsai et at. [12] the Consumer Confidence Index (CCI) has led to be one of the considered factors in foreign exchange rate forecasting. The experimental results that they got indicate that including CCI as one of the considered factors for the foreign exchange rate forecasting with GARCH model that has improved parts of the foreign exchange rate forecasting accuracy. Indri

    Handayani et al.[13] proposed that the traders only use one model for backward price analysis as a tool to predict future price movements. Authors used a literature review research method on Foreign Exchange Technical Analysis in applying this concept. The final result of this study has facilitated traders in carrying out technical analysis in foreign exchange trading. Maheran M. Jaffar et al. [14] proposed that research on foreign exchange trading is a very active part in the field of research. The most important part of the framework of the trading is to predict the foreign exchange trading. Therefore, this paper tried to show the proposed foreign exchange framework. Robert S. Colombo et al. [15] tried to show that critical development these sustainable career capabilities and fluid thinking of learning environments that challenge students to process real-time information, from multiple sources and in a variety of display formats, while coaches help them to seamlessly think across multiple disciplines.

  3. METHODOLOGY

    Foreign currency exchange rate plays an immense role all over the world in many categories. It determines the economic relation between two countries and have impact overall. Its very much important that if we predict the exchange rate for coming time, that should be done precisely as much as possible, if not predicted accurately then a lot of things will be at stake. So, here in this section we have discussed the methodology of our idea on how to get the best possible combinations of features to predict the foreign currency exchange rate precisely as possible.

    1. Data set description:

      The data which is used in our study was recorded from 19.10.2011 and has been taken till 18.06.2021. In the work, we have considered total 28 attributes from the dataset to analyse the variation in order to get fruitful output. The dataset has 2389 rows and 29 columns in total and this dataset is a very recent dataset and pretty decent which contains the values and the variable fluctuations have taken place in the recent past.

    2. Data pre-processing:

      The first most important part of prediction is to pre- process the dataset very well so that in moving forward with the dataset it doesnt create any hindrance in obtaining the desired result. Data preprocessing is one of the most vital approach towards the prediction process. It is used to process the dataset and make it in readable and understandable form. Data preprocessing helps in extraction of important features from the raw data which will give us our desired output. If the dataset is not well processed, then working with the unprocessed dataset will get us erroneous results or maybe it will obtain result which will be not be the desired output.

      As a part of data pre-processing, after careful observing the dataset we found that our dataset did not contain any null values and the data values were in continuous format and not in discrete. Working with continuous value dataset is bit challenging as compared to discrete values as every algorithm doesnt hold for continuous values data. As our dataset was

      about currency exchange rate values, the date plays an important role in that variation. As in the date column, the dates were not uniform and in future working with non- uniform dates the desired output shall not be obtained. So, we have pre-processed the date column and transformed the dates in to integer with respective to 0 days and so on. Hence after transforming the date into integers we observed a pattern of fluctuations in the other attributes which we studied further and worked the idea to get the desired output.

    3. The approaches that we have implemented:

      Our approach towards our work was very much consistent and straight as our aim was to predict the currency exchange rate using the best possible combinations of the features using optimizing and feature selection techniques which will yield optimum results and will significantly show all the variations. In a dataset there are huge no of various attributes and every attributes does not need to hold equal importance in terms of significance. As a result, sometimes accurate prediction cannot be done. So, with the help of feature selection techniques we can work with those attributes which are more significant and can omit those features which are not needed in order to obtain an optimized and accurate output.

      Before approaching with feature selection techniques, we tried to implemented feature reduction techniques. At first, we applied UMAP reduction technique to our dataset in order o reduce the dimensions of our dataset so that we get a compact dataset with more number of useful features. Uniform Manifold Approximation and Projection (UMAP) is a dimension reduction technique basically used for visualizing high dimension data by learning the manifold structures formed from the dataset and finds the low dimensional embedding which preserves the structure of the manifolds. UMAP didnt gave us fruitful result rather it showed error as there was ambiguity due to continuous values in our data. So, then we approached with t-SNE feature reduction technique as after thorough research we found that t-SNE performs better than UMAP in case of reducing dimension. t-SNE is known as t-distributed stochastic neighbour embedding technique which work with the similarities between the data points. t-SNE converts the similarities of data points into joint probabilities to preserve the most of the informations into cluster forms. But the end result which we obtained was not clearly distinguishable in order to predict the exchange rate. Hence we thought of moving onwards with feature selection technique in order to obtain the best possible features combination.

      As feature selection techniques, here in our work we have used polynomial regression and genetic algorithm. To be more specific as selection technique we have used polynomial regression as our dataset contained continuous values data and to optimize further the polynomial regression we have implemented genetic algorithm for achieving the desired output. Genetic algorithm is an adaptive approach based on natural selection. It repeatedly and frequently modifies the result in every phase to find out the best predicted result. Hence genetic algorithm gives the best possible result.

      Fig 1. The Approaches that we have used in our work

    4. Our work:

    The initial part of the work involved data collection and pre-processing, during which the dataset was first collected, and then it was thoroughly analysed. After the data was analysed, we checked for null values, if present then dataset is transformed accordingly. The date column was transformed into integers for better understanding the variations and fluctuations of all the attributes in order to obtain the desired output. After the pre-processing is done, splitting of the dataset into training and testing dataset is done. The dataset was splitted into 9:1 ratio in which 90 percent of the dataset was taken as training dataset and rest 10 percent is used for testing purpose.

    Polynomial regression was implemented on the pre- processed dataset as the second step of our work. The main motive behind implementing polynomial regression is to know which features or attributes of the dataset holds most significance. As a result of which it was observed that the date column holds the most significance in terms of predicting the exchange rate. And in the other hand, we found some attributes not so significant. So, some parts of the data were omitted due to their irrelevance and owing to the fact that they have no such significant impact on the target objective of the work. To check the accuracy of the polynomial regression we have used mean absolute error as model evolution metric and the result which was obtained was pretty descent but it was not the desired output which we wanted.

    So, in order to obtain much more accurate prediction result we have applied Genetic Algorithm in our dataset. Before applying the algorithm, we proposed the fitness function which will be fed to the genetic algorithm. In the fitness function, we have taken a solution array which will deliver us the best solution set from each number of generations set obtained. We designed the solution array in such a way that which of the features will be selected for parents mating those features will be assigned 1 and other features will be assigned

    0. Then we have applied the polynomial regression and the

    score was calculated and the inverse of the score is returned as fitness from the function.

    Fig 2. Workflow Diagram

    After that we called the genetic algorithm by incorporating the fitness function implemented by us. We have implemented 1000 generations for our genetic algorithm work with the number of parents mating be 20 and the number of solution per population as 50. With these combinations of the parameters of genetic algorithm, we obtained the best solution set for prediction the exchange rate more precisely as these possible combinations have given the least error.

  4. RESULT AND DISCUSSION

    It was really a challenging task to find the optimum number of attributes which will hold the key in our endeavour of finding the best predicted rates with the least error and highest accuracy. As we had initially tried and tested with linear regression, we had seen there was a huge margin of error, but at the same time there was a hope of getting better results with the help of finer techniques which will prove to be efficient. After which using of polynomial regression, and with the implementation of genetic algorithm, we received results, which are having marginal errors. When compared to Umap and other previously mentioned techniques, the genetic algorithm has proved to be effective in the process of predicting exchange rates.

    Fig 3. The obtained score from Polynomial Regression

    Fig 4. The significant macros are generated

    Considering that we were dealing with several macros, which usually otherwise are not generally considered in the field of predicting exchange rates, will now prove to be significant. Dates are one of those macros which undoubtedly has a signification, when prediction rates are considered. Through our work, we have observed that the exchange rates often have a periodic nature, which is evident if observed keenly.

  5. CONCLUSION

As we have seen earlier in our work that there are some marginal errors, which have to be trailed off as a part of future scope. It will not only help in better predicting the exchange rates, but also will be a boon for the economists, and the world at large. Our work at present dealing with some macros, out of which some have been found as optimum ones according to our system, but there are chances, that there can be many such avenues, such fields which are yet to be explored.

We have failed to implement U-Map here for our work, along with other some techniques, but it is possible that there are certain newer methods which can prove to be more effective as exchange field is a vast world in it itself. It is a huge area to explore at its best as the exchange market have lots of things within itself and if it is used properly the economists, the traders will see a huge peak in their market and a different definition will be created of the market. So, there is a lot of miles to walk from here, and predict the exchange rates with better and more significant methods.

REFERENCES

[1] Aggarwal and A. K. Sahani, "Comparison of Neural Networks for Foreign Exchange Rate Prediction," 2020 IEEE 15th International Conference on Industrial and Information Systems (ICIIS), 2020, pp. 415-419, doi: 10.1109/ICIIS51140.2020.9342733.

[2] S. Ranjit, S. Shrestha, S. Subedi and S. Shakya, "Comparison of algorithms in Foreign Exchange Rate Prediction," 2018 IEEE 3rd International Conference on Computing, Communication and Security (ICCCS), 2018, pp. 9-13, doi: 10.1109/CCCS.2018.8586826.

[3] S. Nootyaskool and W. Choengtong, "Hidden Markov Models predict foreign exchange rate," 2014 14th International Symposium on Communications and Information Technologies (ISCIT), 2014, pp. 99- 101, doi: 10.1109/ISCIT.2014.7011878.

[4] M. AmirAskari and M. B. Menhaj, "A modified fuzzy relational model approach to prediction of Foreign Exchange rates," 2016 4th International Conference on Control, Instrumentation, and Automation (ICCIA), 2016, pp. 457-461, doi: 10.1109/ICCIAutom.2016.7483206.

[5] J. Kamruzzaman, R. A. Sarker and I. Ahmad,"SVM based models for predicting foreign currency exchange rates," Third IEEE International Conference on Data Mining, 2003, pp. 557-560, doi: 10.1109/ICDM.2003.1250976.

[6] A. Adegboye, M. Kampouridis and C. G. Johnson, "Regression genetic programming for estimating trend end in foreign exchange market," 2017 IEEE Symposium Series on Computational Intelligence (SSCI), 2017, pp. 1-8, doi: 10.1109/SSCI.2017.8280833.

[7] Daijin Kim and Chulhyun Kim, "Forecasting time series with genetic fuzzy predictor ensemble," in IEEE Transactions on Fuzzy Systems, vol. 5, no. 4, pp. 523-535, Nov. 1997, doi: 10.1109/91.649903.

[8] N. A. Hitam, A. R. Ismail, R. Samsudin and O. Ameerbakhsh, "The Influence of Sentiments in Digital Currency Prediction Using Hybrid Sentiment-based Support Vector Machine with Whale Optimization Algorithm (SVMWOA)," 2021 International Congress of Advanced Technology and Engineering (ICOTEN), 2021, pp. 1-7, doi: 10.1109/ICOTEN52080.2021.9493454.

[9] Z. Xu, "Analysis on the Dynamic Causality Relationships among FDI, Foreign Trade and Exchange Rate Volatility," 2013 Third International Conference on Intelligent System Design and Engineering Applications, 2013, pp. 354-357, doi: 10.1109/ISDEA.2012.88.

[10] H. Zhang and R. Ren, "High Frequency Foreign Exchange Trading Strategies Based on Genetic Algorithms," 2010 Second International Conference on Networks Security, Wireless Communications and Trusted Computing, 2010, pp. 426-429, doi: 10.1109/NSWCTC.2010.234.

[11] Y. Xiao and R. Ren, "An Empirical Study of Three Rounds Trading Model of Foreign Exchange Market," 2010 Third International Conference on Business Intelligence and Financial Engineering, 2010, pp. 414-417, doi: 10.1109/BIFE.2010.101.

[12] P. -W. Tsai, C. -H. Liu, L. -C. Liao and J. -F. Chang, "Using Consumer Confidence Index in the Foreign Exchange Rate Forecasting," 2015 International Conference on Intelligent Information Hiding and Multimedia Signal Processing (IIH-MSP), 2015, pp. 360-363, doi: 10.1109/IIH-MSP.2015.36.

[13] I. Handayani, U. Rahardja, E. Febriyanto, H. Yulius and Q. Aini, "Longer Time Frame Concept for Foreign Exchange Trading Indicator using Matrix Correlation Technique," 2019 Fourth International Conference on Informatics and Computing (ICIC), 2019, pp. 1-5, doi: 10.1109/ICIC47613.2019.8985709.

[14] M. Mohd Jaffar and Ilham Abadi Bin Idris, "Foreign exchange trading framework based on mudharabah principle," 2011 IEEE Symposium on Business, Engineering and Industrial Applications (ISBEIA), 2011, pp. 141-143, doi: 10.1109/ISBEIA.2011.6088790.

[15] R. S. Colombo and D. F. Colombo, "Foreign currency trading as an inter-disciplinary teaching pathway for STEM initiatives," IEEE 2nd Integrated STEM Education Conference, 2012, pp. 1-4, doi: 10.1109/ISECon.2012.6204165.

Leave a Reply