Skip to content

Instantly share code, notes, and snippets.

@cdiaz
Last active February 28, 2025 21:45
Show Gist options
  • Save cdiaz/a623334ee994a836cba3 to your computer and use it in GitHub Desktop.
Save cdiaz/a623334ee994a836cba3 to your computer and use it in GitHub Desktop.
Obtener La tasa de cambio representativa del mercado (TRM) para Colombia consumiendo el webservice de la Superintentencia Financiera desde Python
#!/usr/bin/env python
from suds.client import Client
import time
WSDL_URL = 'https://www.superfinanciera.gov.co/SuperfinancieraWebServiceTRM/TCRMServicesWebService/TCRMServicesWebService?WSDL'
date = time.strftime('%Y-%m-%d')
def trm(date):
try:
client = Client(WSDL_URL, location=WSDL_URL, faults=True)
trm = client.service.queryTCRM(date)
except Exception as e:
return str(e)
return trm
print trm(date)
@luchito93
Copy link

Es la que he usado estos años, sin embargo hay una de datos.gov.co mas fácil de consumir que encontré hace poco:

https://www.datos.gov.co/resource/32sa-8pi3.json?vigenciadesde={yyyy-mm-dd}

Sobre todo si se implementa usando NodeJS, que fue el cambio que hice de pasar mi script de Python a Node

Muchas gracias me sirvio ese!

@fe-velazquez
Copy link

https://www.datos.gov.co

Funciona, pero sólo para USD, de CAD alguien conoce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment