[R-sig-finance] Is oanda.com data trustworthy?
Ajay Narottam Shah
ajayshah at mayin.org
Sat Nov 12 15:51:31 CET 2005
> But as you know, FX markets operate 24hrs, and are broker-based implying that
> there will be a) different quotes throughout the day and no "final" one and
> b) different sources may well disagree about quotes at one point [ though
> arguably not by the margin you show there ]. Oanda may report London fixings
> whereas the US Fed probably calls up US banks and end-of-day US time.
I was aware of the 24hour issue. I thought it may lead to some clear
leads and lags. Read on.
> As for the question above, maybe time to test some Granger causality between
> Oanda and the FED sources. :-)
> usfed <- mydb("currency", "EUR/USD", firstdate="2002-01-01",
lastdate="2004-12-31")
> oanda <- window(read.zoo("EUR", skip=1), start=as.Date("2002-01-01"),
end=as.Date("2004-12-31"))
> prices <- cbind(usfed, oanda, all=FALSE)
> plot.zoo(prices, plot.type="single", col=c("blue", "yellow"), lwd=2)
# Visually looks okay.
> returns <- prices2returns(prices)
>
> summary(returns)
Index usfed oanda
Min. :2002-01-03 Min. :-1.82563 Min. :-1.80702
1st Qu.:2002-09-26 1st Qu.:-0.46976 1st Qu.:-0.42765
Median :2003-07-01 Median :-0.04195 Median :-0.05355
Mean :2003-07-02 Mean :-0.03983 Mean :-0.05427
3rd Qu.:2004-04-06 3rd Qu.: 0.31539 3rd Qu.: 0.30200
Max. :2004-12-31 Max. : 2.11408 Max. : 1.98718
# Looks plausible.
> returns <- as.data.frame(returns)
>
> plot(returns$oanda, returns$usfed)
It looks like a zero correlation!!!!!!!!!!!!
> summary(lm(usfed ~ oanda, returns))
Call:
lm(formula = usfed ~ oanda, data = returns)
Residuals:
Min 1Q Median 3Q Max
-1.78081 -0.42691 0.01766 0.36543 2.10784
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.03637 0.02563 -1.419 0.156
oanda 0.06373 0.04205 1.516 0.130
Residual standard error: 0.6191 on 586 degrees of freedom
Multiple R-Squared: 0.003904, Adjusted R-squared: 0.002204
F-statistic: 2.297 on 1 and 586 DF, p-value: 0.1302
> cor(returns)
usfed oanda
usfed 1.00000000 0.06248328
oanda 0.06248328 1.00000000
This is truly scary - a returns correlation of 0.06 between two
measures of returns!
> library(lmtest)
> grangertest(returns$usfed ~ returns$oanda, order=5)
Granger causality test
Model 1: returns$usfed ~ Lags(returns$usfed, 1:5) + Lags(returns$oanda, 1:5)
Model 2: returns$usfed ~ Lags(returns$usfed, 1:5)
Res.Df Df F Pr(>F)
1 572
2 577 5 1.2864 0.2681
> grangertest(returns$oanda ~ returns$usfed, order=5)
Granger causality test
Model 1: returns$oanda ~ Lags(returns$oanda, 1:5) + Lags(returns$usfed, 1:5)
Model 2: returns$oanda ~ Lags(returns$oanda, 1:5)
Res.Df Df F Pr(>F)
1 572
2 577 5 59.686 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
So there IS something going on! Could be a time of day story?
Here are a few days of returns, to help fix the intuition:
> tail(returns, 10)
usfed oanda
2004-12-16 1.06300992 -0.76106917
2004-12-17 -0.06020826 1.18581098
2004-12-21 0.14203074 -0.42746525
2004-12-22 -0.09716418 0.12040941
2004-12-23 -0.75145123 -0.12040941
2004-12-24 -0.33297193 -0.91447652
2004-12-28 0.02928946 -0.58364604
2004-12-29 0.38988948 0.05443658
2004-12-30 -0.40446502 0.04080800
2004-12-31 0.62592084 -0.29964610
So there does seem to be a pattern where information for 2004-12-16
with the US Fed (1.06%) seems to show up on the next day for oanda
(1.18%).
If I lag the US Fed data by 1, the correlation goes up to 0.57. I
think this is a useful discovery :-) but .57 still sux!
--
Ajay Shah
ajayshah at mayin.org
http://www.mayin.org/ajayshah
More information about the R-sig-finance
mailing list