hey guys , if u can help me please , i am trying to build a website with streamlit for a school project,
it’s a bitcoin tracker . the first thing i want to do is have a converter from bitcoin to usd and vice versa , i have the python code but i dont know how to proceed , any ideas. here is the python code:
import requests
url = “https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,JPY,EUR”
response = requests.get(url).json()
price = response[“USD”]
def convert_to_USD(x) :
somme = price*x
return somme
print(convert_to_USD(1),“USD”)
def convert_to_BTC(x) :
s = x/price
somme = round(s,6)
return somme
print(convert_to_BTC(1),“BTC”)