Skip to content

[Tqsdk-Ci] Update Version 3.8.2 #508

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shinny-hongyan
Copy link
Collaborator

@shinny-hongyan shinny-hongyan commented May 25, 2025

Automated changes by create-pull-request GitHub action

Summary by CodeRabbit

  • 新功能
    • 新增了《在 Cursor AI 代码编辑器中高效学习和使用 TqSdk》用户指南,详细介绍了如何在 Cursor 编辑器中利用 AI 辅助开发和调试 TqSdk。
  • 功能修复
    • 修复了 TqApi.query_all_level_finance_options 方法对中金所股指期权标的的判断,支持更多标的代码。
  • 文档
    • 文档目录新增 tqsdk_cursor.rst,移除 tqsdk_llm.rst。
    • 优化了部分文档的标题格式和链接格式。
    • 更新了版本日志,补充了 3.8.2 版本的修复说明。
    • Sphinx 配置增加 Google Analytics 支持,调整了相关参数配置。
  • 其他
    • 版本号更新为 3.8.2。

Copy link

coderabbitai bot commented May 25, 2025

📝 Walkthrough

Walkthrough

本次更新主要包括版本号从3.8.1提升至3.8.2,文档内容和格式的多项修订,新增了关于在Cursor AI代码编辑器中使用TqSdk的详细指南,修正了部分文档链接和引用,完善了Sphinx文档配置以支持Google Analytics,并对部分代码实现进行了小幅改动,如WebSocket连接处理函数增加了返回值、期权查询方法的参数校验范围扩展等。

Changes

文件/分组 变更摘要
PKG-INFO, setup.py, tqsdk/version.py, doc/conf.py 版本号由3.8.1更新为3.8.2,Sphinx配置增加Google Analytics扩展及相关变量,移除旧的主题选项。
doc/tqsdk_cursor.rst 新增文档,详细介绍如何在Cursor AI代码编辑器中高效学习和使用TqSdk。
doc/index.rst 目录中添加tqsdk_cursor.rst,移除tqsdk_llm.rst
doc/demo/base.rst, doc/tq_trading_unit.rst 文档标题下划线长度调整为更统一和规范,纯格式变更。
doc/usage/jupyter.rst 修正Jupyter Notebook安装文档中的链接格式和URL。
doc/version.rst 更新3.8.2版本日志,修正文档历史中的引用和描述。
tqsdk/api.py 示例代码中显式补充datetime导入,query_all_level_finance_options方法对股指期权参数校验范围扩展。
tqsdk/tqwebhelper.py WebSocket连接处理函数结尾新增return ws,完善控制流程。

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant TqWebHelper
    participant WebSocket

    Client->>TqWebHelper: 发起WebSocket连接请求
    TqWebHelper->>WebSocket: 建立连接
    TqWebHelper->>Client: 发送初始数据
    loop 消息处理
        Client->>TqWebHelper: 发送消息
        TqWebHelper->>Client: 响应消息
    end
    TqWebHelper-->>Client: 关闭连接并返回ws对象
Loading

Poem

兔子挥笔写新篇,
版本跃升三八二。
文档整齐又明了,
Cursor指引添新招。
代码微调流程顺,
统计分析也上线。
祝愿开发更轻松,
兔耳随风乐无边!

