Open joeymizrahi opened 6 years ago
Try this library if u need a few company financials. I wouldn't scrape every single company every day. But it should work for many other use cases.
https://gist.github.com/hahnicity/45323026693cdde6a116
On Sun, Nov 4, 2018, 2:44 AM cs4242 <notifications@github.com wrote:
Hi, I am in need of quarterly and yearly financial statements such as: Income statement, Cash Flow, Balance Sheet. this is the only library I found that offers it. but when I try to use it it returns that it is defunct. does anyone have a solution for this? ad if there isn't one, does anyone know of a different library that can help. it can be in python,C,C++,C#,Java
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joshuaulrich/quantmod/issues/254, or mute the thread https://github.com/notifications/unsubscribe-auth/ATeUHtMvaMhrWumf0Kuk8RnG5XOyGdqVks5urprTgaJpZM4YNL5Y .
Try this library if u need a few company financials. I wouldn't scrape every single company every day. But it should work for many other use cases. https://gist.github.com/hahnicity/45323026693cdde6a116 …
this doesn't seem to be a module. how would I use it to extract lets say the Income statement, Cash Flow, Balance Sheet of a specific company?
I'm not sure how to create all the URLs to send to the Yahoo servers... but I looked at the page source for Apple's financials, and it looks like the relevant URL for the quarterly balance sheet history is: https://query2.finance.yahoo.com/v10/finance/quoteSummary/AAPL?modules=balanceSheetHistoryQuarterly
We should be able to find the URLs for the other statements by careful inspection of the page source.
quantmod::getOptionChain.yahoo()
demonstrates how to get JSON data from the Yahoo servers, and how to parse it to return the values.
I stumbled across some python code that does this using the current Yahoo Finance API. Here's an example for AAPL.
u <- "https://finance.yahoo.com/quote/AAPL/financials"
j <- readLines(u)
j <- sub("root.App.main = ", "", j[grep("root\\.App\\.main", j)])
j <- sub(";$", "", j)
x <- jsonlite::fromJSON(j)
y <- x$context$dispatcher$stores$QuoteSummaryStore
## cashflow statements
z <- y$cashflowStatementHistory$cashflowStatements
## others
## cashflowStatementHistory, cashflowStatementHistoryQuarterly
## balanceSheetHistory, balanceSheetHistoryQuarterly
## incomeStatementHistory, incomeStatementHistoryQuarterly
r <- lapply(z, function(x) { x[[1]] })
enddate <- r$endDate
r$maxAge <- r$endDate <- NULL
xd <- xts(data.frame(r), as.Date(.POSIXct(enddate, "UTC")))
I don't have time to update the functions to use this code. Hopefully someone else can give it a try.
Hi, I am in need of quarterly and yearly financial statements such as: Income statement, Cash Flow, Balance Sheet. this is the only library I found that offers it. but when I try to use it it returns that it is defunct. does anyone have a solution for this? ad if there isn't one, does anyone know of a different library that can help. it can be in python,C,C++,C#,Java