Skip to main content

Banco Central Chile SDK

CI Codecov Documentation PyPI Python License

A Python client library for the Banco Central de Chile SieteRestWS API.

This repository provides sync and async wrappers over the API, returning data as pandas.DataFrame or polars.DataFrame and managing retries, timeout configuration, and error handling.

Features

  • Synchronous and asynchronous SDK layers
  • Built-in HTTP retries using httpx-retries
  • Configurable httpx.Timeout
  • Configurable sync/async concurrency limit
  • get_series(...) and search_series(...)
  • Output as pandas.DataFrame or polars.DataFrame
  • Standard logging integration using logging.getLogger(__name__)
  • Typed configuration and credentials

Requirements

  • Python 3.12+
  • httpx[brotli,zstd]
  • pydantic
  • httpx-retries

Pandas and Polars are optional in v2. Install only the backend your application uses.

Installation

This project uses a src/ layout and exposes the bcch_sdk package.

Use Poetry if available:

poetry install

For an installed package, choose an extra:

python -m pip install "bcch-sdk[polars]"
python -m pip install "bcch-sdk[pandas]"
python -m pip install "bcch-sdk[dataframe]"  # both backends

Or install the runtime dependencies manually:

python -m pip install httpx[brotli,zstd] pydantic httpx-retries

If you want to run code from the repository directly, make sure the src/ folder is on PYTHONPATH:

export PYTHONPATH=$(pwd)/src

Quickstart

Import the SDK classes and configure the client using BCChConfig.

Sync example

from httpx import Timeout
from bcch_sdk import BCChSyncSDK
from bcch_sdk.types import BCChConfig

config = BCChConfig(
    credentials={"username": "your_user", "password": "your_pass"},
    timeout=Timeout(10.0),
    max_concurrency=8,
)

sdk = BCChSyncSDK(configuration=config)

series_data = sdk.get_series(
    time_series="SF6041",
    first_date="2023-01-01",
    last_date="2023-12-31",
    polars_response=False,
)

print(series_data)

Async example

import asyncio
from httpx import Timeout
from bcch_sdk import BCChAsyncSDK
from bcch_sdk.types import BCChConfig

async def main() -> None:
    config = BCChConfig(
        credentials={"username": "your_user", "password": "your_pass"},
        timeout=Timeout(10.0),
    )

    sdk = BCChAsyncSDK(configuration=config)

    series_data = await sdk.get_series(
        time_series=["SF6041", "SF6060"],
        first_date="2023-01-01",
        last_date="2023-12-31",
        polars_response=True,
    )

    print(series_data)

asyncio.run(main())

Search series example

from bcch_sdk.types import Frequency

result = sdk.search_series(Frequency.MONTHLY, polars_response=False)
print(result)

Configuration

The main configuration object is BCChConfig from bcch_sdk.types.config.

max_concurrency controls both the maximum thread workers used by the sync SDK and in-flight tasks used by the async SDK. It defaults to 8 and must be greater than zero.

The Banco Central API requires credentials in its query string. The SDK does not log query parameters, but HTTPX logs complete request URLs at INFO; keep the httpx logger at WARNING or higher in production.

Requesting a DataFrame backend that is not installed raises MissingDataFrameDependencyException with the corresponding installation command. The low-level sync/async clients and Pydantic models work with the base installation and do not require either DataFrame library.

  • credentials: a typed dict with username and password
  • timeout: an httpx.Timeout object

The SDK clients use httpx under the hood and will apply retries and timeout settings automatically.

Logging

This library uses logging.getLogger(__name__) in each module. Consumers should configure handlers and levels in their own applications.

Example:

import logging

logging.basicConfig(level=logging.INFO)

Contributing

See CONTRIBUTING.md for contribution guidelines.

Security

See SECURITY.md for security reporting and vulnerability handling.

Code of Conduct

See CODE_OF_CONDUCT.md for community expectations.

Metadata

Release files for bcch-sdk 2.0.0

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

Source distribution (sdist)

Source distribution for bcch-sdk 2.0.0
File Size Uploaded Provenance Actions
bcch_sdk-2.0.0.tar.gz 14.3 kB With provenance Details for bcch_sdk-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bcch-sdk 2.0.0
File Interpreter ABI Platform Actions
bcch_sdk-2.0.0-py3-none-any.whl Python 3 none any Details for bcch_sdk-2.0.0-py3-none-any.whl

Total release size: 38.8 kB

Release files / bcch_sdk-2.0.0.tar.gz

Download URL bcch_sdk-2.0.0.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9dab822fc35615bd187b793586f97924e56f6046aa0e78bf74b87cab4b7012cb
BLAKE2b-256 checksum
How to use checksums
373373e4dbef13485ab25e049ae6565d7ebbfcc441a6727ad73ba3cef6dfa21a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / bcch_sdk-2.0.0-py3-none-any.whl

Download URL bcch_sdk-2.0.0-py3-none-any.whl
Size 24.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4413aa1c5d0d377d37e7a04690e7119592a750091376940438f8c3246e8642a3
BLAKE2b-256 checksum
How to use checksums
00bc37efb08f001cf3a3dbb4f00f5efdfeb8e3d1778d2a6e1d87beee68840825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Security for bcch-sdk 2.0.0

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 bcch_sdk-2.0.0.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 Aug 25, 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