pysiebanxico
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
744bf388753bc42f68ccae0445284ff258f76e5a5a77303c872bddab1beb6e45
|
|
| MD5 |
947ae1c122e5c6b2f288719325824526
|
|
| BLAKE2b-256 |
7744176ae7cb7137fd576b36128772199e2ffa2a9feba3fe52ea1972cd306323
|
Provenance
The following attestation bundles were made for pysiebanxico-0.1.0.tar.gz:
Publisher:
publish.yml on guadaloop-07/pysiebanxico
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysiebanxico-0.1.0.tar.gz -
Subject digest:
744bf388753bc42f68ccae0445284ff258f76e5a5a77303c872bddab1beb6e45 - Sigstore transparency entry: 2304484738
- Sigstore integration time:
-
Permalink:
guadaloop-07/pysiebanxico@43e07864db8496afbcc34458fed9a2fb44a37509 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/guadaloop-07
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43e07864db8496afbcc34458fed9a2fb44a37509 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ecb4c40f092e8da427535dcccd2967cda744b8dc7883c590da95820e4a19c96
|
|
| MD5 |
d2733399bf7e5bc8fdc06e72fcc0ad0b
|
|
| BLAKE2b-256 |
8c15047d6b1c02519faf33815002fb740ecc3041d8a531816c397efde89cda46
|
Provenance
The following attestation bundles were made for pysiebanxico-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on guadaloop-07/pysiebanxico
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysiebanxico-0.1.0-py3-none-any.whl -
Subject digest:
3ecb4c40f092e8da427535dcccd2967cda744b8dc7883c590da95820e4a19c96 - Sigstore transparency entry: 2304484879
- Sigstore integration time:
-
Permalink:
guadaloop-07/pysiebanxico@43e07864db8496afbcc34458fed9a2fb44a37509 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/guadaloop-07
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43e07864db8496afbcc34458fed9a2fb44a37509 -
Trigger Event:
workflow_dispatch
-
Statement type: