price_new = None
url = 'wss://stream.binance.com:9443/stream?streams=ethusdt@kline_1m'
async with websockets.connect(url) as websocket:
while True:
price = price_new if price_new != None else 1800
await asyncio.sleep(10)
response = json.loads(await websocket.recv())
price_new = float(response['data']['k']['c'])
print(price)
print(price_new)
Куда скопировать?
Обсуждают сегодня