Skip to content

Commit

Permalink
cran version
Browse files Browse the repository at this point in the history
  • Loading branch information
msperlin committed Mar 19, 2021
1 parent 8e0f7b5 commit e127592
Show file tree
Hide file tree
Showing 52 changed files with 83 additions and 5,901 deletions.
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Package: GetDFPData2
Title: Reading Annual and Quarterly Financial Reports from B3
Version: 0.5
Date: 2020-06-11
Date: 2021-03-19
Authors@R: c(person("Marcelo", "Perlin", email = "marceloperlin@gmail.com", role = c("aut", "cre")),
person("Guilherme", "Kirch", email = "guilhermekirch@gmail.com", role = c("aut")))
Description: Reads annual and quarterly financial reports from companies traded at B3, the Brasilian exchange <http://www.bmfbovespa.com.br/en_us/products/listed-equities-and-derivatives/equities/listed-companies.htm>. All data is downloaded and imported from CVM's ftp site <http://dados.cvm.gov.br/dados/CIA_ABERTA/>.
Description: Reads annual and quarterly financial reports from companies traded at B3, the Brazilian exchange
<http://www.b3.com.br/>.
All data is downloaded and imported from CVM's public ftp site <http://dados.cvm.gov.br/dados/CIA_ABERTA/>.
Depends:
R (>= 3.5.0)
Imports:
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ export("%>%")
export(export_xlsx)
export(get_dfp_data)
export(get_info_companies)
export(get_itr_data)
export(search_company)
importFrom(magrittr,"%>%")
1 change: 0 additions & 1 deletion R/fct_download_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ find_dl_size <- function(url_in) {
return(size_out)
}


find_file_size <- function(path) {
info <- file.info(path)
size <- info$size
Expand Down
2 changes: 1 addition & 1 deletion R/fct_download_read_itr_zip_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ download_read_itr_zip_file <- function(url_in,
companies_cvm_codes,
type_docs,
type_format,
cache_folder = 'gcvmd_cache',
cache_folder,
clean_data) {

# create folder
Expand Down
5 changes: 3 additions & 2 deletions R/fct_export_xlsx.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Export DFP/ITR data to a xlsx file
#'
#' @param l_dfp A list from get_dfp_data
#' @param l_dfp A list from get_dfp_data or get_itr_data
#' @param f_xlsx Path to xlsx file
#'
#' @return A dataframe with several information about B3 companies
Expand All @@ -18,10 +18,11 @@ export_xlsx <- function(l_dfp, f_xlsx = 'GetDFPData-XLSX.xlsx') {

if (my_file_ext != 'xlsx') stop('File extension for f_xlsx should be .xlsx')

message('Exporting file to ', f_xlsx)
writexl::write_xlsx(x = l_dfp,
path = f_xlsx)

message(stringr::str_glue('\nArquivo salvo em {f_xlsx}.') )
message(stringr::str_glue('\nDone! File saved at {f_xlsx}.') )
return(invisible(TRUE))

}
6 changes: 4 additions & 2 deletions R/fct_get_itr_data.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' Downloads and reads ITR datasets
#'
#' **IN DEVELOPMENT and NOT EXPORTED (dont use it)**. Results dont seem right..
#'
#' The ITR (informacoes trimestrais) is the quarterly reporting system of companies
#' traded at B3. This function will access the CVM ftp and parse all available files according to user
#' choices
Expand All @@ -9,7 +11,6 @@
#' This option only applies for the DRE. Be aware that the original data only includes accumulated quarters.
#'
#' @return A list of tibbles, separated by column GRUPO_DFP
#' @export
#'
#' @examples
#'
Expand Down Expand Up @@ -85,7 +86,8 @@ get_itr_data <- function(companies_cvm_codes = NULL,
clean_data = clean_data,
companies_cvm_codes = companies_cvm_codes,
type_docs = type_docs,
type_format = type_format))
type_format = type_format,
cache_folder = cache_folder))

# do calculation of quarters
if (individual_dre_quarters) {
Expand Down
6 changes: 4 additions & 2 deletions R/fct_read_dfp_csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ read_dfp_csv <- function(file_in, clean_data) {
col_types = readr::cols(CD_CONTA = readr::col_character(),
VL_CONTA = readr::col_character(),
CD_CVM = readr::col_number()),
locale = readr::locale(decimal_mark = ',', encoding = 'Latin1'),
progress = FALSE) %>%
locale = readr::locale(decimal_mark = ',',
encoding = 'Latin1'),
progress = FALSE,
quote = '\\"') %>%
dplyr::mutate(VL_CONTA = readr::parse_number(VL_CONTA))
})

Expand Down
7 changes: 4 additions & 3 deletions R/fct_read_itr_csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ read_itr_csv <- function(file_in, clean_data) {
col_types = readr::cols(CD_CVM = readr::col_number(),
CD_CONTA = readr::col_character(),
VL_CONTA = readr::col_character()),
locale = readr::locale(#decimal_mark = '.',
encoding = 'Latin1'),
progress = FALSE) %>%
locale = readr::locale(decimal_mark = ',',
encoding = 'Latin1'),
progress = FALSE,
quote = '\\"') %>%
dplyr::mutate(VL_CONTA = readr::parse_number(VL_CONTA)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/fct_search_company.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' \dontrun{ # dontrun: keep cran check fast
#' df <- search_company('petrobras')
#' }
search_company <- function(char_to_search, cache_folder = 'gcvmd_cache') {
search_company <- function(char_to_search, cache_folder = 'gdfpd2_cache') {

df_cvm <- get_info_companies(cache_folder)

Expand Down
2 changes: 1 addition & 1 deletion R/utils-pipe.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @keywords internal
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
NULL
160 changes: 0 additions & 160 deletions docs/404.html

This file was deleted.

Loading

0 comments on commit e127592

Please sign in to comment.