Skip to content

sivefunc/venrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

venrate

Venrate is a library to get the exchange rate from currency A to currency B from different platforms like BCV.

venrate logo

Requeriments

  • python3 >= 3.9
  • requests >= 2.32.3
  • dataclasses and typing (standard libraries)

Installation

You can install venrate from Pypi

pip install venrate

Using venrate.

Exchange rate from 'Bolivares' to 'US Dollars' in all platforms.

# 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}'")

Exchange rate from 'Bolivares' to 'US Dollars' using BCV.

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

Default currency names that platforms uses

# 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

📓 Notes

  • 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.

Supported platforms

Name Image
Binance
BCV
MonitorDolar
Yadio

Made by 🔗 Sivefunc

Licensed under 🔗 GPLv3

About

No description, website, or topics provided.

Resources

License

Unknown, GPL-3.0 licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages