Skip to main content

beta-Cynosure

Biblioteca Python para extração e análise de dados financeiros públicos da CVM (Comissão de Valores Mobiliários).

Permite baixar, limpar e consolidar DFP (demonstrações anuais), ITR (trimestrais) e FRE (estrutura acionária) de companhias abertas brasileiras.


Funcionalidade

  • Baixa os arquivos diretamente do portal dados.cvm.gov.br
  • Processa automaticamente:
    • DFP: dados anuais
    • ITR: dados trimestrais
    • FRE: número total de ações e ações em circulação
  • Retorna tudo como DataFrames Pandas prontos para uso
  • Permite consultas por:
    • Um único ano (ex: 2024)
    • Intervalo de anos (ex: "2020-2024")
    • Empresa específica (ex: ["PETR"])
    • Grupo de empresas (ex: ["PETR", "VALE", "ITAU"])

Instalação

pip install beta-cynosure

Exemplo de uso básico

from beta_cynosure import get_dfp, get_itr, get_fre, get_all

# DFP: demonstrações anuais (um ou mais anos)
dfp = get_dfp("2023-2024", ["PETR"])
print(dfp.head())

# ITR: dados trimestrais
itr = get_itr(2024, ["PETR", "VALE"])

# FRE: estrutura acionária
fre = get_fre(2023, ["ITAU"])

# Todos de uma vez
data = get_all("2023-2024", ["PETR", "VALE"])
print(data["dfp"].shape, data["itr"].shape, data["fre"].shape)

Estrutura dos DataFrames

Tipo Descrição
DFP Demonstrações financeiras anuais (Balanço, DRE, etc.)
ITR Informações trimestrais (dados resumidos por trimestre)
FRE Quantidade total de ações e ações em circulação

Exemplo de análise

Somar o "Ativo Total" de 2023 e 2024

target = dfp[dfp["DS_CONTA"] == "Ativo Total"]
by_year = target.groupby("YEAR")["VL_CONTA"].sum()
soma = by_year.get(2023, 0) + by_year.get(2024, 0)
print("Ativo Total (2023 + 2024):", soma)

Exportação de dados

Os resultados obtidos pelas funções get_dfp, get_itr, get_fre ou get_all podem ser exportados facilmente em CSV ou JSON usando o módulo export.

from beta_cynosure import get_all, save

# Busca dados da Petrobras entre 2023 e 2024
data = get_all("2023-2024", ["PETR"])

# Exporta em formato JSON
save(data, prefix="PETR", period="2023-2024", format="json")

# Ou exporta em formato CSV
save(data, prefix="PETR", period="2023-2024", format="csv")

Metadata

Release files for beta-cynosure 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beta-cynosure 0.1.4
File Size Uploaded Provenance Actions
beta_cynosure-0.1.4.tar.gz 25.9 kB Without provenance Details for beta_cynosure-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for beta-cynosure 0.1.4
File Interpreter ABI Platform Actions
beta_cynosure-0.1.4-py3-none-any.whl Python 3 none any Details for beta_cynosure-0.1.4-py3-none-any.whl

Total release size: 55.6 kB

Release files / beta_cynosure-0.1.4.tar.gz

Download URL beta_cynosure-0.1.4.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bb49ee7a5938a4ab227347d4119910512d0bfd2a6193ec90239cf5f7aadfb33f
BLAKE2b-256 checksum
How to use checksums
6162804ed2240ae71201b73a0d2383f31006dc6821dd52db59c6f0d18ea207c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / beta_cynosure-0.1.4-py3-none-any.whl

Download URL beta_cynosure-0.1.4-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3599db8eff7d806136eb28acefb577b015ba500140e50416224a662022601746
BLAKE2b-256 checksum
How to use checksums
5cf482782497b72491a530e5a4696cb3a290ae3a37143efbe896c0af9ab6669b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for beta-cynosure 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page