Skip to main content

pysiebanxico

CI

An independent Python client for querying time series, historical data, and metadata from Banco de México's Economic Information System (SIE).

Status: version 0.1.0 is the initial public release. The public API will continue to evolve through documented, versioned releases.

Goal

pysiebanxico aims to provide a clear, typed, and tested interface for the SIE REST API. The initial public release covers historical data, current values, metadata, and optional pandas conversions. It does not include frequency conversion or a graphical interface.

Installation

Install the package from PyPI:

python3 -m pip install pysiebanxico

Planned usage

from pysiebanxico import BanxicoClient

client = BanxicoClient()  # Reads BANXICO_TOKEN from the environment.
series = client.get_series_data(["SF43718"], start_date="2024-01-01", end_date="2024-12-31")

for observation in series[0].observations:
    print(observation.date, observation.value)

The client also exposes get_current_value() for the latest published observation and get_series_metadata() for series titles in Spanish or English. It automatically splits requests containing more than 20 series, the maximum accepted by the SIE API. For transient network failures, server errors, or rate limits, opt into limited retries with BanxicoClient(max_retries=2).

Values such as N/E, N.D., ND, NA, and N/A are exposed as None while the original text remains available through Observation.raw_value.

Data utilities

Use dependency-free helpers to index results or export plain records:

from pysiebanxico import index_by_id, to_records

fix = index_by_id(series)["SF43718"]
records = to_records(series)

For pandas integration, install the optional extra:

python3 -m pip install "pysiebanxico[pandas]"
from pysiebanxico.pandas import metadata_to_dataframe, to_dataframe

long = to_dataframe(series)
wide = to_dataframe(series, layout="wide")
metadata_frame = metadata_to_dataframe(metadata)

The long layout contains series_id, title, date, value, and raw_value. The wide layout uses dates as its index and series identifiers as columns.

Development

python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -e ".[dev,pandas]"
pre-commit install
pre-commit run --all-files
pytest

See CONTRIBUTING.md for the complete workflow.

Security

Each user must use their own SIE token. Do not commit tokens, .env files, tokens.yaml, PyPI credentials, or API responses that contain them. Report security issues according to SECURITY.md.

Independence notice

This project is an independent library. It is not affiliated with, sponsored by, or endorsed by Banco de México. It uses Banco de México's public SIE API and requires each user to provide their own token.

License

Distributed under the MIT License.

Download files

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

Source Distribution

pysiebanxico-0.1.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

pysiebanxico-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file pysiebanxico-0.1.0.tar.gz.

File metadata

  • Download URL: pysiebanxico-0.1.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pysiebanxico-0.1.0.tar.gz
Algorithm Hash digest
SHA256 744bf388753bc42f68ccae0445284ff258f76e5a5a77303c872bddab1beb6e45
MD5 947ae1c122e5c6b2f288719325824526
BLAKE2b-256 7744176ae7cb7137fd576b36128772199e2ffa2a9feba3fe52ea1972cd306323

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysiebanxico-0.1.0.tar.gz:

Publisher: publish.yml on guadaloop-07/pysiebanxico

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

File details

Details for the file pysiebanxico-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysiebanxico-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pysiebanxico-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ecb4c40f092e8da427535dcccd2967cda744b8dc7883c590da95820e4a19c96
MD5 d2733399bf7e5bc8fdc06e72fcc0ad0b
BLAKE2b-256 8c15047d6b1c02519faf33815002fb740ecc3041d8a531816c397efde89cda46

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysiebanxico-0.1.0-py3-none-any.whl:

Publisher: publish.yml on guadaloop-07/pysiebanxico

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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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