sewardlee337 / finreportr Goto Github PK
View Code? Open in Web Editor NEWR package - Financial Data from U.S. Securities and Exchange Commission
License: Other
R package - Financial Data from U.S. Securities and Exchange Commission
License: Other
No finreportr functions work when year = 2019. Have tested on multiple companies and multiple years, problem is not company specific and only exists when year = 2019.
GetBalanceSheet('GOOG', 2019)
Error in fileFromCache(file) : Error in download.file(file, cached.file, quiet = !verbose) : cannot open URL 'https://www.sec.gov/Archives/edgar/data/1652044/000165204419000004/https://xbrl.sec.gov/dei/2018/dei-2018-01-31.xsd'
Session Info:
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.1 purrr_0.3.2 readr_1.3.1 tidyr_0.8.3 tibble_2.1.3 ggplot2_3.1.1
[9] tidyverse_1.2.1 finreportr_1.0.1 lubridate_1.7.4 rvest_0.3.4 xml2_1.2.0 edgar_2.0.1
loaded via a namespace (and not attached):
[1] tidyselect_0.2.5 xfun_0.7 slam_0.1-45 NLP_0.2-0 haven_2.1.0 lattice_0.20-38 colorspace_1.4-1
[8] generics_0.0.2 yaml_2.2.0 XML_3.98-1.20 rlang_0.3.4 R.oo_1.22.0 pillar_1.4.1 withr_2.1.2
[15] glue_1.3.1 R.utils_2.8.0 selectr_0.4-1 readxl_1.3.1 modelr_0.1.4 plyr_1.8.4 cellranger_1.1.0
[22] munsell_0.5.0 gtable_0.3.0 R.methodsS3_1.7.1 XBRL_0.99.18 qdapRegex_0.7.2 knitr_1.23 tm_0.7-6
[29] parallel_3.6.0 curl_3.3 broom_0.5.2 Rcpp_1.0.1 backports_1.1.4 scales_1.0.0 jsonlite_1.6
[36] hms_0.4.2 stringi_1.4.3 grid_3.6.0 cli_1.1.0 tools_3.6.0 magrittr_1.5 lazyeval_0.2.2
[43] crayon_1.3.4 pkgconfig_2.0.2 assertthat_0.2.1 httr_1.4.0 rstudioapi_0.10 R6_2.4.0 nlme_3.1-139
[50] compiler_3.6.0
Hi,
I have been able to download Data for some years and not others. I continue to get the same error with older data. I know that the package can see the data that I want because I get a full list of 10Ks with the Annual Reports Function.
`library(quantmod)
library(finreportr)
CompanyInfo("BAC")
AnnualReports("BAC")
BAC.BS.2017 <- GetBalanceSheet("BAC",2017)
BAC.BS.2015 <- GetBalanceSheet("BAC",2015)
BAC.BS.2014 <- GetBalanceSheet("BAC",2014)
BAC.BS.2012 <- GetBalanceSheet("BAC",2012)
BAC.BS.2005 <- GetBalanceSheet("BAC",2005)
`
when i try to get the 2005 data I get the following error
`> BAC.BS.2005 <- GetBalanceSheet("BAC",2005)
Error in fileFromCache(file.inst) :
Error in download.file(file, cached.file, quiet = !verbose) :
cannot open URL 'https://www.sec.gov/Archives/edgar/data/70858/000119312505039878/bac-20041231.xml'
In addition: Warning message:
In download.file(file, cached.file, quiet = !verbose) :
cannot open URL 'https://www.sec.gov/Archives/edgar/data/70858/000119312505039878/bac-20041231.xml': HTTP status was '403 Forbidden'`
Additionally, is there any way to make the same Balance Sheet call from the accession numbers generated by the AnnualReports function?
Thanks in advance for your help
Receiving the below error when trying to pull IS/BS/CF. I am at work and that is the cause of the issue. Was wondering if there was a known work around? I am able to install/update packages directly from CRAN so it is possible to connect via R. I attempted via a proxy but to no avail.
> GetIncome("FB", 2016)
Error in open.connection(x, "rb") :
Timeout was reached: Connection timed out after 10015 milliseconds
GetIncome("MSFT", 2016)
Error in filter_impl(.data, dots) : basic_string::resize
head(GetIncome("AMZN", 2016),5)
Metric Units Amount startDate endDate
1 Sales Revenue, Goods, Net usd 60903000000 2013-01-01 2013-12-31
2 Sales Revenue, Goods, Net usd 70080000000 2014-01-01 2014-12-31
3 Sales Revenue, Goods, Net usd 79268000000 2015-01-01 2015-12-31
4 Sales Revenue, Services, Net usd 13549000000 2013-01-01 2013-12-31
5 Sales Revenue, Services, Net usd 18908000000 2014-01-01 2014-12-31
Once in many try it does go through the request and get's me the data. The rest of the time I get the error
AnnualReports("AAPL") on any ticker I get this in the console:
Error in open.connection(x, "rb") : Could not resolve host: www.sec.gov
The problem is not just present with the function AnnualReports(), but also with all the others
I read there that it could be because sec.gov try to se if i'm a bot. (https://stackoverflow.com/questions/33295686/rvest-error-in-open-connectionx-rb-timeout-was-reached)
sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bindrcpp_0.2 finreportr_1.0.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.12 dplyr_0.7.3 assertthat_0.2.0 XBRL_0.99.18 R6_2.2.2 magrittr_1.5
[7] httr_1.3.1 stringi_1.1.5 rlang_0.1.2.9000 curl_2.8.1 xml2_1.1.1 tools_3.4.1
[13] stringr_1.2.0 selectr_0.3-1 glue_1.1.1 compiler_3.4.1 pkgconfig_2.0.1 rvest_0.3.2
[19] bindr_0.1 tibble_1.3.4
My run of the example README.md code for GetIncome
, GetBalanceSheet
, and GetCashFlow
does not produce the expected output. For example, running GetIncome("GOOG", 2015)
produces:
Error in GetAccessionNo(symbol, year, foreign = FALSE) :
no filings available for given year
hello
when working in r with the following function, i get an error
> TSLA.inc <- GetIncome("TSLA", 2019)
Error in fileFromCache(file) :
Error in download.file(file, cached.file, quiet = !verbose) :
cannot open URL 'https://www.sec.gov/Archives/edgar/data/1318605/000156459019003165/https://xbrl.sec.gov/dei/2018/dei-2018-01-31.xsd'
when trying to retrieve the same data from a different year, it does work
> TSLA.inc <- GetIncome("TSLA", 2018)
> head(TSLA.inc)
Metric Units Amount startDate endDate
1 Sales Revenue Goods Net U_iso4217USD 3431587000 2015-01-01 2015-12-31
2 Sales Revenue Goods Net U_iso4217USD 5589007000 2016-01-01 2016-12-31
3 Sales Revenue Goods Net U_iso4217USD 8534752000 2017-01-01 2017-12-31
4 Operating Leases Income Statement Lease Revenue U_iso4217USD 309386000 2015-01-01 2015-12-31
5 Operating Leases Income Statement Lease Revenue U_iso4217USD 761759000 2016-01-01 2016-12-31
6 Operating Leases Income Statement Lease Revenue U_iso4217USD 1106548000 2017-01-01 2017-12-31
function get_financial.R contains a link that does not longer work (it's broken). The link in question is http://www.xbrl.org/2003/role/label and it appears here:
statement <-
merge(statement.skeleton, instFile$label, by.x = "toElementId",
by.y = "elementId") %>%
filter(labelRole == "http://www.xbrl.org/2003/role/label")
I think that this broken link creates some problems to the user.
Is it possible to have it fixed?
Thank you very much in advance
VS
Hello when parsing UNF (CIK 717954) q1 report from 2012.
Link to SEC XBRL
I am getting the following error:
Error in eval(substitute(expr), envir, enclos) : expecting a single value
xbrl_url_unf2012 <- "...../UNF/2012/q1/xbrl/unf-20111126.xml"
old_o <- options(stringsAsFactors = FALSE)
xbrl_data_unf2012 <- xbrlDoAll(xbrl_url_unf2012, verbose = TRUE)
options(old_o)
statement <- xbrl_get_statements(xbrl_data_unf2012)
NOTE: this also fails on their 2013 reports but not their 2014 reports (could be malformed xbrl, but sadly I don't know enough about the format to be sure??)
I keep getting this error when running:
CompanyInfo("GOOG")
Great package! Is there a way to download quarterly reports?
finreportr::GetCashFlow('ATLS',2017)
[1] "https://www.sec.gov/cgi-bin/browse-edgar?CIK=ATLS&owner=exclude&action=getcompany&Find=Search"
Error in filter_impl(.data, quo) : Result must have length 1381, not 0
Is is possible to obtain financial information by CIK number? The following code is able to download the company information and annual reports but neither contrain the ticker symbol to download the financial reports
x <- "66740" # a single CIK number
library(finreportr)
library(dplyr)
AnnReps <- AnnualReports(x, foreign = FALSE)
CompInf <- CompanyInfo(x)
The following returns an error:
BS <- GetBalanceSheet(CompInf$CIK, 2016)
GetBalanceSheet(AnnReps$accession.no[3], 2017)
I see in the functions that you deal a lot with the CIK numbers, how do you link the CIK with the ticker symbol?
After successfully reading SEC financial data until 2018 inclusive, my attemps to read 2019 & 2020 fail.
I get the following message:
_> GetIncome("NVDA", 2019)
Error in fileFromCache(file) :
Error in download.file(file, cached.file, quiet = !verbose) :
no fue posible abrir la URL -> it was not possible to open URL 'https://www.sec.gov/Archives/edgar/data/1045810/000104581019000023/https://xbrl.sec.gov/dei/2018/dei-2018-01-31.xsd'
Además: Warning message:
In download.file(file, cached.file, quiet = !verbose) :
cannot open URL 'https://www.sec.gov/Archives/edgar/data/1045810/000104581019000023/https://xbrl.sec.gov/dei/2018/dei-2018-01-31.xsd': HTTP status was '404 Not Found'_
Reports for 2019 & 2020 (and 2021) are available
AnnualReports(symbol = "NVDA", foreign = FALSE)
filing.name filing.date accession.no
1 10-K 2021-02-26 0001045810-21-000010
2 10-K 2020-02-20 0001045810-20-000010
3 10-K 2019-02-21 0001045810-19-000023
4 10-K 2018-02-28 0001045810-18-000010
5 10-K 2017-03-01 0001045810-17-000027
6 10-K 2016-03-17 0001045810-16-000205
7 10-K 2015-03-12 0001045810-15-000036
8 10-K 2014-03-13 0001045810-14-000030
9 10-K 2013-03-12 0001045810-13-000008
10 10-K 2012-03-13 0001045810-12-000013
11 10-K 2011-03-16 0001045810-11-000015
12 10-K 2010-03-18 0001045810-10-000006
13 10-K 2009-03-13 0001045810-09-000013
14 10-K 2008-03-21 0001045810-08-000011
15 10-K 2007-03-16 0001045810-07-000008
16 10-K/A 2006-11-29 0001193125-06-243224
17 10-K 2006-03-16 0001045810-06-000014
18 10-K 2005-03-22 0001045810-05-000008
19 10-K/A 2004-05-20 0001045810-04-000014
20 10-K 2004-03-29 0001045810-04-000007
21 10-K 2003-04-25 0001045969-03-001196
22 10-K 2002-05-14 0001012870-02-002262
23 10-K405/A 2001-05-25 0001012870-01-501023
24 10-K405 2001-04-27 0001012870-01-500492
25 10-K405 2000-03-13 0001012870-00-001346
26 10-K405 1999-04-29 0000929624-99-000772
However, I think there might be a problem with a date, since finreportr is trying to find a file whose date "2018-01-31.xsd" it's unavaible to find.
Is it possible that there might be a problem with the dates?
And congratulations for the package, it can be very useful.
VS
When I try to run GetIncome("CAT", 2016)
I receive the following error: Error in filter_impl(.data, quo) : Result must have length 1855, not 0
Here is the output from sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bindrcpp_0.2 xml2_1.2.0 curl_3.1 XBRL_0.99.18 finreportr_1.0.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 XML_3.98-1.9 dplyr_0.7.4 assertthat_0.2.0 R6_2.2.2 magrittr_1.5 httr_1.3.1 stringi_1.1.5
[9] rlang_0.1.4 tools_3.4.1 stringr_1.2.0 selectr_0.3-1 glue_1.2.0 yaml_2.1.14 compiler_3.4.1 pkgconfig_2.0.1
[17] rvest_0.3.2 knitr_1.17 bindr_0.1 tibble_1.3.4
I've tried successfully with a few other symbols (i.e., AAPL), but can't seem to get it to work consistently. Also, this is my first bug report, so please let me know if you need any other information.
Following errors were produced when execute provided functions
Error in do.call(method, list(parsed_selector)) :
could not find function "xpath_class"
or
Error in do.call(method, list(parsed_selector)) :
could not find function "xpath_combinedselector"
It's now taking several seconds to return financials. For instance, the call below took over 8 seconds to return results. It's now causing RStudio to crash.
head(GetIncome("GOOG", 2016), 20)
This seems to be a new issue as I was not observing this behavior 2 days ago.
Hello,
I am getting a 403 error when attempting the following
`> GetIncome("FB", 2016)
Error in fileFromCache(file) :
Error in download.file(file, cached.file, quiet = !verbose) :
cannot open URL 'https://www.sec.gov/Archives/edgar/data/1326801/000132680116000043/fb-20151231.xsd'
In addition: Warning message:
In download.file(file, cached.file, quiet = !verbose) :
cannot open URL 'https://www.sec.gov/Archives/edgar/data/1326801/000132680116000043/fb-20151231.xsd': HTTP status was '403 Forbidden'`
Do the source links need updating? Thank you!
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.