bitmart优化完成
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
telegram/sign.db
BIN
telegram/sign.db
Binary file not shown.
40
test1.py
40
test1.py
@@ -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())
|
||||
|
||||
@@ -5,7 +5,7 @@ from tqdm import *
|
||||
from loguru import *
|
||||
from DrissionPage import *
|
||||
|
||||
from curl_cffi import requests
|
||||
import requests
|
||||
|
||||
from 交易.tools import send_dingtalk_message
|
||||
|
||||
@@ -104,10 +104,25 @@ class WeexTransaction:
|
||||
return None, None
|
||||
|
||||
def get_price(self):
|
||||
|
||||
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',
|
||||
}
|
||||
# 方法 1:最常用(推荐)
|
||||
now_ts = int(time.time()) # 当前毫秒时间戳
|
||||
ten_days_ago_ts = int((time.time() - 86400 * 10)) # 10天前毫秒时间戳
|
||||
ten_days_ago_ts = int((time.time() - 86400 * 3)) # 10天前毫秒时间戳
|
||||
|
||||
params = {
|
||||
'symbol': 'ETH-USDT',
|
||||
@@ -121,7 +136,9 @@ class WeexTransaction:
|
||||
logger.info(f"获取最新数据:{i + 1}次。。。")
|
||||
try:
|
||||
response = self.session.get('https://capi.websea.com/webApi/market/getKline', params=params,
|
||||
headers=headers,
|
||||
timeout=5)
|
||||
print(response.json())
|
||||
|
||||
for data in response.json()["result"]['data']:
|
||||
insert_data = {
|
||||
@@ -262,11 +279,27 @@ class WeexTransaction:
|
||||
return False
|
||||
|
||||
def get_position_status(self):
|
||||
|
||||
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',
|
||||
}
|
||||
for i in range(3):
|
||||
try:
|
||||
response = self.session.get(
|
||||
'https://capi.websea.com/webApi/entrust/holdPosition',
|
||||
|
||||
)
|
||||
|
||||
resp_data = response.json()
|
||||
|
||||
@@ -6,7 +6,7 @@ from tqdm import *
|
||||
from loguru import *
|
||||
from DrissionPage import *
|
||||
|
||||
from curl_cffi import requests
|
||||
import requests
|
||||
from telethon import TelegramClient
|
||||
|
||||
from 交易.tools import send_dingtalk_message
|
||||
|
||||
Reference in New Issue
Block a user