Open joshuaulrich opened 1 year ago
this will return different types based on the length of the output (list vs xts) would be nice to be able to have it always return a list, regardless of length
So getSymbols("SPY", auto.assign = FALSE)
would return a list? That would break backward compatibility. Maybe leave getSymbols
as-is and create an importSymbols()
function that always returns a list?
just thinking out loud:
ideally, getSymbols
would always return a list and getSymbol
(singular) would wrap that with an unlist()
, and auto.assign and env would get deprecated. if thats an agreed target state, (prolly a big if) whats the best interim approach?
get_Symbol
/get_Symbols
that implement new pattern. maybe turn existing getSymbols
into a wrapperauto.assign
to take T,F,"list". very uglyauto.assign == FALSE
, and implement new getSymbol()
wrapper. def breaks back-compat, but slightly less uglysimplify = TRUE
, that controls whether to unlist()
a single return value, when auto.assign == FALSE
. doesn't break back-compat, but does add complexity to argument interaction and overall "intuitiveness" of the APIi'd prolly vote for something like 1 or 4
Thanks for your thoughts. Making getSymbols()
always return a list would break a lot of code, so that's not an option.
I prefer (1) and I like the idea of a get_symbol()
function that only works for a single symbol.
getSymbols()
currently errors if you specifyauto.assign = FALSE
with more than one symbol.Instead of throwing an error, we can return a named list of xts objects. This will make it easier to avoid the side-effect of assigning to the calling environment without breaking any backward compatibility.