Metadata-Version: 2.1
Name: tqwebhelper2
Version: 0.1.0
Summary: 天勤量化 Web UI 增强版 — 替换 tqsdk 默认 Web 界面，无需修改官方 SDK
Author: pseudocodes
Project-URL: Homepage, https://github.com/pseudocodes/tqwebhelper2
Project-URL: Repository, https://github.com/pseudocodes/tqwebhelper2
Project-URL: Issues, https://github.com/pseudocodes/tqwebhelper2/issues
Keywords: tqsdk,quantitative,trading,web-ui,futures
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tqsdk>=1.3.0

# tqwebhelper2

天勤量化 Web UI 增强版。通过 monkey-patch 替换 tqsdk 默认的 Web 界面，无需修改官方 SDK。

## Preview
实盘

![实盘](img/rl.png)

回测

![回测](img/bt.png)


## 安装

```bash
pip install tqwebhelper2
```

## 使用

```python
import tqwebhelper2
tqwebhelper2.patch()  # 必须在 TqApi 之前调用

from tqsdk import TqApi, TqAuth
api = TqApi(auth=TqAuth("user", "pass"), web_gui=True)
```

浏览器打开控制台输出的地址即可看到新版 Web 界面。

## 原理

- 继承原版 `TqWebHelper`，只替换 `_web_dir` 指向本包内的编译产物
- 通过 `patch()` 同时替换 `tqsdk.tqwebhelper` 和 `tqsdk.api` 中的引用
- WebSocket 数据通道、路由逻辑完全复用原版，零侵入
- `unpatch()` 可恢复原版


