Metadata-Version: 2.4
Name: ctpbee_opt_api
Version: 0.1.1
Summary: Optimized Trading API for China Future - Based on ctpbee_api with GIL optimization
Home-page: https://github.com/fangdejia/ctpbee_api
Author: fangdejia
Author-email: fangdejia@example.com
License: MIT
Platform: Windows
Platform: Linux
Platform: Mac OS-X
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: platform
Dynamic: summary


# ctpbee_opt_api

基于 ctpbee_api 的优化版本，感谢原作者 somewheve 的贡献。

## 优化内容

### 合约查询批量模式 (Instrument Batch Mode)

解决全量查询合约时 GIL 争抢导致 UI 界面卡顿的问题。

- 问题背景: 查询全量合约时，CTP 回调会逐条触发 Python 回调，每次都需要获取 GIL，导致界面卡死。
- 解决方案: 新增批量模式，在 C++ 层缓存所有合约数据，仅在最后一条数据到达时一次性回调 Python。

## 新增 API

- setInstrumentBatchMode(enable): 设置合约查询批量模式
- getInstrumentBatchMode(): 获取当前批量模式状态  
- onRspQryInstrumentBatch(instruments): 批量模式下的合约查询回调

## 安装

    pip install ctpbee_opt_api

详细文档请访问: https://github.com/fangdejia/ctpbee_api
