The financial departments of large companies often deal with foreign currency transactions while doing international business. As a result, they're always looking for anything that can help them better understand the future direction and risk of various currencies. Hedge funds, too, are keenly interested in anything that will give them a consistent edge in predicting currency movements.
This project tested time-series tools in order to predict future movements in the value of the Japanese yen versus the U.S. dollar.
The following were the list of tasks:
- Time-Series Return Forecasting
- Volatility Forecasting
- Out-of-Sample Predictions
In this section, the project used the Quandl API to obtain daily futures data on the Japanese yen per U.S. dollar exchange rate and used the data to build various time-series models that predict near-term yen returns.
The following were the steps taken:
-
Generated a Quandl API key.
- Used the API key to read historical daily yen futures data into a Pandas DataFrame.
-
Performed a time-series decomposition, using Hodrick-Prescott filter and various moving average (MA) and exponentially weighted moving average (EWMA) smoothers.
-
Estimated a Scikit-Learn time-series regression to identify seasonal effects in the yen.
-
Identified autocorrelation and used that to guide selection for the best fitting autoregressive moving average (ARMA) and autoregressive integrated moving average (ARIMA) models.
In this section, the project used the time-series GARCH (generalized autoregressive conditional heteroskedasticity) or EGARCH (exponential GARCH) models to forecast short-term volatility in the Japanese yen. The following is a list of the steps taken:
-
Estimated either a GARCH or EGARCH model using the arch python package.
-
Identified patterns of clustered and/or high yen volatility.
-
Forecasted three-day volatility of the yen using a GARCH or EGARCH model.
Last, the project applied Scikit-Learn regression model under a testing approach commonly used by data scientists and quantitative traders when dealing specifically with time-series data.
-
Used Pandas datetime indexing to slice the dataset into a training and test set, and compared model performance (root mean square error or RMSE) between the two (a one-shot approach).
-
Created a rolling-out-of sample approach that updates to a new model each week using the most recent data and evaluated performance on data over the following week.
Futures spreads, as opposed to futures contracts, often exhibit more seasonal patterns and are generally easier to predict.
-
Navigated the Quandl website, pulled futures data one-month and two-month continuous Japanese yen futures contracts.
-
Constructed a futures spread, by taking [(2 month contract return) - (1 month contract return * -1)]. This was effectively a bet that the yen will be stronger two months from now than it will be a month from now (regardless of what it is today).
-
Used an ARMA model and the out-of-sample approaches to see if it is possible build a model with a low RMSE.
- Python - Programming language.
- Pandas - Data analysis and manipulation tool.
- Quandl - API used to access econonmic and financial data.
- Roberto Cantu - GitHub