Skip to main content

allratestoday-central-bank

PyPI version Python license zero dependencies

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-rate and 120 more on npm
  • MCP server for AI agents: 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

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.2

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.2
File Size Uploaded Provenance Actions
allratestoday_central_bank-1.0.2.tar.gz 10.1 kB Without provenance Details for allratestoday_central_bank-1.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 19.1 kB

Release files / allratestoday_central_bank-1.0.2.tar.gz

Download URL allratestoday_central_bank-1.0.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b880af89e869f814d700c943cf9488475d6797e104aaafc37411b397e895da0c
BLAKE2b-256 checksum
How to use checksums
b167a22c44c5f45e0fbd9ea9896188e4ad99a9799a1d47a16ad203d0afebfe35
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.2-py3-none-any.whl

Download URL allratestoday_central_bank-1.0.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e3a7b9c3e58100d504b625cb7a8d28b0910206914dda4212964f81f879c7049
BLAKE2b-256 checksum
How to use checksums
d2d8ba1f900c532185d940daf983d6095da172cb2929f0c3b78dbea27d9ceadd
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.2

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