70 current 2024-03-01 01:54:07 24.05.20240228.9099616 6.6.18 *

This commit is contained in:
zackartz 2024-03-01 01:54:12 -05:00
parent e63d61382b
commit 4053f29d91
6 changed files with 417 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#!/usr/bin/env python
import requests
import json
url = "https://api.coingecko.com/api/v3/coins/markets"
params = {
"vs_currency": "usd",
"order": "market_cap_desc",
"per_page": 10,
"price_change_percentage": "24h",
"page": 1,
}
response = requests.get(url, params=params)
if response.status_code == 200:
top_cryptos = response.json()
tooltip = '<span size="xx-large">Crypto</span>\n'
for crypto in top_cryptos:
name = crypto["name"]
symbol = crypto["symbol"]
price = crypto["current_price"]
change = crypto["price_change_percentage_24h"]
tooltip += str(f" <b>{name}</b>: ${price} | {change:.2f}%\n")
out_data = {
"text": f"󰠓",
"alt": f"",
"tooltip": tooltip,
"class": "weather",
}
print(json.dumps(out_data))
else:
exit(1)