Skip to content

Commit

Permalink
Multi version ctpapi into one pypi project (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jedore committed Apr 14, 2023
1 parent bdb3414 commit ffcc6d6
Show file tree
Hide file tree
Showing 30 changed files with 107 additions and 311 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-test-6315.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 6315 tests
pytest tests
test-windows:
Expand Down Expand Up @@ -63,4 +63,4 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 6315 tests
pytest tests
4 changes: 2 additions & 2 deletions .github/workflows/python-test-6319.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 6319 tests
pytest tests
test-windows:
Expand Down Expand Up @@ -63,4 +63,4 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 6319 tests
pytest tests
4 changes: 2 additions & 2 deletions .github/workflows/python-test-651.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 651 tests
pytest tests
test-windows:
Expand Down Expand Up @@ -63,4 +63,4 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 651 tests
pytest tests
4 changes: 2 additions & 2 deletions .github/workflows/python-test-661.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 661 tests
pytest tests
test-windows:
Expand Down Expand Up @@ -63,4 +63,4 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 661 tests
pytest tests
6 changes: 3 additions & 3 deletions .github/workflows/python-test-667.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 667 tests
pytest tests
test-macos:
needs:
Expand All @@ -59,7 +59,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 667 tests/test_mdapi.py
pytest tests/test_mdapi.py
test-windows:
Expand Down Expand Up @@ -89,4 +89,4 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 667 tests
pytest tests
6 changes: 3 additions & 3 deletions .github/workflows/python-test-669.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 669 tests
pytest tests
test-macos:
needs:
Expand All @@ -59,7 +59,7 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 669 tests/test_mdapi.py
pytest tests/test_mdapi.py
test-windows:
Expand Down Expand Up @@ -89,4 +89,4 @@ jobs:
shell: bash
- name: Test
run: |
pytest --ctp 669 tests
pytest tests
11 changes: 5 additions & 6 deletions ctp-667/README.md → PYPI_README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# openctp-ctp-667
# openctp-ctp

[![PyPI - Version](https://badgen.net/badge/pypi/v1.0.0/blue)](https://pypi.org/project/openctp-ctp-667)
[![PyPI - Python Version](https://badgen.net/badge/python/3.7|3.8|3.9|3.10|3.11/blue)](https://pypi.org/project/openctp-ctp-667)
[![PyPI - Python Version](https://badgen.net/badge/python/3.7|3.8|3.9|3.10|3.11/blue)](https://pypi.org/project/openctp-ctp)

-----

Expand All @@ -13,20 +12,20 @@
## Installation

```console
pip install openctp-ctp-667
pip install openctp-ctp
```

## Example

[Demo](https://github.com/Jedore/openctp-ctp-python/tree/main/demo)

```python
from openctp_ctp_667 import mdapi, tdapi
from openctp_ctp import mdapi, tdapi

md_api = mdapi.CThostFtdcMdApi.CreateFtdcMdApi("market")
td_api = tdapi.CThostFtdcTraderApi.CreateFtdcTraderApi('user_id')
```

## License

`openctp-ctp-667` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
`openctp-ctp` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
47 changes: 15 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
<h1 align="center">openctp-ctp</h1>

<p align="center">
<a href="http://www.sfit.com.cn/5_2_DocumentDown_6.htm" target="_blank">
<img src="https://badgen.net/badge/ctpapi/6.3.15|6.3.19|6.5.1|6.6.1|6.6.7|6.6.9/cyan" />
</a>
<a href="#">
<img src="https://badgen.net/badge/platform/windows_x64|linux_x64|mac_x64/cyan" />
</a>
<a href="#">
<img src="https://badgen.net/badge/python/3.7|3.8|3.9|3.10|3.11/cyan" />
</a>
</p>

<p align="center">
<a href="https://pypi.org/project/openctp-ctp-6315" target="_blank">
<img src="https://badgen.net/badge/pypi/openctp-ctp-6315/blue" />
</a>
<a href="https://pypi.org/project/openctp-ctp-6319" target="_blank">
<img src="https://badgen.net/badge/pypi/openctp-ctp-6319/blue" />
</a>
<a href="https://pypi.org/project/openctp-ctp-651" target="_blank">
<img src="https://badgen.net/badge/pypi/openctp-ctp-651/blue" />
</a>
</p>
<p align="center">
<a href="https://pypi.org/project/openctp-ctp-661" target="_blank">
<img src="https://badgen.net/badge/pypi/openctp-ctp-661/blue" />
</a>
<a href="https://pypi.org/project/openctp-ctp-667" target="_blank">
<img src="https://badgen.net/badge/pypi/openctp-ctp-667/blue" />
<a href="https://pypi.org/project/openctp-ctp" target="_blank">
<img src="https://badgen.net/badge/pypi/openctp-ctp/blue" />
</a>
<a href="https://pypi.org/project/openctp-ctp-669" target="_blank">
<img src="https://badgen.net/badge/pypi/openctp-ctp-669/blue" />
<a href="#">
<img src="https://badgen.net/badge/python/3.7|3.8|3.9|3.10|3.11/blue" />
</a>
</p>

<p align="center">
<a href="https://github.com/Jedore/openctp-ctp-python/actions" target="_blank">
<img src="https://badgen.net/badge/CI-Test/passing/green?icon=github" />
</a>
Expand All @@ -43,23 +25,23 @@
</p>

<p align="center">
<em>:zap:以 Python 的方式,简化对接 CTPAPI 的过程,节省精力,快速上手:zap:</em>
:rocket:<em>以 Python 的方式,简化对接 CTPAPI 的过程,节省精力,快速上手</em>
</p>

-----

## 安装:hammer_and_wrench:

CTPAPI 6.6.7

```shell
pip install openctp-ctp-667
# pip install openctp-ctp==<ctpapi version>
pip install openctp-ctp==6.3.15
pip install openctp-ctp==6.6.7
```

## 代码示例:man_technologist:

```python
from openctp_ctp_667 import mdapi, tdapi
from openctp_ctp import mdapi, tdapi

md_api = mdapi.CThostFtdcMdApi.CreateFtdcMdApi("market")
td_api = tdapi.CThostFtdcTraderApi.CreateFtdcTraderApi('user_id')
Expand All @@ -68,7 +50,7 @@ td_api = tdapi.CThostFtdcTraderApi.CreateFtdcTraderApi('user_id')
- 行情 [demo](demo/mdapi.py)
- 交易 [demo](demo/tdapi.py)

## 主要功能:smile:
## 功能:full_moon_with_face:

- 支持多版本 CTPAPI
- 6.3.15_20190220
Expand All @@ -94,11 +76,12 @@ graph TD;
CTPAPI库<-->Simnow前置;
```

> 转换流程主要参考[Ralph Jing](https://github.com/nicai0609)[Python-CTPAPI](https://github.com/nicai0609/Python-CTPAPI),感谢:pray:
> 生成Python扩展的逻辑,参考[Ralph Jing](https://github.com/nicai0609)
> [Python-CTPAPI](https://github.com/nicai0609/Python-CTPAPI) :+1:
## 更多信息:page_facing_up:

- [openctp](https://github.com/openctp/openctp)
- QQ交流群
- QQ交流群

<img src="https://user-images.githubusercontent.com/17944025/231727684-fb62f5f9-71d8-448f-9e35-255639756bb2.png" width="200px">
2 changes: 1 addition & 1 deletion ctp-6315/6315/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Jedore <jedore@protonmail.com>
#
# SPDX-License-Identifier: MIT
__version__ = '1.0.0'
__version__ = '6.3.15'
32 changes: 0 additions & 32 deletions ctp-6315/README.md

This file was deleted.

8 changes: 4 additions & 4 deletions ctp-6315/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "openctp-ctp-6315"
description = 'A package for CTPAPI-6.3.15'
readme = "README.md"
name = "openctp-ctp"
description = 'A package for CTPAPI'
readme = "../PYPI_README.md"
requires-python = ">=3.7"
license = "MIT"
keywords = ["openctp", "ctp", "ctpapi", "trading", "investment"]
Expand Down Expand Up @@ -75,7 +75,7 @@ exclude = [
]

[tool.hatch.build.sources]
"6315" = "openctp_ctp_6315"
"6315" = "openctp_ctp"

[tool.hatch.build.targets.sdist]

Expand Down
2 changes: 1 addition & 1 deletion ctp-6319/6319/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Jedore <jedore@protonmail.com>
#
# SPDX-License-Identifier: MIT
__version__ = '1.0.0'
__version__ = '6.3.19'
32 changes: 0 additions & 32 deletions ctp-6319/README.md

This file was deleted.

8 changes: 4 additions & 4 deletions ctp-6319/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "openctp-ctp-6319"
description = 'A package for CTPAPI-6.3.19'
readme = "README.md"
name = "openctp-ctp"
description = 'A package for CTPAPI'
readme = "../PYPI_README.md"
requires-python = ">=3.7"
license = "MIT"
keywords = ["openctp", "ctp", "ctpapi", "trading", "investment"]
Expand Down Expand Up @@ -75,7 +75,7 @@ exclude = [
]

[tool.hatch.build.sources]
"6319" = "openctp_ctp_6319"
"6319" = "openctp_ctp"

[tool.hatch.build.targets.sdist]

Expand Down
2 changes: 1 addition & 1 deletion ctp-651/651/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Jedore <jedore@protonmail.com>
#
# SPDX-License-Identifier: MIT
__version__ = '1.0.0'
__version__ = '6.5.1'
Loading

0 comments on commit ffcc6d6

Please sign in to comment.