https://github.com/jedore/openctp-ctp-channels
openctp-ctp 切换多通道柜台利器
https://github.com/jedore/openctp-ctp-channels
ctp ctpapi openctp python python3
Last synced: 11 months ago
JSON representation
openctp-ctp 切换多通道柜台利器
- Host: GitHub
- URL: https://github.com/jedore/openctp-ctp-channels
- Owner: Jedore
- License: bsd-3-clause
- Created: 2024-05-02T11:10:36.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-26T12:18:09.000Z (over 1 year ago)
- Last Synced: 2025-06-15T06:09:19.707Z (12 months ago)
- Topics: ctp, ctpapi, openctp, python, python3
- Language: Python
- Homepage: https://jedore.top
- Size: 5.83 MB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
openctp-ctp-channels
[openctp](https://github.com/openctp/openctp)
提供了兼容各大柜台的统一 CTPAPI 兼容接口库,[openctp-ctp](https://github.com/openctp/openctp-ctp-python) 也继承了这个能力。
**openctp-ctp-channels** 简化了替换兼容接口库的过程,可以快速上手体验,连接不同的柜台环境。
## 快速使用
- 安装
```shell
pip install openctp-ctp-channels -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host=pypi.tuna.tsinghua.edu.cn
```
- 展示所有通道
```shell
$ openctp-channels show
Support channels:
ctp - 上期技术CTP柜台
tts - openctp TTS柜台 7x24环境
tts-s - openctp TTS柜台 仿真环境(接实盘行情)
emt - 东方财富EMT柜台
xtp - 中泰证券XTP柜台
tora - 华鑫证券奇点股票柜台
qq - 腾讯财经(只有行情)
sina - 新浪财经(只有行情)
```
- 展示当前通道
```shell
$ openctp-channels check
Current channel: ctp
```
- 切换通道
```shell
$ openctp-channels switch tts
Switch to tts channel.
$ openctp-channels check
Current channel: tts
```
切换通道 **tts** 成功后,即可使用 openctp-ctp
库连接 [TTS 7x24环境](http://openctp.cn/report/openctp%A3%A8TTS%A3%A97x24%BB%B7%BE%B3process%BD%BB%D2%D7.html)
**更多示例参见 [ctp.examples](https://github.com/Jedore/ctp.examples)**
## 支持通道
- [x] openctp TTS(tts/tts-s)
[详情跳转1](https://github.com/openctp/openctp?tab=readme-ov-file#openctp%E6%A8%A1%E6%8B%9F%E7%8E%AF%E5%A2%83)
[详情跳转2](https://github.com/openctp/openctp/tree/master/ctp2TTS)
TTS仿真环境没有提供行情服务,需要连接实盘行情(连接实盘行情不需要替换dll/so), 因此多了一个 `tts-s` 通道
`tts` 通道用于连接 TTS 7x24 环境; `tts-s` 通道用于连接 TTS 仿真环境
| version | win x86 | win x64 | linux x64 |
|---------|--------------------|--------------------|--------------------|
| 6.3.15 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.3.19 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.5.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.0 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
- [x] 华鑫证券奇点股票(tora)
[详情跳转](https://github.com/openctp/openctp/tree/master/ctp2STP)
| version | win x86 | win x64 | linux x64 |
|---------|--------------------|--------------------|--------------------|
| 6.3.15 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.3.19 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.5.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
- [x] 东方财富EMT(emt)
[详情跳转](https://github.com/openctp/openctp/tree/master/ctp2EMT)
| version | win x64 | linux x64 |
|---------|--------------------|-----------|
| 6.3.15 | :heavy_check_mark: | :x: |
| 6.3.19 | :heavy_check_mark: | :x: |
| 6.5.1 | :heavy_check_mark: | :x: |
| 6.6.1 | :heavy_check_mark: | :x: |
| 6.6.7 | :heavy_check_mark: | :x: |
- [x] 中泰证券XTP(xtp)
[详情跳转](https://github.com/openctp/openctp/tree/master/ctp2XTP)
| version | win x86 | win x64 | linux x64 |
|---------|---------|--------------------|-----------|
| 6.6.1 | :x: | :heavy_check_mark: | :x: |
- [x] 新浪财经(sina)
只能查询行情,不可以交易,[详情跳转](https://github.com/openctp/openctp/blob/master/ctp2Sina/readme.md) [构建仓库](https://github.com/Jedore/ctp2sina)
| version | win x86 | win x64 | linux x64 |
|---------|--------------------|--------------------|--------------------|
| 6.3.15 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.3.19 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.5.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.0 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
- [x] 腾讯财经(qq)
只能查询行情,不可以交易,[详情跳转](https://github.com/openctp/openctp/blob/master/ctp2QQ/readme.md) [构建仓库](https://github.com/Jedore/ctp2qq)
| version | win x86 | win x64 | linux x64 |
|---------|--------------------|--------------------|--------------------|
| 6.3.15 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.3.19 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.5.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.0 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
- [ ] 易盛
- [ ] 易达
- [ ] 量投QDP
## 代码示例
todo...
## 注意
- openctp-ctp 在被使用中时,无法切换通道
- 如果开启了网络代理,切换通道可能失败,关闭代理重试