Closed eddelbuettel closed 4 years ago
Agreed. I already include convert_to_local_time()
because I was unsure of what the best thing to do here was, but can default to local time. I can make the resolution dependent on the resample_frequency
and return Date
when appropriate rather than POSIXct
Also omitting the pennies when the only difference is in pennies is ... not good. These are prices (and OHLC aren't even computed aggregates). Can we not always show two digits?
Also not how my options(digits.secs=6)
creeps in and messes up the column alignment, but I guess that may be a tibble issue.
Re digits.secs) Yes ive reported that https://github.com/r-lib/pillar/issues/102
Re pennies) Another pillar issue. Aggressive truncation. Try) options(pillar.sigfig = 6)
sigfig=6 may still fail on high priced stocks.But I guess this is a new bug :-/
R> res <- riingo_iex_latest("BRK.A")
Error: lexical error: invalid char in json text.
<h1>Not Found</h1><p>The reques
(right here) ------^
R>
Also affects ringo_latest
.
Frustrating. I can catch riingo_iex_latest("abcde")
because it returns actual JSON. riingo_iex_latest("BRK.A")
returns HTML which gets converted into an xml_document
Hi all,
Thanks for the great work @DavisVaughan
The reason for the URL handling is that we do not use "." in our ticker methodology. Let me talk to my team and see if we can implement a better JSON-encoded 404 for when "." are used. This should make it consistent. Thank you for the catch.
Thanks @tiingo for the great support.
In the mean time, the dev version catches it with a slightly more informative error:
> riingo::riingo_iex_latest("BRK.A")
Error: The ticker name, BRK.A, is invalid or data is currently not available. Check ticker validity with is_supported_ticker().
Tiingo msg) <h1>Not Found</h1><p>The requested URL /iex/BRK.A/prices was not found on this server.</p>
Which is still somewhat frustrating because:
> is_supported_ticker("BRK.A", "iex")
[1] TRUE
IEX supported tickers data come from: https://iextrading.com/api/mobile/refdata
@DavisVaughan We are able to return a JSON error message on a 404 with a ticker with a ".".
For "is_supported_ticker" would you be open to querying a Tiingo endpoint to see if the ticker is available?
Holding off pushing the API change for the 404 error depending on your answer to is_supported_ticker
@tiingo Yea that'd be great
You should now see a consistent error message if the ticker contains a "."
E.g. https://api.tiingo.com/tiingo/daily/brk.a/prices?startDate=2017-1-1
Additionally, you can use the meta endpoint to see if a ticker exists, which is simply: https://api.tiingo.com/tiingo/daily/brk.a
Let me know if this works @DavisVaughan
Thanks all
But ... BRK.A is a valid symbol and known / traded on IEX rfom what I can tell.
@eddelbuettel We use "-" instead of "."
e.g. https://api.tiingo.com/tiingo/daily/brk-b/prices?startDate=2017-1-1 or https://api.tiingo.com/iex/brk-b/prices?startDate=2018-04-16&resampleFreq=5min
The time should be aware of localtime, and the resolution is simply not useful for pricing data.