I'm using CoingGecko API for acquiring info about crypto. I have a function for getting a json from the API of crypto currencies. Then I upload the id of crypto and its current price to a Replit database (id becomes the key and the current price a value of that key). I want to have a second value for that key which would be a 24h change in percentage of crypto price. Is it possible to have another value for a key? If not, how the should I approach my problem.
The function:
def getCryptoPrices(crypto):
URL = 'https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur'
r = requests.get(url = URL)
data = r.json()
#putting cryptocurrencies with their prices to a database
for i in range(len(data)):
db[data[i]['id']] = data[i]['current_price']
if crypto in db.keys():
return db[crypto]
else:
return None