Session Ready
Exercise

Download exchange rate data from Oanda

Oanda.com provides historical foreign exchange data for many currency pairs. Currency pairs are expressed as two currencies, the "base" and the "quote", separated by a "/". For example, the U.S. Dollar to Euro exchange rate would be "USD/EUR".

Note that getSymbols() will automatically convert "USD/EUR" to a valid name by removing the "/". For example, getSymbols("USD/EUR") would create an object named USDEUR.

Also, Oanda.com only provides 180 days of historical data. getSymbols() will warn and return as much data as possible if you request data from more than 180 days ago. You can use the from and to arguments to set a date range; both should be strings in "%Y-%m-%d" format (e.g. "2016-02-06").

Instructions
100 XP
  • Create an object called currency_pair with the symbols for the British Pound and the Canadian Dollar so we can use this to get British Pound to Canadian Dollar exchange rate data. quantmod::oanda.currencies contains a list of currencies provided by Oanda.com.
  • Use getSymbols() to load data for currency_pair. Remember to specify src!
  • Use str() to examine the data getSymbols() created. Remember, it will remove the /!
  • Try to load data from 190 days ago to today. Remember that Sys.Date() will give you today's date.