pieterprovoost / quantr

R package for fetching financials and stock market data
Other
4 stars 3 forks source link

Empty result crashes function #2

Open ga-it opened 2 years ago

ga-it commented 2 years ago

Symbol vector includes LBSI which returns empty query result despite data on web page.

Query:

https://query2.finance.yahoo.com/v10/finance/quoteSummary/LBSI?modules=incomeStatementHistory,balanceSheetHistory,cashflowStatementHistory

Web page:

https://finance.yahoo.com/quote/LBSI/cash-flow?p=LBSI

This crashes entire yahoo_financials function:

Error in select(., -maxAge) : select() doesn't handle lists.

pieterprovoost commented 2 years ago

Thanks for reporting, I'm not sure what is going on with the API but I implemented some temporary error handling. If this doesn't get fixed at Yahoo I'll need to look into using other endpoints.

ga-it commented 2 years ago

Thanks. Forked and wrapped inelegantly with

if (length(res[[1]][[1]][[1]])==0)

and returned empty dataframe.

Sure your solution will be more elegant!

;)

ga-it commented 2 years ago

Thanks for reporting, I'm not sure what is going on with the API but I implemented some temporary error handling. If this doesn't get fixed at Yahoo I'll need to look into using other endpoints.

Yahoo has benefits as a source.

I am looking at putting together an RShiny markets dashboard and your functions are some of the few that elegantly grab Yahoo API data.

Other elements of the API could therefore add value to a dashboard such as assetProfile, summaryProfile, summaryDetail, calendarEvents, secFilings etc

With your fixes and disabling the FCF calc, pulled 367 global banks financial data! Awesome!