allratestoday-central-bank
Official exchange rates as published by 100+ central banks and tax authorities — ECB, Federal Reserve, Bank of Japan, HMRC, US Treasury and more.
pip install allratestoday-central-bank
from allratestoday_central_bank import CentralBankRates
cb = CentralBankRates() # no API key needed
pair = cb.latest("ecb", source="USD", target="EUR")
print(pair["rate"], "published", pair["rate_date"])
# 0.8588851671 published 2026-08-28
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 free API key (no card) adds historical dates, time series, publication calendars and cross-source comparison:
cb = CentralBankRates(api_key="art_live_...")
Methods that need one raise NeedsApiKeyError — a subclass of
CentralBankError — with sign-up instructions, before making any request.
API
| Method | Key? | Returns |
|---|---|---|
latest(bank, source=None, target=None) |
no | Newest published table, or one pair from it |
sources() |
yes | Every covered institution with coverage dates |
for_date(bank, on, source=None, target=None) |
yes | The table in force on a date |
history(bank, symbol=..., from_date=..., to_date=...) |
yes | Date-by-date official series |
availability(bank, year=...) |
yes | Which dates the institution actually published |
compare(source, target) |
yes | One pair across every institution, with spread stats |
Dates accept "YYYY-MM-DD", datetime.date, or datetime.datetime.
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 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"]
Also available
- Live mid-market rates:
allratestoday - Single-source packages:
ecb-exchange-rate,hmrc-exchange-rateand 100+ others on npm - MCP server for AI agents:
npx -y @allratestoday/central-bank-mcp - Claude Code plugin:
/plugin marketplace add AllRates-Today/claude-code-plugin
Links
- Coverage and docs: https://allratestoday.com/central-bank-rates-api/
- API reference: https://allratestoday.com/docs
- Support: support@allratestoday.com
MIT licensed. Rates are served as published by the named institution; AllRatesToday is not affiliated with any of them.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file allratestoday_central_bank-1.0.0.tar.gz.
File metadata
- Download URL: allratestoday_central_bank-1.0.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2994c033320a65b15a81be991b50dfa937bbc6ac9341665ca2fe5a4b6f04e3e5
|
|
| MD5 |
999c5f02b9741346bdc316f3f80e228b
|
|
| BLAKE2b-256 |
240518e839935248d41444fc0def4a0628b41fa41b3159214c2ba2f36680cbb6
|
File details
Details for the file allratestoday_central_bank-1.0.0-py3-none-any.whl.
File metadata
- Download URL: allratestoday_central_bank-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d3ee67c1dbb50972cb8aab929d85a7ad15d46a443e7ef650eebbbea42e7d9e2
|
|
| MD5 |
f44f48fb06d0017386f62d5013034002
|
|
| BLAKE2b-256 |
a5a781a442b0b878f337c078ee709302a17a5e374d9d2f4215beafdcb210e7df
|