Open nilshg opened 3 years ago
While general solution is not yet ready, there is a one-liner which at least makes it smaller.
tickers = ["SPY", "AGG", "IEI"]
vcat(((df[!, :ticker] .= tickers[i]; df) for (i, df) in pairs(DataFrame.(yahoo.(tickers))))...)
I suppose problem with TimeArray
is that ticker name can be written only as metadata. But metadata is something generic so it's not quite clear how to transform it to DataFrame
in general case.
well, TimeArray
cannot have different type in single column, since the underlying implementation is Matrix
. Although one can build an instance of TimeArray{Union{Float64, String}, ...}
, that breaks almost all operations on it.
Adding ticker to metadata
field is similar to zip
a variable with TimeArray
, so there isn't an easy way to add the ticker in TimeArray
table at this moment.
I think the code snippets can be added to document and make a quick lookup sheet.
By the way, I think that if #71 is resolved, then one can extend sink with this sort of metadata. Then the resulting user code is just
vcat(DataFrame.(yahoo.(tickers))...)
yeah, with the additional kwarg supported
(Let me re-read that issue again :p)
Was there progress on this issue (multiple tickers in one call)? Looking to integrate this package with TSx.
Also, the metadata can be stored in TSx in the future because DataFrames.jl now supports storing metadata.
Well, I still believe that approach proposed in https://github.com/JuliaQuant/MarketData.jl/issues/71 (with proposed https://github.com/Arkoniak/ProtoMarketData.jl approach) is still the best solution to this kind of problems. As far as I remember it worked fine as a prototype, but for some reasons it was not included as a part of JuliaQuant. Probably it's because of type piracy in aforementioned package.
I often find myself doing something like
Could something like this (this might not be the best way of doing it of course, just a quick hack) be implemented as a
yahoo(tickers::Vector{Union{String, Symbol}})
method?If not (and this could be a separate issue but I thought it would be a bit small) could we have a
add_ticker
kwarg that includes the ticker in theTimeArray
that's being returned?