Skip to main content

allratestoday-central-bank

PyPI version Python license zero dependencies ECB EUR/USD today

Official exchange rates for Python, as published by 121 central banks and 3 tax authorities — ECB, Federal Reserve, Bank of Japan, Bank of England, HMRC, US Treasury and more. The latest table of every source works without an API key. Zero dependencies.

🚀 Why this package?

  • 🏛️ Published rates, not estimates — each number is what a named institution printed, with that institution's own rate_date
  • 🔓 No key for the latest table — latest() reads an open, edge-cached endpoint for any of the 124 sources
  • 🌍 One client, every source — switch from the ECB to HMRC to the Reserve Bank of India by changing one string
  • 🔀 Published vs derived, always flagged — computed pairs carry derived: True and are never crossed between institutions
  • 📊 Cross-source comparison — one pair across every institution with spread statistics
  • 📅 Publication calendars — which dates a source actually published, for audit trails
  • ⚡ Zero dependencies — standard library only, Python 3.9+, typed (py.typed)

📦 Installation

pip install allratestoday-central-bank

🏁 Quick start

from allratestoday_central_bank import CentralBankRates

cb = CentralBankRates()                  # no API key needed
pair = cb.latest("ecb", source="EUR", target="USD")

print(pair["rate"], "published", pair["rate_date"])
# 1.1253 published 2026-10-16

⚖️ Which rate is this?

Not a market rate. A published rate: the number a named institution put out for a given day, fixed once published, carrying that institution's own date.

That distinction is the whole reason this package exists. Compliance rules almost never say "use the current market rate" — they name a publisher and a date. The ECB reference rate on the invoice date. The HMRC monthly rate for the period. The two routinely differ by a percent or more, so a VAT return computed from a live market rate produces numbers nobody can reconcile.

Use this package for invoices, VAT and tax returns, customs valuation, transfer pricing, month-end and statutory accounting, and audit evidence.

For live mid-market rates — price display, checkout, conversion UI — use allratestoday instead.

⚡ Works without an API key

latest() reads an open, edge-cached endpoint, so the newest published table of any source needs no signup:

cb = CentralBankRates()

cb.latest("ecb")                                   # full ECB table
cb.latest("hmrc")                                  # HMRC's published rates
cb.latest("boj", source="USD", target="JPY")       # one pair

A pair response looks like this:

{
    "bank": "ecb", "rate_date": "2026-10-16",
    "source": "EUR", "target": "USD", "rate": 1.1253,
    "rate_type": "reference", "derived": False, "method": "published",
    "age_days": 3, "stale": False, "cadence": "daily",
    "attribution": {"source": "Official rates published by ECB, served by AllRatesToday", ...},
}

🔑 API key

A free API key (no card) adds the source list, publication calendars and cross-source comparison. Historical dates and time series (for_date, history) need a paid plan; free and trial keys get a 403. Your key and plan live on the dashboard.

cb = CentralBankRates(api_key="art_live_...")

📚 API reference

Method Key? Returns
latest(bank, source=None, target=None) no Newest published table, or one pair from it
sources() free key Every covered institution with coverage dates
availability(bank, year=...) free key Which dates the institution actually published
compare(source, target) free key One pair across every institution, with spread stats
for_date(bank, on, source=None, target=None) paid plan The table in force on a date
history(bank, symbol=..., from_date=..., to_date=...) paid plan Date-by-date official series

bank is the source code used across AllRatesToday — ecb, fed, boe, boj, rbi, hmrc, cbsl and so on; the full list is on the central bank and tax authority hubs. Dates accept "YYYY-MM-DD", datetime.date, or datetime.datetime.

cb = CentralBankRates(api_key="art_live_...")

cb.compare("USD", "EUR")              # {"count": 111, "banks": [{"code": "amcm", "rate": ..., "rate_date": ...}, ...]}
cb.availability("ecb", year=2026)     # {"count": ..., "dates": ["2026-01-02", "2026-01-05", ...]}

🌍 Covered sources

121 central banks and 3 tax authorities. Pass the Code as bank (e.g. cb.latest("rbi")). Every source's latest table is keyless.

Tax authorities

Code Institution Country Currency Publishes Archive from
bazg Swiss Federal Office for Customs and Border Security Switzerland CHF daily 2000
hmrc HM Revenue & Customs United Kingdom GBP monthly 2021
ustreasury U.S. Department of the Treasury United States USD quarterly 2001

