Files
lm_code/test1.py

17 lines
480 B
Python
Raw Normal View History

2025-12-11 11:05:02 +08:00
import time
from binance.um_futures import UMFutures
2025-10-31 11:33:34 +08:00
2025-12-11 11:05:02 +08:00
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) # 控制查询频率,避免被限流