bitmart优化完成

This commit is contained in:
Administrator
2025-12-19 09:46:11 +08:00
parent b61c0926bd
commit dcfba0619c
6 changed files with 64 additions and 19 deletions

View File

@@ -1,17 +1,29 @@
import time
from binance.um_futures import UMFutures
import requests
client = UMFutures() # 无需key
headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'zh-CN,zh;q=0.9',
'cache-control': 'no-cache',
'origin': 'https://www.websea.com',
'pragma': 'no-cache',
'priority': 'u=1, i',
'referer': 'https://www.websea.com/',
'sec-ch-ua': '"Not;A=Brand";v="99", "Google Chrome";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
}
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}")
params = {
'symbol': 'ETH-USDT',
'period': '30min',
'start': '1763480074',
'end': '1766072134',
}
time.sleep(0.3) # 控制查询频率,避免被限流
response = requests.get('https://capi.websea.com/webApi/market/getKline', params=params, headers=headers)
print(response.json())