Last active
February 1, 2021 21:40
-
-
Save KebabLord/16ccd29b5fe10bc3e21dc7780054b314 to your computer and use it in GitHub Desktop.
tl cinsinden anlık kripto para birimleri ve yüzdelikleri i3block bloğu
This file contains 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
#!/usr/bin/env python3 | |
""" | |
[kripto] | |
label= | |
markup=pango | |
interval=60 | |
instance=BTC | |
""" | |
from os import environ | |
from json import loads | |
from requests import get | |
coin = environ.get('BLOCK_INSTANCE') | |
r = loads( | |
get("https://api.btcturk.com/api/v2/ticker",params={"pairSymbol":f"{coin}_TRY"}).text | |
)['data'][0] | |
if r['dailyPercent'] > 0: | |
percentChange=f'<span color="#3BB92D">{r["dailyPercent"]}%</span>' | |
else: | |
percentChange=f'<span color="#F7555E">{r["dailyPercent"]}%</span>' | |
print(f"{coin} {r['last']} {percentChange}") |
Author
KebabLord
commented
Jan 21, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment