## 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, ...)
- commodity (Palladium, Gold, ...)
- others (WIR Franc, CFP Franc, ...)
## Sources
- [Coinmarketcap website](https://coinmarketcap.com) for crypto
- [ISO's website](https://www.iso.org/iso-4217-currency-codes.html) for rest
## Installation
Install the package with the following command:
```shell
pip install iso_4217_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
```python
from iso_4217_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.
```python
from iso_4217_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
```python
from iso_4217_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.
```python
from iso_4217_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
```python
from iso_4217_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
```python
from iso_4217_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
```python
from iso_4217_currency_codes import get_crypto_currencies, Currency
crypto_currencies: list[Currency] = get_crypto_currencies()
```
### Get the list of commodity currencies
If you want to get information only about commodity currencies, you can use `get_commodity_currencies` function
```python
from iso_4217_currency_codes import get_commodity_currencies, Currency
commodity_currencies: list[Currency] = get_commodity_currencies()
```
### Get the list of other currencies
If you want to get information only about other currencies, you can use `get_other_currencies` function
```python
from iso_4217_currency_codes import get_other_currencies, Currency
other_currencies: list[Currency] = get_other_currencies()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/duketemon/iso-4217_currency-codes",
"name": "iso-4217-currency-codes",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "ISO 4217,ISO-4217,Currency Codes,Currencies,fiat,crypto,commodity",
"author": "Artem Kuchumov",
"author_email": "duketemon@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/45/57/dd5a99521b16c718150fd9b9da68cfe2370362cfeb3d993b1847ac88ce1b/iso_4217_currency_codes-23.4.23.tar.gz",
"platform": null,
"description": "## Description\nComprehensive 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 \nThe package provides currency codes for different types of assets. Such as \n- fiat (US dollar, UAE Dirham, ...)\n- crypto (Bitcoin, Solana, ...)\n- commodity (Palladium, Gold, ...)\n- others (WIR Franc, CFP Franc, ...) \n\n## Sources\n - [Coinmarketcap website](https://coinmarketcap.com) for crypto\n - [ISO's website](https://www.iso.org/iso-4217-currency-codes.html) for rest\n\n## Installation\nInstall the package with the following command:\n```shell\npip install iso_4217_currency_codes\n```\n\n## How to use the package?\n### Get a currency info by a currency code\nYou can get any currency info using the snippet below\n```python\nfrom iso_4217_currency_codes import get_currency_by_code, Currency\n\ncurrency_code: str = \"EUR\"\ncurrency: Currency = get_currency_by_code(currency_code)\n```\nif 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.\n\n```python\nfrom iso_4217_currency_codes import get_currency_by_code, CurrencyNotFoundError\n\n# non-existent currency code\ncurrency_code: str = \"EUR000\"\ntry:\n get_currency_by_code(currency_code)\nexcept CurrencyNotFoundError:\n print(\"Non-existent code have been used\")\n```\n\n\n### Get a currency info by a currency numeric code\nTo get a currency info you can also use the numeric code like in the example below\n```python\nfrom iso_4217_currency_codes import get_currency_by_numeric_code, Currency\n\n# Euro has 978 numeric code\ncurrency_numeric_code: str = \"978\"\ncurrency: Currency = get_currency_by_numeric_code(currency_numeric_code)\n```\nif 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.\n\n```python\nfrom iso_4217_currency_codes import get_currency_by_numeric_code, CurrencyNotFoundError\n\n# non-existent currency numeric code\ncurrency_numeric_code: str = \"00000000\"\ntry:\n get_currency_by_numeric_code(currency_numeric_code)\nexcept CurrencyNotFoundError:\n print(\"Non-existent numeric code have been used\")\n```\n\n\n### Get the list of all currencies\nIf you want to get information about all currencies, you can use `get_all_currencies` function\n```python\nfrom iso_4217_currency_codes import get_all_currencies, Currency\n\ncurrencies: list[Currency] = get_all_currencies()\n```\n\n### Get the list of fiat currencies\nIf you want to get information only about fiat currencies, you can use `get_fiat_currencies` function\n```python\nfrom iso_4217_currency_codes import get_fiat_currencies, Currency\n\nfiat_currencies: list[Currency] = get_fiat_currencies()\n```\n\n### Get the list of crypto currencies\nIf you want to get information only about crypto currencies, you can use `get_crypto_currencies` function\n```python\nfrom iso_4217_currency_codes import get_crypto_currencies, Currency\n\ncrypto_currencies: list[Currency] = get_crypto_currencies()\n```\n\n### Get the list of commodity currencies\nIf you want to get information only about commodity currencies, you can use `get_commodity_currencies` function\n```python\nfrom iso_4217_currency_codes import get_commodity_currencies, Currency\n\ncommodity_currencies: list[Currency] = get_commodity_currencies()\n```\n\n### Get the list of other currencies\nIf you want to get information only about other currencies, you can use `get_other_currencies` function\n```python\nfrom iso_4217_currency_codes import get_other_currencies, Currency\n\nother_currencies: list[Currency] = get_other_currencies()\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "All currency codes in one package",
"version": "23.4.23",
"split_keywords": [
"iso 4217",
"iso-4217",
"currency codes",
"currencies",
"fiat",
"crypto",
"commodity"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "03420c5618337f179cb472773d4696aa56a339c8ee3c57300f8ca0d0e48826d4",
"md5": "aa696e2fc006ddd6b4538444ddbd5e6c",
"sha256": "3b5a30d373d487ed3469bbbdb323a7f74c9f32a7d84e9cfad3aec6ade2c62693"
},
"downloads": -1,
"filename": "iso_4217_currency_codes-23.4.23-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aa696e2fc006ddd6b4538444ddbd5e6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 9587,
"upload_time": "2023-04-23T11:52:52",
"upload_time_iso_8601": "2023-04-23T11:52:52.621133Z",
"url": "https://files.pythonhosted.org/packages/03/42/0c5618337f179cb472773d4696aa56a339c8ee3c57300f8ca0d0e48826d4/iso_4217_currency_codes-23.4.23-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4557dd5a99521b16c718150fd9b9da68cfe2370362cfeb3d993b1847ac88ce1b",
"md5": "46fafa2e77a70368659caafdd47c506c",
"sha256": "15003e0731936a980c9c5962c835373c43c28909289692a8b14636969a431300"
},
"downloads": -1,
"filename": "iso_4217_currency_codes-23.4.23.tar.gz",
"has_sig": false,
"md5_digest": "46fafa2e77a70368659caafdd47c506c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 14528,
"upload_time": "2023-04-23T11:52:54",
"upload_time_iso_8601": "2023-04-23T11:52:54.340965Z",
"url": "https://files.pythonhosted.org/packages/45/57/dd5a99521b16c718150fd9b9da68cfe2370362cfeb3d993b1847ac88ce1b/iso_4217_currency_codes-23.4.23.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-23 11:52:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "duketemon",
"github_project": "iso-4217_currency-codes",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "iso-4217-currency-codes"
}