Central banks

Code Institution Country Currency Publishes Archive from
boa Bank of Albania Albania ALL daily 2026
bda Bank of Algeria Algeria DZD daily 2000
bna National Bank of Angola Angola AOA daily 1999
bcra Central Bank of Argentina Argentina ARS daily 2000
cba Central Bank of Armenia Armenia AMD daily 2000
rba Reserve Bank of Australia Australia AUD daily 2023
cbar Central Bank of Azerbaijan Azerbaijan AZN daily 2016
cbb Central Bank of Bahrain Bahrain BHD daily 2016
bb Bangladesh Bank Bangladesh BDT daily 2010
cbbd Central Bank of Barbados Barbados BBD daily 2010
nbrb National Bank of the Republic of Belarus Belarus BYN daily 2016
cbbz Central Bank of Belize Belize BZD daily 2010
rma Royal Monetary Authority of Bhutan Bhutan BTN daily 2024
bcbol Banco Central de Bolivia Bolivia BOB daily 2016
cbbh Central Bank of Bosnia and Herzegovina Bosnia and Herzegovina BAM daily 2016
bob Bank of Botswana Botswana BWP daily 2026
bcb Banco Central do Brasil Brazil BRL daily 2016
bnb Bulgarian National Bank Bulgaria EUR daily 2016
nbc National Bank of Cambodia Cambodia KHR daily 2016
boc Bank of Canada Canada CAD daily 2017
beac Bank of Central African States (BEAC) Central Africa (CEMAC) XAF daily 2026
bcch Central Bank of Chile Chile CLP daily 1982
pboc People's Bank of China China CNY daily 2026
sfc Superintendencia Financiera de Colombia Colombia COP daily 1991
bccr Banco Central de Costa Rica Costa Rica CRC daily 2026
bccu Banco Central de Cuba Cuba CUP daily 2025
cnb Czech National Bank Czech Republic CZK daily 2016
bcc Banque Centrale du Congo DR Congo CDF daily 2026
dnb Danmarks Nationalbank Denmark DKK daily 2016
bcrd Banco Central de la República Dominicana Dominican Republic DOP daily 1991
cbe Central Bank of Egypt Egypt EGP daily 2026
nbe National Bank of Ethiopia Ethiopia ETB daily 2024
ecb European Central Bank Eurozone EUR daily 1999
rbf Reserve Bank of Fiji Fiji FJD daily 2001
nbg National Bank of Georgia Georgia GEL daily 2016
bog Bank of Ghana Ghana GHS daily 2007
banguat Banco de Guatemala Guatemala GTQ daily 2004
bogy Bank of Guyana Guyana GYD weekly 2026
brh Banque de la République d'Haïti Haiti HTG daily 2026
bch Banco Central de Honduras Honduras HNL daily 2019
hkma Hong Kong Monetary Authority Hong Kong HKD monthly 1981
mnb Magyar Nemzeti Bank Hungary HUF daily 2016
cbi Central Bank of Iceland Iceland ISK daily 2016
rbi Reserve Bank of India India INR daily 2003
bi Bank Indonesia Indonesia IDR daily 2016
cbiq Central Bank of Iraq Iraq IQD daily 2009
boi Bank of Israel Israel ILS daily 1975
bdi Banca d'Italia Italy EUR daily 2016
bojm Bank of Jamaica Jamaica JMD daily 2000
boj Bank of Japan Japan JPY daily 1998
cbj Central Bank of Jordan Jordan JOD daily 2026
nbk National Bank of Kazakhstan Kazakhstan KZT daily 2016
cbke Central Bank of Kenya Kenya KES daily 2024
cbk Central Bank of Kuwait Kuwait KWD daily 2008
nbkr National Bank of the Kyrgyz Republic Kyrgyzstan KGS daily 2026
bol Bank of the Lao PDR Laos LAK daily 2021
cbl Central Bank of Libya Libya LYD daily 2015
lb Bank of Lithuania Lithuania EUR daily 2015
amcm Monetary Authority of Macao Macao MOP daily 1999
bfm Central Bank of Madagascar (BFM) Madagascar MGA daily 2023
rbm Reserve Bank of Malawi Malawi MWK daily 2016
bnm Bank Negara Malaysia Malaysia MYR daily 2020
mma Maldives Monetary Authority Maldives MVR daily 2011
bcm Banque Centrale de Mauritanie Mauritania MRU daily 2023
bmu Bank of Mauritius Mauritius MUR daily 2026
banxico Banco de México Mexico MXN daily 1993
nbm National Bank of Moldova Moldova MDL daily 1994
bom Bank of Mongolia Mongolia MNT daily 2026
bam Bank Al-Maghrib Morocco MAD daily 2000
bdm Banco de Moçambique Mozambique MZN daily 2026
cbm Central Bank of Myanmar Myanmar MMK daily 2012
bon Bank of Namibia Namibia NAD daily 2026
nrb Nepal Rastra Bank Nepal NPR daily 1998
rbnz Reserve Bank of New Zealand New Zealand NZD daily 1999
bcn Banco Central de Nicaragua Nicaragua NIO daily 2012
cbn Central Bank of Nigeria Nigeria NGN daily 2001
nbrm National Bank of North Macedonia North Macedonia MKD daily 1993
norges Norges Bank Norway NOK daily 2016
cbo Central Bank of Oman Oman OMR daily 2022
sbp State Bank of Pakistan Pakistan PKR daily 2017
pma Palestine Monetary Authority Palestine ILS daily 2026
bcp Banco Central del Paraguay Paraguay PYG daily 2016
bcrp Central Reserve Bank of Peru Peru PEN daily 2016
bsp Bangko Sentral ng Pilipinas Philippines PHP daily 2026
nbp Narodowy Bank Polski Poland PLN daily 2016
qcb Qatar Central Bank Qatar QAR daily 2024
bnr National Bank of Romania Romania RON daily 2005
cbr Bank of Russia Russia RUB daily 2016
bnrw National Bank of Rwanda Rwanda RWF daily 2012
sama Saudi Central Bank (SAMA) Saudi Arabia SAR monthly_average 2009
nbs National Bank of Serbia Serbia RSD daily 2016
bsl Bank of Sierra Leone Sierra Leone SLE daily 2026
mas Monetary Authority of Singapore Singapore SGD daily 1988
sarb South African Reserve Bank South Africa ZAR daily 2000
bok Bank of Korea South Korea KRW daily 1964
cbsl Central Bank of Sri Lanka Sri Lanka LKR daily 2010
cbvs Central Bank of Suriname Suriname SRD daily 2009
riksbank Sveriges Riksbank Sweden SEK daily 2016
snb Swiss National Bank Switzerland CHF monthly_average 1914
bcstp Banco Central de São Tomé e Príncipe São Tomé and Príncipe STN daily 2026
cbc Central Bank of the Republic of China (Taiwan) Taiwan TWD daily 2008
nbt National Bank of Tajikistan Tajikistan TJS daily 2010
botz Bank of Tanzania Tanzania TZS daily 2010
bot Bank of Thailand Thailand THB daily 2002
cbg Central Bank of The Gambia The Gambia GMD daily 2026
cbtt Central Bank of Trinidad and Tobago Trinidad and Tobago TTD daily 1991
bct Central Bank of Tunisia Tunisia TND daily 2004
cbt Central Bank of Turkmenistan Turkmenistan TMT daily 2009
tcmb Central Bank of Türkiye Türkiye TRY daily 2020
bou Bank of Uganda Uganda UGX daily 2026
nbu National Bank of Ukraine Ukraine UAH daily 1996
cbuae Central Bank of the UAE United Arab Emirates AED daily 2019
boe Bank of England United Kingdom GBP daily 2016
fed US Federal Reserve United States USD weekly 2016
bcu Central Bank of Uruguay Uruguay UYU daily 2000
cbu Central Bank of Uzbekistan Uzbekistan UZS daily 2016
bcv Central Bank of Venezuela Venezuela VES daily 2016
sbv State Bank of Vietnam Vietnam VND daily 2009
boz Bank of Zambia Zambia ZMW daily 2026
rbz Reserve Bank of Zimbabwe Zimbabwe ZWG daily 2024
bceao Central Bank of West African States (BCEAO) eight WAEMU countries XOF daily 2014

