shinnytech / tqsdk-python

天勤量化开发包, 期货量化, 实时行情/历史数据/实盘交易
https://doc.shinnytech.com/tqsdk/latest
Apache License 2.0
3.67k stars 653 forks source link

[Tqsdk-Ci] Update Version 3.5.8 #480

Closed shinny-hongyan closed 7 months ago

shinny-hongyan commented 7 months ago

Automated changes by create-pull-request GitHub action

coderabbitai[bot] commented 7 months ago
Walkthrough ## 概述 此次更新主要是将`tqsdk`包的版本号从`3.5.7`升级到`3.5.8`。除了版本号的统一升级外,还对`DataDownloader`和`TargetPosTask`等类进行了功能优化和错误修复,增强了参数验证,改进了异步代码的资源管理。 ## 变更 | 文件路径 | 变更摘要 | |------------------------------------|------------------------------------------| | PKG-INFO, setup.py, .../__version__.py, doc/conf.py | 版本号从`3.5.7`更新为`3.5.8` | | doc/version.rst, tqsdk/tools/downloader.py | 添加新功能,修复和优化相关类 | | tqsdk/api.py | 修改`show_symbols_info`函数的参数处理逻辑 | | tqsdk/lib/..., tqsdk/backtest/... | 更新任务取消和资源释放的处理方式 | | tqsdk/ins_schema.py | 增强GraphQL查询的参数验证 | > 🐰🌟 > 更新又来啦,版本跳跃不停歇, > 代码行行改,bug无处遁形逃, > 优化迭代忙,兔子码农笑开颜, > 新功能如春风,吹散疑云雾, > 兔耳朵一振,敲代码不用愁。

Recent Review Details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between b263bae538646a7fb014d50b56eaa13692d5d3a7 and d4178fd76f41b8f7b954373417c92f2c9f7a39b8.
Files selected for processing (11) * PKG-INFO (1 hunks) * doc/conf.py (1 hunks) * doc/version.rst (1 hunks) * setup.py (1 hunks) * tqsdk/__version__.py (1 hunks) * tqsdk/api.py (1 hunks) * tqsdk/backtest/backtest.py (3 hunks) * tqsdk/ins_schema.py (1 hunks) * tqsdk/lib/target_pos_scheduler.py (2 hunks) * tqsdk/lib/target_pos_task.py (4 hunks) * tqsdk/tools/downloader.py (9 hunks)
Files skipped from review due to trivial changes (4) * PKG-INFO * doc/conf.py * setup.py * tqsdk/__version__.py
Additional Context Used
Ruff (21)
tqsdk/api.py (15)
433-433: f-string without any placeholders --- 559-559: f-string without any placeholders --- 561-561: f-string without any placeholders --- 1253-1253: f-string without any placeholders --- 1264-1264: f-string without any placeholders --- 1468-1468: f-string without any placeholders --- 1529-1529: f-string without any placeholders --- 1591-1591: f-string without any placeholders --- 1816-1819: Do not assign a `lambda` expression, use a `def` --- 2243-2243: f-string without any placeholders --- 2339-2339: f-string without any placeholders --- 2341-2341: f-string without any placeholders --- 2716-2716: Do not compare types, use `isinstance()` --- 4023-4023: Do not assign a `lambda` expression, use a `def` --- 4028-4028: Do not use bare `except`
tqsdk/ins_schema.py (1)
18-18: f-string without any placeholders
tqsdk/lib/target_pos_task.py (3)
41-41: f-string without any placeholders --- 592-592: f-string without any placeholders --- 593-593: f-string without any placeholders
tqsdk/tools/downloader.py (2)
24-24: Ambiguous variable name: `l` --- 25-25: Do not use bare `except`
Additional comments not posted (13)
tqsdk/lib/target_pos_scheduler.py (1)
`138-139`: 代码更改简化了任务取消过程,直接在 `target_pos_task` 对象上调用 `cancel` 方法,使代码更加清晰。
tqsdk/tools/downloader.py (1)
`264-267`: 处理 `write_mode` 参数的方式与构造函数中的更改一致,正确地根据 `write_mode` 参数处理不同的写入模式。
doc/version.rst (7)
`5-5`: 更新版本号至3.5.8,确保与其他文件中的版本号更新保持一致。 --- `7-7`: 新增`write_mode`参数描述,确保文档准确反映`DataDownloader`类的功能更新。 --- `8-8`: 描述了`TargetPosScheduler`使用中可能出现的问题及其修复,确保用户了解此变更。 --- `9-9`: 优化描述,关于`DataDownloader`在处理无成交数据的合约时的行为改进,增强了用户对功能改进的理解。 --- `10-10`: 详细说明了`TargetPosTask`资源释放和任务完成的优化,这有助于开发者更好地管理异步任务。 --- `11-11`: 优化了回测功能,特别是在处理无成交数据的合约时,避免程序长时间等待,提高了效率。 --- `12-12`: 增强了数据发送前的验证,减少了发送非法数据的风险,提高了系统的稳定性和用户的使用体验。
tqsdk/lib/target_pos_task.py (3)
`220-241`: `_exit_task` 方法正确地处理了资源的清理。这包括从单例的实例字典中移除实例,取消并等待其他任务和通道。这确保了所有资源都被适当释放。 --- Line range hint `409-487`: `cancel` 方法正确地取消了主任务,并设置了机制以防止取消后设置新的交易量。这对于防止状态不一致至关重要。 --- `498-501`: `is_finished` 方法使用 `_wait_task_finished` 的完成状态来确定任务是否已结束。它还断言主任务已完成,这是一个很好的检查,以确保一致性。
tqsdk/backtest/backtest.py (1)
`353-353`: 请确保 `_rangeset_range_union` 函数的调用是正确的,特别是在处理数据范围合并时,需要确保数据的完整性和准确性。
---
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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 generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@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.` 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 as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.