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.0.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.0-cp313-cp313-win_amd64.whl (37.9 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

ctpbee_opt_api-0.1.0-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.0.tar.gz.

File metadata

  • Download URL: ctpbee_opt_api-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a73014a7b4d4d4b2691860b365c918dd987d49121ae6810906062bc71f77f5c2
MD5 0a5036534af4e3bedce5c61e9880e295
BLAKE2b-256 c2d06bc005e58681d14ce1b0da84cb392092f44c6e0d5bc425d5895d1bcf4303

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.0.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.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fe6554e65be1a04b057558843cd4372fdeb9cf5e848688d69c70eb0bbcdd9082
MD5 5b63d862566e1d65ddc44b43f4bd250e
BLAKE2b-256 1eff52ca56e0b8f18c0e00cc23b6597605294b1fc69462026444dc728ea3788a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.0-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.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 141395127a15f7fc4aca02d7149f88196ec67c33d972753762cd7fae8f12cef1
MD5 3771a40dc19c14aa30754a61c87e37f8
BLAKE2b-256 aa375729132a93aae0b2c33eeaddb863b083f723c175316e3fd066bd08fdc00e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.0-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.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 019f6670d68fd7cfafc128cc21774d6b8e7c16637e1c929d1b3c7bcfe3075b77
MD5 841704a65fceaed1bfa9dd09e6a59e85
BLAKE2b-256 85b1aabcbbaa7e4f847b7be579478aae279077ff3f1606f552204f6bfa269d11

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.0-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.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4c0dc969b879e6cbb0f35d6a62aca4167ffc53fb2bba626ab505726cc799db62
MD5 4b8ea5ecf628d265ba0ebfa26bc36ed2
BLAKE2b-256 b9e3d9be9b437efadf6c8d40a845bacf5a45657af73c4e2ea27442b2ceebce91

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.0-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.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f211de6edc257a548aff3595b813cd7de8afef8d55a3d7a34ec7da3c71a1c28f
MD5 6abd18d80ce826d4b45ebff07d503239
BLAKE2b-256 68f0e7eea782f3dbb995687c471f37c975345fc3634de88828e581f804e750bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.0-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.0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5cd380d829d1be1d01266e1812eeeec6efc606e08ad7fe90734b0bfabdd513a5
MD5 bce8dcce4bbd9ebc71fd674150e60e0f
BLAKE2b-256 eb078efbf84fa8b24614957c1de28d213bd1299986d8f029a4fb9caec6bc9fec

See more details on using hashes here.

Provenance

The following attestation bundles were made for ctpbee_opt_api-0.1.0-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