Toggle Navigation
Hatchery
Eggs
BNB-EURO
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import uinterface, rgb, time, default_icons, urequests def left(s, amount): return s[:amount] def logo(): logo = [0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0xff8300ff, 0x000000ff, 0xff8300ff, 0xff8300ff] rgb.clear() rgb.image(logo, (0, 0), size=(8,8)) api = 'https://api.binance.com/api/v3/klines?symbol=BNBEUR&interval=3m&limit=1' # Data format: [[TS, OPEN, HIGH, LOW, CLOSE, VOL, ...], ...] rgb.setfont(rgb.FONT_6x3) rgb.clear() uinterface.connect_wifi() data, size, frames = default_icons.animation_loading rgb.gif(data, (13, 1), size, frames) while True: uinterface.connect_wifi() request = urequests.get(api) result = request.json() last = float(result[0][4]) open = float(result[0][1]) percent = ((last-open)/open)*100 if last > open: logo() rgb.text(left(str(last),6), (0,255,0),(9,3)) time.sleep(2) logo() rgb.text(left("+" + str(percent),5)+"%", (0, 255, 0),(9,3)) time.sleep(2) logo() rgb.text(left(str(last),6), (0, 255, 0),(9,3)) else: if last < open: logo() rgb.text(left(str(last),6), (255,0,0),(9,3)) time.sleep(2) logo() rgb.text(left(str(percent),5)+"%", (255, 0, 0),(9,3)) time.sleep(2) logo() rgb.text(left(str(last),6), (255, 0, 0),(9,3)) else: logo() rgb.text(left(str(last),6), (255,255,255),(9,3)) time.sleep(30)