[This article was first published on R on msperlin, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
After battling B3’s website for days, I finally managed to gather a master table for all corporate data. I’m happy to report that the 2019’s data is now included in GetDFPData, the CRAN package and shiny interface. This includes new financial statements and company’s FRE data.
I also want to use this update to formally thank everyone that made a donation in the shiny website. Your donation is not only helping paying for the bills of the server but increasing my motivation for working further in this project.
As for R code with then new dataset, let’s give it a try:
library(GetDFPData) library(tidyverse) ## ── Attaching packages ───────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ── ## ✓ ggplot2 3.3.0 ✓ purrr 0.3.4 ## ✓ tibble 3.0.0 ✓ dplyr 0.8.5 ## ✓ tidyr 1.0.2 ✓ stringr 1.4.0 ## ✓ readr 1.3.1 ✓ forcats 0.5.0 ## ── Conflicts ──────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ── ## x dplyr::filter() masks stats::filter() ## x dplyr::lag() masks stats::lag() name.companies <- c('PETRÓLEO BRASILEIRO S.A. - PETROBRAS') first.date <- '2017-01-01' last.date <- '2020-01-01' inflation.index <- 'IPCA' df.reports <- gdfpd.GetDFPData(name.companies = name.companies, first.date = first.date, last.date = last.date) ## Found cache file. Loading data.. ## ## Downloading data for 1 companies ## First Date: 2017-01-01 ## Laste Date: 2020-01-01 ## Inflation index: dollar ## ## Downloading inflation data ## Caching inflation RDATA into tempdir() Done ## ## Inputs looking good! Starting download of files: ## ## PETRÓLEO BRASILEIRO S.A. - PETROBRAS ## Available periods: 2017-12-31 2018-12-31 2019-12-31 ## ## ## Processing 9512 - PETRÓLEO BRASILEIRO S.A. - PETROBRAS ## Finding info from Bovespa ## Found BOV cache file ## Processing 9512 - PETRÓLEO BRASILEIRO S.A. - PETROBRAS | date 2017-12-31 ## Acessing DFP data | Found DFP cache file ## Acessing FRE data | Found FRE cache file ## Acessing FCA data | Found FCA cache file ## Processing 9512 - PETRÓLEO BRASILEIRO S.A. - PETROBRAS | date 2018-12-31 ## Acessing DFP data | Found DFP cache file ## Acessing FRE data | Found FRE cache file ## Acessing FCA data | Found FCA cache file ## Processing 9512 - PETRÓLEO BRASILEIRO S.A. - PETROBRAS | date 2019-12-31 ## Acessing DFP data | Found DFP cache file ## Acessing FRE data | No FRE file available.. ## Acessing FCA data | No FCA file available.. glimpse(df.reports) ## Rows: 1 ## Columns: 46 ## $ company.name <chr> "PETRÓLEO BRASILEIRO S.A. - PETROB… ## $ company.code <int> 9512 ## $ cnpj <chr> "33000167000101" ## $ date.company.constitution <date> 1953-10-03 ## $ date.cvm.registration <date> 1977-07-20 ## $ company.tickers <chr> "PETR3;PETR4" ## $ min.date <date> 2017-12-31 ## $ max.date <date> 2019-12-31 ## $ n.periods <int> 3 ## $ company.segment <chr> "Corporate Governance - Level 2" ## $ current.stockholders <list> [<data.frame[8 x 6]>] ## $ current.stock.composition <list> [<data.frame[3 x 4]>] ## $ history.files <list> [<data.frame[1 x 2]>] ## $ fr.assets <list> [<data.frame[46 x 6]>] ## $ fr.liabilities <list> [<data.frame[75 x 6]>] ## $ fr.income <list> [<data.frame[78 x 6]>] ## $ fr.cashflow <list> [<data.frame[68 x 6]>] ## $ fr.value <list> [<data.frame[78 x 6]>] ## $ fr.assets.consolidated <list> [<data.frame[45 x 6]>] ## $ fr.liabilities.consolidated <list> [<data.frame[78 x 6]>] ## $ fr.income.consolidated <list> [<data.frame[84 x 6]>] ## $ fr.cashflow.consolidated <list> [<data.frame[71 x 6]>] ## $ fr.value.consolidated <list> [<data.frame[78 x 6]>] ## $ fr.auditing.report <list> [<data.frame[3 x 6]>] ## $ history.dividends <list> [<data.frame[0 x 0]>] ## $ history.stockholders <list> [<data.frame[19 x 15]>] ## $ history.capital.issues <list> [<data.frame[4 x 6]>] ## $ history.mkt.value <list> [<data.frame[2 x 6]>] ## $ history.capital.increases <list> [<data.frame[6 x 9]>] ## $ history.capital.reductions <list> [<data.frame[0 x 0]>] ## $ history.stock.repurchases <list> [<data.frame[0 x 0]>] ## $ history.other.stock.events <list> [<data.frame[0 x 0]>] ## $ history.compensation <list> [<data.frame[2 x 19]>] ## $ history.compensation.summary <list> [<data.frame[6 x 10]>] ## $ history.transactions.related <list> [<data.frame[201 x 14]>] ## $ history.debt.composition <list> [<data.frame[10 x 10]>] ## $ history.governance.listings <list> [<data.frame[2 x 5]>] ## $ history.board.composition <list> [<data.frame[52 x 19]>] ## $ history.committee.composition <list> [<data.frame[171 x 19]>] ## $ history.family.relations <list> [<data.frame[0 x 0]>] ## $ history.family.related.companies <list> [<data.frame[20 x 12]>] ## $ history.auditing <list> [<data.frame[3 x 11]>] ## $ history.responsible.docs <list> [<data.frame[4 x 6]>] ## $ history.stocks.details <list> [<data.frame[4 x 13]>] ## $ history.dividends.details <list> [<data.frame[2 x 8]>] ## $ history.intangible <list> [<data.frame[155 x 7]>]
To leave a comment for the author, please follow the link and comment on their blog: R on msperlin.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.