bvc-renta-fija
Librería Python para extraer datos de renta fija de la Bolsa de Valores de Colombia (BVC) y generar reportes HTML visuales.
Segmentos
- Deuda pública — segmento público
- Deuda pública — segmento privado
- Deuda corporativa
Características
- Consulta por fecha única o rango
- Búsqueda e historial por nemotécnico
- Columnas derivadas: Prefijo (6 caracteres), Familia, Bucket de vencimiento
- Reporte HTML con gráficos (Chart.js): volumen por familia, vencimiento, prefijos (CDTBBO, CDTBCB…) y emisores
- Cache local en Parquet
Instalación
pip install -e ".[cache]"
playwright install chromium
Uso rápido — datos
from bvc_renta_fija import BVCRentaFija
with BVCRentaFija(headless=True, cache_dir="./cache") as client:
df = client.get_deuda_publica_segmento_publico(fecha="2025-10-15")
df = client.get_todo(fecha_inicio="2025-10-01", fecha_fin="2025-10-15")
hist = client.get_historial_nemotecnico(
nemotecnico="TFIT08031127",
fecha_inicio="2025-09-01",
fecha_fin="2025-10-15",
)
Uso rápido — reporte HTML
from bvc_renta_fija import generar_reporte_html
path = generar_reporte_html(fecha="2025-10-15", output_path="reporte.html")
print("Reporte en:", path)
Columnas base (BVC)
| Nemotécnico | Emisor | Clase de título | Fecha de vencimiento | Cantidad | Volúmenes |
Columnas derivadas (enriquecer)
| Prefijo | Familia | Bucket_vencimiento | Volumen_num | Cantidad_num |
- Prefijo: primeros 6 caracteres del nemotécnico (
CDTBBO,CDTBCB,TFIT08…) - Familia: TES Tasa Fija, TES UVR, TIDIS, CDT, Bonos, TDA, Otros
- Bucket: < 1 año | 1–3 | 3–5 | 5–10 | > 10 años
Ficha facial y operaciones de un título
La librería también puede abrir la ficha de una emisión y consultar las operaciones Contado desde el endpoint de mercado que usa el propio frontend oficial de BVC. Playwright se utiliza para iniciar la sesión pública del sitio y obtener los encabezados temporales requeridos; las filas se normalizan desde la respuesta JSON, no se reconstruyen a partir de datos sintéticos. En la BVC, un nemotécnico puede corresponder a varias emisiones y vencimientos; para seleccionar una emisión concreta, pase slug_url con la URL exacta del detalle cuando esté disponible.
from bvc_renta_fija import BVCRentaFija
with BVCRentaFija(headless=True) as client:
# Use el símbolo correcto: CDTBB080 (con cero) no es el ticker CDTBBO80 (con O).
ficha = client.get_detalle_titulo("CDTBBO80", segmento="deuda_corporativa")
ops = client.get_operaciones_titulo("CDTBBO80", fecha="2026-10-22", segmento="deuda_corporativa")
print(ficha)
print(ops)
get_operaciones_titulo devuelve las columnas Hora, Rueda, Precio, Tasa, Cantidad, Volúmenes y Procedencia, además de Nemotecnico, Fecha, Segmento y Fuente_datos. Solo se extraen filas que devuelve la API oficial en data.tab.contado; no se inventan operaciones si la BVC no devuelve movimientos. Si el sitio bloquea la sesión, no genera el encabezado temporal requerido o la API rechaza la consulta, se genera un error explícito en vez de devolver una tabla vacía que parezca un día sin operaciones.
get_operaciones_dia(fecha=..., max_titulos=20) ofrece una consolidación acotada por los primeros títulos únicos del listado. Para evitar carga innecesaria sobre la BVC, ajuste max_titulos; para una extracción exhaustiva, primero hay que confirmar límites de uso y disponibilidad de los datos de cada modalidad.
Importante sobre la validación: se comprobó en una sesión del sitio oficial que el endpoint devuelve tres operaciones para TFIT16300632 el 22 de octubre de 2026 (10:46, 10:50 y 11:42). Los valores de mercado se leen en tiempo de ejecución desde la respuesta de BVC; el caso se usa en pruebas de integración, no como dato hardcodeado de producción. Algunos entornos automatizados pueden recibir un 403 de CloudFront al abrir el sitio, lo que es una restricción de acceso del entorno y no una respuesta de mercado vacía.
Metadata
Release files for bvc-renta-fija 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bvc_renta_fija-0.3.4.tar.gz | 26.1 kB | With provenance | Details for bvc_renta_fija-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bvc_renta_fija-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for bvc_renta_fija-0.3.4-py3-none-any.whl |
Total release size: 48.4 kB
Release files / bvc_renta_fija-0.3.4.tar.gz
| Download URL | bvc_renta_fija-0.3.4.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bd82647f69fd2623d2c0ba5019e2905e2657d930f69a9c8584f9e82a2efcef0
|
|
BLAKE2b-256 checksum How to use checksums |
bdd08cb828d547a59ef8c3bc154beb888fccea582bc6761290116f1373a848ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 26, 2026.
Transparency logRelease files / bvc_renta_fija-0.3.4-py3-none-any.whl
| Download URL | bvc_renta_fija-0.3.4-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16a6298dc6fed514254bc46c618828e1c4d79bc515893ed8a014fbcaccaec545
|
|
BLAKE2b-256 checksum How to use checksums |
791f54d7d72e478f9a3f9c0b91bfc26cadfc557539d9409c441f6be54a4c535d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 26, 2026.
Transparency logSecurity for bvc-renta-fija 0.3.4
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.
Attestation for bvc_renta_fija-0.3.4.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 Oct 26, 2026.
Transparency logA 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.