import json def main(): LogStatus("正在连接...") # client = Dial("wss://stream.binance.com:9443/stream?streams=btcusdt@aggTrade/ethusdt@aggTrade|reconnect=true") #多个交易对 # client = Dial("wss://stream.binance.com:9443/ws/btcusdt@aggTrade|reconnect=true") #单个交易对 # client = Dial("wss://dstream.binance.com/ws/btcusd_perp@aggTrade|reconnect=true") #币本位,ticker client = Dial("wss://fstream.binance.com/ws/btcusdt@aggTrade|reconnect=true") if not client: Log("连接失败, 程序退出") return while True: buf = client.read(-2) Log('tt',buf) if buf: obj = json.loads(buf) # Log(obj) # Log('交易对',obj['data']['s'], ' 价格', obj['data']['p']) #多个交易对 Log(obj['p']) #测试 Sleep(5000) client.close()
OklongTemanku, tolong tuliskan.
GCCSaya tidak bisa menulis di sini, maaf, saya tidak bisa menulis di sini.