Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ano 2021 faltante #9

Open
Sidonesio opened this issue May 11, 2023 · 3 comments
Open

Ano 2021 faltante #9

Sidonesio opened this issue May 11, 2023 · 3 comments

Comments

@Sidonesio
Copy link

Olá, professor.
Baixei os dados de Cosan desde 2010, mas não veio o ano de 2021.
O que está acontecendo?

Código abaixo:

rm(list = ls())
graphics.off()
if (!require("pacman")) install.packages("pacman")
p_load(
GetDFPData2,
tidyverse,
janitor,
here,
lubridate,
tiqyquant
)
select_company <- "cosan"
data_search <-
search_company(select_company) |>
as_tibble() |>
clean_names() |>
filter(sit_reg == "ATIVO")
company_code <-
data_search |>
pull(cd_cvm)
first_year <- 2010
income <-
get_dfp_data(
companies_cvm_codes = company_code,
type_docs = "DRE",
type_format = "con",
first_year = first_year,
last_year = year(Sys.Date())
) |>
pluck(1) |>
clean_names()
select_income <- c(
"Receita de Venda de Bens e/ou Serviços",
"Resultado Bruto",
"Resultado Antes do Resultado Financeiro e dos Tributos",
"Lucro/Prejuízo Consolidado do Período",
)
income_subset <-
income |>
select(
date_start = dt_ini_exerc,
index = cd_conta,
item = ds_conta,
value = vl_conta
) |>
filter(item %in% select_income)
income_subset |>
filter(str_detect(item, "Receita")) |>
tq_mutate(
select = value,
mutate_fun = periodReturn,
period = "annually",
col_rename = "return"
)

@msperlin
Copy link
Owner

Oi Sidonesio,

Rodei o seu código aqui e funcionou (veja abaixo).

image

O que aparece para voce?

@Sidonesio
Copy link
Author

Rodei este código:

rm(list = ls())
graphics.off()
lapply(names(sessionInfo()$otherPkgs), function(pkgs)
detach(
paste0('package:', pkgs),
character.only = T,
unload = T,
force = T))
if (!require("pacman")) install.packages("pacman")
p_load(
GetDFPData2,
tidyverse,
janitor
)
cia_code <-
search_company("infracommerce") |>
as_tibble() |>
clean_names() |>
pull(cd_cvm)
cia_bpa <-
get_dfp_data(
companies_cvm_codes = cia_code,
first_year = 2010,
last_year = year(Sys.Date()),
type_docs = "BPA",
type_format = "con"
) |>
pluck(1) |>
clean_names()
glimpse(cia_bpa)
cia_bpa |>
select(date = dt_refer, variable = ds_conta, value = vl_conta) |>
filter(variable == "Ativo Total")
distinct(ds_conta) |>
print(n = Inf)

E apareceu isto:

image

@msperlin
Copy link
Owner

Oi Sid,

Aqui está funcionando:

image

talvez esteja com cache de arquivo antigo? Tenta limpar o diretório de cacheamento ou então rodar sem cacheamento.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants