# Pyrrencies Python Library
## Overview
The `pyrrencies` library provides a convenient way to handle currency conversion and arithmetic operations in Python. It supports a wide range of currencies and allows for easy conversion between them.
## Installation
```bash
pip install pyrrencies
```
## Usage
### Initialization
```python
from pyrrencies import CurrencyAmount
amount_usd = CurrencyAmount(1000, 'USD') # USD 10.0
amount_uah = CurrencyAmount(10000, 'UAH') # UAH 100.0
```
### Display
```python
print(amount_usd) # USD 10.0
```
### Accessing Properties
```python
print(amount_usd.cents) # 1000
print(amount_usd.currency) # USD
```
### Currency Conversion
```python
print(amount_usd.to('UAH')) # UAH 367.44
print(amount_usd.to('EUR')) # EUR 9.55
```
### Exchange Rates
```python
from pyrrencies import CurrencyRates
print(CurrencyRates.get_rate('USD', 'UAH')) # 36.744452
print(CurrencyRates.get_rate('PLN', 'EUR')) # 0.21633
```
### Arithmetic Operations
```python
print(amount_usd + 50) # USD 10.5
print(amount_usd + amount_uah) # ValueError: Currencies must be the same
print(amount_usd + amount_uah.to('USD')) # USD 12.72
print(amount_usd - amount_uah.to('USD')) # USD 7.28
print(amount_usd * 7.34) # USD 73.4
print(amount_usd / 2) # USD 5.0
```
### Comparison
```python
print(amount_usd == amount_uah) # False
print(amount_usd != amount_uah) # True
print(amount_usd > amount_uah) # ValueError: Currencies must be the same
print(amount_usd >= amount_uah) # ValueError: Currencies must be the same
print(amount_usd < amount_uah) # ValueError: Currencies must be the same
print(amount_usd <= amount_uah) # ValueError: Currencies must be the same
```
### Supported Currencies
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, FOK, GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWL
Raw data
{
"_id": null,
"home_page": "https://github.com/de-jure/pyrrencies",
"name": "pyrrencies",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "currency currencies exchange rates",
"author": "Yurii Plets",
"author_email": "de.jure.software@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/ec/f329b6bc67946d48c035bb2ee8cc0e27c8a1d871f506221eefe6b87c6d9d/pyrrencies-0.1.0.tar.gz",
"platform": null,
"description": "# Pyrrencies Python Library\n\n## Overview\n\nThe `pyrrencies` library provides a convenient way to handle currency conversion and arithmetic operations in Python. It supports a wide range of currencies and allows for easy conversion between them.\n\n## Installation\n\n```bash\npip install pyrrencies\n```\n\n## Usage\n\n### Initialization\n\n```python\nfrom pyrrencies import CurrencyAmount\n\namount_usd = CurrencyAmount(1000, 'USD') # USD 10.0\namount_uah = CurrencyAmount(10000, 'UAH') # UAH 100.0\n```\n\n### Display\n\n```python\nprint(amount_usd) # USD 10.0\n```\n\n### Accessing Properties\n\n```python\nprint(amount_usd.cents) # 1000\nprint(amount_usd.currency) # USD\n```\n\n### Currency Conversion\n\n```python\nprint(amount_usd.to('UAH')) # UAH 367.44\nprint(amount_usd.to('EUR')) # EUR 9.55\n```\n\n### Exchange Rates\n\n```python\nfrom pyrrencies import CurrencyRates\n\nprint(CurrencyRates.get_rate('USD', 'UAH')) # 36.744452\nprint(CurrencyRates.get_rate('PLN', 'EUR')) # 0.21633\n```\n\n### Arithmetic Operations\n\n```python\nprint(amount_usd + 50) # USD 10.5\nprint(amount_usd + amount_uah) # ValueError: Currencies must be the same\nprint(amount_usd + amount_uah.to('USD')) # USD 12.72\nprint(amount_usd - amount_uah.to('USD')) # USD 7.28\nprint(amount_usd * 7.34) # USD 73.4\nprint(amount_usd / 2) # USD 5.0\n```\n\n### Comparison\n\n```python\nprint(amount_usd == amount_uah) # False\nprint(amount_usd != amount_uah) # True\nprint(amount_usd > amount_uah) # ValueError: Currencies must be the same\nprint(amount_usd >= amount_uah) # ValueError: Currencies must be the same\nprint(amount_usd < amount_uah) # ValueError: Currencies must be the same\nprint(amount_usd <= amount_uah) # ValueError: Currencies must be the same\n```\n\n### Supported Currencies\n\nAED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, FOK, GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KID, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STN, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWL\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Comfortable work with currencies and currencies exchange rates",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/de-jure/pyrrencies"
},
"split_keywords": [
"currency",
"currencies",
"exchange",
"rates"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d1af09566d8b6a36e97064f200384690a5803839e2c650133f23f70a2a0365b8",
"md5": "1a3c669e284e2fb81a5d907692bf9032",
"sha256": "f424703f559038a501109a085e74870253f99e827834c7a6546a0096d6d762d5"
},
"downloads": -1,
"filename": "pyrrencies-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1a3c669e284e2fb81a5d907692bf9032",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4703,
"upload_time": "2023-10-04T20:57:49",
"upload_time_iso_8601": "2023-10-04T20:57:49.353703Z",
"url": "https://files.pythonhosted.org/packages/d1/af/09566d8b6a36e97064f200384690a5803839e2c650133f23f70a2a0365b8/pyrrencies-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eaecf329b6bc67946d48c035bb2ee8cc0e27c8a1d871f506221eefe6b87c6d9d",
"md5": "a6fe7ba0e2c7ab8a633d7b401189a18b",
"sha256": "8009f123c077af08ed2dbf9558cb5dcc2bc2250cea3fbb4d2021e5d2923db25d"
},
"downloads": -1,
"filename": "pyrrencies-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a6fe7ba0e2c7ab8a633d7b401189a18b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4325,
"upload_time": "2023-10-04T20:57:51",
"upload_time_iso_8601": "2023-10-04T20:57:51.958435Z",
"url": "https://files.pythonhosted.org/packages/ea/ec/f329b6bc67946d48c035bb2ee8cc0e27c8a1d871f506221eefe6b87c6d9d/pyrrencies-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-04 20:57:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "de-jure",
"github_project": "pyrrencies",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyrrencies"
}