Skip to main content

Optimized Trading API for China Future - Based on ctpbee_api with GIL optimization

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctpbee_opt_api-0.1.4.tar.gz (36.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ctpbee_opt_api-0.1.4-cp313-cp313-win_amd64.whl (37.9 MB view details)

Uploaded CPython 3.13Windows x86-64

ctpbee_opt_api-0.1.4-cp312-cp312-win_amd64.whl (37.9 MB view details)

Uploaded CPython 3.12Windows x86-64

ctpbee_opt_api-0.1.4-cp311-cp311-win_amd64.whl (37.9 MB view details)

Uploaded CPython 3.11Windows x86-64

ctpbee_opt_api-0.1.4-cp310-cp310-win_amd64.whl (37.8 MB view details)

Uploaded CPython 3.10Windows x86-64

ctpbee_opt_api-0.1.4-cp39-cp39-win_amd64.whl (37.8 MB view details)

Uploaded CPython 3.9Windows x86-64

ctpbee_opt_api-0.1.4-cp38-cp38-win_amd64.whl (37.8 MB view details)

Uploaded CPython 3.8Windows x86-64

File details

Details for the file ctpbee_opt_api-0.1.4.tar.gz.

File metadata

  • Download URL: ctpbee_opt_api-0.1.4.tar.gz
  • Upload date:
  • Size: 36.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ctpbee_opt_api-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a0a54841b59e41f5dec58ca6309a92b0963b280ba54006720ab0237e325731ee
MD5 dd58fa2ba7355fc82473d65a84222da7
BLAKE2b-256 e62a38583b04bd96055bc4b44eebc9144b40deed0dc08163b856d5d5d77f537f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.4.tar.gz:

Publisher: python-publish.yml on fangdejia/ctpbee_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ctpbee_opt_api-0.1.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f65298457fed3578998afdb5b47502f4d77b3a1a36b0f16a398a11458467387c
MD5 d7bfdd45ec0a0d9a1eec842d5f18df05
BLAKE2b-256 c8adcdab73924e847fb4898d7f6e0eb88fa009bfb4d77b8e01ea24d517e84fcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.4-cp313-cp313-win_amd64.whl:

Publisher: python-publish.yml on fangdejia/ctpbee_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ctpbee_opt_api-0.1.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b934a1cac0a0c33a8754529d69a44f7ac6d0e14165be4cc5ab368896a281b460
MD5 4631ee118a9844d3e1982d68089afc6d
BLAKE2b-256 4ca20f1a4e9798e6fa9084d37aa23968cf1ad2ac5151b12c8fcefef51c323548

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.4-cp312-cp312-win_amd64.whl:

Publisher: python-publish.yml on fangdejia/ctpbee_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ctpbee_opt_api-0.1.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b25b82b5fcd6f92094711f004152f3f2e1d377e53fb635d70447d4408d194417
MD5 f9925bd6edf4623243ee5209e64c3aed
BLAKE2b-256 a5ae8ff792c12d8723b062c3e0eb4ac01d9ef1acecc8d3312a74cbdb937502f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.4-cp311-cp311-win_amd64.whl:

Publisher: python-publish.yml on fangdejia/ctpbee_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ctpbee_opt_api-0.1.4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ae8a86cf11f2813ccd7e79de9d2a99959ae67d1d5ab5698d2a8dd6bc62969268
MD5 77a7b8b56637a0ccef5c2d8e8fa46e4c
BLAKE2b-256 d507f24ae64a956e8c642e2e360e806adf4c685cf57568279303f40751e31039

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.4-cp310-cp310-win_amd64.whl:

Publisher: python-publish.yml on fangdejia/ctpbee_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ctpbee_opt_api-0.1.4-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 102ce818801e4cebcc5e64e3e9bb57340b7e3525b92e5cc52a6e612f15de1e78
MD5 11c374bc27dfd6fddd76803dbcb87468
BLAKE2b-256 7981ada14c36ae90e382435744bde0c8d6bcb4dea190491616de5b10dc469a1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.4-cp39-cp39-win_amd64.whl:

Publisher: python-publish.yml on fangdejia/ctpbee_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ctpbee_opt_api-0.1.4-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b8626b02692f8694f89c1d0b358e0c54d08ff23150bf33eac4edab42ce1570cf
MD5 a006e141031b078907345dadc1415dbd
BLAKE2b-256 f8c3e10f41a7d6429494c4a86c1144a521ce61b5c54799d004e17743bd72c4f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.4-cp38-cp38-win_amd64.whl:

Publisher: python-publish.yml on fangdejia/ctpbee_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page