currency-codes


Namecurrency-codes JSON
Version 23.6.4 PyPI version JSON
download
home_pagehttps://github.com/duketemon/currency_codes/blob/main/README.md#description
SummaryComprehensive Python package for managing currency codes across different types of assets
upload_time2023-06-04 15:48:16
maintainer
docs_urlNone
authorArtem Kuchumov
requires_python>=3.7.2,<4.0.0
license
keywords iso 4217 iso-4217 currency codes currencies fiat crypto commodity
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## 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
- [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 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 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 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 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 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 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 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 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
```python
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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/duketemon/currency_codes/blob/main/README.md#description",
    "name": "currency-codes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.2,<4.0.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/67/93/4756d484b3bc006e76a5cfcd5c3cb5943adfa2e7d6a907be2f48b2819576/currency_codes-23.6.4.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, Cardano, ...)\n- others (Palladium, Gold, Unidad Previsional, ...) \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 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 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 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 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 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 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 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 currency_codes import get_crypto_currencies, Currency\n\ncrypto_currencies: list[Currency] = get_crypto_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 currency_codes import get_other_currencies, Currency\n\nother_currencies: list[Currency] = get_other_currencies()\n```\n\n## How to contribute\nContributions 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\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Comprehensive Python package for managing currency codes across different types of assets",
    "version": "23.6.4",
    "project_urls": {
        "Homepage": "https://github.com/duketemon/currency_codes/blob/main/README.md#description",
        "Repository": "https://github.com/duketemon/currency_codes"
    },
    "split_keywords": [
        "iso 4217",
        "iso-4217",
        "currency codes",
        "currencies",
        "fiat",
        "crypto",
        "commodity"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6ab75aac132a480c83fdfdf37b973e78894314d1ff4975f76efba2d6dfa7491c",
                "md5": "88b37ad48702b8755615b415256a6310",
                "sha256": "bbc34ede96bcb950fc0db2a5d2e624846e674bc09cbaa55550950575cacef67f"
            },
            "downloads": -1,
            "filename": "currency_codes-23.6.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "88b37ad48702b8755615b415256a6310",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.2,<4.0.0",
            "size": 22747,
            "upload_time": "2023-06-04T15:48:14",
            "upload_time_iso_8601": "2023-06-04T15:48:14.324610Z",
            "url": "https://files.pythonhosted.org/packages/6a/b7/5aac132a480c83fdfdf37b973e78894314d1ff4975f76efba2d6dfa7491c/currency_codes-23.6.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67934756d484b3bc006e76a5cfcd5c3cb5943adfa2e7d6a907be2f48b2819576",
                "md5": "8145ff09ce57e24c91d2492a1b062d25",
                "sha256": "b7c6be602ef24e4074dc9e7ddbeaa56bf91dc36f9c3da9f7ca68d19cfd74918c"
            },
            "downloads": -1,
            "filename": "currency_codes-23.6.4.tar.gz",
            "has_sig": false,
            "md5_digest": "8145ff09ce57e24c91d2492a1b062d25",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.2,<4.0.0",
            "size": 21919,
            "upload_time": "2023-06-04T15:48:16",
            "upload_time_iso_8601": "2023-06-04T15:48:16.222338Z",
            "url": "https://files.pythonhosted.org/packages/67/93/4756d484b3bc006e76a5cfcd5c3cb5943adfa2e7d6a907be2f48b2819576/currency_codes-23.6.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-04 15:48:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "duketemon",
    "github_project": "currency_codes",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "currency-codes"
}
        
Elapsed time: 0.10134s