This is an interesting take away example from the class
which Anand is teaching at
NIAS.
Here we are trying to correlate between the INR values of various
currencies like AUD, CNY (Chinese Yen), EUR, GBP (Great Britain
Pound), JPY, SGD, USD and find the positive or negative
correlations. The focus is on data collection and transformation.
The first part is the identification of a proper source to get the
data. oanda.com is one such source
from which historic currency exchange rates can be obtained.
The next part is the development of an automated/easy way of obtaining
the data from the site, suitable for transformation. With some
help from develpment tools in the browser the url of the
download link can be found.
It looks something like
The next is the transformation part, the downloaded csv files
contains data that are not required for further analysis that
should be filtered to get the required data. In this case we have
to filter the first 5 lines, that is done by using
We also combine the data and make a single csv file containing data of all currencies
for easy consumption, this can be done using
The complete code for the steps so far
The next step is the visualization, The choice of tools for
visualization is left open, I prefer clojure with incanter.
Here is the clojure snippet
load the data
It can be found that it is difficult to compare data on different
scales, normalization helps us in this case (data-mean/mean)
and the plot is updated to show the normalized data
the complete code
<script src="https://gist.github.com/3638650.js?file=data2_url.sh"></script>
<br/>
Here we can find that SGD is the currency that is being used, with
little exprimentation it can be found that we can download data
for other currencies by altering this URL (example - replace SGD
with JPY for downloading data for Japanese yen)
tail -n +6
,
which prints starting from the 6th line and we have to also filter
the last 4 lines and this is done by using head -n -4
, which
prints all lines but the last 4 lines.
paste AUD.csv CNY.csv EUR.csv GBP.csv JPY.csv SGD.csv USD.csv |sed
’s/\t/,/g’>alldata.csv
plot it
Here is a function to normalize data
No comment