You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

exchango

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exchango

Exchango - modern Python library for obtaining current exchange rates and converting currencies with support for both synchronous and asynchronous interfaces. Easy integration, flexible settings, and regular data updates.

1.0.2
pipPyPI
Maintainers
1

Supported currencies:

CODEFULL NAME
AUDAustralian Dollar
AZNAzerbaijani Manat
GBPBritish Pound Sterling
AMDArmenian Dram
BYNBelarusian Ruble
BGNBulgarian Lev
BRLBrazilian Real
HUFHungarian Forint
VNDVietnamese Dong
HKDHong Kong Dollar
GELGeorgian Lari
DKKDanish Krone
AEDUnited Arab Emirates Dirham
USDUnited States Dollar
EUREuro
EGPEgyptian Pound
INRIndian Rupee
IDRIndonesian Rupiah
KZTKazakhstani Tenge
CADCanadian Dollar
QARQatari Riyal
KGSKyrgystani Som
CNYChinese Yuan
MDLMoldovan Leu
NZDNew Zealand Dollar
NOKNorwegian Krone
PLNPolish Zloty
RONRomanian Leu
XDRSpecial Drawing Rights
SGDSingapore Dollar
TJSTajikistani Somoni
THBThai Baht
TRYTurkish Lira
TMTTurkmenistani Manat
UZSUzbekistani Som
UAHUkrainian Hryvnia
CZKCzech Koruna
SEKSwedish Krona
CHFSwiss Franc
RSDSerbian Dinar
ZARSouth African Rand
KRWSouth Korean Won
JPYJapanese Yen

1. Quick start

First, install exchango. Enter this command in the console or in the terminal:

pip install exchango

Next, select the synchronous or asynchronous version of the library.

# Synchronous version
import exchango.sync_api as exchango
# Asynchronous version
import exchango.async_api as exchango

The difference in usage is almost imperceptible, but the asynchronous version must be applied in async def and await before calling the function or in asyncio.run().

The difference between synchronous and asynchronous versions.

# Synchronous version
import exchango.sync_api as exchango
from time import time

codes = ["AUD", "AZN", "GBP", "AMD", "BYN", "BGN", "BRL", "HUF", "VND", "HKD", "GEL", "DKK", "AED", "USD", "EUR", "EGP", "INR", "IDR", "KZT", "CAD", "QAR", "KGS", "CNY", "MDL", "NZD", "NOK", "PLN", "RON", "XDR", "SGD", "TJS", "THB", "TRY", "TMT", "UZS", "UAH", "CZK", "SEK", "CHF", "RSD", "ZAR", "KRW", "JPY"]

def main():
    start = time()
    for currency in codes:
        for to in codes:
            for amount in range(0, 11):
                result = exchango.convert(currency, amount, to)
                print(f"{amount} {currency} = {result} {to}")
    end = time()
    print(end - start)

if __name__ == "__main__":
    main()
# Asynchronous version
import exchango.async_api as exchango
from time import time
import asyncio

codes = ["AUD", "AZN", "GBP", "AMD", "BYN", "BGN", "BRL", "HUF", "VND", "HKD", "GEL", "DKK", "AED", "USD", "EUR", "EGP", "INR", "IDR", "KZT", "CAD", "QAR", "KGS", "CNY", "MDL", "NZD", "NOK", "PLN", "RON", "XDR", "SGD", "TJS", "THB", "TRY", "TMT", "UZS", "UAH", "CZK", "SEK", "CHF", "RSD", "ZAR", "KRW", "JPY"]

async def main():
    start = time()
    for currency in codes:
        for to in codes:
            for amount in range(0, 11):
                result = await exchango.convert(currency, amount, to)
                print(f"{amount} {currency} = {result} {to}")
    end = time()
    print(end - start)

if __name__ == "__main__":
    asyncio.run(main())

This code calls the exchango.convert function 20339 times and at the end outputs how much time was spent.

Currency converting.

# Synchronous version
exchango.convert(currency, amount, to)
# Asynchronous version
await exchango.convert(currency, amount, to)
ARGUMENTDESCRIPTIONTYPEEXAMPLE 1EXAMPLE 2EXAMPLE 3
currency3-letter code of the currency to convertstringUSDEURRUB
amountAmount of currency to convert into another currencynumber591.84-647
to3-letter code of the target currency to convert currency intostringRUBUSDEUR
RETURNSSUCCESSDESCRIPTIONEXAMPLE 1EXAMPLE 2EXAMPLE 3
numberYESConverting result500.0145.1541451-23.535
stringNOError during convertingIncorrect typeUnspecified argumentAnd other

Keywords

currency

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts