English | Português
cvmdata provides a tidy API to the open data published by the Brazilian Securities and Exchange Commission (CVM — Comissão de Valores Mobiliários) on listed companies. It reads nine datasets and 104 tables through one function: the company register (cad), annual and quarterly financial statements (dfp, itr), the reference form (fre), the registration form (fca, which links B3 tickers to companies), the corporate governance code report (cgvn), insider trading positions (vlmo), share buyback programmes (recompra_acoes) and the index of periodic and occasional filings (ipe).
The package preserves table names, column names, categorical values and free text in Portuguese exactly as CVM publishes them. Function names, arguments and metadata attributes follow English-language rOpenSci and tidyverse conventions.
Where the data comes from. By default, cvmdata does not read the CVM portal on every call: it reads a mirror of the portal — Parquet snapshots of the CVM files, maintained by the package author in this repository’s GitHub Releases and refreshed weekly by an automated pipeline. Pass source = "cvm" (or call cvm_source_set("cvm")) to read the official portal directly. The CVM publishes these datasets under the Open Database License (ODbL) and the mirror is redistributed under the same licence; see Data provenance and licence below.
Why cvmdata
CVM publishes filings as yearly ZIPs of CSVs with mixed encodings, table-specific schemas, and no unified data dictionary. Common workflows — “give me DFP for company X across 2018-2024” — typically require manual ZIP downloads, ISO-8859-1 handling, scale-by-ESCALA_MOEDA conversion, and joins against a separate submissao header to translate CD_CVM to CNPJ. cvmdata consolidates these steps behind a single cvm_fetch(dataset, table, cnpj, year, basis, reading, ...) call and ships the official dictionary as an embedded snapshot, so column types are picked up automatically.
Two R packages on CRAN, both by Marcelo Perlin and colleagues, read the same portal (checked on CRAN on 2026-11-15):
-
GetDFPData2(0.6.5) reads the annual statements (DFP), the company register and the B3 tickers. -
GetFREData(1.1.0) reads the tables of the reference form (FRE).
Their predecessors GetDFPData and GetITRData are archived on CRAN. If you need the DFP of a list of companies, or one FRE table for a few years, those packages serve you well.
cvmdata differs in what it does between the file and the analysis. It keeps the current filing when a company resubmits (and returns every replaced version with cvm_versions()), gives the original and the restated figures of a fiscal year side by side (reading), applies the currency scale, keeps identifiers as text, checks every file against the CVM dictionary, and selects companies by CNPJ or B3 ticker and periods by year or by a window of reference dates, across the nine datasets. The dictionary and the code lists ship with the package, and the default source is a dated, checksummed mirror.
Installation
cvmdata requires R ≥ 4.1 (native pipe) and is not yet on CRAN. The development version can be installed from GitHub:
# install.packages("pak")
pak::pak("SidneyBissoli/cvmdata")Quick start
Browse what’s covered (offline — discovery reads from embedded snapshots):
library(cvmdata)
cvm_datasets()
#> [1] "cad" "cgvn" "dfp" "fca"
#> [5] "fre" "ipe" "itr" "recompra_acoes"
#> [9] "vlmo"The bundled dictionary surfaces the types and descriptions CVM publishes for every column:
dict <- cvm_dictionary("dfp", "bpa")
tbl <- knitr::kable(
dict[1:8, c("campo", "descricao", "tipo_dados", "tamanho")],
format = "html"
)
cat('<div align="center">', tbl, '</div>', sep = "\n")| campo | descricao | tipo_dados | tamanho |
|---|---|---|---|
| cd_conta | Código da conta | varchar | 18 |
| cd_cvm | Código CVM | char | 6 |
| cnpj_cia | CNPJ da companhia | varchar | 18 |
| denom_cia | Nome empresarial da companhia | varchar | 100 |
| ds_conta | Descrição da conta | varchar | 100 |
| dt_fim_exerc | Data fim do exercício social | date | 10 |
| dt_refer | Data de referência do documento | date | 10 |
| escala_moeda | Escala monetária | varchar | 100 |
Fetch annual individual balance sheets (“BPA individual”) for two companies across recent years. Companies are identified by CNPJ (with or without punctuation) or by B3 ticker; basis picks the individual or consolidated statements, or both:
bpa <- cvm_fetch(
dataset = "dfp",
table = "bpa",
cnpj = c("00.000.000/0001-91", "47.960.950/0001-21"),
year = 2022:2024,
basis = "ind"
)Each yearly file also carries the comparative the issuer presented for the previous exercise, which is often restated. reading puts the two readings of an exercise side by side, labelled: the figures originally filed and the comparative in the following year’s file:
bpa_2022 <- cvm_fetch(
dataset = "dfp",
table = "bpa",
ticker = "PSSA3",
year = 2022,
basis = "con",
reading = c("original", "restated")
)A filing may be re-filed, and cvm_fetch() returns the current version. cvm_versions() returns every known version, the current one included, each superseded version dated and pointing at the version that replaced it (Braskem filed its 2023 income statement three times; version 1 was in R$ units by mistake):
brkm <- cvm_versions(
dataset = "dfp",
table = "dre",
cnpj = "42.150.391/0001-70",
year = 2023,
basis = "con"
)Parse and format Brazilian corporate taxpayer IDs (CNPJ):
cnpj_clean("00.000.000/0001-91")
#> [1] "00000000000191"
cnpj_format("00000000000191")
#> [1] "00.000.000/0001-91"Documentation
Reference and articles at https://sidneybissoli.github.io/cvmdata/. The exported API is grouped into five families:
-
Fetcher —
cvm_fetch()is the single function for every dataset and table; the groups still on the roadmap (funds, agents, offerings, events) will extend it through their schemas.cvm_versions()returns every known version of a filing. -
Discovery —
cvm_groups(),cvm_datasets(),cvm_tables(),cvm_dictionary(),cvm_codelist(),cvm_dataset_years(). -
Cache —
cvm_cache_path(),cvm_cache_set_path(),cvm_cache_info(),cvm_cache_clear(). The TTL window for HTTP revalidation is configurable viaoptions(cvmdata.cache_ttl_seconds)(default 30 days). -
Source backend —
cvm_source_get(),cvm_source_set(). The cache/mirror integration is documented in detail in the cache-and-mirror article. -
Utilities —
cnpj_lookup()(find a CNPJ by company name),cnpj_clean(),cnpj_format().
Data provenance and licence
All data originates from the official CVM Open Data Portal (https://dados.cvm.gov.br/). The package reaches it through one of two backends, selectable via cvm_source_set() or the source argument of cvm_fetch():
-
"mirror"(the default since v0.1.0) — Parquet snapshots of the CVM files published in this repository’s GitHub Releases (mirror-<group>-<dataset>-latest) and queried via DuckDB with year-partition filter pushdown. The mirror is produced and refreshed weekly by the ETL underinst/etl/, maintained by the package author, not by the CVM. It is typically ~30× faster than the portal; its staleness is bounded by the weekly refresh. The mirror omits a year when the CVM publishes that year’s CSV with no data rows. Every weekly run also keeps a dated snapshot (mirror-<group>-<dataset>-snapshot-<YYYY-MM-DD>), socvm_release_set("2026-11-01")pins a session to the mirror as it was on that day; the default"latest"follows the weekly refresh. -
"cvm"— HTTP directly to the CVM Open Data Portal. Opt in when byte-level freshness against the regulator is required, or when you prefer not to depend on a third-party mirror.
Every returned tibble carries provenance attributes (source, fetched_at, group, dataset, table, package_version, release) so a downstream caller can audit which backend, and which mirror release, served the data.
Licence of the data. The CVM publishes every dataset covered by cvmdata under the Open Data Commons Open Database License (ODbL) v1.0. The mirror is a derivative database in the terms of that licence and is redistributed under the ODbL as well. Attribution for the data: “Contains data from the Comissão de Valores Mobiliários (CVM) Open Data Portal, https://dados.cvm.gov.br/, under the ODbL v1.0.” Details, including what the licence asks of you when you redistribute the data, are in DATA-LICENSE.md. The package code is MIT licensed.
The mirror holds data about companies, not about people; the tables that describe people are read straight from the CVM. What the mirror leaves out, who answers for it and how a person mentioned in a text can ask for the name to be removed are in the privacy notice, PRIVACY.md (em português).
Citing the data
The mirror is deposited on Zenodo in editions with a DOI (the plan is four a year), so that a study can cite the exact data it used and the data outlives the GitHub releases. Cite the edition you used; the DOI 10.5281/zenodo.24260440 always resolves to the latest one. The first edition is of 2026-11-15 (10.5281/zenodo.24260441). citation("cvmdata") gives both the package and the data.
Related work
For exchange-side market data (prices, volumes, tickers, indices, trading calendars), the natural companion is rb3 by Wilson Freitas (with Marcelo Perlin as co-author), which downloads and parses public files released by B3. rb3 and cvmdata are complements: cvmdata covers issuer-side filings released by the regulator (CVM); rb3 covers exchange-side trading data released by the market operator (B3). Analyses that join market microstructure with financial statements use the two side by side.
Getting help
Bug reports and feature requests: https://github.com/SidneyBissoli/cvmdata/issues.
Contributing
Pull requests are welcome. See CONTRIBUTING.md for the development setup, the quality gate run on every commit, and the schema-YAML format used when adding a new dataset.
Please note that the cvmdata project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.