Skip to main content

CBAR Rates

PyPI - Version PyPI - Python Version License

A Python library to work with Azerbaijani manat (AZN) official exchange rates based on CBAR (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.
  • Convert an amount between any two currencies (nominal-aware, case-insensitive).
  • Filter results by specific currency codes (e.g., USD, EUR).

Requirements

  • Python 3.9 or higher
  • requests library

Installation

Install the library using pip:

pip install cbar-rates --upgrade

For isolated installations, use a virtual environment:

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

Examples

Usage of get_rates()

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()

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()

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

License

This project is licensed under the MIT License.

Release files for cbar-rates 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cbar-rates 1.4.0
File Size Uploaded
cbar_rates-1.4.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cbar-rates 1.4.0
File Interpreter ABI Platform
cbar_rates-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / cbar_rates-1.4.0.tar.gz

Download URL cbar_rates-1.4.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
32a0250f7f6b2cfb4b394b0f46702af7c8858f7112fe499648a062861da9e451
BLAKE2b-256 checksum
How to use checksums
19dd4714c48df7678be78ace2daf52096182c9de3441efb8148555f8d21dbf87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / cbar_rates-1.4.0-py3-none-any.whl

Download URL cbar_rates-1.4.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0a494e9802ffae3ed3c5ec735ac4db85cc4ecd8f9744ff4a2c84b75104e8eb2
BLAKE2b-256 checksum
How to use checksums
6ff18168bc6d057d4af3da8a8122bc332c311c6c58a04c2d881347362e176af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page