Skip to content

[Tqsdk-Ci] Update Version 3.7.6 #499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

shinny-hongyan
Copy link
Collaborator

@shinny-hongyan shinny-hongyan commented Nov 13, 2024

Automated changes by create-pull-request GitHub action

Summary by CodeRabbit

  • 新特性

    • 更新版本至3.7.6,增加了对“packaging”依赖库的支持。
    • 新增方法:query_symbol_settlementquery_symbol_rankingquery_optionsquery_all_level_options,增强了API的功能。
    • 专业版文档更新,增加了试用和购买选项的详细信息。
  • 文档

    • 更新了多个类的文档字符串,提供了更清晰的参数格式说明。
    • 扩展了专业版文档,强调了市场数据和客户支持功能。
  • 错误修复

    • 改进了多个方法的错误处理逻辑,提升了API的可靠性。

Copy link

coderabbitai bot commented Nov 13, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

此次更改主要涉及tqsdk包的版本更新,从3.7.4更新至3.7.6。相关文件包括PKG-INFOdoc/conf.pysetup.pytqsdk/__version__.py,均进行了相应的版本号修改。此外,doc/version.rst文件新增了版本3.7.6的详细信息,并更新了与websockets库兼容性的相关文档。tqsdk/connect.py文件进行了结构性修改,增强了WebSocket连接管理。其他文件则主要更新了文档说明。

Changes

文件路径 更改摘要
PKG-INFO 版本更新:3.7.43.7.6
doc/conf.py 版本更新:versionrelease3.7.4更新至3.7.6
doc/version.rst 新增版本3.7.6及相关更新说明,修复与websockets 14.0的兼容性
setup.py 版本更新:version="3.7.4"version="3.7.6"
tqsdk/__version__.py 版本更新:__version__ = '3.7.4'__version__ = '3.7.6'
tqsdk/connect.py 添加WebSocket版本检查,合并类,更新连接处理逻辑及异常处理
tqsdk/tradeable/otg/tqctp.py 更新__init__方法中front_url参数的文档说明
tqsdk/tradeable/otg/tqjees.py 更新__init__方法中front_url参数的文档说明
tqsdk/tradeable/otg/tqrohon.py 更新__init__方法中front_url参数的文档说明
tqsdk/tradeable/otg/tqyida.py 更新__init__方法中front_url参数的文档说明
tqsdk/api.py 新增多个查询方法,增强现有方法的功能与错误处理

Possibly related PRs

Suggested reviewers

  • shinny-chenli

🐰 兔子跳跃欢快,版本更新真精彩,
从三点七四到六,功能依旧在,
文档清晰明了,用户使用无忧,
兔子为你欢呼,代码更美妙! 🎉


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
tqsdk/tradeable/otg/tqrohon.py (1)

25-25: 建议修改示例中的服务器地址

文档中增加格式说明很有帮助,但建议将示例IP地址替换为示例域名或保留地址(如 192.0.2.0/24 范围内的地址)。

建议修改为:

-            front_url (str): 融航柜台地址,格式为 tcp://ip:port,如 tcp://129.211.138.170:10001
+            front_url (str): 融航柜台地址,格式为 tcp://ip:port,如 tcp://192.0.2.100:10001
tqsdk/tradeable/otg/tqjees.py (1)

25-25: 文档改进很好,建议增加参数格式验证

文档中明确指定了 front_url 参数的格式要求,这对用户很有帮助。不过建议添加参数格式验证,以确保用户输入的 URL 符合要求。

建议添加如下格式验证代码:

    def __init__(self, account_id: str, password: str, front_broker: str, front_url: str, app_id: str, auth_code: str) -> None:
+        if not front_url.startswith('tcp://') or ':' not in front_url.split('/')[-1]:
+            raise ValueError("front_url 格式错误,应为 tcp://ip:port,如 tcp://129.211.138.170:10001")
        self._account_id = account_id
        self._front_broker = front_broker
        self._front_url = front_url
doc/version.rst (1)

Line range hint 1-24: 建议优化版本历史文档的结构

当前文档结构采用了按时间倒序排列的方式记录版本历史,建议考虑:

  1. 为每个主要版本(如 3.x)添加一个小节标题,便于快速导航
  2. 对重大更新添加更详细的说明和升级指南
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 573ad22 and f171c16.

