Skip to content
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

getDividends throws an error: unable to find the function ".yahooURL" #364

Closed
rpfreitasxyz opened this issue Jun 10, 2022 · 2 comments
Closed
Labels

Comments

@rpfreitasxyz
Copy link

Description

Hello, all! Recently, getDividends() has been unable to find the function ".yahooURL()", throwing this error. Any tips?

Minimal, reproducible example

library(quantmod)
#> Carregando pacotes exigidos: xts
#> Carregando pacotes exigidos: zoo
#> Warning: package 'zoo' was built under R version 4.1.3
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> Carregando pacotes exigidos: TTR
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo

getDividends("PETR3.SA")
#> Error in .yahooURL(Symbol.name, from.posix, to.posix, "1d", "div"): não foi possível encontrar a função ".yahooURL"

Session Info

sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19043)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252   
#> [3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C                      
#> [5] LC_TIME=Portuguese_Brazil.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] quantmod_0.4.20.1 TTR_0.24.3        xts_0.12.1        zoo_1.8-10       
#> 
#> loaded via a namespace (and not attached):
#>  [1] pillar_1.7.0      compiler_4.1.2    highr_0.9         R.methodsS3_1.8.1
#>  [5] R.utils_2.11.0    tools_4.1.2       digest_0.6.29     evaluate_0.15    
#>  [9] lifecycle_1.0.1   tibble_3.1.7      R.cache_0.15.0    lattice_0.20-45  
#> [13] pkgconfig_2.0.3   rlang_1.0.2       reprex_2.0.1      cli_3.3.0        
#> [17] rstudioapi_0.13   curl_4.3.2        yaml_2.3.5        xfun_0.31        
#> [21] fastmap_1.1.0     withr_2.5.0       styler_1.7.0      stringr_1.4.0    
#> [25] knitr_1.39        fs_1.5.2          vctrs_0.4.1       grid_4.1.2       
#> [29] glue_1.6.2        fansi_1.0.3       rmarkdown_2.14    purrr_0.3.4      
#> [33] magrittr_2.0.3    ellipsis_0.3.2    htmltools_0.5.2   utf8_1.2.2       
#> [37] stringi_1.7.6     crayon_1.5.1      R.oo_1.24.0
@joshuaulrich
Copy link
Owner

joshuaulrich commented Jun 10, 2022

Thanks for the report! I'm aware of this and have started working on a fix. This has to do with switching to the JSON endpoint (#362) and removing the CSV endpoint for Yahoo Finance.

@joshuaulrich
Copy link
Owner

Fixed and merged!

@joshuaulrich joshuaulrich added this to the Release 0.4.21 milestone Mar 27, 2023
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jun 12, 2023
### 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants