Skip to content

Predicting forex rates with high accuracy using MCMC with Bayesian structural time-series

License

Notifications You must be signed in to change notification settings

Dorsa-Arezooji/Forex-MCMC

Repository files navigation

Forex-MCMC

Predicting forex rates with high accuracy using MCMC with Bayesian structural time-series

License: CC BY-NC-SA 4.0

Required Libraries

library(bsts)
library(ggplot2)
library(scales)
library(forecast)

Overview

This notebook contains code for log-term prediction of daily forex currency pair rates. However, instructions are included in the notebook for using a dataset with smaller than 24hr candles.

  • You can find the compiled notebook containing all of the results here.

What does it do?

  1. The data is loaded, preprocessed, and split into training and testing automatically.

  2. A number of different models are defined (using the bsts library) to fit the training data and make predictions:

The performance of different models are plotted and compared with each other regarding their fit (in training):

and accuracy (in prediction):

  • The optimal model with the highest accuracy is used on another currency pair to examine its performance.

  1. Finally, the performance of the Bayesian models are compared with that of popular time-series forecasting models such as ARIMA.

  • The Bayesian models outperformed the ARIMA model, yielding a prediction accuracy of 98.3% as apposed to 75.7%.

References

[1] Scott, Steven & Varian, Hal. (2014). Predicting the Present with Bayesian Structural Time Series. Int. J. of Mathematical Modelling and Numerical Optimisation. 5. 4 - 23. 10.1504/IJMMNO.2014.059942.

[2] Scott, Steven. (2020). The "bsts" Package Manual,

About

Predicting forex rates with high accuracy using MCMC with Bayesian structural time-series

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages