Skip to main content

Filings B3 Filings B3

Project Status: Active Python Version PyPI Version Snyk Vulnerabilities Snyk License PyPI Downloads Linting Formatting: isort Test Coverage License Open Issues Contributions Welcome

Simple and efficient Python library to interact with B3 (Brazil's exchange) public datasets. Each reader turns one trading session into a typed, contract-validated pandas.DataFrame carrying provenance — money as exact Decimal, never a lossy float.

✨ Key Features

📊 Daily Bulletin (BDI) readers

🔒 Fidelity by construction

  • Explicit typing — every column typed on load, never pandas' inference.
  • Exact decimals — money and any value whose fractional part matters is decimal.Decimal, never a binary float.
  • Contracts — a source that drops a required column fails loudly with ContractError, verified against B3's own published layouts.

🧾 Provenance & bronze layer

  • Six provenance columns on every frame (url, updated_at, source_key, package_version, ingestion_run_id, content_hash).
  • Pass path_raw= to retain each untouched source page for a datalake's bronze layer.

🚀 Getting Started

Prerequisites

  • Python 3.10+
  • Poetry (recommended)
  • Optional: Makefile

Installation

Option 1: Pip (recommended)

pip install filings-b3

Option 2: Build from source

git clone https://github.com/guilhermegor/filings-b3.git
cd filings-b3
pyenv install 3.12.2
pyenv local 3.12.2
poetry install --no-root
poetry shell

Basic usage

from datetime import date
from filings_b3 import BdiBtbLendingOpenPositionsReader

df = BdiBtbLendingOpenPositionsReader(date(2025, 1, 2)).read()
print(df[["TCKR_SYMB", "STOCK_BALANCE", "BALANCE"]].head())

date_ref is required — the BDI endpoint is date-addressed, so there is no "latest" default. See the documentation for every reader and more recipes.

Running Tests

poetry run pytest tests/unit/ -v
poetry run pytest tests/integration/ -v

📂 Project Structure

filings-b3/
├── .github/
│   ├── workflows/
│   ├── CODEOWNERS
│   └── PULL_REQUEST_TEMPLATE.md
├── assets/
│   └── b3-logo.jpg
├── bin/
├── docs/
├── src/filings_b3/
│   ├── daily_bulletin/          # Boletim Diário do Pregão (BDI) readers
│   ├── search_trading_session/  # Pesquisa por Pregão readers
│   └── _internal/               # private: contracts, utils, ports
├── tests/
│   ├── unit/
│   ├── integration/
│   └── performance/
├── LICENSE
├── Makefile
├── poetry.lock
├── pyproject.toml
├── README.md
└── requirements.txt

👨‍💻 Authors

📜 License

This project is licensed under the MIT License — see LICENSE.

Metadata

Release files for opendata-b3 0.1.2

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

Source distribution (sdist)

Source distribution for opendata-b3 0.1.2
File Size Uploaded Provenance Actions
opendata_b3-0.1.2.tar.gz 54.7 kB With provenance Details for opendata_b3-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opendata-b3 0.1.2
File Interpreter ABI Platform Actions
opendata_b3-0.1.2-py3-none-any.whl Python 3 none any Details for opendata_b3-0.1.2-py3-none-any.whl

Total release size: 130.2 kB

Release files / opendata_b3-0.1.2.tar.gz

Download URL opendata_b3-0.1.2.tar.gz
Size 54.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4a5420af6887d95b56df6121ab6547bd5c7730422621df8df84f87ad3fd6cf80
BLAKE2b-256 checksum
How to use checksums
07f367549e606cbbb05945eaef992e5ae02282954496e480fa6f2e33f93fe975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / opendata_b3-0.1.2-py3-none-any.whl

Download URL opendata_b3-0.1.2-py3-none-any.whl
Size 75.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58e8069d41be143d2e25b7c6a5ee05d53eb583a2c9a34eac75ef35ddce9bf896
BLAKE2b-256 checksum
How to use checksums
ce4a56617fa2cf305c2f714f999905a03b345840e16aa1f7f5ddee84a40104e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for opendata-b3 0.1.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opendata_b3-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

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