Tools to query Bank of Russia
Project description
https://github.com/idlesign/pycbrf
Description
Tools to query Bank of Russia
Provides methods to get the following information:
Exchange rates on various dates
Banks information (requisites, codes, numbers, etc.)
Requirements
Python 3.6+
requests Python package
dbf_light Python package (to support legacy Bank format)
click package (optional, for CLI)
Usage
CLI
$ pycbrf --help
$ pycbrf rates
$ pycbrf rates -d 2016-06-26 -c USD
$ pycbrf banks
$ pycbrf banks -b 045004641
CLI requires click package to be installed. Can be installed with pycbrf using:
$ pip install pycbrf[cli]
Python
from pycbrf import ExchangeRates, Banks
rates = ExchangeRates('2016-06-26', locale_en=True)
rates.date_requested # 2016-06-26 00:00:00
rates.date_received # 2016-06-25 00:00:00
rates.dates_match # False
# Note: 26th of June was a holiday, data is taken from the 25th.
# Various indexing is supported:
rates['USD'].name # US Dollar
rates['R01235'].name # US Dollar
rates['840'].name # US Dollar
rates['USD']
'''
ExchangeRate(
id='R01235',
name='US Dollar',
code='USD',
num='840',
value=Decimal('65.5287'),
par=Decimal('1'),
rate=Decimal('65.5287'))
'''
banks = Banks()
bank = banks['045004641']
assert bank
bank.swift # SABRRUMMNH1
bank.corr # 30101810500000000641
bank_annotated = Banks.annotate([bank])[0]
for title, value in bank_annotated.items():
print(f'{title}: {value}')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycbrf-1.1.0.tar.gz.
File metadata
- Download URL: pycbrf-1.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aa83e886e9f0fcf7c4aff1fd463d130e076800e268386a9797f66308244bebd
|
|
| MD5 |
f9f005b869f9f00dd882863d5349b8ee
|
|
| BLAKE2b-256 |
32a740769e1d423d6d355942a0963111681a4a7942a534f0b1662cbbcd17b505
|
File details
Details for the file pycbrf-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pycbrf-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aca6e7f363a1188a8edb2df57e526cf9f782df2b152e8691bac264fc9bb3b00
|
|
| MD5 |
ac20a45289892651360c81cee73b1546
|
|
| BLAKE2b-256 |
1db403ec4f70d85c1b129f8f030dbe62b0d523335ac1f0752dc20ff282b8e5d7
|
File details
Details for the file pycbrf-1.1.0-py2-none-any.whl.
File metadata
- Download URL: pycbrf-1.1.0-py2-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b74c086dd034c8bfd9cde314a8c87c2f04659adabdd810c39f3990b7bf52700
|
|
| MD5 |
394e9c1756a3baa6d4cf25b10bc0520f
|
|
| BLAKE2b-256 |
9108170f779152ccf21f17aa3f6dfec4959b5e84ac8739b264af7af47b1e312d
|