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 2.7, 3.4+
requests Python package
dbf_light Python package
click package 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']
bank.swift # SABRRUMMNH1
bank.phone # (383)2122004
bank_annotated = Banks.annotate([bank])[0]
for title, value in bank_annotated.items():
print('%s: %s' % (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
pycbrf-0.2.2.tar.gz
(2.3 MB
view hashes)
Built Distribution
pycbrf-0.2.2-py2.py3-none-any.whl
(10.0 kB
view hashes)
Close
Hashes for pycbrf-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdb61ae64026cad3eec05ac654741b73ecd0fb0037e753815bbd4a4b9938c8de |
|
MD5 | bf3bd73104e9aeec1379364e45d760ba |
|
BLAKE2b-256 | f8f6f137ebaed5363981468d5a10b141078ef157e53aca70245b9c798fbf5d07 |