JuliaQuant / FinancialBlotter.jl

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

read_asset is broke on FRED test data #3

Closed milktrader closed 11 years ago

milktrader commented 11 years ago

julia> filename = Pkg.dir("TradingInstrument", "test", "data", "DGS10.csv");

julia> foo = read_asset(filename);

julia> head(foo)
6x3 DataFrame:
                DATE  VALUE       Date
[1,]    "2013-02-12" "2.02" 2013-02-12
[2,]    "2013-02-11" "1.99" 2013-02-11
[3,]    "2013-02-08" "1.99" 2013-02-08
[4,]    "2013-02-07" "1.99" 2013-02-07
[5,]    "2013-02-06" "2.00" 2013-02-06
[6,]    "2013-02-05" "2.04" 2013-02-05
milktrader commented 11 years ago

A couple things. First there are missing values in the DGS10 data ...

julia> foo[34:38,:]                                                                                                                                                 
5x3 DataFrame:               
                DATE  VALUE       Date
[1,]    "2012-12-27" "1.74" 2012-12-27
[2,]    "2012-12-26" "1.77" 2012-12-26
[3,]    "2012-12-25"    "." 2012-12-25
[4,]    "2012-12-24" "1.79" 2012-12-24
[5,]    "2012-12-21" "1.77" 2012-12-21

This is corrected in the read_fred function through a tortured hack but not accounted for in this general function.

Second, since the first column isn't named "Date" but instead "DATE", there isn't a replacement with the time conversion code.

Probably snip the first row header like in the read_yahoo and read_fred functions and then replace good names

milktrader commented 11 years ago

fixed with e528f1e7e9a4e37ccba0442c0ad693ddcd0cdb74

milktrader commented 11 years ago
julia> head(read_asset(Pkg.dir("TradingInstrument", "test", "data", "spx.csv")))
6x7 DataFrame:
              Date  Open  High   Low Close   Volume Adj Close
[1,]    1970-01-02 92.06 93.54 91.79  93.0  8050000      93.0
[2,]    1970-01-05  93.0 94.25 92.53 93.46 11490000     93.46
[3,]    1970-01-06 93.46 93.81 92.13 92.82 11460000     92.82
[4,]    1970-01-07 92.82 93.38 91.93 92.63 10010000     92.63
[5,]    1970-01-08 92.63 93.47 91.99 92.68 10670000     92.68
[6,]    1970-01-09 92.68 93.25 91.82  92.4  9380000      92.4

julia> head(read_asset(Pkg.dir("TradingInstrument", "test", "data", "DGS10.csv")))
6x2 DataFrame:
              Date VALUE
[1,]    1962-01-02  4.06
[2,]    1962-01-03  4.03
[3,]    1962-01-04  3.99
[4,]    1962-01-05  4.02
[5,]    1962-01-08  4.03
[6,]    1962-01-09  4.05