Skip to main content

Biblioteca Python para consultar a PTAX de USD, GBP e EUR no Banco Central do Brasil.

Project description

xcamb

Biblioteca Python para consultar a PTAX oficial de USD, GBP e EUR usando o servico PTAX do Banco Central do Brasil.

Instalacao

pip install .

Uso

from datetime import datetime
import xcamb

data = datetime(2026, 4, 16)

xcamb.cotacao("USD", data)
# 5.0007

moeda = "gbp"
xcamb.cotacao(moeda, data)
# cotacao da Libra esterlina no dia

xcamb.cotacao("EUR", data)
# 5.8923

xcamb.help()
# mostra um guia rapido de uso

Regras da biblioteca

  • xcamb.cotacao(moeda, data) retorna a cotacao de venda da moeda no dia informado.
  • As moedas suportadas sao USD, GBP e EUR.
  • O codigo da moeda pode ser informado em maiusculas ou minusculas.
  • A moeda precisa ser uma str, inclusive quando vier de uma variavel.
  • A data precisa ser um datetime.datetime.
  • A biblioteca prioriza o boletim Fechamento PTAX. Se ele ainda nao existir no dia consultado, retorna o boletim mais recente disponivel.
  • Compatibilidade minima: Python 3.8.

Exemplo com variavel

from datetime import datetime
import xcamb

codigo = "eur"
data = datetime(2026, 4, 16, 12, 0, 0)

valor = xcamb.cotacao(codigo, data)

Fonte oficial

Project details


Download files

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

Source Distribution

xcamb-26.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

xcamb-26.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file xcamb-26.1.tar.gz.

File metadata

  • Download URL: xcamb-26.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for xcamb-26.1.tar.gz
Algorithm Hash digest
SHA256 a36db5b7793ab2f5ee508ae7f6f13920002337d198bc644ae75912ea0bb97669
MD5 c2254441f90ee0ba5cd6def9a70fc6c1
BLAKE2b-256 bd07e384847563157bf22801b4ed059c1562f50818f56c2fc925b6c0ba848bd5

See more details on using hashes here.

File details

Details for the file xcamb-26.1-py3-none-any.whl.

File metadata

  • Download URL: xcamb-26.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for xcamb-26.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc7d8409e75a81ac3f1ca4cab363154c53ccf51fc8a455b6e5a7f392aaabbaf2
MD5 972bd5176b2ad3a4dc0c42789c66d4bd
BLAKE2b-256 3a2f9d33b075e9f580f24a15254c61f21e50a959f7d51c495978d9c24d9a38ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page