-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability for getSymbols.yahoo()
to import from JSON endpoint
#362
Comments
There seems to be a rate limit for the number of tickers you can request via the CSV endpoint. The yfinance python library [1] uses the JSON endpoint and doesn't seem to have rate limit issues. [1] https://github.com/ranaroussi/yfinance Closes #362.
Here's an example using the JSON endpoint: quantmod::getSymbols("SPY", use.json.api = TRUE) @msperlin has an example that pulls 10 years of S&P 500 stocks using 14 cores without hitting a rate limit: #360 (comment) |
Hi Josh, No problem downloading data (no limitations downloading last 6 years of daily stocks price) but I have a problem maybe is my fault, when I tried to save the xts object using your code, it saves the character not the xts object.
So, temp = "GOO" which is the latest value but not the xts object with "GOO" stock data. any idea why this behavior?
Thanks in advance P.D.: Congratulations for the huge job you do. |
### Changes in 0.4.22 (2023-04-05) 1. Move jsonlite from Suggests to Imports so it doesn't cause a problem when a package that doesn't also Suggest jsonlite uses getSymbols(). Thanks to Kurt Hornik for the report and fix! [#380](joshuaulrich/quantmod#380) ### Changes in 0.4.21 (2023-03-29) 1. Fix S3 method issues. R-devel (83995-ish) added a check for possible S3 method issues. Register methods it found that were not registered: `str.replot()`, `seriesHi.timeSeries()`, and `seriesLo.timeSeries()`. It was also confused by `range.bars()` and `unique.formula.names()`. Remove `unique.formula.names()` because it wasn't exported or used internally. Rename `range.bars()` to `rangeBars()`, which isn't exported. Thanks to Kurt Hornik for the report! [#375](joshuaulrich/quantmod#375) 1. Remove "^" prefix from `getSymbols()` return value. When the 'Symbols' argument has a "^" prefix and `auto.assign = TRUE`: * `getSymbols()` removes the "^" from the object it creates, but * returns the 'Symbols' argument unchanged, and * removes the "^" from the column names of the object it creates. The example below will create an object named `IXIC` but the value of `sym` will be "^IXIC". sym <- getSymbols("^IXIC") That means `x <- get(sym)` will not work because an object named `^IXIC` doesn't exist. [#371](joshuaulrich/quantmod#371) 1. Add 'from' and 'to' arguments to `getSymbols.FRED()`. Users expect to be able to set the 'from' and 'to' arguments for FRED data like they can for Yahoo data. Those values were ignored and the entire series was always returned. [#368](joshuaulrich/quantmod#368) 1. Change interval to 1d for `getDividends()` and `getSplits()`. The "3mo" setting caused some dividends to be missing for companies that issued monthly dividends. Note that the response to this request also includes all the OHLCV data. But it's small (less than 1MB for 60+ years of daily data). [#372](joshuaulrich/quantmod#372) 1. Handle errors in `getSplits()` and `getDividends()`. `getDividends()` didn't handle cases where the download failed, or when dividends needed to be split-adjusted but there were no splits. It also tried to set colnames on the empty xts object that's returned when there are no dividends. `getSplits()` had the same colnames issue. Check for no splits by testing for `NULL` because that's more explicit. Thanks to Chris Cheung for the report! [#366](joshuaulrich/quantmod#366) 1. Export `HL()`, `is.HL()`, and `has.HL()` functions and add documentation. These were added in 0.4.18 but not exported or included in the documentation. 1. Use Yahoo Finance v8 JSON endpoint and remove the v7 CSV endpoint. There seems to be a rate limit for the number of tickers you can request via the CSV endpoint. The [yfinance python library](https://github.com/ranaroussi/yfinance) uses the JSON endpoint and doesn't seem to have rate limit issues. [#360](joshuaulrich/quantmod#360) [#362](joshuaulrich/quantmod#362) [#364](joshuaulrich/quantmod#364)
There seems to be a rate limit for the number of tickers you can request via the CSV endpoint. The yfinance python library uses the JSON endpoint and doesn't seem to have this rate limit (cf #358 (comment)).
Try to use the other endpoint when there's an error from the current endpoint.
Here's an example that uses the JSON endpoint:
The text was updated successfully, but these errors were encountered: