rsquaredacademy / yahoofinancer Goto Github PK
View Code? Open in Web Editor NEWObtain historical and near real time data from Yahoo Finance
Home Page: https://yahoofinancer.rsquaredacademy.com
License: Other
Obtain historical and near real time data from Yahoo Finance
Home Page: https://yahoofinancer.rsquaredacademy.com
License: Other
First release:
usethis::use_cran_comments()
Title:
and Description:
@return
and @examples
Authors@R:
includes a copyright holder (role 'cph')Prepare for release:
git pull
devtools::build_readme()
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
rhub::check_for_cran()
git push
Submit to CRAN:
usethis::use_version('minor')
devtools::submit_cran()
Wait for CRAN...
git push
usethis::use_github_release()
usethis::use_dev_version()
git push
* checking tests ... ERROR
Running 'testthat.R'
Running the tests in 'tests/testthat.R' failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # *
https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(yahoofinancer)
>
> test_check("yahoofinancer")
Error in `FUN()`:
! In path:
"D:\\library-devel\\yahoofinancer.Rcheck\\tests\\testthat\\setup.R"
Caused by error in `library()`:
! there is no package called 'httptest'
Backtrace:
▆
1. ├─testthat::test_check("yahoofinancer")
2. │ └─testthat::test_dir(...)
3. │ └─testthat:::test_files(...)
4. │ └─testthat:::test_files_serial(...)
5. │ └─testthat:::test_files_setup_state(...)
6. │ └─testthat::source_test_setup(".", env)
7. │ └─testthat::source_dir(path, "^setup.*\\.[rR]$", env
= env, wrap = FALSE)
8. │ └─base::lapply(...)
9. │ └─testthat (local) FUN(X[[i]], ...)
10. │ └─testthat::source_file(path, env = env, chdir
= chdir, wrap = wrap)
11. │ ├─base::withCallingHandlers(...)
12. │ └─base::eval(exprs, env)
13. │ └─base::eval(exprs, env)
14. │ └─base::library(httptest) at
D:\library-devel\yahoofinancer.Rcheck\tests\testthat\setup.R:1:1
15. │
└─base::stop(packageNotFoundError(package, lib.loc, sys.call()))
16. └─testthat (local) `<fn>`(`<pckgNtFE>`)
17. └─rlang::abort(...)
Execution halted
I am trying to retrieve some fields in yahoofinancier that should be available according to the documentation: https://www.r-bloggers.com/2022/11/introducing-yahoofinancer/
When I run the script below it returns values for high, low, volume, forward PE, 50 day average, and 200 day average
But it returns NULL values for beta, averageVolume, averageVolume10days
Can someone advise why these values return as NULL?
Thank you!
#-----------------sample script
#load the library
library(yahoofinancer)
#----------------------------------------
tickerSymbol <- 'aapl'
startDate <- '2023-11-01'
endDate <- '2023-12-21'
interval <- '1d'
#---------------------------------------
ticker <- Ticker$new(tickerSymbol)
df <- ticker$get_history(start = startDate, end = endDate, interval = interval)
df <- data.frame(df)
fwdPE <- ticker$quote$forwardPE
avgVol <- ticker$quote$averageVolume
avg10dVol <- ticker$quote$averageVolume10days
avg50d <- ticker$quote$fiftyDayAverage
avg200d <- ticker$quote$twoHundredDayAverage
beta <- ticker$quote$beta
Hello,
I am a regular user of the R package yahoofinancer. The last time I used it, in May, it worked perfecty.
But now in October, I had this issue:
y <- Ticker$new("GOOG")
y.yearly <- y$get_income_statement('annual')
Yahoo Finance API request failed
Status: 401
Type: Client error
Mesage:
Descript
Then, I updated the R package 'yahoofinancer' from github and I now get this message:
y <- Ticker$new("GOOG")
y.yearly <- y$get_income_statement('annual')
Error: attempt to apply non-function
Would it be possible that the get_income_statement() function does not work anymore because of changes in the yahoo API features?
Thanks a lot.
nz50 = Index$new('^NZ50')
nz = nz50$get_history(start = '2003-01-03', interval = '1d')
produces
Error in $<-.data.frame
(*tmp*
, adj_close, value = c(1954.9599609375, :
replacement has 5070 rows, data has 5191
nz50 = Ticker$new('^NZ50')
nz = nz50$get_history(start = '2003-01-03', interval = '1d')
produces
Error in data.frame(date = as_datetime(unlist(data$timestamp)), volume = unlist(indicators$volume), :
arguments imply differing number of rows: 5191, 5070
From CRAN:
Dear maintainer,
You have file 'yahoofinancer/man/yahoofinancer.Rd' with
\docType{package}, likely intended as a package overview help file, but
without the appropriate PKGNAME-package \alias as per "Documenting
packages" in R-exts.
This seems to be the consequence of the breaking change
Using @docType package no longer automatically adds a -package alias.
Instead document _PACKAGE to get all the defaults for package
documentation.
in roxygen2 7.0.0 (2019-11-12) having gone unnoticed, see
<https://github.com/r-lib/roxygen2/issues/1491>.
As explained in the issue, to get the desired PKGNAME-package \alias
back, you should either change to the new approach and document the new
special sentinel
"_PACKAGE"
or manually add
@aliases yahoofinancer-package
if remaining with the old approach.
Please fix in your master sources as appropriate, and submit a fixed
version of your package within the next few months.
Best,
-k
Prepare for release:
git pull
devtools::build_readme()
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
rhub::check_for_cran()
revdepcheck::revdep_check(num_workers = 4)
cran-comments.md
git push
Submit to CRAN:
usethis::use_version('minor')
devtools::submit_cran()
Wait for CRAN...
git push
usethis::use_github_release()
usethis::use_dev_version()
git push
Hello,
I'm using the 'yahoofinancer' package to download quartely financials from yahoo. In the last few weeks, I have faced this issue:
I get 0 values for many financial metrics for the last available quarter. For example, when loading the 'alphabet' quarterly financials, I get 0s for variables such as 'total revenues' or 'net income' for quarter ending '2023-03-31', although non-zero values are displayed on yahoo.finance.com (https://finance.yahoo.com/quote/GOOG/financials?p=GOOG).
alphabet.financials <- Ticker$new("GOOG")$get_income_statement('quarter')
print(alphabet.financials[,c("end_date","total_revenue","ebit","net_income")])
end_date total_revenue ebit net_income
1 2023-03-31 0 17415000000 0
2 2022-12-31 76048000000 18160000000 13624000000
3 2022-09-30 69092000000 17135000000 13910000000
4 2022-06-30 69685000000 19453000000 16002000000
I know and checked the I have internet connection when using R, but I still get a no internet connection when I use the function validate.
Ex: validate("AAPL") does not give my any result other then no internet connection.
Prepare for release:
git pull
devtools::build_readme()
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
rhub::check_for_cran()
revdepcheck::revdep_check(num_workers = 4)
cran-comments.md
git push
Submit to CRAN:
usethis::use_version('minor')
devtools::submit_cran()
Wait for CRAN...
git push
usethis::use_github_release()
usethis::use_dev_version()
git push
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.