Manuel Cazares
2015-02-22
At present time the mexican peso has been on the rise after the U.S. Federal Reserve offered a strong signal that it was on track to raise interest rates in 2015. Also there are several factors that are making the mexican peso weak, this factors are the following More Info:
To track the USD/MXN exchange rate we connect to a Exchange Rate Web Service, then we created a function to do the automatic conversion with real time data from the Web Service.
library(rjson)
myConverter <- function(valueToConvert){
url <- "http://rate-exchange.appspot.com/currency?from=USD&to=MXN"
result <- fromJSON(file=url, method='C')
myResult <- result$rate * valueToConvert
return(myResult)
}
print(myConverter(1))
[1] 14.9872
In order to track historical data we used the Quandl Web Service. More Info.
library(Quandl)
data <- Quandl("CURRFX/USDMXN", trim_date="2014-02-20", end_date="2015-02-20", authcode="API-KEY")
Exchange1 <- data[order(-1:-413), ]
plot(Exchange1$Rate, type="l", main="1 USD = MXN, Exchange Rate", xlab="Days", ylab="MXN")
Example Data Range: 2014-02-20 / 2015-02-20.