🧭 Three things that will bite you

1. rate_date is the answer, not the date you asked for. Most institutions publish on business days only. Ask for a Sunday and you get the previous publication, with rate_date saying which day it really is. Record that date — it is the audit trail.

table = cb.for_date("ecb", "2026-01-04")   # a Sunday
table["rate_date"]                          # '2026-01-02'

2. derived: True means the institution did not publish that pair. It was cross-computed within that institution's own table. Fine for display; say so if the number goes into a filing, and never derive one institution's rate from another's — an ECB rate crossed through USD is not an HMRC rate.

3. Cadence differs by source. The Fed's H.10 is weekly, the SNB publishes monthly averages, the US Treasury is quarterly, most central banks are daily. Check cadence on the response, or sources(), before assuming yesterday's rate exists.

🧾 Worked example: converting an invoice

from allratestoday_central_bank import CentralBankRates

cb = CentralBankRates(api_key="art_live_...")

def invoice_total_in_gbp(amount_usd: float, invoice_date: str) -> tuple[float, str]:
    """Convert at the HMRC rate in force on the invoice date."""
    published = cb.for_date("hmrc", invoice_date, source="USD", target="GBP")
    total = amount_usd * published["rate"]
    # Return the publication date alongside the number: it is what an auditor
    # will ask for, and it is not necessarily the invoice date.
    return round(total, 2), published["rate_date"]

