Git Product home page Git Product logo

yfinance's People

Contributors

ljupch0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yfinance's Issues

Errors from get_price()

I could not get the quote of a ticker
yfinance::get_price("AAPL")
and I got this return:

Warning messages:
1: replacing previous import ‘purrr::flatten’ by ‘jsonlite::flatten’ when loading ‘yfinance’
2: In safe_download(vector = ticker, proto_function = get_price_proto) :
There were ERRORS while downloading data for these items: AAPL.
Please check if you have the correct ticker. The vector of errored items and error messages can be accessed as attributes of the returned dataframe - attributes(df).

R version 4.1.2 (2021-11-01) -- "Bird Hippie"

Has anyone else encountered similar issues?

getIncome("AAPL") fails with Error: Only strings can be converted to symbols

As the title says this is the error I get.

It seems to me that parse_number in the clean function fails because the dataframe has NAs and "" (empty strings?). Maybe a solution would be to turn all NA and "" to "0" and then parse_number, then convert 0 to NA. Or maybe use stringr::str_replace_na to get NA_character_.

Also as far as I can see there are some things going on in line 40: headers <- c('Items','TTM', matches[[1]][,1]) that messes the column names leaving some columns without a name. This has implications further down the code at line 62. Maybe I should've made another issue for this one.

sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libopenblasp-r0.3.7.so
LAPACK: /usr/lib/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=mk_MK.UTF-8       LC_NUMERIC=C               LC_TIME=mk_MK.UTF-8       
 [4] LC_COLLATE=mk_MK.UTF-8     LC_MONETARY=mk_MK.UTF-8    LC_MESSAGES=mk_MK.UTF-8   
 [7] LC_PAPER=mk_MK.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=mk_MK.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] equityanalysis_0.1.0

Suppressing output

I love yfinance -- however, there is one minor nuisance.
When it runs, this type of output appears:
Downloading Prices SQ [======================>---------------] 62% ETA: 5s
Downloading Prices TTD [=======================>-------------] 65% ETA: 4s
Downloading Prices TTEK [========================>-----------] 69% ETA: 4s
Downloading Prices UNH [==========================>----------] 73% ETA: 3s
Is it possible to suppress that output?

Yahoo Finance API issue

I'm experiencing what seems to be an issue with the Yahoo Finance Endpoint behind get_price() :

> yfinance::get_price("SPY")
# A tibble: 0 x 0
Warning messages:
1: In open.connection(con, "rb") :
  cannot open URL 'https://query2.finance.yahoo.com/v10/finance/quoteSummary/SPY?modules=price': HTTP status was '401 Unauthorized'
2: In safe_download(vector = ticker, proto_function = get_price_proto) :
  There were ERRORS while downloading data for these items: SPY.
Please check if you have the correct ticker. The vector of errored items and error messages can be accessed as attributes of the returned dataframe - attributes(df).

It seems like quantmod package authors have dealt with** a very similar issue in a certain way (although it is with a different endpoint and API version etc...)

**https://github.com/joshuaulrich/quantmod/pull/383/files/554af1b9f35bff83afb700f1f98281be785e56d3

Wrong values gotten in the Cash Flow Statement of AMD

Hello Ljupcho,

Just to report a weird situation when retrieving the Cash Flow Statement of the ticker AMD.
The Operating Cash Flow (annual) for 2017 is not the same shown in the CF Statement in the Y! Finance web page.

image

VERSUS

image

I do not believe is any issue with the package, but an issue of the API.
In any case, I thought it was worth to share it.

Thanks for the package!

Daniel.

error in yfinance::get_summaries()

ticker <- "AA"

company_name <- yfinance::get_company_names(ticker)
summary <- yfinance::get_summaries(ticker)

yields:
Error in open.connection(con, "rb") : HTTP error 404.

get_company_names & nested data query

Hi Ljupch0,

I am new to this so if this is a simple fix apologies for wasting your time. I have been following along and I could successfully run all code bar get_company_names which returns "Error in open.connection(con, "rb") : HTTP error 404." although the tickers are spelt correctly.

I left this as it wasn't essential to continue with the tutorial but when I got to Nested Data I got the following error when mutating
> biotech_balance_sheets <- tibble(
+ companies = companies
+ ) %>%
+ mutate(
+ ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol,
+ full_name = yfinance::search_stock(search_term = companies, keep_results = "top")$longname,
+ )
Warning: Problem with mutate() column ticker.
i ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol.
i There were ERRORS while downloading data for these items: Alexion Pharmaceuticals Inc..
Please check if you have the correct ticker. The vector of errored items and error messages can be accessed as attributes of the returned dataframe - attributes(df).
Error: Problem with mutate() column ticker.
i ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol.
i ticker must be size 8 or 1, not 7.
Run rlang::last_error() to see where the error occurred.
> biotech_balance_sheets <- tibble(
+ companies = companies
+ )
> biotech_balance_sheets <- tibble(
+ companies = companies
+ ) %>%
+ mutate(
+ ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol,
+ full_name = yfinance::search_stock(search_term = companies, keep_results = "top")$longname,
+ )
Warning: Problem with mutate() column ticker.
i ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol.
i There were ERRORS while downloading data for these items: Alexion Pharmaceuticals Inc..
Please check if you have the correct ticker. The vector of errored items and error messages can be accessed as attributes of the returned dataframe - attributes(df).
Error: Problem with mutate() column ticker.
i ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol.
i ticker must be size 8 or 1, not 7.
Run rlang::last_error() to see where the error occurred.
> rlang::last_error()
x
+-<error/dplyr:::mutate_error>
| Problem with mutate() column ticker.
| i ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol.
| i ticker must be size 8 or 1, not 7.
-<error/dplyr:::mutate_incompatible_size>
Backtrace:
1. %>%(...)
7. dplyr:::abort_glue(character(0), list(x_size = 7L), "dplyr:::mutate_incompatible_size")
8. rlang::exec(abort, class = class, !!!data)
Run rlang::last_trace() to see the full context.
> rlang::last_trace()
x
+-<error/dplyr:::mutate_error>
| Problem with mutate() column ticker.
| i ticker = yfinance::search_stock(search_term = companies, keep_results = "top")$symbol.
| i ticker must be size 8 or 1, not 7.
-<error/dplyr:::mutate_incompatible_size>
Backtrace:
x
1. +-%>%(...)
2. +-dplyr::mutate(...)
3. +-dplyr:::mutate.data.frame(...)
4. | -dplyr:::mutate_cols(.data, ..., caller_env = caller_env())
5. | +-base::withCallingHandlers(...)
6. | -mask$eval_all_mutate(quo)
7. -dplyr:::abort_glue(character(0), list(x_size = 7L), "dplyr:::mutate_incompatible_size")
8. -rlang::exec(abort, class = class, !!!data)

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.