Skip to content

Instantly share code, notes, and snippets.

@JayantGoel001
Created January 9, 2021 21:32
Show Gist options
  • Save JayantGoel001/1b6c048cc054878292cb40efec415787 to your computer and use it in GitHub Desktop.
Save JayantGoel001/1b6c048cc054878292cb40efec415787 to your computer and use it in GitHub Desktop.
Creating A Currency Converter using forex_python
# pip install forex-python
from forex_python.converter import CurrencyCodes, CurrencyRates
from forex_python.bitcoin import BtcConverter
codes = CurrencyCodes()
l = ['INR', 'USD']
for i in l:
name = codes.get_currency_name(i)
symbol = codes.get_symbol(i)
print("Currency Name : ", name)
print("Currency Symbol : ", symbol)
print()
rates = CurrencyRates()
rate = rates.get_rate('USD', 'INR')
print(rate)
rate_eq = rates.convert('USD', 'INR', 8)
print(rate_eq)
print()
print("BTC Converter-->", end=" ")
btc = BtcConverter()
price = btc.get_latest_price('INR')
print(price)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment