Closed ethanbsmith closed 2 years ago
@ethanbsmith Let me know what you think of the branch I just pushed... I'll merge if it looks good to you.
@joshuaulrich is the intent for this library to sit on top of existing quantmod
as is or to replace it? I would have though t it easier to just remove the prefixing code from getSymbols.xxx
. or is this just to prove out the ideas before working on actual code?
We will not be making any breaking changes to quantmod. This package is a place where we can make all the changes we would like to make, but in a way that won't impact any existing code.
I intend to eventually remove the dependency on quantmod, but continue to use quantmod for the foreseeable future. Then we can focus on the new ideas instead of simply re-writing working code.
don't think the existing regex will work for symbols with a "." eg: BRK.A, ZEV.W, etc
dont we have the actual symbol at this point in the code as that gets passed to getSymbols
. maybe something like gsub(paste0("^", Symbol, "\\."), "", colnames())
would be more robust?
another option would be to add a new symbol.prefix=TRUE
parameter to the existing getSymbols
implementations that controls the prefixing functionality
I just pushed a commit that accounts for the issue you brought up. I added a test case for the case you pointed out. Thanks for catching it!
Let me know if this looks good to you and I'll merge.
I decided to stick with the current approach, even though it uses mind-bending regex. It should work for nearly anything. I'm open to trying to simplifying it once we've used this more and built more test cases.
a simple xts containing a OHLCVA returned from import_ohlc/getSymbols shodu not have the Symbol as part of the column names
TTR
functions . eg:SMA(SPY$Close, 10)
could returnCloseSMA10
as a column name