CLI for ECB JSON exchange rates.
Project description
ecb-rate
Simple CLI tool to fetch EUR-based exchange rates from the European Central Bank (ECB) API.
Note: ECB euro foreign exchange reference rates are published for information purposes only. Using these rates for transaction purposes is strongly discouraged by the ECB.
Official ECB reference: https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html
Installation
Using uv (recommended):
uv sync
Or with pip:
pip install .
Usage
Basic
ecb_rate TRY
Output:
51.2795
With specific date
ecb_rate TRY --specific-date 2025-06-06
Pretty output
ecb_rate TRY --pretty
Output:
Base currency: EUR
Target currency: TRY
2025-06-06: 1 EUR = 43.1234 TRY
Version
ecb_rate --version
Output:
ecb_rate 0.4.1
Use this option to print the installed CLI version and exit immediately.
Supported currencies
The CLI supports all currencies defined by the ECB reference exchange rate dataset (EXR).
Currently implemented currencies:
- AUD – Australian dollar (Australia)
- BRL – Brazilian real (Brazil)
- CAD – Canadian dollar (Canada)
- CHF – Swiss franc (Switzerland)
- CNY – Chinese yuan (China)
- CZK – Czech koruna (Czech Republic)
- DKK – Danish krone (Denmark)
- EUR – Euro (Eurozone)
- GBP – Pound sterling (United Kingdom)
- HKD – Hong Kong dollar (Hong Kong)
- HUF – Hungarian forint (Hungary)
- IDR – Indonesian rupiah (Indonesia)
- ILS – Israeli shekel (Israel)
- INR – Indian rupee (India)
- ISK – Icelandic krona (Iceland)
- JPY – Japanese yen (Japan)
- KRW – South Korean won (South Korea)
- MXN – Mexican peso (Mexico)
- MYR – Malaysian ringgit (Malaysia)
- NOK – Norwegian krone (Norway)
- NZD – New Zealand dollar (New Zealand)
- PHP – Philippine peso (Philippines)
- PLN – Polish zloty (Poland)
- RON – Romanian leu (Romania)
- SEK – Swedish krona (Sweden)
- SGD – Singapore dollar (Singapore)
- THB – Thai baht (Thailand)
- TRY – Turkish lira (Turkey)
- USD – US dollar (United States)
- ZAR – South African rand (South Africa)
Source: https://data-api.ecb.europa.eu/service/data/EXR
Currency support in this tool is defined via the CurrencyType enum.
API
Uses the official ECB Data Portal:
https://data-api.ecb.europa.eu/service/data/EXR
Format:
- jsondata (SDMX JSON)
Reference rates are intended for informational use and should not be treated as executable market prices.
Project structure
ecb_rate/
├─ cli.py
├─ client.py
├─ custom_types.py
├─ models.py
├─ service.py
└─ utils.py
Development
Install dev dependencies:
uv sync --dev
Run tests:
pytest
Project details
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 ecb_rate-0.5.2.tar.gz.
File metadata
- Download URL: ecb_rate-0.5.2.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
666ffb6816c6a38cb07f5237ed0d90c8e3ce24c626dca6efa4dda249e4f633b7
|
|
| MD5 |
b48ed26aaf500c57f3fc7c6895d4e07b
|
|
| BLAKE2b-256 |
9a3be716e4a219ac4c1fc7d59b9b6718c54171219c72a05a59e543c03a742edd
|
File details
Details for the file ecb_rate-0.5.2-py3-none-any.whl.
File metadata
- Download URL: ecb_rate-0.5.2-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0e535c5f1803cb0f08a4cfcd54044b3a2409eecc2095a800d458806d9f050b8
|
|
| MD5 |
144ce4935b950ff043457f0c72d53d06
|
|
| BLAKE2b-256 |
84c7b9d7fd790a33cac179d021f8358151ad0bd55192cf61c8b11886865aed02
|