|
@@ -7,37 +7,81 @@ d = u2.connect('127.0.0.1:6555')
|
|
|
|
|
|
|
|
# 获取所有运行的APP
|
|
# 获取所有运行的APP
|
|
|
running_apps = d.app_list_running()
|
|
running_apps = d.app_list_running()
|
|
|
-
|
|
|
|
|
|
|
+print("安装列表:", running_apps)
|
|
|
# 如果app没有启动, 启动APP
|
|
# 如果app没有启动, 启动APP
|
|
|
if "com.niocpeed.dna" not in running_apps:
|
|
if "com.niocpeed.dna" not in running_apps:
|
|
|
|
|
+ print("com niocpeed.dna 重新启动")
|
|
|
d.app_start("com.niocpeed.dna")
|
|
d.app_start("com.niocpeed.dna")
|
|
|
# tab 交易按钮
|
|
# tab 交易按钮
|
|
|
btn_jy = d.xpath('//*[@content-desc="交易"]')
|
|
btn_jy = d.xpath('//*[@content-desc="交易"]')
|
|
|
-btn_jy.click()
|
|
|
|
|
|
|
+# btn_jy.click()
|
|
|
|
|
+# 交易方式选择
|
|
|
|
|
+btn_sel = d.xpath('//*[@content-desc="USDT合约"]')
|
|
|
|
|
+if btn_sel.exists:
|
|
|
|
|
+ btn_sel.click()
|
|
|
|
|
+
|
|
|
# 设置委托
|
|
# 设置委托
|
|
|
-input_weituo = d.xpath('//android.widget.ScrollView/android.view.View[17]/android.widget.EditText[1]')
|
|
|
|
|
|
|
+input_weituo = d.xpath('//*[@content-desc="最优"]')
|
|
|
# 设置数量
|
|
# 设置数量
|
|
|
-input_num = d.xpath('//android.widget.ScrollView/android.view.View[27]/android.widget.EditText[1]')
|
|
|
|
|
|
|
+input_num = d.xpath('//android.widget.ScrollView/android.view.View[39]/android.widget.EditText[1]')
|
|
|
btn_buy = d(description="买入/开多")
|
|
btn_buy = d(description="买入/开多")
|
|
|
|
|
|
|
|
-for i in range(10):
|
|
|
|
|
- # 初始化点击按钮
|
|
|
|
|
- start = time.time()
|
|
|
|
|
-
|
|
|
|
|
- input_weituo.click()
|
|
|
|
|
- input_weituo.set_text("0.114")
|
|
|
|
|
|
|
+buy_x, buy_y = btn_buy.center()
|
|
|
|
|
|
|
|
- input_num.click()
|
|
|
|
|
- input_num.set_text("40")
|
|
|
|
|
|
|
+start1 = time.time()
|
|
|
|
|
+input_weituo.click()
|
|
|
|
|
+end1 = time.time()
|
|
|
|
|
+print("点击:最优委托 操作耗时:", end1 - start1)
|
|
|
|
|
|
|
|
- btn_buy.click()
|
|
|
|
|
|
|
+# start1 = time.time()
|
|
|
|
|
+# input_weituo.set_text("0.114")
|
|
|
|
|
+# end1 = time.time()
|
|
|
|
|
+# print("设置:操作耗时:", end1 - start1)
|
|
|
|
|
+# start1 = time.time()
|
|
|
|
|
+# input_num.click()
|
|
|
|
|
+# end1 = time.time()
|
|
|
|
|
+# print("点击数量:操作耗时:", end1 - start1)
|
|
|
|
|
+# start1 = time.time()
|
|
|
|
|
+# input_num.set_text("40")
|
|
|
|
|
+# end1 = time.time()
|
|
|
|
|
+# print("设置数量:操作耗时:", end1 - start1)
|
|
|
|
|
|
|
|
|
|
+for i in range(10):
|
|
|
|
|
+ # 初始化点击按钮
|
|
|
|
|
+ start = time.time()
|
|
|
|
|
+ # start1 = time.time()
|
|
|
|
|
+ # input_weituo.click()
|
|
|
|
|
+ # end1 = time.time()
|
|
|
|
|
+ # print("点击:最优委托 操作耗时:", end1 - start1)
|
|
|
|
|
+ #
|
|
|
|
|
+ # # start1 = time.time()
|
|
|
|
|
+ # # input_weituo.set_text("0.114")
|
|
|
|
|
+ # # end1 = time.time()
|
|
|
|
|
+ # # print("设置:操作耗时:", end1 - start1)
|
|
|
|
|
+ # start1 = time.time()
|
|
|
|
|
+ # input_num.click()
|
|
|
|
|
+ # end1 = time.time()
|
|
|
|
|
+ # print("点击:操作耗时:", end1 - start1)
|
|
|
|
|
+ # start1 = time.time()
|
|
|
|
|
+ # input_num.set_text("40")
|
|
|
|
|
+ # end1 = time.time()
|
|
|
|
|
+ # print("设置:操作耗时:", end1 - start1)
|
|
|
|
|
+ start1 = time.time()
|
|
|
|
|
+ # 直接点击 xpath直接点击
|
|
|
|
|
+ # btn_buy.click()
|
|
|
|
|
+ # 比上面的快50毫秒
|
|
|
|
|
+ # d.click(1078, 1094) ui点击 指定坐标
|
|
|
|
|
+ # 比上面的快100毫秒 直接调用shell 指定坐标
|
|
|
|
|
+ d.shell(f"input tap {buy_x} {buy_y}")
|
|
|
|
|
+ end1 = time.time()
|
|
|
|
|
+ print("点击下单:操作耗时:", end1 - start1)
|
|
|
end = time.time()
|
|
end = time.time()
|
|
|
- print("操作耗时:", end - start)
|
|
|
|
|
|
|
+ # print("点击整体:操作耗时:", end - start)
|
|
|
time.sleep(5)
|
|
time.sleep(5)
|
|
|
|
|
|
|
|
# 给开仓确认的弹框 选中 下次不在提醒,能减少时间
|
|
# 给开仓确认的弹框 选中 下次不在提醒,能减少时间
|
|
|
# d(description="确认").click()
|
|
# d(description="确认").click()
|
|
|
# d.xpath('//*[@content-desc="确认"]').click()
|
|
# d.xpath('//*[@content-desc="确认"]').click()
|
|
|
|
|
|
|
|
-# button = d.xpath("//android.widget.Button[@text='Button']")
|
|
|
|
|
|
|
+
|
|
|
|
|
+# button = d.xpath("//android.widget.Button[@text='Button']")
|