Skip to main content

A small CLI tool for fetching EUR exchange rates from the European Central Bank JSON API.

Project description

ecb-rate

Simple CLI tool to fetch EUR-based exchange rates from the European Central Bank (ECB) API.

Requires Python 3.11 or newer.


Installation

Using uv (recommended):

uv sync

Or with pip:

pip install .

Usage

Basic

ecb_rate TRY

Output:

51.2795

Version

ecb_rate --version

Output:

ecb_rate 0.6.3

With specific date

ecb_rate TRY --specificDate 2025-06-06

Pretty output

ecb_rate TRY --pretty

Output:

Base currency:   EUR
Target currency: TRY

2025-06-06: 1 EUR = 43.1234 TRY

List supported currencies

ecb_rate --list

Output:

Supported currency codes:
  AUD  Australian dollar (Australia)
  ...
  USD  US dollar (United States of America)
  ZAR  South African rand (South Africa)

Invalid input

Missing target currency:

ecb_rate

Output:

Error: A target currency code is required. Example: ecb_rate USD. Use --help for usage.

Unsupported target currency:

ecb_rate US

Output:

Error: Unsupported currency code: US. Use --list to see all supported currency codes.

Supported currencies

The CLI supports all currencies defined by the ECB reference exchange rate dataset (EXR).

Run ecb_rate --list to print all supported currency codes.

  • AUD – Australian dollar (Australia)
  • BRL – Brazilian real (Brazil)
  • CAD – Canadian dollar (Canada)
  • CHF – Swiss franc (Switzerland)
  • CNY – Chinese yuan (China)
  • CZK – Czech koruna (Czechia)
  • DKK – Danish krone (Denmark)
  • EUR – Euro (euro area)
  • GBP – Pound sterling (United Kingdom)
  • HKD – Hong Kong dollar (China, Hong Kong SAR)
  • 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 (Republic of 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 (Türkiye)
  • USD – US dollar (United States of America)
  • 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)

Project structure

ecb_rate/
├─ cli.py
├─ client.py
├─ custom_types.py
├─ models.py
├─ service.py

Development

Install dev dependencies:

uv sync --dev

Run tests:

uv run 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

ecb_rate-0.6.4.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecb_rate-0.6.4-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file ecb_rate-0.6.4.tar.gz.

File metadata

  • Download URL: ecb_rate-0.6.4.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ecb_rate-0.6.4.tar.gz
Algorithm Hash digest
SHA256 e7d04d1857c67da6e41172e3feff83675ecb37d765c70f3c0e9d5d0c4d288480
MD5 40f0e553feec85a94d16f5b1ebfb3b40
BLAKE2b-256 438fdd510f1c0706d6a91e7171401c5aacf7d8294a8686775d9e73f9094e1c91

See more details on using hashes here.

File details

Details for the file ecb_rate-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: ecb_rate-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ecb_rate-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f33bf05bbf0436249d4a15b486278f7149bc9ad6089341b4856ac00c784e2d4f
MD5 82ed333ca4764c3af053bc5e493f3292
BLAKE2b-256 add0a1b3e15d9b30516352b8fd10d414d5218e3f82012dae3a21ef28c6501ea4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page