From 61e5a897fcaad10bf60910efb34266602d81e16c Mon Sep 17 00:00:00 2001 From: 27942 Date: Fri, 12 Dec 2025 11:07:15 +0800 Subject: [PATCH] rgfewfger --- 交易/websea_交易.py | 6 ++++++ 交易/weex_交易.py | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/交易/websea_交易.py b/交易/websea_交易.py index 0c28b54..1fc4ebc 100644 --- a/交易/websea_交易.py +++ b/交易/websea_交易.py @@ -319,6 +319,7 @@ class WeexTransaction: self.pbar = tqdm(total=30, desc="等待时间中", ncols=80) # desc:进度条说明,ncols:长度 + self.time_start = None # 时间状态 避免同一个时段,发生太多消息 while True: # 获取当前时间 current_time = time.localtime() @@ -350,6 +351,11 @@ class WeexTransaction: if self.get_now_time() != self.kline_3["id"]: continue + if self.time_start == self.get_now_time(): + continue + + self.time_start = self.get_now_time() + if self.get_token(): # 获取token logger.info("获取token成功!!!") else: diff --git a/交易/weex_交易.py b/交易/weex_交易.py index 6cf7a28..af54161 100644 --- a/交易/weex_交易.py +++ b/交易/weex_交易.py @@ -322,6 +322,7 @@ class WeexTransaction: self.pbar = tqdm(total=30, desc="等待时间中", ncols=80) # desc:进度条说明,ncols:长度 + self.time_start = None # 时间状态 避免同一个时段,发生太多消息 while True: # 获取当前时间 current_time = time.localtime() @@ -335,7 +336,7 @@ class WeexTransaction: self.pbar.refresh() if current_minute not in [0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 34, ]: # 判断是否是 新的30分钟了 - # if current_minute not in range(60): # 判断是否是 新的30分钟了 + # if current_minute not in range(60): # 判断是否是 新的30分钟了 time.sleep(10) continue @@ -359,6 +360,10 @@ class WeexTransaction: # 判断抓取的数据是否正确 if self.get_now_time() != self.kline_3["id"]: continue + if self.time_start == self.get_now_time(): + continue + + self.time_start = self.get_now_time() if self.get_position_status(): logger.info("获取仓位信息成功!!!")