Skip to content

Make futures demo compatible with Python 3 - #119

Open
ai-yang wants to merge 1 commit into
UFund-Me:mainfrom
ai-yang:agent/fix-python3-futures
Open

Make futures demo compatible with Python 3#119
ai-yang wants to merge 1 commit into
UFund-Me:mainfrom
ai-yang:agent/fix-python3-futures

Conversation

@ai-yang

@ai-yang ai-yang commented Jul 31, 2026

Copy link
Copy Markdown

Description

  • pyfutures/futuresDemo.py 中 9 处可执行的 Python 2 print 语句转换为 Python 3 调用。
  • 保持 CTP 回调名称、参数、订阅流程和主循环不变。
  • 不导入 CTP、不连接真实前置机,仅进行离线语法验证。

Motivation and Context

仓库工作流声明使用 Python 3.8/3.9,但该示例在解析阶段即因 Python 2 print 语法失败,无法导入或运行。

Related issue: none. 上游当前限制此账号创建 Issue(GitHub API 返回 403),因此复现、根因和测试信息完整记录在本 PR 中。

How Has This Been Tested?

  • python -m py_compile pyfutures/futuresDemo.py:连续 3 次通过
  • Python 3.8 AST 语法解析通过
  • flake8 --select=E9,F63,F7,F82 pyfutures/futuresDemo.py
  • git diff --check origin/main...HEAD

全仓 compileall 当前还会被独立的 pytrader/data/data_utils.py 方法签名语法错误阻塞;该错误不由本 PR 引入,并已拆分为另一独立修复。

未运行真实 CTP 集成测试,以避免连接交易前置机。

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

@sonarqubecloud

Copy link
Copy Markdown

@ai-yang
ai-yang marked this pull request as ready for review July 31, 2026 15:12
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