🛡️ Error handling

Every failure raises CentralBankError, with the HTTP status on .status when the server answered. Calls that need a key raise its subclass NeedsApiKeyError before any request is made, with sign-up instructions in the message.

from allratestoday_central_bank import CentralBankRates, CentralBankError, NeedsApiKeyError

try:
    CentralBankRates(api_key="art_live_...").for_date("ecb", "2026-01-15")
except NeedsApiKeyError as err:
    print(err)                  # no key configured
except CentralBankError as err:
    print(err, err.status)      # e.g. 403 on a free key: dated tables need a paid plan
Status Meaning
None No key configured (NeedsApiKeyError), or a network error
401 Invalid API key
403 Your plan does not include this call
404 The source does not publish that pair or date
429 Quota or rate limit reached

🧩 ERP & accounting systems

Loading an official rate into an accounting system? Step-by-step guides with the direction each system expects: Business Central · Xero · QuickBooks Online · SAP · Odoo.

🤖 AI agents

  • MCP server: npx -y @allratestoday/central-bank-mcp, or the hosted keyless endpoint https://allratestoday.com/api/mcp
  • Claude Code plugin: /plugin marketplace add AllRates-Today/claude-code-plugin
  • Trial key for agents (no signup): POST https://allratestoday.com/api/agent/keys with Content-Type: application/json → 100 calls over 7 days for latest rates and latest tables (dated tables and history are paid-plan only); MCP tool request_trial_key

📦 Also available

📥 Bulk data (no key)

Need the whole archive rather than an API call? The same published tables are mirrored daily as open data, one CSV per institution: Hugging Face · Kaggle (CC BY-NC 4.0).

📜 License

MIT. Rates are served as published by the named institution; AllRatesToday is not affiliated with any of them.

Metadata

Release files for allratestoday-central-bank 1.0.6

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

Source distribution (sdist)

Source distribution for allratestoday-central-bank 1.0.6
File Size Uploaded Provenance Actions
allratestoday_central_bank-1.0.6.tar.gz 22.5 kB Without provenance Details for allratestoday_central_bank-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for allratestoday-central-bank 1.0.6
File Interpreter ABI Platform Actions
allratestoday_central_bank-1.0.6-py3-none-any.whl Python 3 none any Details for allratestoday_central_bank-1.0.6-py3-none-any.whl

Total release size: 36.7 kB

Release files / allratestoday_central_bank-1.0.6.tar.gz

Download URL allratestoday_central_bank-1.0.6.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8acac6903ed3217b5bdd57071c72d0da826d52650b4658ee6f8145187fc84c52
BLAKE2b-256 checksum
How to use checksums
51721b2f0f48de3c7955af763789eb6f2b05d102c0134b8f27054e4218d46125
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / allratestoday_central_bank-1.0.6-py3-none-any.whl

Download URL allratestoday_central_bank-1.0.6-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b101627afe89da88bda314b3e94d3cceeb473f0e097f299f990d958f89a68d74
BLAKE2b-256 checksum
How to use checksums
c21a5b098080c8551a467e61fe3e5ba846bfa3c159378c561b1c5a9633cb0b0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for allratestoday-central-bank 1.0.6

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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