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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

ctpbee_opt_api-0.1.1-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.1.tar.gz.

File metadata

  • Download URL: ctpbee_opt_api-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 257b5e0557c283bb2dd1f62c480491770be6c6d5332ef1a461539c1c26b78d10
MD5 e93f09b89506642953913963a1858eb8
BLAKE2b-256 a9646452e9c9012336da1b8d1610aedaec7d9928191fbbeb504717be5bd75b28

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 26d319c7dffb8654656a26f93da6bfda5e00afa92f474e18210e4e2108e161ba
MD5 ddfbc5c195b713aff7c3840422efc6cf
BLAKE2b-256 b0d1b59ed939a25c961431fcc4682bbb2d2d47e7d2149c6477d59093f96e0a18

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 07a55721b42ec592f249713409f1033947fa8ad9bb67e1a60a07c2aefdcdfe69
MD5 8c4bb843fdd2b8ad8628dac92dbb03ab
BLAKE2b-256 a325ca597613bc85e1b1d28a5048b2f21ef1a1004456d64370865e326d337044

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 adc0c7fbac727774268adcdda0c146d781068aac72eb48174fa846d5f753c577
MD5 482cf3eff1f885cad1864cac74412cf3
BLAKE2b-256 08525367de08945ff28594d9e63ea8a0e5948062b3bfe0f88d4d7144fa08a485

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 07e6b3624194cfc58319afdaa8fb3a73a719d079939ae67dcfae0cbf8c334233
MD5 509adcd2f673cde607d33dad70d70940
BLAKE2b-256 e151cef52fec584b18206f2397e5e1a183b9cb8f72c1ab4a3b6687da0273fa87

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f5fd09b7d5ac5964559f87fd311421fc0a132fb23e54c323c1c129776c27a36f
MD5 9b854ebdcc0e89151a4e12f7cab94ddd
BLAKE2b-256 ed63b5c76733de01d70bacf98312f69336f532ab8c5ae8c162fe2563be5f2516

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e08113b6c20a902286649215bf55010b05881298b8d56da5ad42a8329f11c0ef
MD5 eb97ec861cb9b1f2607da0c7a3ff244a
BLAKE2b-256 abac4ab5048c1e8bfb83b7f3ca112b07560a60cb09c445389c53502289a6b3b5

See more details on using hashes here.

Provenance

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