Files
lm_code/test1.py
2025-12-11 11:05:02 +08:00

17 lines
480 B
Python

import time
from binance.um_futures import UMFutures
client = UMFutures() # 无需key
while True:
try:
ticker = client.ticker_price("ETHUSDT")
price = float(ticker['price'])
print(f"ETHUSDT 永续合约当前价格: {price}")
# 在这里加入你的判断逻辑,例如:
# if price > 4000:
# tu_wx1()
except Exception as e:
print(f"错误: {e}")
time.sleep(0.3) # 控制查询频率,避免被限流