((\
( -.-)
o_(")(")

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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

🧹 Nitpick comments (1)
tqsdk/api.py (1)

3072-3084: 统一错误提示中的参数名称
当前错误提示使用了 exercise_date 参数,但是该接口实际接收的参数名为 nearbys。建议将提示修改为:

if underlying_symbol in ["SSE.000300", "SSE.000852", "SSE.000016"]:
    if any(i not in [0, 1, 2, 3, 4, 5] for i in nearbys):
        raise Exception(f"股指期权标的为:{underlying_symbol},nearbys 参数应在 [0, 1, 2, 3, 4, 5] 之间。")
else:
    if any(i not in [0, 1, 2, 3] for i in nearbys):
        raise Exception(f"ETF 期权标的为:{underlying_symbol},nearbys 参数应在 [0, 1, 2, 3] 之间。")

这样可保持文档、参数和错误提示的一致性。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62335b6 and b5b435f.

📒 Files selected for processing (12)
  • PKG-INFO (1 hunks)
  • doc/conf.py (3 hunks)
  • doc/demo/base.rst (30 hunks)
  • doc/index.rst (1 hunks)
  • doc/tq_trading_unit.rst (4 hunks)
  • doc/tqsdk_cursor.rst (1 hunks)
  • doc/usage/jupyter.rst (1 hunks)
  • doc/version.rst (4 hunks)
  • setup.py (1 hunks)
  • tqsdk/__version__.py (1 hunks)
  • tqsdk/api.py (3 hunks)
  • tqsdk/tqwebhelper.py (1 hunks)
🔇 Additional comments (19)
tqsdk/tqwebhelper.py (1)

290-290: 修复 WebSocket 处理器的返回值

正确添加了 return ws 语句,这符合 aiohttp WebSocket 处理器的标准模式。之前缺少返回值可能会导致框架无法正确处理 WebSocket 响应对象。

PKG-INFO (1)

3-3: 版本号更新正确

版本从 3.8.1 更新到 3.8.2,与项目的版本发布一致。

tqsdk/__version__.py (1)

1-1:

✅ Verification successful

版本字符串更新正确

版本号已正确更新为 '3.8.2',与其他文件中的版本信息保持一致。

运行以下脚本验证版本号在整个项目中的一致性:


🏁 Script executed:

#!/bin/bash
# 描述:检查项目中所有版本号引用是否一致
# 预期:所有版本号都应该是 3.8.2

echo "检查版本号一致性:"
echo "=== __version__.py ==="
cat tqsdk/__version__.py

echo "=== PKG-INFO ==="
grep "^Version:" PKG-INFO

echo "=== setup.py ==="
rg -A 3 -B 3 "version.*=" setup.py

echo "=== 其他可能的版本引用 ==="
rg "3\.8\.[0-9]" --type py --type rst --type md

Length of output: 930


版本号一致性验证通过

项目中所有主要版本引用均已正确更新为 3.8.2:

  • tqsdk/version.py

  • PKG-INFO

  • setup.py

  • doc/conf.py

  • doc/version.rst 中保留了历史版本记录(3.8.2、3.8.1、3.8.0),无需修改。

  • doc/tq_trading_unit.rst 中的最低版本要求 >= 3.8.0 对于 3.8.2 依然适用,无需调整。

✅ 批准合并。

doc/index.rst (1)

24-24:

✅ Verification successful

文档索引更新正确

在目录树中添加了 tqsdk_cursor.rst,这应该是新增的 Cursor AI 代码编辑器使用指南。

验证新添加的文档文件是否存在:


🏁 Script executed:

#!/bin/bash
# 描述:检查新添加的文档文件是否存在
# 预期:tqsdk_cursor.rst 文件应该存在

echo "检查文档文件:"
if [ -f "doc/tqsdk_cursor.rst" ]; then
    echo "✓ doc/tqsdk_cursor.rst 存在"
    echo "文件大小:$(wc -l < doc/tqsdk_cursor.rst)"
else
    echo "✗ doc/tqsdk_cursor.rst 不存在"
fi

echo ""
echo "检查是否有其他相关的 LLM 或 Cursor 文档:"
fd -e rst . doc/ | grep -i -E "(llm|cursor|ai)"

Length of output: 402


文档索引更新已验证

  • 已确认 doc/tqsdk_cursor.rst 文件存在(178 行)
  • 原有的 doc/tqsdk_llm.rst 仍在,新增文档与现有 LLM 文档可并存
    批准合并,无其他问题。
setup.py (1)

11-11: 版本号更新 已将版本号从3.8.1更新至3.8.2,与 __version__.pydoc/conf.py 等保持一致,符合发布流程。

doc/tq_trading_unit.rst (1)

8-8: 统一格式调整:标题下划线 已将各段落标题的下划线长度调整为与标题文本长度一致,保持文档格式统一。

Also applies to: 81-81, 93-93, 106-106, 113-113

doc/usage/jupyter.rst (1)

28-29: 修复链接格式 已移除冗余冒号和空格,修正为正确的 reST 链接语法,确保文档引用链接准确可用。

doc/demo/base.rst (1)

4-4: 统一格式调整:标题下划线 已将演示文档中所有标题的下划线长度统一为与标题文本长度一致,提升可读性和一致性。

Also applies to: 12-12, 21-21, 30-30, 39-39, 48-48, 57-57, 66-66, 74-74, 82-82, 89-89, 96-96, 103-103, 110-110, 117-117, 124-124, 131-131, 138-138, 145-145, 152-152, 159-159, 165-165, 173-173, 180-180, 187-187, 194-194, 201-201, 208-208

tqsdk/api.py (2)

870-871: 在示例中显式导入 datetime 以避免运行错误
添加 from datetime import datetime 导入,使示例能正确识别 datetime 类型,确保示例代码可运行。


942-943: 在示例中显式导入 datetime 以避免运行错误
添加 from datetime import datetime 导入,使示例能正确识别 datetime 类型,确保示例代码可运行。

doc/version.rst (1)

5-10: 版本变更日志条目格式正确

新增的3.8.2版本条目格式规范,内容简洁明了,符合项目的变更日志标准。修复内容和文档改进的描述都很清晰。

doc/conf.py (3)

17-17: 正确添加Google Analytics扩展

在extensions列表中正确添加了sphinxcontrib.googleanalytics扩展,这将为文档站点提供访问分析功能。


51-53: 版本号更新一致

版本号从3.8.1正确更新为3.8.2,与其他文件中的版本更新保持一致。


82-84: Google Analytics配置合理

Google Analytics的配置设置合理:

  • 使用了GA4格式的跟踪ID (G-9SPL7ERCMF)
  • 默认启用分析功能
  • 配置简洁明了
doc/tqsdk_cursor.rst (5)

1-36: 优秀的文档概述和介绍部分

文档开头部分内容全面且结构清晰:

  • 明确说明了文档目的和适用对象
  • 对Cursor的介绍准确且有针对性
  • 详细列出了在TqSdk开发中使用Cursor的具体好处
  • 内容组织逻辑性强,便于用户理解

37-77: 实用的安装和配置指南

安装和初始配置部分提供了清晰的步骤指导:

  • 安装步骤简明扼要
  • 包含了重要的配置建议(如推荐购买会员)
  • Python环境配置说明详细实用
  • 验证安装的命令很有帮助

78-108: 极佳的源码集成建议

将TqSdk源码添加到工作区的建议非常有价值:

  • 强调了这种做法的重要性
  • 提供了两种获取源码的方法,适应不同用户需求
  • 详细说明了操作步骤
  • 清楚阐释了这样做的技术优势

这是一个非常实用的最佳实践建议。


109-173: 全面的AI交互指南

文档的核心部分内容丰富且实用:

  • 提供了具体的使用快捷键和操作方法
  • 包含了大量实际的提问示例,覆盖不同使用场景
  • 调试指导简洁实用
  • 高效提问技巧部分很有价值,能帮助用户更好地利用AI功能

174-179: 恰当的总结部分

文档结尾总结恰当:

  • 重申了Cursor对TqSdk开发的价值
  • 鼓励用户积极使用关键功能
  • 语调积极正面,有助于用户采用

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.

1 participant