joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
798 stars 219 forks source link

`getSymbols.tiingo` should return a `Date` index #350

Closed ethanbsmith closed 2 years ago

ethanbsmith commented 2 years ago

Description

getSymbols.tiingo currently only return daily sampled date, but the index on the data is POSIXct tm.stamps <- as.POSIXct(stock.data[, "date"], ...)

  1. this is inconsistent with other daily data source, which use a Date data type on the index
  2. using a POSIXct data type on daily data exposes the consumer to time zone issues

Expected behavior

return the index as a Date data type

joshuaulrich commented 2 years ago

Thanks for the report! Let me know what you think of the patch in the commit I just pushed.

ethanbsmith commented 2 years ago

just checked the tiingo docs and they do support those other sampling frequencies. is there a reason to disallow them? would seem to be a potential breaking change. returning a Date index for those periodicities would match how getSymbols.yahoo works

image

rest looks good

joshuaulrich commented 2 years ago

Good find regarding that argument! I didn't (and still couldn't) find that in the documentation. I added that functionality to the patch.

ethanbsmith commented 2 years ago

https://api.tiingo.com/documentation/end-of-day

ethanbsmith commented 2 years ago

scratch that. i need to do some testing

ethanbsmith commented 2 years ago

https://github.com/joshuaulrich/quantmod/commit/71978df0a5b5c69b67f1ff3e4ab1acadd7c77f9c looks good. thx for this!