Py Currency
A simple currency module to:
Retrive various info about currency
Format currency price
Convert between currencies
Requirements
python3
Internet connection (optional)
Installation
$ pip install nh-currency
Usage
import currency
Get currency name
currency.name('USD')
currency.name('USD', plural=True)
'US Dollar'
'US dollars'
Symbol
currency.symbol('CAD')
currency.symbol('CAD', native=False)
currency.symbol('NOK')
currency.symbol('NOK', native=False)
'$'
'CA$'
'kr'
'Nkr'
Number of decimal digits
currency.decimals('USD')
currency.decimals('JPY')
2
0
Round to the maximum decimal digits
currency.rounding(100.115735, 'USD')
currency.rounding(2253.12309, 'ISK')
100.12
2253
Currency increment used for rounding
currency.roundto('USD')
currency.roundto('CHF')
0
0.05
Format currency
currency.pretty(10050000.2394, 'USD')
currency.pretty(10050000.2394, 'USD', trim=True)
currency.pretty(10050000.2394, 'USD', abbrev=False)
'$10,050,000.2394'
'$10,050,000.24'
'10,050,000.2394 USD'
Convert to other currency
currency.convert('USD', 'EUR')
currency.convert('USD', 'EUR', 2)
currency.convert('JPY', 'AUD', 100)
0.815797
1.631594
1.1759
Currency info
currency.info('USD')
# Output has been formatted for representation purpose
{
'symbol': '$',
'name': 'US Dollar',
'symbol_native': '$',
'decimal_digits': 2,
'rounding': 0,
'code': 'USD',
'name_plural': 'US dollars'
}
Testing
$ cd .../py-currency
$ python -m unittest
Resources
Metadata
Release files for nh-currency 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nh-currency-1.0.1.tar.gz | 10.7 kB | Without provenance | Details for nh-currency-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nh_currency-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for nh_currency-1.0.1-py3-none-any.whl |
Total release size: 22.6 kB
Release files / nh-currency-1.0.1.tar.gz
| Download URL | nh-currency-1.0.1.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca4ff3d401c7b2f5b94595c82c0ff1b9b21d6303058a7d224f7ce6e309f15f4a
|
|
BLAKE2b-256 checksum How to use checksums |
e818c7be20a1234a8c6509a1cfa028585d13fce487ccf17775375dcd79ec7fc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / nh_currency-1.0.1-py3-none-any.whl
| Download URL | nh_currency-1.0.1-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6848d94e1023e9b112551a9067c56459fc294710c702c1fc0c89f1a0e17edaf4
|
|
BLAKE2b-256 checksum How to use checksums |
3e85c10a5b8d423a2661807ce3a6cb1a0b480f0956409d4691f7aab83ecf93a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for nh-currency 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.