bitmart优化完成

This commit is contained in:
Administrator
2026-01-12 09:34:55 +08:00
parent 28003da75e
commit 4707589129
6 changed files with 8 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -642,7 +642,7 @@ async def send_price_periodically(bot, chat_id):
print(f"[price] Failed to send price update: {e}")
# 等待下一小时整点(保持每小时推送一次)
now = datetime.datetime.now(LOCAL_TZ)
next_hour = (now.replace(minute=0, second=0, microsecond=0) + datetime.timedelta(hours=1))
next_hour = (now.replace(minute=0, second=0, microsecond=0) + datetime.timedelta(hours=2))
wait_seconds = (next_hour - now).total_seconds()
await asyncio.sleep(wait_seconds)

Binary file not shown.

View File

@@ -1,6 +1,6 @@
import time
import datetime
import openBrowser
from tqdm import tqdm
from loguru import logger

View File

@@ -27,7 +27,7 @@ class Config:
KLINE_LIMIT = 300
# 交易页面URL
TRADING_URL = "https://www.weeaxs.site/zh-CN/futures/ETH-USDT"
TRADING_URL = "https://www.weex.com/zh-CN/futures/ETH-USDT"
# 交易配置
POSITION_RATIO = 100 # 开仓金额比例余额的1/100
@@ -355,9 +355,9 @@ class TradingExecutor:
def close_all_positions(self) -> bool:
"""平仓所有持仓(闪电平仓)"""
try:
self.page.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
self.page.ele('x:(//span[normalize-space(text()) = "闪电平仓"])').scroll.to_see(center=True)
time.sleep(1)
self.page.ele('x://*[contains(text(), "闪电平仓")]').click()
self.page.ele('x:(//span[normalize-space(text()) = "闪电平仓"])').click()
time.sleep(3)
logger.success("成功执行平仓操作")
return True
@@ -370,7 +370,7 @@ class TradingExecutor:
try:
self.page.ele('x://input[@placeholder="请输入数量"]').input(amount)
time.sleep(1)
self.page.ele('x://*[contains(text(), "买入开多")]').click()
self.page.ele('x://*[normalize-space(text()) ="买入开多"]').click(by_js=True)
logger.success(f"成功开多,金额:{amount}")
return True
except Exception as e:
@@ -382,7 +382,7 @@ class TradingExecutor:
try:
self.page.ele('x://input[@placeholder="请输入数量"]').input(amount)
time.sleep(1)
self.page.ele('x://*[contains(text(), "卖出开空")]').click()
self.page.ele('x://*[normalize-space(text()) ="卖出开空"]').click(by_js=True)
logger.success(f"成功开空,金额:{amount}")
return True
except Exception as e:
@@ -810,7 +810,7 @@ class WeexTransaction:
MessageSender.send_dingtalk_message("获取可用余额失败", is_error=True)
return
amount = balance / Config.POSITION_RATIO
amount = int(balance / 100)
# 执行交易
trade_executed = self.trading_executor.execute_trade(