Created
January 9, 2021 21:32
-
-
Save JayantGoel001/1b6c048cc054878292cb40efec415787 to your computer and use it in GitHub Desktop.
Creating A Currency Converter using forex_python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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