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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

ctpbee_opt_api-0.1.3-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.3.tar.gz.

File metadata

  • Download URL: ctpbee_opt_api-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 c06ff43e3cdb53692c9560f1c0708bdd6a60d4b77c6460c52c49140bb3cf91ce
MD5 e6d44326ecaf1329fe416875585ebccb
BLAKE2b-256 7181e1a277f2942bab9795a7591d2f2133a78a59de61c46110c1e665f03ac942

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bd39438e2f80cd5e130b12980e9ad6177d8740444f92bb11e5aafee567d0064d
MD5 f5eceeab480932230eb9089fa29bd47d
BLAKE2b-256 7994407dfae1a3d6f1e1f138e8021957a449b53d4290be1fb901806959a42bc9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bc8cb3dcc04525881d5508f37609a01daff464f5e326c016a545c270ebb16c10
MD5 bf65e2e4eda92cd74198bcbdc75aceb4
BLAKE2b-256 9b9a3e57e82d365bf6a166378a98c8ecb0af9f16478385848f612c44efaaddcd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 980e995cb826468a7818a54adc244d08935b8ec3c2851fa05374e69cbdafaa8e
MD5 bb2a176f021e7ac24c725ff486087945
BLAKE2b-256 e50a8590f8174606f30435c63578badf18019a694236544b361271e796e005e6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e7f0c6f21e261f9ca9e638f3c55a23ed06c4c1e495df26df845bf80f7bf94f8e
MD5 afe5d823452df783369e3acba822f226
BLAKE2b-256 1124b379dc96dd3296220b2483254a356442fa1952e01d2a067e5e91741326ad

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c150d186b8751d8b4a3461bd508ac83f4b19dd7a73bac49e19fb43242563894a
MD5 fa74f095bd2a33cbb759d847a76ac26b
BLAKE2b-256 5a928a8bb9d0b2316fdc165e9422c61db4ba00b6cd4f3a37c10520cacf0a70f5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d95da827e51b2a526b7161a7d28b37508ca0179cc1c82b1eb0e2a575220ef71e
MD5 72383a4009b344a342219e28e792286e
BLAKE2b-256 5ca4c940f5beb923b3fb28765a8f8fedfb3e3f5ed3f6473227af0de59623a102

See more details on using hashes here.

Provenance

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