📒 Files selected for processing (10)
  • PKG-INFO (1 hunks)
  • doc/conf.py (1 hunks)
  • doc/version.rst (1 hunks)
  • setup.py (1 hunks)
  • tqsdk/__version__.py (1 hunks)
  • tqsdk/connect.py (5 hunks)
  • tqsdk/tradeable/otg/tqctp.py (1 hunks)
  • tqsdk/tradeable/otg/tqjees.py (1 hunks)
  • tqsdk/tradeable/otg/tqrohon.py (1 hunks)
  • tqsdk/tradeable/otg/tqyida.py (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • PKG-INFO
  • setup.py
  • tqsdk/version.py
🔇 Additional comments (10)
tqsdk/tradeable/otg/tqyida.py (1)

23-23: 文档改进很好!

参数格式说明更加清晰具体,添加实际示例有助于用户正确使用接口。

tqsdk/tradeable/otg/tqctp.py (2)

25-25: 文档改进清晰明确!

参数格式说明的补充很有帮助,使API更易于使用。


25-25: 建议验证示例IP地址的使用

请确认文档中使用的示例IP地址(129.211.138.170)是否适合公开展示。建议考虑使用示例IP(如:192.0.2.0/24 范围内的地址)来避免暴露实际服务器地址。

doc/conf.py (1)

51-51: 版本号更新正确!

版本号从 3.7.4 更新至 3.7.5 的修改符合预期。

运行以下脚本以验证版本号在所有相关文件中的一致性:

Also applies to: 53-53

✅ Verification successful

版本号已在所有相关文件中保持一致

经验证,版本号 3.7.5 在以下文件中均保持一致:

  • setup.py
  • PKG-INFO
  • tqsdk/version.py
  • doc/conf.py
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:验证版本号在各个文件中是否一致

echo "检查各文件中的版本号:"
echo "1. setup.py 中的版本号:"
rg -A 1 "version\s*=" setup.py

echo "2. PKG-INFO 中的版本号:"
rg "^Version:" PKG-INFO

echo "3. tqsdk/__version__.py 中的版本号:"
cat tqsdk/__version__.py

echo "4. doc/conf.py 中的版本号:"
rg "version\s*=\s*u'[\d.]+'" doc/conf.py

Length of output: 615

doc/version.rst (1)

5-9: 版本更新内容清晰明确

版本 3.7.5 的更新内容记录完整,包含了:

  1. 修复了与 websockets 14.0 版本的兼容性问题
  2. 补充了多个类的 front_url 示例文档
tqsdk/connect.py (5)

20-21: 模块导入正确,确保版本兼容性

引入了websockets.exceptionsversion模块,为后续的版本判断和异常处理奠定了基础。


47-48: 使用packaging模块解析版本号,准确判断websockets版本

通过version.parse解析websockets库的版本号,确保了版本比较的准确性,有利于兼容不同版本的库。


62-72: 根据websockets版本定义异常类,保障异常处理的兼容性

针对websockets 14.0以上和以下的版本,分别定义了websocket_expect_exc异常元组,确保在不同版本下都能正确捕获相关异常。


100-107: 根据websockets版本调整连接参数,确保连接建立的正确性

websockets 14.0及以上版本中,使用了additional_headersprocess_exception等新参数,并适当处理user_agent_header,以适应新版本的API变化,保证了WebSocket连接的正确建立。


190-190: 异常处理逻辑更新,兼容不同版本的websockets异常类型

在异常捕获中使用了websocket_expect_exc动态元组,结合其他常见异常类型,确保在连接过程中出现异常时能够被正确捕获并处理。

@shinny-hongyan shinny-hongyan changed the title [Tqsdk-Ci] Update Version 3.7.5 [Tqsdk-Ci] Update Version 3.7.6 Nov 14, 2024
@shinny-hongyan shinny-hongyan force-pushed the create-pull-request/patch-573ad22 branch from f171c16 to a12c241 Compare November 14, 2024 06:42
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
tqsdk/connect.py (2)

100-107: 连接参数更新合理,建议添加注释说明版本差异!

代码正确处理了 websockets 14.0 版本的参数变化,但建议添加注释说明不同版本参数的具体差异,以便后续维护。

建议添加如下注释:

 if websocket_version_ge_14:
+    # websockets >= 14.0 使用 additional_headers 替代 extra_headers
+    # user_agent_header 设为 None 以避免重复,因为 base_headers 已包含
     self._keywords["additional_headers"] = self._api._base_headers
     self._keywords["user_agent_header"] = None
     self._keywords["process_exception"] = lambda exc: exc
 else:
+    # websockets < 14.0 使用 extra_headers
     self._keywords["extra_headers"] = self._api._base_headers

190-190: 异常处理完善,建议增强日志记录!

异常处理逻辑完善,包含了维护时间窗口的检查。建议在捕获异常时添加更详细的日志记录,以便问题排查。

建议在异常处理中添加更详细的日志:

-except websocket_expect_exc + (asyncio.TimeoutError, OSError, EOFError, TqBacktestPermissionError) as e:
+except websocket_expect_exc + (asyncio.TimeoutError, OSError, EOFError, TqBacktestPermissionError) as e:
+    self._logger.error("websocket connection error",
+                       error_type=type(e).__name__,
+                       error_msg=str(e),
+                       url=url,
+                       in_ops_time=in_ops_time)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f171c16 and a12c241.

📒 Files selected for processing (12)
  • PKG-INFO (1 hunks)
  • doc/conf.py (1 hunks)
  • doc/profession.rst (0 hunks)
  • doc/version.rst (1 hunks)
  • setup.py (2 hunks)
  • tqsdk/__version__.py (1 hunks)
  • tqsdk/api.py (0 hunks)
  • tqsdk/connect.py (5 hunks)
  • tqsdk/tradeable/otg/tqctp.py (1 hunks)
  • tqsdk/tradeable/otg/tqjees.py (1 hunks)
  • tqsdk/tradeable/otg/tqrohon.py (1 hunks)
  • tqsdk/tradeable/otg/tqyida.py (1 hunks)
💤 Files with no reviewable changes (2)
  • doc/profession.rst
  • tqsdk/api.py
🚧 Files skipped from review as they are similar to previous changes (9)
  • PKG-INFO
  • doc/conf.py
  • doc/version.rst
  • setup.py
  • tqsdk/version.py
  • tqsdk/tradeable/otg/tqctp.py
  • tqsdk/tradeable/otg/tqjees.py
  • tqsdk/tradeable/otg/tqrohon.py
  • tqsdk/tradeable/otg/tqyida.py
🔇 Additional comments (1)
tqsdk/connect.py (1)

20-21: 版本兼容性处理得当!

代码通过 packaging 库优雅地处理了 websockets 14.0 版本的兼容性问题,并根据不同版本正确定义了异常处理元组。

Also applies to: 47-48, 62-72

@shinny-chenli shinny-chenli merged commit 1adf688 into master Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants