Venrate is a library to get the exchange rate from currency A to currency B from different platforms like BCV.
- python3 >= 3.9
- requests >= 2.32.3
- dataclasses and typing (standard libraries)
You can install venrate from Pypi
pip install venrate
# importing venrate and creating object.
from venrate import Venrate
venrate = Venrate()
for p_name, platform in venrate.platforms.items():
currency_from = platform.currency_from
currency_to = platform.currency_to
rate = venrate.get_rate(
p_name,
currency_from,
currency_to,
use_last_response=False,
timeout=10, # This is a requests.request option
verify=True # This is a requests.request option
)
print(f"{p_name} rate from '{currency_from}' to '{currency_to}' is"
" " f"'{rate}'")
# importing venrate and creating object
from venrate import Venrate
venrate = Venrate()
platform_name = 'BcV' # Name is case insensitive
bcv_rate = venrate.get_rate(
platform_name,
use_last_response=False,
timeout=10,
verify=False # Lately BCV it's giving SSL errors
)
print(bcv_rate)
# Successfull requests.Response are saved, so you can use it later.
bcv_rate = venrate.get_rate(
platform_name,
use_last_response=True,
timeout=10,
verify=False # Lately BCV it's giving SSL errors
)
print(bcv_rate)
# importing venrate and creating object
from venrate import Venrate
venrate = Venrate()
for p_name, platform in venrate.platforms.items():
currency_from = platform.currency_from
currency_to = platform.currency_to
print(p_name, currency_from, currency_to)
# Why know this?
# Platforms could have different naming for currencies
# Binance for example uses USDT
# MonitorDolar, BCV and Yadio uses USD
-
It's still a very premature library, it lacks:
- Documentation
- Tests
- More platforms
- More methods or new idea of superclass that results useful to use.
-
There are platforms like MonitorDolar that only does BS to USD so if you try using different currencies or different ordering it will throw the same rate.
Name | Image |
Binance | |
BCV | |
MonitorDolar | |
Yadio |