Another Czech National Bank exchange rates package
Project description
cnb-rates
Another Czech National Bank exchange rates package for Python.
Další balíček poskytující kurzy ČNB. Data do konce 2025, distribuována spolu s balíčkem, v data/all.csv.xz.
Try
uvx cnb-rates EUR 2025-10-28
Installation
pip install cnb-rates
Usage
Command Line
# Get rate for 1 unit of currency
python -m cnb_rates 2025-01-05 EUR
python -m cnb_rates 05.01.2025 USD
python -m cnb_rates 2025/01/05 GBP
# Convert specific amount
python -m cnb_rates 2025-01-05 USD 1.5
# List available data
python -m cnb_rates --list-years
python -m cnb_rates --list-currencies
Python API
import cnb_rates
from datetime import date
# Get CZK value of 1 USD on specific date
rate = cnb_rates.rate1(cnb_rates.USD, "02.01.2025")
print(f"1 USD = {rate} CZK")
# Convert amount
czk_value = cnb_rates.rate(cnb_rates.EUR, "2025-01-02", 100)
print(f"100 EUR = {czk_value} CZK")
# Using datetime.date
rate = cnb_rates.rate1(cnb_rates.GBP, date(2025, 1, 2))
# List available data
print("Available years:", cnb_rates.years())
print("Available currencies:", cnb_rates.currencies())
API
Functions
rate1(currency, date)- Get CZK value of 1 unit of currencyrate(currency, date, amount)- Get CZK value of specified amountyears()- List available data yearscurrencies()- List supported currencies
Currency Constants
Available as cnb_rates.USD, cnb_rates.EUR, etc:
AUD, BGN, BRL, CAD, CHF, CNY, DKK, EUR, GBP, HKD, HUF, IDR, ILS, INR, ISK, JPY, KRW, MXN, MYR, NOK, NZD, PHP, PLN, RON, SEK, SGD, THB, TRY, USD, XDR, ZAR
Date Formats
Supports multiple date formats:
datetime.dateobjects"DD.MM.YYYY"strings (e.g., "02.01.2025")"YYYY-MM-DD"strings (e.g., "2025-01-02")"YYYY/MM/DD"strings (e.g., "2025/01/02")
Note: If the requested date is not available (e.g., weekends, holidays), the package automatically uses the most recent previous date with available data. This includes searching across years if needed (e.g., January 1st will use December 31st from the previous year).
Data Source
Project details
Release history Release notifications | RSS feed
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 cnb_rates-0.2.0.tar.gz.
File metadata
- Download URL: cnb_rates-0.2.0.tar.gz
- Upload date:
- Size: 396.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a26537ebe15ca55cdc8b9826b63dc55e99323ee361387a6161e9112520fad268
|
|
| MD5 |
a23c441635f0f18d60be34b3922569fd
|
|
| BLAKE2b-256 |
42b8cb80c4bbfd65cc232965cd2eb0bf6100444a2c83510205aad50e612e47d7
|
File details
Details for the file cnb_rates-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cnb_rates-0.2.0-py3-none-any.whl
- Upload date:
- Size: 394.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c00c28887c0f247c93fd68f725212c2fe3e46811d9ffa3cd837aad16cc8a31e6
|
|
| MD5 |
2b04f73fd22393341d67d76a7a241498
|
|
| BLAKE2b-256 |
84e069f31f74d2f05b4360601fdc359def06685a05850124179443dc1a5b4c73
|