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", ...]}

🧭 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.5

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.5
File Size Uploaded Provenance Actions
allratestoday_central_bank-1.0.5.tar.gz 14.9 kB Without provenance Details for allratestoday_central_bank-1.0.5.tar.gz

Built distribution (wheel)

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

Total release size: 25.6 kB

Release files / allratestoday_central_bank-1.0.5.tar.gz

Download URL allratestoday_central_bank-1.0.5.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3798c659d22cd6f982d0b74eeb2b6758f9b335944366d10e96991aacaf9cc2e6
BLAKE2b-256 checksum
How to use checksums
b64d44217190c8e871636bb0da7869639ee744882d0dcafc0947ba35ffce7462
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.5-py3-none-any.whl

Download URL allratestoday_central_bank-1.0.5-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
679ff4fabf3e922d58262f780f1e3a9817c41cbc1d3f7b4b167f21e633677109
BLAKE2b-256 checksum
How to use checksums
fe4cd9cd05dddbf2c782b2b5334dbbe5dcfea082a01faf8df06673e2e5a270da
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.5

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