策略源码
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()
更多内容
全部留言
oklong
老哥,代写?怎么联系
2021-11-12 13:56:44
GCC
本人水平有限,暂不接代写,抱歉
2021-11-15 14:54:59