Skip to content

Instantly share code, notes, and snippets.

@KebabLord
Last active February 1, 2021 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KebabLord/16ccd29b5fe10bc3e21dc7780054b314 to your computer and use it in GitHub Desktop.
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
#!/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}")
@KebabLord
Copy link
Author

2021-01-21_17-53_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment