I am using R to analyse stock data, using the quantmod package to get all sorts of data, but here specifically FX data using the function getFX(). This uses the Oanda database as its source.

This works great, however it returns weekend values - i.e. values for days on which no trading takes place. These values must therefore have somehow been exptrapolated, for example by taking the average over the surrounding period, using a spline...

This is the problem, I can't find out how it is done on the website nor in the quantmod documentation. I can actually just use the Quandl package to get around this, but I would like to know what I am avoiding or potentially missing out on.

I say that I may be missing out on something here because I may myself need to deal with data imputation, filling in the weekends, so if Oanda has done something half-sensible, I could just swipe there gap-filling skills. Just to make it super clear, compare the two outputs below, first from Quandl {package: Quandl} and then from Oanda {package: quantmod}. Notice the dates and the 'filled values' **

> head(x, n=10)
               Rate High (est) Low (est)
2013-01-14 0.749652    0.75838   0.74102
2013-01-15 0.748650    0.75799   0.73942
2013-01-16 0.751178    0.76022   0.74225
2013-01-17 0.751165    0.00000   0.00000
2013-01-18 0.749440    0.75843   0.74056
2013-01-21 0.750220    0.75880   0.74174
2013-01-22 0.750742    0.75993   0.74167
2013-01-23 0.750851    0.75944   0.74236
2013-01-24 0.750387    0.00000   0.00000
2013-01-25 0.747175    0.00000   0.00000

> head(y, n=10)
2013-01-14  0.7480
2013-01-15  0.7490
2013-01-16  0.7524
2013-01-17  0.7504
2013-01-18  0.7489
2013-01-19  0.7508 ** Saturday
2013-01-20  0.7508 ** Sunday
2013-01-21  0.7510
2013-01-22  0.7506
2013-01-23  0.7510

--> I would have added more links to documentation etc., but I can only add two with my current rep:

www dot quandl dot com/help/r


Your premise that there should be no data is incorrect. The foreign exchange market is an over-the-counter market, so there is no official definition of a trading day and the market never officially closes. The fact that you see some data on weekends is because OANDA never stops collecting data. There is nothing to prevent any of the parties who report trades to OANDA from trading on weekends or holidays.

  • $\begingroup$ Ok, that is interesting. I noticed that the two values given for weekends were identical, which makes me think they are still averaged in some way. Or is it simply the fact that the trading volume drops dramatically as all major banks and institutions are closed? $\endgroup$
    – n1k31t4
    Dec 2 '15 at 5:22
  • $\begingroup$ @DexterMorgan: The latter. Look at all weekends. Sometimes the values are not identical. $\endgroup$ Dec 2 '15 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.