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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

ctpbee_opt_api-0.1.5-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.5.tar.gz.

File metadata

  • Download URL: ctpbee_opt_api-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 b40fdaa37dd839e24ab7d33884dd16daf4a646ae32f50d23f48791c72f17ab66
MD5 e45931274fb9c9da0b44a448028862f3
BLAKE2b-256 f1e7e3252e2347a67fe96a5bc6e7ef6f15747335be3f0b9a5cfac0d382f3fa8c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 db6e873b347828a3f7a76c5482d7556da73578ebae4fd74518900bd966f08461
MD5 3c1e3e2f1b3872e256d11dae6c11c4ce
BLAKE2b-256 ad5aa742896a03d73e4100fdb50de7623e8705d00ee5b0825bada5c74a7c13d7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a1c358ba6b20f2314a48c597c430d65616a2dcf1dd5460c723924860585e72ac
MD5 e7d7c6439721ec3738e8dcb0860b02a4
BLAKE2b-256 960c689f1169b0d2d81b973b71c2614cdd601446f28af73ba6452d29a8cf7846

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 013d3d42f6d117dcf283112403057d700e32e89f7b6b1055921da9356df16884
MD5 9f2f32793ec1a6307f4b3e9327d90d23
BLAKE2b-256 c75491541d1916ec295b9ee6a3de7eb5d455826b31b706bfa01a4e54325c835e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a6a35eae6d63dcf1eeddf6fc8fbda4735deb997ae35102331aec6bbd62ce52c1
MD5 bada72ceaf27c75a0d72fe4a3187dbea
BLAKE2b-256 f3522635e834e8e247e04041577f836940305761147fa127a76ea55f1ef8dea3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a060237d0cdec5ad79a666db23d1b38a099fd39d877b904e3664b918d8685f7b
MD5 cb61979c8bc444dbffce00a9fd06ec72
BLAKE2b-256 ca72835d02ecaedd5f99a8d7cfe890597407187df40d31ed4205221e1f5575f6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ctpbee_opt_api-0.1.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5a6539c390287695a6637767d9b5d8494be9118068d997197354207e598a9d68
MD5 7838da0a712429f405d3219a13bd4338
BLAKE2b-256 0232e741f3de5a6e39633436343b6a2acaa730de1d0aead01919bc3cafe76ee4

See more details on using hashes here.

Provenance

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