Exchange Rate Analysis With ARIMA, STL, and Exponential Smoothing
Spendings Analysis And Predictions
This is my personal need: I live in Russia and for an American company, which means I have income in USD and purchase everything in Ruble. Moreover I pay TEXes in Rubles based on my income in USD, which make me feel bad sometime when I pay them according to one rate, but actually exit 20% less.
In my country all the time some bad things happen which directly influence the exchange rate. Mostly I cannot do anything about it, but I can to choose the best strategy for my actions!
What it does
The app analyses two time series: (1) my sendings, (2) USD to RUB exchange rate. Than, based on what we think about the future (how much do I plan to spend the following time period and what is my prediction about the rate) the app recommends me to change money or to wait (in case of waiting it does nothing).
The app does the following:
Exchange rate analysis.
The most basic thing is to analyse time series of exchange rates in order to understand when it’s the best time to change USD to RUB based on our goals and given risks. I have my own simple strategy that I think is easy enough to follow in real life without any math. I’m going to implement it first (calculate the average rate for last 12 months, and start changing if we get closer to this level: the closer we are the more money we change per transaction but not more than some amount per day and up to some cumulative amount of money in RUB on the bank account).
The algorithm above works with the current situation but does not make any assumptions about the future. We can add some weights for the transaction amount based on: (1) needs (future spendings), (2) our thoughts about the future possible exchange rate in a time horizon.
We may make our guesses about the future exchange rate by predicting the rate using ETS, STL, or ARIMA decomposition. Seasons for us would be a week (to find the best day of week) and a month (best month). We will use buy/sell series as well as the central bank rate. Additionally we will use diffs of sell/buy and buy/central bank rate.
If we have some extra time it would be nice to have some risks in the model as a probability (or trust) of our model to happen. Risks’ weights should correct the amount of money that we change per transaction in the current situation.
To set up financial goals and horizons I’m going to use one’s past spendings. It means that the basic goals is to change enough money on the day to day spendings only. The horizon here is what we think about exchange rate (what rate is acceptable for us). In the basic model I want to use “higher than average over last 12 months”. It means we must change enough to survive to the next acceptable exchange rate.
As well as for the exchange rate I’m going to use ETS, STL, or ARIMA methods to analyse and predict spendings. Seasons the same: weekly and monthly.
Challenges I ran into
As usual, a lot of unicode encoding errors. I worked with real data that I've got from my bank one day before the hackathon. It took a few hours just to upload CSV files to the system.
Of course, the most hardest thing is to understand the math models and implement them from scratch.
What I learned
I found interesting some math models to work with time series. And in general: it's almost impossible to predict the USD/RUB exchange rate with good accuracy.
What's next for Money Flow
I defiantly want complete it and post in app markets. For that I need to work on risk strategy, improve some math models, make it user oriented, think about a business model.
I have a lot to do, actually. This is my spec: The Specification.