cbar-rates


Namecbar-rates JSON
Version 1.3.0 PyPI version JSON
download
home_pageNone
SummaryPython library to work with AZN (Azerbaijani manat) official rates
upload_time2024-12-18 22:04:36
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords cbar-rates azn azerbaijan azn-rates cbar manat mezenne
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CBAR Rates

[![PyPI - Version](https://img.shields.io/pypi/v/cbar-rates)](https://pypi.org/project/cbar-rates)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cbar-rates)](https://pypi.org/project/cbar-rates)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/cbar-rates)](https://pypistats.org/packages/cbar-rates)
[![License](https://img.shields.io/pypi/l/cbar-rates)](LICENSE.md)

A Python library to work with Azerbaijani manat (AZN) official exchange rates based on [CBAR](https://cbar.az/currency/rates?language=en) (The Central Bank of the Republic of Azerbaijan).

## Features

- Retrieve official CBAR exchange rates for the Azerbaijani manat (AZN).
- Compare exchange rates between two dates and calculate differences.
- Filter results by specific currency codes (e.g., USD, EUR).

## Requirements

- Python 3.7 or higher
- `requests` library

## Installation

Install the library using pip:

```bash
pip install cbar-rates --upgrade
```

For isolated installations, use a virtual environment:

```bash
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install cbar-rates
```

## Examples

### Usage of `get_rates()`

```python
from datetime import date
import cbar

rates_date = date.today()
currencies = ["USD", "EUR"]

rates = cbar.get_rates(rates_date, currencies)

print(rates)
# Output:
{
    "date": "18.11.2024",
    "currencies": {
        "USD": {
            "nominal": "1",
            "rate": 1.7
        },
        "EUR": {
            "nominal": "1",
            "rate": 1.7919
        },
    }
}
```

### Usage of `get_rates_with_diff()`

```python
from datetime import date
import cbar

previous_date = date(2024, 11, 25)
date_ = date(2024, 11, 26)
currencies = ["USD", "EUR"]

rates = cbar.get_rates_with_diff(previous_date, date_, currencies)

print(rates)
# Output:
{
    "previous_date": "25.11.2024",
    "date": "26.11.2024",
    "currencies": {
        "USD": {
            "nominal": "1",
            "previous_rate": 1.7,
            "rate": 1.7,
            "difference": 0.0,
        },
        "EUR": {
            "nominal": "1",
            "previous_rate": 1.7814,
            "rate": 1.7815,
            "difference": 0.0001,
        },
    }
}
```

### Usage of `convert()`

```python
from datetime import date
import cbar

amount = 100
from_currency = "USD"
to_currency = "AZN"
conversion_date = date(2024, 11, 25)

converted_amount = cbar.convert(amount, from_currency, to_currency, conversion_date)

print(converted_amount)
# Output:
170.0  # 1 USD = 1.7 AZN
```

You can find all available currency codes on the [CBAR website](https://www.cbar.az/currency/rates?language=en)

## License

This project is licensed under the [MIT License](https://github.com/TahirJalilov/cbar-rates/blob/main/LICENSE.md).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cbar-rates",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "cbar-rates, AZN, Azerbaijan, AZN-Rates, CBAR, Manat, Mezenne",
    "author": null,
    "author_email": "Tahir Jalilov <tahir.jalilov@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9d/ec/65580f1aa45547657e49bceab4c4a3a35f8ea8819a0c6f3248b75ca23e4e/cbar_rates-1.3.0.tar.gz",
    "platform": null,
    "description": "# CBAR Rates\n\n[![PyPI - Version](https://img.shields.io/pypi/v/cbar-rates)](https://pypi.org/project/cbar-rates)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cbar-rates)](https://pypi.org/project/cbar-rates)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/cbar-rates)](https://pypistats.org/packages/cbar-rates)\n[![License](https://img.shields.io/pypi/l/cbar-rates)](LICENSE.md)\n\nA Python library to work with Azerbaijani manat (AZN) official exchange rates based on [CBAR](https://cbar.az/currency/rates?language=en) (The Central Bank of the Republic of Azerbaijan).\n\n## Features\n\n- Retrieve official CBAR exchange rates for the Azerbaijani manat (AZN).\n- Compare exchange rates between two dates and calculate differences.\n- Filter results by specific currency codes (e.g., USD, EUR).\n\n## Requirements\n\n- Python 3.7 or higher\n- `requests` library\n\n## Installation\n\nInstall the library using pip:\n\n```bash\npip install cbar-rates --upgrade\n```\n\nFor isolated installations, use a virtual environment:\n\n```bash\npython3 -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\npip install cbar-rates\n```\n\n## Examples\n\n### Usage of `get_rates()`\n\n```python\nfrom datetime import date\nimport cbar\n\nrates_date = date.today()\ncurrencies = [\"USD\", \"EUR\"]\n\nrates = cbar.get_rates(rates_date, currencies)\n\nprint(rates)\n# Output:\n{\n    \"date\": \"18.11.2024\",\n    \"currencies\": {\n        \"USD\": {\n            \"nominal\": \"1\",\n            \"rate\": 1.7\n        },\n        \"EUR\": {\n            \"nominal\": \"1\",\n            \"rate\": 1.7919\n        },\n    }\n}\n```\n\n### Usage of `get_rates_with_diff()`\n\n```python\nfrom datetime import date\nimport cbar\n\nprevious_date = date(2024, 11, 25)\ndate_ = date(2024, 11, 26)\ncurrencies = [\"USD\", \"EUR\"]\n\nrates = cbar.get_rates_with_diff(previous_date, date_, currencies)\n\nprint(rates)\n# Output:\n{\n    \"previous_date\": \"25.11.2024\",\n    \"date\": \"26.11.2024\",\n    \"currencies\": {\n        \"USD\": {\n            \"nominal\": \"1\",\n            \"previous_rate\": 1.7,\n            \"rate\": 1.7,\n            \"difference\": 0.0,\n        },\n        \"EUR\": {\n            \"nominal\": \"1\",\n            \"previous_rate\": 1.7814,\n            \"rate\": 1.7815,\n            \"difference\": 0.0001,\n        },\n    }\n}\n```\n\n### Usage of `convert()`\n\n```python\nfrom datetime import date\nimport cbar\n\namount = 100\nfrom_currency = \"USD\"\nto_currency = \"AZN\"\nconversion_date = date(2024, 11, 25)\n\nconverted_amount = cbar.convert(amount, from_currency, to_currency, conversion_date)\n\nprint(converted_amount)\n# Output:\n170.0  # 1 USD = 1.7 AZN\n```\n\nYou can find all available currency codes on the [CBAR website](https://www.cbar.az/currency/rates?language=en)\n\n## License\n\nThis project is licensed under the [MIT License](https://github.com/TahirJalilov/cbar-rates/blob/main/LICENSE.md).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library to work with AZN (Azerbaijani manat) official rates",
    "version": "1.3.0",
    "project_urls": {
        "Changelog": "https://github.com/TahirJalilov/cbar-rates/blob/main/CHANGES.md",
        "Homepage": "https://github.com/TahirJalilov/cbar-rates/",
        "Issues": "https://github.com/TahirJalilov/cbar-rates/issues",
        "Repository": "https://github.com/TahirJalilov/cbar-rates/"
    },
    "split_keywords": [
        "cbar-rates",
        " azn",
        " azerbaijan",
        " azn-rates",
        " cbar",
        " manat",
        " mezenne"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd30675d2c93b32ee478bd84e19318fc2fcbaa7258e03522f259ddda2ccc120c",
                "md5": "2b31c010c2372df43adfe58be41aa82b",
                "sha256": "0e9aacad6261c5f36db0935f6a6c3697106c471e66b3e548dd0b5569eab6227c"
            },
            "downloads": -1,
            "filename": "cbar_rates-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b31c010c2372df43adfe58be41aa82b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5537,
            "upload_time": "2024-12-18T22:04:34",
            "upload_time_iso_8601": "2024-12-18T22:04:34.846390Z",
            "url": "https://files.pythonhosted.org/packages/bd/30/675d2c93b32ee478bd84e19318fc2fcbaa7258e03522f259ddda2ccc120c/cbar_rates-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9dec65580f1aa45547657e49bceab4c4a3a35f8ea8819a0c6f3248b75ca23e4e",
                "md5": "f8de6ed1313a7e983a487c45953acef2",
                "sha256": "4bed8e1a88e421860d193764e66c86ccff4b337ffb32af58352cab1810c95c63"
            },
            "downloads": -1,
            "filename": "cbar_rates-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f8de6ed1313a7e983a487c45953acef2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6595,
            "upload_time": "2024-12-18T22:04:36",
            "upload_time_iso_8601": "2024-12-18T22:04:36.780728Z",
            "url": "https://files.pythonhosted.org/packages/9d/ec/65580f1aa45547657e49bceab4c4a3a35f8ea8819a0c6f3248b75ca23e4e/cbar_rates-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 22:04:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TahirJalilov",
    "github_project": "cbar-rates",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cbar-rates"
}
        
Elapsed time: 0.70727s