- Async API Support — All modules now have async counterparts:
sgs.async_get(),sgs.async_get_json(),currency.async_get(),ODataQuery.async_text(),ODataQuery.async_collect(),Endpoint.async_get()for concurrent data fetching withasyncio.gather() - Logging Infrastructure — Debug-level logging for all HTTP requests/responses (URL, status, response length) and warning-level logging for connection retry attempts across currency, sgs, and odata modules
- Comprehensive Test Coverage — Added 36 new tests: 12 negative tests for currency API (404/429/500 errors, malformed CSV), 15 negative tests for SGS API (malformed JSON, invalid inputs), 9 async tests; total 103 unit tests with proper mock isolation
- Example Scripts — Added
examples/directory with 4 comprehensive usage examples: SGS time series, currency exchange rates, OData queries with filters/sorting, and async API usage (all translated to Portuguese) - Async Documentation — New
docs/async.rstwith comprehensive guide to async APIs, examples withasyncio.gather(), performance comparisons, and semaphore patterns - Portuguese Documentation — Translated README.md and all example scripts to Portuguese (docstrings and comments)
- Enhanced Documentation — Added "Which Module to Use?" decision table and FAQ section to README covering module differences, data coverage, async usage, error handling, logging setup, caching, and long-running applications
- Factory Functions in tests/conftest.py — Parameterizable mock data generators:
make_currency_id_list_html(),make_currency_list_csv(),make_currency_rate_csv(),make_sgs_response(),make_odata_metadata_xml(),make_odata_query_response() - Cache Clearing Fixtures — Added automatic OData metadata cache clearing between tests to prevent pytest-httpx mock assertion errors
- Sidebar Navigation — Configured Furo theme with global sidebar navigation appearing on all documentation pages
- Exception Handling — Updated
bcb/currency.pyget()function to wrap_get_symbol()calls in try-except, allowing skipping of missing currencies while maintaining fail-fast for internal errors (per Phase 2 architecture) - Test Organization — Added
clear_odata_cachefixture for proper test isolation; fixedtest_clear_cacheto use new_ThreadSafeCacheAPI; renamedtest_get_symbol_unknown_currency_returns_nonetotest_get_symbol_unknown_currency_raisesto match fail-fast semantics - Cache Management — Added explicit
_CacheKeynamedtuple for structured cache keys in currency module; enhanced thread-safe cache with clear, get, set operations
- Cache State Issues — Resolved pytest-httpx unused mock assertions by implementing
clear_odata_cachefixture that clears global_METADATA_CACHEbetween tests - Test Failures — Fixed 2 failing tests (
test_clear_cache,test_get_symbol_unknown_currency_returns_none) to work with Phase 2 architecture changes and Phase 3 cache refactor - Example API Constraints — Updated examples to respect API limits:
last=20(not 30) for SGS; fixed OData filter syntax andselect()variadic arguments
- Added
output="text"parameter tosgs.get(),currency.get(),EndpointQuery.collect(), andEndpoint.get()— returns raw API response text (JSON for SGS and OData, CSV for currency) instead of a DataFrame; multi-code/symbol calls returndict[key, str]; default behavior unchanged - Migrated from Poetry to uv for package management (PEP 621 + hatchling build backend)
- Replaced
blackandpycodestylewithrufffor linting and formatting
- Replaced
requestswithhttpxas the sole HTTP client across all modules - Added custom exceptions:
BCBError,BCBAPIError,CurrencyNotFoundError,SGSError,ODataError - Added full type annotations with
mypy --strictcompliance - Added
DATE_COLUMNSclass attribute toBaseODataAPIfor configurable date column detection - Renamed internal
CACHEto_CACHEincurrencymodule; addedcurrency.clear_cache() - Overhauled test suite with mocked HTTP unit tests and a separate
tests/integration/layer - Added CI/CD workflows: test matrix (Python 3.10–3.12), lint (black + mypy), Sphinx docs build
- Fixed Sphinx docs build: updated
taxajurosexample to match BCB API rename of'Cheque especial - Pré-fixado'→'Cheque especial - Prefixado'
- Improved error handling in SGS API
- Added type hints to the bcb.sgs and sgs.currency modules
- Added function sgs.get_json to retrieve raw JSON data returned from SGS API
- Poetry lock file updated
- Replaced http with https in SGS URL
- Add Regional economy series support (tks @anapaulagomes)
- Dependencies updated
- Date columns of some OData API endpoints are now formatted in the returned Dataframe (Issue #3)
- New methods ODataQuery.raw and ODataQuery.text
- Created class bcb.ODataAPI to directly wrap OData APIs
- Updated documentation
- Updated pyproject.toml
- Updated documentation
- Migrated to poetry
- Added httpx to install_requirements
- Updated docs
- sgs.TaxaJuros upgraded to v2
- Updated README
- Updated requirements files including
httpx - Added
autosummary_generateto sphinx conf.py
- Implemented the definetive wraper for OData APIs.
- A few APIs have been unlocked: Expectativas, PTAX, taxaJuros, MercadoImobiliario, SPI
- Updated documentation
- Changed arguments start_date and end_date to start and end to bring conformity with commom python data libraries like Quandl and pandas-datareader, for example.
- bcb.currency.get multi argument, which refers to multivariate time series returned (defaults to True)
- bcb.sgs.get groupby argument
- Sphinx docs implemented
- BUG fix in get_valid_currency_list: recurrent ConnectionError
- Added side and group_by arguments to currency.get function
- New notebooks with examples
- Added join argument to sgs.get function
- New sgs module downloads time series from SGS BACEN's site
- Notebooks created to show a few examples
- Date class moved to utils module
- Bug fixes
- First commit
- currency module downloads currency rates quoted in Brazilian Real (BRL)