Showing posts with label data. Show all posts
Showing posts with label data. Show all posts

Tuesday, November 20, 2012

Source of Forex historical intraday data

As mentioned in the last post, I am trying to find some historical forex intraday data, at least in hours, better in minutes or seconds.

I found a post listing 6 places to download forex historical intraday data. I select the follows as I feel they are  easier to use.

Fxhistoricaldata

Forex intraday data provided by Fxhistoricaldata is available in two different periods (hourly and daily) and for 17 FX pairs.

How to download quotes:

  • - Go to http://www.fxhistoricaldata.com/
  • - Click on one currency pair
  • - Click on "Hourly" to download 1-hour data
  • - Rename the downloaded file by adding the ".zip" extension
  • - Open the zipped file and extract the CSV data

I think, instead of using R to download daily forex data from Oanda, I prefer downloading data and do the analysis seperately. However, one thing I am worred is R's ability to work with big data which is an issue since long time ago -- several problems when R meets big data makes me stay farther from it.... 



Monday, November 19, 2012

Get ForEx data using quantmod R package

The first step of every analysis is getting enough data.

I am interested in the foreign exchange market and curious about the pattern about the exchange rate change; therefore, I try to find some convenient way to obtain the ForEx data.

Thanks to the "quantmod" package recently developed by some kind people, now I can download the forex data at least for some preliminary analysis, if not perfect data I hope to have.

The follows are what I have learnt from an example in the "quantmod" webiste.


# for example, I need to have forex data about USD again CAD price from 2004 to the current 

require(quantmod)


getSymbols("USD/CAD",src="oanda",from="2012-01-01")

forex12 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2011-01-01",to="2011-12-31")
forex11 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2010-01-01",to="2010-12-31")
forex10 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2009-01-01",to="2009-12-31")
forex09 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2008-01-01",to="2008-12-31")
forex08 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2007-01-01",to="2007-12-31")
forex07 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2006-01-01",to="2006-12-31")
forex06 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2005-01-01",to="2005-12-31")
forex05 <- USDCAD
getSymbols("USD/CAD",src="oanda",from="2004-01-01",to="2004-12-31")
forex04 <- USDCAD

forex <-rbind(forex04,forex05,forex06,forex07,forex08,forex09,forex10,forex11,forex12)


# make a rough plot to see the daily change

chartSeries(forex,theme = chartTheme("white"))



This downloading method works well, but I still feel the data is not enough to support some analysis, particular some short term trading strategy, so I really need to figure out if there is any way to have data in 5 mins or hours instead of on a daily average.