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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

ctpbee_opt_api-0.1.2-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.2.tar.gz.

File metadata

  • Download URL: ctpbee_opt_api-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 2f3d58851d8815964b34a0ff3f5bf056feec158d5b3541e6be3a49f3fd4be310
MD5 dd5f6b4ed8142622ddbf4e9c70dc9ca9
BLAKE2b-256 15e46327fcfe3efca7157e06b14fdd37abfbfc6b31d1bfd4f0bb571b8abcc076

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 98a0d7ca9b1186c0600e1e8836276527d904503d10b1809639b2c188667232f3
MD5 fc03ee5491ae7255e485a34491a4a10d
BLAKE2b-256 d50e1f7602605207cf7ab95b745e706475fb14697a77ccb3743f466337a4335d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 11702bf2da4af8ba77c6c12cfed9fb938f60cac962ef681c06d6eedd4938c1c1
MD5 eb8cf19150594ee361fdc0e36d771f84
BLAKE2b-256 f12b544b52e116c05b7060e78d38154e87665690d26c4c6260438f3b0604df76

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cc72c34d58f8f585b03e245e1b7502c6e839f3814349edb66a642531b4f36a4e
MD5 c9cf3edba03ab7a63e6eaaae9b26cf83
BLAKE2b-256 ff2d66e08b6d6b73dbb19ad24cff005b83721234f00eafa945f0906167496b7b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6ade97d92f9dd1764a4d2ad8eb37deb373abfb5d5d0e0a47f016e3accaf31ba1
MD5 425de1c9ae8e1aa5794e61553d6f6f3f
BLAKE2b-256 634addc87963d22d06de34f1bb1a9e553fd7c99332cbe4dc06cbf9154ee0aee2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ffee75073f79d8b2e1b2979fef6a752b5879576ac8b35ba59c01818b380ae6f0
MD5 e7089e481375dbc196a93004c71db88b
BLAKE2b-256 ac6a90c2350d4935532f7188c1a1f4f8242257b39bad9b3e5cd7ba92c3b2c130

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e8817cfe015a6d745e6713be9128fa9ab8e8542af944de52e26af8b65a14436e
MD5 fba8a57d3967e5f51c826b6e2e2cb22e
BLAKE2b-256 14982c8a7e001199ec25f95c29c8dccf18b71af370e83dd616d37daf6cfddcf5

See more details on using hashes here.

Provenance

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