JuliaQuant / FinancialBlotter.jl

Trade and Portfolio Accounting in Julia
Other
13 stars 12 forks source link

Yahoo ignores from dates and defaults to first record #7

Closed milktrader closed 11 years ago

milktrader commented 11 years ago

After some debugging it appears the issue with with Yahoo. The c field is for the from year value, but it's ignored.

julia> head(yahoo("GLD", 22,22,22,  1,21,2006, "d"))
6x7 DataFrame:
              Date  Open  High   Low Close      Vol   Adj
[1,]    2004-11-18 44.43 44.49 44.07 44.38  5991500 44.38
[2,]    2004-11-19 44.49 44.92 44.47 44.78 11655300 44.78
[3,]    2004-11-22 44.75 44.97 44.74 44.95 11996000 44.95
[4,]    2004-11-23 44.88 44.92 44.72 44.75  3169200 44.75
[5,]    2004-11-24 44.93 45.05 44.79 45.05  6105100 45.05
[6,]    2004-11-26 45.25  45.6 45.06 45.29  3097700 45.29
milktrader commented 11 years ago

I should have checked this first, but this confirms that it's not the Yahoo api but the yahoo function that is bugged.

> getSymbols("GLD", from="2010-01-01")
    As of 0.4-0, ‘getSymbols’ uses env=parent.frame() by default.
 This behavior will be phased out in 0.5-0 when the call will check
 getOptions("getSymbols")$env for default value. If NULL, auto.assign will
 be set to FALSE.  This message is only shown once per session.
[1] "GLD"
> head(GLD)
           GLD.Open GLD.High GLD.Low GLD.Close GLD.Volume GLD.Adjusted
2010-01-04   109.82   110.14  109.31    109.80   16224100       109.80
2010-01-05   109.88   110.39  109.26    109.70   14213100       109.70
2010-01-06   110.71   111.77  110.41    111.51   24981900       111.51
2010-01-07   111.07   111.29  110.62    110.82   13609800       110.82
2010-01-08   111.52   111.58  110.26    111.37   15894600       111.37
2010-01-11   113.34   113.59  112.52    112.85   17253000       112.85
milktrader commented 11 years ago

The api was defaulting to the first record because it was getting a bogus value for month.