From 3ab4cf17acef6e2caf6b6e3328d80a4cd9b9d450 Mon Sep 17 00:00:00 2001 From: shinny-pack Date: Sun, 1 Sep 2024 14:56:26 +0000 Subject: [PATCH] Update Version 3.7.1 --- PKG-INFO | 2 +- doc/conf.py | 4 ++-- doc/version.rst | 6 ++++++ setup.py | 4 ++-- tqsdk/__version__.py | 2 +- tqsdk/tradeable/otg/tqctp.py | 2 +- tqsdk/zq_otg.py | 9 ++++----- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/PKG-INFO b/PKG-INFO index 1c5379e5..20ceaff9 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: tqsdk -Version: 3.7.0 +Version: 3.7.1 Summary: TianQin SDK Home-page: https://www.shinnytech.com/tqsdk Author: TianQin diff --git a/doc/conf.py b/doc/conf.py index 473c20d9..cfa43c73 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -48,9 +48,9 @@ # built documents. # # The short X.Y version. -version = u'3.7.0' +version = u'3.7.1' # The full version, including alpha/beta/rc tags. -release = u'3.7.0' +release = u'3.7.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/version.rst b/doc/version.rst index 08483b70..2265dca4 100644 --- a/doc/version.rst +++ b/doc/version.rst @@ -2,6 +2,12 @@ 版本变更 ============================= +3.7.1 (2024/08/29) + +* 修复:在 Windows 系统上使用 :py:class:`~tqsdk.TqCtp` 账户导致多 TqApi 实例无法运行的问题 +* 修复::py:class:`~tqsdk.TqCtp` 文档 demo 代码拼写错误 + + 3.7.0 (2024/08/22) * 新增::py:class:`~tqsdk.TqCtp` 账户类型,支持直连 CTP 柜台 diff --git a/setup.py b/setup.py index fe168950..45f7732a 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='tqsdk', - version="3.7.0", + version="3.7.1", description='TianQin SDK', author='TianQin', author_email='tianqincn@gmail.com', @@ -18,7 +18,7 @@ packages=setuptools.find_packages(exclude=["tqsdk.test", "tqsdk.test.*"]), python_requires='>=3.6.4', install_requires=["websockets>=8.1", "requests", "numpy", "pandas>=1.1.0", "scipy", "simplejson", "aiohttp", - "certifi", "pyjwt", "psutil", "shinny_structlog", "sgqlc", "filelock", "tqsdk_ctpse", "tqsdk_sm", "tqsdk_zq_otg==1.1.0"], + "certifi", "pyjwt", "psutil", "shinny_structlog", "sgqlc", "filelock", "tqsdk_ctpse", "tqsdk_sm", "tqsdk_zq_otg==1.1.1"], classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", diff --git a/tqsdk/__version__.py b/tqsdk/__version__.py index 8c3336cc..380cd80a 100644 --- a/tqsdk/__version__.py +++ b/tqsdk/__version__.py @@ -1 +1 @@ -__version__ = '3.7.0' +__version__ = '3.7.1' diff --git a/tqsdk/tradeable/otg/tqctp.py b/tqsdk/tradeable/otg/tqctp.py index 6552327a..3e6ce4e6 100644 --- a/tqsdk/tradeable/otg/tqctp.py +++ b/tqsdk/tradeable/otg/tqctp.py @@ -31,7 +31,7 @@ def __init__(self, account_id: str, password: str, front_broker: str, front_url: Example1:: from tqsdk import TqApi, TqCtp - account = TqCtp(account_id="CTP 账户", password="CTP 密码", front_broker="CTP 柜台代码", "front_url"="CTP 柜台地址", app_id="CTP AppID", auth_code="CTP AuthCode") + account = TqCtp(account_id="CTP 账户", password="CTP 密码", front_broker="CTP 柜台代码", front_url="CTP 柜台地址", app_id="CTP AppID", auth_code="CTP AuthCode") api = TqApi(account, auth=TqAuth("快期账户", "账户密码")) """ diff --git a/tqsdk/zq_otg.py b/tqsdk/zq_otg.py index 24aee48d..1e94dfd1 100644 --- a/tqsdk/zq_otg.py +++ b/tqsdk/zq_otg.py @@ -11,7 +11,7 @@ import subprocess import contextlib from pathlib import Path -from asyncio.subprocess import DEVNULL +from asyncio.subprocess import DEVNULL, PIPE from tqsdk_zq_otg import get_zq_otg_path @@ -46,9 +46,9 @@ async def get_addr(self): self._zq_otg_proc.poll() if self._zq_otg_proc is None or self._zq_otg_proc.returncode is not None: if sys.platform.startswith("win"): - self._zq_otg_proc = subprocess.Popen([self._zq_otg_exe, f"--config={parameters}", "--mode=cmd"], stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL, env=self._zq_otg_env) + self._zq_otg_proc = subprocess.Popen([self._zq_otg_exe, f"--config={parameters}", "--mode=cmd"], stdin=PIPE, stdout=DEVNULL, stderr=DEVNULL, env=self._zq_otg_env) else: - self._zq_otg_proc = await asyncio.create_subprocess_exec(self._zq_otg_exe, f"--config={parameters}", "--mode=cmd", stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL, env=self._zq_otg_env) + self._zq_otg_proc = await asyncio.create_subprocess_exec(self._zq_otg_exe, f"--config={parameters}", "--mode=cmd", stdin=PIPE, stdout=DEVNULL, stderr=DEVNULL, env=self._zq_otg_env) for i in range(30): if port_file.exists(): @@ -62,8 +62,7 @@ async def get_addr(self): async def __aexit__(self, exc_type, exc, tb): if self._zq_otg_proc is not None: - with contextlib.suppress(ProcessLookupError): - self._zq_otg_proc.send_signal(signal.CTRL_BREAK_EVENT if sys.platform.startswith("win") else signal.SIGTERM) + self._zq_otg_proc.stdin.close() if sys.platform.startswith("win"): self._zq_otg_proc.wait() else: