dededdew
This commit is contained in:
@@ -204,6 +204,23 @@ class WeexTransaction:
|
||||
time.sleep(3)
|
||||
self.page.ele('x://span[normalize-space()="卖出开空"]').click()
|
||||
|
||||
def get_text(self, target_text):
|
||||
# 去除目标文本中的空白字符
|
||||
cleaned_target_text = re.sub(r'\s', '', target_text)
|
||||
|
||||
# 创建 BeautifulSoup 对象
|
||||
soup = BeautifulSoup(self.page.html, 'html.parser')
|
||||
|
||||
# 遍历所有标签的文本内容
|
||||
for tag in soup.find_all():
|
||||
tag_text = tag.get_text()
|
||||
# 去除标签文本中的空白字符
|
||||
cleaned_tag_text = re.sub(r'\s', '', tag_text)
|
||||
if cleaned_target_text in cleaned_tag_text:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def action(self):
|
||||
|
||||
# 获取比特端口
|
||||
@@ -240,43 +257,14 @@ class WeexTransaction:
|
||||
|
||||
if current_minute in [0, 30]: # 判断是否是 新的30分钟了
|
||||
|
||||
|
||||
# 要匹配的目标文本
|
||||
target_text = "仓位(1)"
|
||||
|
||||
# 去除目标文本中的空白字符
|
||||
cleaned_target_text = re.sub(r'\s', '', target_text)
|
||||
|
||||
# 创建 BeautifulSoup 对象
|
||||
soup = BeautifulSoup(self.page.html, 'html.parser')
|
||||
|
||||
# 遍历所有标签的文本内容
|
||||
for tag in soup.find_all():
|
||||
tag_text = tag.get_text()
|
||||
# 去除标签文本中的空白字符
|
||||
cleaned_tag_text = re.sub(r'\s', '', tag_text)
|
||||
if cleaned_target_text in cleaned_tag_text:
|
||||
text = self.page.ele(
|
||||
'x://*[@id="tradeLimitContainerJS"]/div[2]/div/div[1]/div/div/div/div[5]/div/div/div[2]').text
|
||||
if "ETH/SUSDT 多" in text:
|
||||
self.start = 1
|
||||
break
|
||||
elif "ETH/SUSDT 空" in text:
|
||||
self.start = -1
|
||||
break
|
||||
if self.get_text(target_text="仓位(1)"):
|
||||
if self.get_text(target_text="ETH/SUSDT多"):
|
||||
self.start = 1
|
||||
elif self.get_text(target_text="ETH/SUSDT空"):
|
||||
self.start = -1
|
||||
else:
|
||||
self.start = 0
|
||||
|
||||
# if self.page.html:
|
||||
# text = self.page.ele(
|
||||
# 'x://*[@id="tradeLimitContainerJS"]/div[2]/div/div[1]/div/div/div/div[5]/div/div/div[2]').text
|
||||
# if "ETH/SUSDT 多" in text:
|
||||
# self.start = 1
|
||||
# elif "ETH/SUSDT 空" in text:
|
||||
# self.start = -1
|
||||
# else:
|
||||
# self.start = 0
|
||||
|
||||
new_price_datas = self.get_price()
|
||||
if new_price_datas:
|
||||
logger.success("获取最新交易价格成功!!!")
|
||||
|
||||
Reference in New Issue
Block a user