Closed manyhelp closed 9 months ago
# 初次使用请在`debug=True`模式下多测试几次
# 再次测试在模拟炒股下再开启`debug=False`
# 然后再在其它账号下`debug=True`模式下测试
# 最后是其它账号下`debug=False`下交易
t = THS(debug=True, skip_popup=False)
t.connect(addr="emulator-5554")
为了防止操作失误,默认参数为debug=True
,需要设置为debug=False
` [D 231017 17:54:24 init:661] [pid:2120] [emulator-5554] kill process(ps): uiautomator 2023-10-17 17:54:24.426 | INFO | thsauto.utils:exit:16 - code executed in 2.4565136 seconds Traceback (most recent call last): File "D:\devsoft\Miniconda3\lib\site-packages\uiautomator2__init__.py", line 486, in _jsonrpc_retry_call return self._jsonrpc_call(*args, **kwargs) File "D:\devsoft\Miniconda3\lib\site-packages\uiautomator2__init__.py", line 519, in _jsonrpc_call raise GatewayError( uiautomator2.exceptions.GatewayError: (<Response [502]>, 'gateway error, time used 0.0s')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "K:\quant\thsauto\examples\demo.py", line 12, in
https://github.com/openatx/uiautomator2/issues/906
或者降低uiautomator2的版本,或者降低packaging版本 pip install packaging==21.3
你可以试试,我目前还没有遇到此问题
安装的是这个版本。不知道什么原因,重启电脑解决。多谢大佬。
confirm, prompt = t.buy(100, 7.1, code='600000') print(confirm, prompt)
{'标题': '委托买入确认', '账户': 'A123456', '名称': '浦发银行', '代码': '600000', '数量': 100, '价格': 7.1} {}