Skip to main content

A Python library for fetching and processing XML data from BNR (National Bank of Romania) website

Project description

bnrxrate

Python3 utility for easily accessing and parsing XML documents containing the exchange rates published by BNR (Romanian National Bank / Banca Națională a României) on their website.

Features

  • Fetch XML documents from https://www.bnr.ro with simple function calls.
  • Parse XML into a Pythonic format (a dict).
  • Cache retrieved data in an object property (a dict).

Installation

pip install bnrxrate

Usage

from bnrxrate import Xrates

bnrxr = Xrates()

# Get the listed exchange rates for all symbols for today:
bnrxr.get_xrate()

# Get the exchange rate for EUR and USD for today:
bnrxr.get_xrate(['EUR', 'USD'])

# Get the exchange rate for EUR and USD for specific date:
date = datetime.date(2024, 2, 22)
bnrxr.get_xrate(['EUR', 'USD'], date)

# Get the symbols available at a specific date:
date = datetime.date(2024, 6, 1)
bnrxr.list_symbols(date)

# Get the exchange rates for all symbols in a specific period:
start_date = datetime.date(2024, 1, 1)
end_date = datetime.date.today()
all_xrates = bnrxr.get_xrate([], start_date, end_date)

# Get the exchange rates for specific symbols in a specific period:
start_date = datetime.date(2024, 1, 1)
end_date = datetime.date.today()
all_xrates = bnrxr.get_xrate(['EUR', 'usd'], start_date, end_date)

# Check if a specific date is a banking day:
date = datetime.date(2024, 4, 1)
bnrxr.is_banking_day(date)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bnrxrate-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bnrxrate-0.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file bnrxrate-0.1.1.tar.gz.

File metadata

  • Download URL: bnrxrate-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for bnrxrate-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0ac136c4f15e800ef9337a70b281bb74d78e19f1d7accfe5e0025b89348bea42
MD5 8ca6a88d602c41026807c3b72223a1d1
BLAKE2b-256 c292d8df27b27163a3937b6752ba9862249ee0b0b909a95e0d07200d3eb0e57f

See more details on using hashes here.

File details

Details for the file bnrxrate-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bnrxrate-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for bnrxrate-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 556fb5477da092c9023738f964c173293e8b4be83484d75574d985fcfd06cc19
MD5 00defc1ecdbb2a2bd22a286adabd6a72
BLAKE2b-256 10b418a4fbef6cad71a42a39ab9d43bf29df1d932862e543e6a2cecada99be70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page