python-bcb
What it is and what it does
python-bcb is a Python wrapper for the Brazilian Central Bank's open data APIs, providing structured access to economic and financial datasets. It abstracts three main data sources: SGS (time-series economic indicators like interest rates and inflation), a currency converter for daily exchange rates, and OData endpoints for market expectations, interest rates, real estate financing, and financial institution data.
The package handles HTTP requests via httpx with connection pooling, parses responses into pandas DataFrames, and supports both synchronous and asynchronous retrieval. It includes built-in retry logic via tenacity, caches metadata where appropriate, and raises specific exceptions for common failure modes (rate limits, invalid series codes, missing currencies). Typical use is fetching historical economic time series for analysis, but it also supports ad-hoc queries with SQL-like filtering on OData endpoints.
Use it for:
- Fetch historical Selic or IPCA rates for inflation and interest rate analysis.
- Retrieve daily USD/BRL exchange rates with buy/sell spreads for currency trading or financial reporting.
- Query market consensus forecasts from the FOCUS bulletin for economic scenario planning.
- Build dashboards or reports aggregating multiple BCB data sources concurrently with async methods.
- Access real estate financing data and financial institution balance sheets for regulatory or research analysis.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Structured Python interface to fetch Brazilian Central Bank open data APIs, including time series, exchange rates, market expectations, and financial institution information.
Yes, if you need Brazilian Central Bank data. The package is actively maintained, has low install friction, and provides a clean interface to otherwise fragmented APIs. License treatment is unclear, so verify terms before use in proprietary projects. No known vulnerabilities. Requires Python 3.10+.
Install
python-bcb on PyPI
pip
pip install python-bcbuv
uv add python-bcbpoetry
poetry add python-bcbInstalling python-bcb
Before you install
Low install friction with a pure-wheel distribution. Active maintenance with a release 60 days ago. Requires Python 3.10 or later.
Quickstart
pip install python-bcb
from bcb import sgs
df = sgs.get(1, start="2023-01-01", end="2024-12-31")
Requires Python 3.10 or later.
Verify before relying
- License classification is unclear in the fact sheet; verify actual license terms before use in proprietary or GPL-incompatible projects.
- Rate limiting behavior and retry strategy details are not specified; confirm handling for production workloads.
- Async API stability and connection pooling behavior under sustained load are not documented in the fact sheet.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — httpx, lxml, pandas, tenacity |
| Maintenance | actively maintained — 60 days since the last release |
| First released | |
| Downloads | 110,379/month — #12,465 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_bcb-0.4.0-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
tradingeconomicsProvides Python access to over 300,000 economic…
permissive · top 15,000 on PyPI
openbb-fixedincomeProvides fixed income market data—government…
agpl · top 15,000 on PyPI
forex-pythonFetches current and historical foreign exchange…
permissive · top 15,000 on PyPI
validate-docbrValidates and generates Brazilian identity and…
permissive · top 15,000 on PyPI
openbb-tradingeconomicsIntegrates Trading Economics data into the…
agpl · top 15,000 on PyPI
wbdataWbdata provides a Python interface to query and…
copyleft · top 5,000 on PyPI
openbb-federal-reserveIntegrates Federal Reserve data sources into…
agpl · top 15,000 on PyPI
clabeValidates and generates CLABE numbers, Mexico's…
permissive · top 15,000 on PyPI
openplantbook-sdkPython SDK for querying the Open Plantbook API…
permissive · top 15,000 on PyPI
BrazilFiscalReportConverts Brazilian electronic invoice XML files…
agpl · top 15,000 on PyPI