dededdew
This commit is contained in:
62
1.json
Normal file
62
1.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
'id': '681146715025178980',
|
||||
'accountId': '667375883530535268',
|
||||
'coinId': '64',
|
||||
'contractId': '20000002',
|
||||
'marginMode': 'SHARED',
|
||||
'separatedMode': 'COMBINED',
|
||||
'separatedOpenOrderId': '0',
|
||||
'positionSide': 'LONG',
|
||||
'orderSide': 'BUY',
|
||||
'price': '0.00',
|
||||
'size': '2.680',
|
||||
'clientOrderId': 'f57f5877-5af4-42d6-adad-5d88457b65ca',
|
||||
'type': 'MARKET',
|
||||
'timeInForce': 'IMMEDIATE_OR_CANCEL',
|
||||
'reduceOnly': False,
|
||||
'triggerPrice': '0',
|
||||
'triggerPriceType': 'UNKNOWN_PRICE_TYPE',
|
||||
'orderSource': 'WEB',
|
||||
'openTpslParentOrderId': '0',
|
||||
'openTpParam': None,
|
||||
'openSlParam': None,
|
||||
'extraType': '',
|
||||
'extraDataJson': '{"appVersion":"2.0.1","terminalType":"1"}',
|
||||
'leverage': '100',
|
||||
'takerFeeRate': '0.0008',
|
||||
'makerFeeRate': '0.0002',
|
||||
'feeDiscount': '1',
|
||||
'liquidateFeeRate': '0.01',
|
||||
'liquidateType': 'UNKNOWN_LIQUIDATE_TYPE',
|
||||
'legacyOrderDirection': 'OPEN_LONG',
|
||||
'legacyOrderDirectionDesc': '开多仓',
|
||||
'withoutMatchFillSize': '0',
|
||||
'withoutMatchFillValue': '0',
|
||||
'withoutMatchPeerAccountId': '0',
|
||||
'withoutMatchPeerOrderId': '0',
|
||||
'status': 'FILLED',
|
||||
'matchSequenceId': '2944106434',
|
||||
'triggerTime': '0',
|
||||
'triggerPriceTime': '0',
|
||||
'triggerPriceValue': '0',
|
||||
'cancelReason': 'UNKNOWN_ORDER_CANCEL_REASON',
|
||||
'latestFillPrice': '3420.63',
|
||||
'maxFillPrice': '3420.63',
|
||||
'minFillPrice': '3420.63',
|
||||
'cumFillSize': '2.680',
|
||||
'cumFillValue': '9167.28840',
|
||||
'cumFillFee': '7.33383072',
|
||||
'cumLiquidateFee': '0',
|
||||
'cumRealizePnl': '0',
|
||||
'createdTime': '1762398031956',
|
||||
'updatedTime': '1762398031962',
|
||||
'fallback': False,
|
||||
'positionTpsl': False,
|
||||
'setOpenTp': False,
|
||||
'setOpenSl': False,
|
||||
'liquidate': False,
|
||||
'deleverage': False,
|
||||
'withoutMatch': False,
|
||||
'closeAllPosition': False,
|
||||
'closeFullPositionTpSl': False
|
||||
}
|
||||
@@ -111,8 +111,6 @@ class WeexTransaction:
|
||||
|
||||
self.page.set.window.max()
|
||||
|
||||
self.page.get(url="https://www.weeaxs.site/zh-CN/futures/demo-trading/ETH-SUSDT")
|
||||
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
@@ -147,8 +145,8 @@ class WeexTransaction:
|
||||
for i in range(3):
|
||||
try:
|
||||
logger.info(f"获取最新数据:{i + 1}次。。。")
|
||||
self.page.refresh()
|
||||
res = self.page.listen.wait(timeout=15) # 等待并获取一个数据包
|
||||
self.mn_tab.refresh()
|
||||
res = self.mn_tab.listen.wait(timeout=15) # 等待并获取一个数据包
|
||||
|
||||
datas = []
|
||||
if res:
|
||||
@@ -172,40 +170,40 @@ class WeexTransaction:
|
||||
def to_do_page(self):
|
||||
# self.page.get("https://www.weeaxs.site/zh-CN/futures/demo-trading/ETH-SUSDT")
|
||||
|
||||
self.page.ele('x://*[contains(text(), "市价")]', timeout=15).click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "市价")]', timeout=15).click()
|
||||
time.sleep(1)
|
||||
self.page.ele('x://input[@placeholder="请输入数量"]').input(100)
|
||||
self.mn_tab.ele('x://input[@placeholder="请输入数量"]').input(100)
|
||||
time.sleep(1)
|
||||
|
||||
if self.direction == "long" and not self.start:
|
||||
logger.success(f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},开多")
|
||||
self.send_dingtalk_message(
|
||||
message_content=f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},开多")
|
||||
self.page.ele('x://*[contains(text(), "买入开多")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "买入开多")]').click()
|
||||
self.start = 1
|
||||
elif self.direction == "short" and not self.start:
|
||||
logger.success(f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},开空")
|
||||
self.send_dingtalk_message(
|
||||
message_content=f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},开空")
|
||||
self.page.ele('x://*[contains(text(), "卖出开空")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "卖出开空")]').click()
|
||||
self.start = -1
|
||||
elif self.direction == "long" and self.start == -1:
|
||||
logger.success(f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},反手平空做多")
|
||||
self.send_dingtalk_message(
|
||||
message_content=f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},反手平空做多")
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
time.sleep(3)
|
||||
self.page.ele('x://*[contains(text(), "买入开多")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "买入开多")]').click()
|
||||
self.start = 1
|
||||
elif self.direction == "short" and self.start == 1:
|
||||
logger.success(f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},反手平多做空")
|
||||
self.send_dingtalk_message(
|
||||
message_content=f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},反手平多做空")
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
time.sleep(3)
|
||||
self.page.ele('x://*[contains(text(), "卖出开空")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "卖出开空")]').click()
|
||||
self.start = -1
|
||||
|
||||
def get_text(self, target_text):
|
||||
@@ -213,7 +211,7 @@ class WeexTransaction:
|
||||
cleaned_target_text = re.sub(r'\s', '', target_text)
|
||||
|
||||
# 创建 BeautifulSoup 对象
|
||||
soup = BeautifulSoup(self.page.html, 'html.parser')
|
||||
soup = BeautifulSoup(self.mn_tab.html, 'html.parser')
|
||||
|
||||
# 遍历所有标签的文本内容
|
||||
for tag in soup.find_all():
|
||||
@@ -242,8 +240,22 @@ class WeexTransaction:
|
||||
|
||||
return int(target_timestamp) * 1000
|
||||
|
||||
def action(self):
|
||||
def close_extra_tabs_in_browser(self):
|
||||
|
||||
try:
|
||||
for _, i in enumerate(self.page.get_tabs()):
|
||||
if _ == 0:
|
||||
continue
|
||||
|
||||
i.close()
|
||||
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
def action(self):
|
||||
# 获取比特端口
|
||||
if self.openBrowser():
|
||||
logger.info("获取打开比特成功,成功获取端口!!!")
|
||||
@@ -258,13 +270,20 @@ class WeexTransaction:
|
||||
logger.error("接管浏览器失败!!!")
|
||||
return
|
||||
|
||||
self.page.listen.start("public/quote/v1/getKlineV2")
|
||||
if self.close_extra_tabs_in_browser():
|
||||
logger.info('关闭多余标签页成功!!!')
|
||||
else:
|
||||
logger.info('关闭多余标签页失败!!!')
|
||||
|
||||
self.mn_tab = self.page.new_tab()
|
||||
self.mn_tab.listen.start("public/quote/v1/getKlineV2")
|
||||
logger.success("浏览器开启抓包模式。。。")
|
||||
|
||||
self.mn_tab.get(url="https://www.weeaxs.site/zh-CN/futures/demo-trading/ETH-SUSDT") # 打开网页
|
||||
|
||||
self.pbar = tqdm(total=30, desc="等待时间中", ncols=80) # desc:进度条说明,ncols:长度
|
||||
|
||||
while True:
|
||||
|
||||
# 获取当前时间
|
||||
current_time = time.localtime()
|
||||
current_minute = current_time.tm_min
|
||||
@@ -308,8 +327,8 @@ class WeexTransaction:
|
||||
logger.success(f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},平多")
|
||||
self.send_dingtalk_message(
|
||||
message_content=f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},平多")
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
self.start = 0
|
||||
elif self.start == -1:
|
||||
if is_bullish(self.kline_1) and is_bullish(self.kline_2):
|
||||
@@ -317,8 +336,8 @@ class WeexTransaction:
|
||||
self.send_dingtalk_message(
|
||||
message_content=f"{datetime.datetime.now()},第一根信号:{self.kline_1},{self.kline_2},平空")
|
||||
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.page.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').scroll.to_see(center=True)
|
||||
self.mn_tab.ele('x://*[contains(text(), "闪电平仓")]').click()
|
||||
self.start = 0
|
||||
|
||||
self.direction, signal_key = self.check_signal(prev=self.kline_1, curr=self.kline_2) # 判断信号
|
||||
|
||||
Reference in New Issue
Block a user