Skip to main content

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.3

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

Source distribution (sdist)

Source distribution for bvc-renta-fija 0.3.3
File Size Uploaded Provenance Actions
bvc_renta_fija-0.3.3.tar.gz 25.2 kB With provenance Details for bvc_renta_fija-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bvc-renta-fija 0.3.3
File Interpreter ABI Platform Actions
bvc_renta_fija-0.3.3-py3-none-any.whl Python 3 none any Details for bvc_renta_fija-0.3.3-py3-none-any.whl

Total release size: 47.3 kB

Release files / bvc_renta_fija-0.3.3.tar.gz

Download URL bvc_renta_fija-0.3.3.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6cb766a53529ee1a5b4e88b0e026af670be11dcd15b098c2dfbbac362391bf4a
BLAKE2b-256 checksum
How to use checksums
01b5f2d89e49dd335ac0bfdcaf158f1850eff48d0b2f5485cd8a0e1e85969b31
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 log

Release files / bvc_renta_fija-0.3.3-py3-none-any.whl

Download URL bvc_renta_fija-0.3.3-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba2f15339ae52472477c8fdc26f93e4f609361d761171189b3c1e348cbda8dff
BLAKE2b-256 checksum
How to use checksums
22aae8b00dfe1ee15b3a942d2fdbc114cbfe0f0c445d4fe7a5e934e3e87db522
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 log

Security for bvc-renta-fija 0.3.3

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 bvc_renta_fija-0.3.3.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 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