
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Comprehensive Python package for managing currency codes across different types of assets
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
Install the package with the following command:
pip install currency_codes
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")
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")
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()
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()
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()
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()
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
FAQs
Comprehensive Python package for managing currency codes across different types of assets
We found that currency-codes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.