Skip to main content

A Python tool for downloading, processing, and storing data from the Brazilian Securities and Exchange Commission (CVM - Comissão de Valores Mobiliários) in a SQLite database.

Project description

CVM-SQLite

CVM-SQLite is a Python tool for downloading, processing, and storing data from the Brazilian Securities and Exchange Commission (CVM - Comissão de Valores Mobiliários) in a SQLite database.

Features

  • Automatically downloads data from the CVM repository
  • Processes and structures data according to provided schemas
  • Stores data in a SQLite database
  • Supports incremental updates

What can be obtained with CVM-SQLite?

CVM-SQLite facilitates access to a comprehensive range of official documents from various financial entities regulated by the Brazilian Securities and Exchange Commission (CVM). These include:

CIA_ABERTA (Companhias Abertas) - Public Companies

  • DFP (Demonstrações Financeiras Padronizadas) - Standardized Financial Statements
  • ITR (Informações Trimestrais) - Quarterly Information Reports
  • FRE (Formulário de Referência) - Reference Form
  • FCA (Formulário Cadastral) - Registration Form
  • Additional relevant documentation

FI (Fundos de Investimento) - Investment Funds

  • Financial Statements
  • Periodic Reports
  • Balance Sheets
  • CDA (Composição e Diversificação das Aplicações) - Portfolio Composition and Diversification
  • Other pertinent fund documentation

FII (Fundos de Investimento Imobiliário) - REIT (Real Estate Investment Trusts)

  • Periodic Reports
  • DFIN (Demonstrações Financeiras de Fundos de Investimentos) - Investment Fund Financial Statements

SECURIT (Securitizadoras) - Securitization Companies

  • CRA (Certificado de Recebíveis do Agronegócio) - Agribusiness Receivables Certificate
  • CRI (Certificado de Recebíveis Imobiliários) - Real Estate Receivables Certificate
  • OTS (Operações de Transferência de Saldos) - Balance Transfer Operations

Additional Financial Instruments and Entities

  • Other investment funds
  • Equity Crowdfunding Platforms
  • Auditing Reports
  • Registration relating to Foreign Companies operating in Brazil
  • Other relevant financial and regulatory documents

Installation

You can install CVM-SQLite using pip:

pip install cvm-sqlite

Usage

from cvm_sqlite import CVMDataProcessor

# Initialize the processor
processor = CVMDataProcessor(
    db_path='path/to/your/database.db',
    cvm_url='https://dados.cvm.gov.br/dados/CIA_ABERTA',
    verbose=True
)

# Run the processor
processor.run()

# Now you can use the processor object to run queries
results = processor.query("""
    SELECT
        CAST(STRFTIME('%Y', DT_REFER) AS INTEGER) AS exercise,
        DENOM_CIA AS company,
        VL_CONTA AS net_income
    FROM dfp_cia_aberta_DRE
    WHERE CNPJ_CIA = '00.000.000/0001-91'
        AND GRUPO_DFP = 'DF Consolidado - Demonstração do Resultado'
        AND ORDEM_EXERC = 'ÚLTIMO'
        AND (
            (CD_CONTA = '3.09' AND STRFTIME('%Y', DT_REFER) < '2020')
            OR (CD_CONTA = '3.11' AND STRFTIME('%Y', DT_REFER) >= '2020')
        )
    ORDER BY exercise
""")

Parameters

Note: It is mandatory that the CVM directory includes a META folder at any level, which contains the table schemas.

How it works

If the database doesn't exist, it will be created. From the URL provided, all files and directories that can be accessed from this URL will be mapped. The tables are created according to the schema file provided by the CVM itself. If the database already exists, only necessary updates will be made, processing only new files or those whose last modification date has changed.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cvm_sqlite-1.1.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cvm_sqlite-1.1.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file cvm_sqlite-1.1.1.tar.gz.

File metadata

  • Download URL: cvm_sqlite-1.1.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cvm_sqlite-1.1.1.tar.gz
Algorithm Hash digest
SHA256 52321dcceb81318d3cf0be527d49e4d50a5945f2a9c5fec21dc3940ca2f86c73
MD5 874524546ebc820ea43b934fe9d4c254
BLAKE2b-256 ec4855d67efbe08a702b7d6a9fc777278f841837407f7dd240a0d5241eec8b66

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvm_sqlite-1.1.1.tar.gz:

Publisher: publish.yml on eduresser/cvm-sqlite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cvm_sqlite-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: cvm_sqlite-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cvm_sqlite-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eaed405427ccae5284b836b6c3134f759874b77ca528fcffffc819ee21873aae
MD5 a7531312f2ec6ed9a01b17ba9032e03b
BLAKE2b-256 128d6ba4b9662f78aa3f4b9e3f3122c40c84b4e2a33944d0ee213cb1e34b7c94

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvm_sqlite-1.1.1-py3-none-any.whl:

Publisher: publish.yml on eduresser/cvm-sqlite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page