allratestoday-central-bank
Official exchange rates as published by 121 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 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. Pass the key:
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) |
paid plan | The table in force on a date |
history(bank, symbol=..., from_date=..., to_date=...) |
paid plan | 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 120 more on npm - MCP server for AI agents:
npx -y @allratestoday/central-bank-mcp, or the hosted keyless endpointhttps://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/keyswithContent-Type: application/json→ 100 calls over 7 days for latest rates and latest tables (dated tables and history are paid-plan only); MCP toolrequest_trial_key - Open data archive: the same published tables mirrored daily, one CSV per institution — Hugging Face · Kaggle (CC BY-NC 4.0)
Links
- Coverage and docs: https://allratestoday.com/central-bank-rates-api/
- API reference: https://allratestoday.com/docs
- Support: support@allratestoday.com
- Register (Free)
- Dashboard
- Status
- GitHub
MIT licensed. 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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| allratestoday_central_bank-1.0.3.tar.gz | 10.3 kB | Without provenance | Details for allratestoday_central_bank-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| allratestoday_central_bank-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for allratestoday_central_bank-1.0.3-py3-none-any.whl |
Total release size: 19.5 kB
Release files / allratestoday_central_bank-1.0.3.tar.gz
| Download URL | allratestoday_central_bank-1.0.3.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0063658610ec163af76297002c94646656c2810d26c4019ebb99d917b7bd6316
|
|
BLAKE2b-256 checksum How to use checksums |
2da9a62bbaa3e1fdff1852c5938dc8d8cb022b9757fcd8a0dfd4674a1696840c
|
| 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.3-py3-none-any.whl
| Download URL | allratestoday_central_bank-1.0.3-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a264ed57a0f95218825914a2626cdd0c50221ed500fa1d2bf67821f9a420edde
|
|
BLAKE2b-256 checksum How to use checksums |
847d0199afa443164e70e354f0482a527b18178059941c3a2254578be1da3252
|
| 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.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.
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.