Skip to main content

Description

Comprehensive Python package for managing currency codes across different types of assets. Having all the currency codes in one package can simplify the development process for applications that involve multiple currencies and assets. This package could also help to ensure consistency and accuracy in managing currency codes across different parts of an application
The package provides currency codes for different types of assets. Such as

  • fiat (US dollar, UAE Dirham, ...)
  • crypto (Bitcoin, Solana, Cardano, ...)
  • others (Palladium, Gold, Unidad Previsional, ...)

Sources

Installation

Install the package with the following command:

pip install currency_codes

How to use the package

Get a currency info by a currency code

You can get any currency info using the snippet below

from currency_codes import get_currency_by_code, Currency

currency_code: str = "EUR"
currency: Currency = get_currency_by_code(currency_code)

if the package doesn't know a currency code you can raise a PR to extend the knowledge base but for now the CurrencyNotFoundError will be raised.

from currency_codes import get_currency_by_code, CurrencyNotFoundError

# non-existent currency code
currency_code: str = "EUR000"
try:
    get_currency_by_code(currency_code)
except CurrencyNotFoundError:
    print("Non-existent code have been used")

Get a currency info by a currency numeric code

To get a currency info you can also use the numeric code like in the example below

from currency_codes import get_currency_by_numeric_code, Currency

# Euro has 978 numeric code
currency_numeric_code: str = "978"
currency: Currency = get_currency_by_numeric_code(currency_numeric_code)

if the package doesn't know a currency numeric code you can raise a PR to extend the knowledge base but for now the CurrencyNotFoundError will be raised.

from currency_codes import get_currency_by_numeric_code, CurrencyNotFoundError

# non-existent currency numeric code
currency_numeric_code: str = "00000000"
try:
    get_currency_by_numeric_code(currency_numeric_code)
except CurrencyNotFoundError:
    print("Non-existent numeric code have been used")

Get the list of all currencies

If you want to get information about all currencies, you can use get_all_currencies function

from currency_codes import get_all_currencies, Currency

currencies: list[Currency] = get_all_currencies()

Get the list of fiat currencies

If you want to get information only about fiat currencies, you can use get_fiat_currencies function

from currency_codes import get_fiat_currencies, Currency

fiat_currencies: list[Currency] = get_fiat_currencies()

Get the list of crypto currencies

If you want to get information only about crypto currencies, you can use get_crypto_currencies function

from currency_codes import get_crypto_currencies, Currency

crypto_currencies: list[Currency] = get_crypto_currencies()

Get the list of other currencies

If you want to get information only about other currencies, you can use get_other_currencies function

from currency_codes import get_other_currencies, Currency

other_currencies: list[Currency] = get_other_currencies()

How to contribute

Contributions are always welcomed. If you found any mistakes or missing currencies, please raise a PR to make the package more accurate for all of us

Release files for currency-codes 23.6.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for currency-codes 23.6.4
File Size Uploaded
currency_codes-23.6.4.tar.gz 21.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for currency-codes 23.6.4
File Interpreter ABI Platform
currency_codes-23.6.4-py3-none-any.whl Python 3 none any Details

Total release size: 44.7 kB

Release files / currency_codes-23.6.4.tar.gz

Download URL currency_codes-23.6.4.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b7c6be602ef24e4074dc9e7ddbeaa56bf91dc36f9c3da9f7ca68d19cfd74918c
BLAKE2b-256 checksum
How to use checksums
67934756d484b3bc006e76a5cfcd5c3cb5943adfa2e7d6a907be2f48b2819576
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-1038-azure

Release files / currency_codes-23.6.4-py3-none-any.whl

Download URL currency_codes-23.6.4-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbc34ede96bcb950fc0db2a5d2e624846e674bc09cbaa55550950575cacef67f
BLAKE2b-256 checksum
How to use checksums
6ab75aac132a480c83fdfdf37b973e78894314d1ff4975f76efba2d6dfa7491c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-1038-azure

Release history Release notifications | RSS feed

This release

23.6.4 This release

2 release files

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