forked from ctpbee/ctpbee
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5714ca9
Showing
87 changed files
with
11,730 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.py linguist-language=python3 | ||
*.cpp linguist-language=python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: Bug report/ 错误报告 | ||
about: Create a report to help us improve/ 创建一个报告以帮助我们了解情况 | ||
title: Bugs | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug / 问题描述** | ||
> 请在此处描述问题 | ||
**To Reproduce / 复现步骤 ** | ||
|
||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior / 期望结果** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots / 截图** | ||
|
||
If applicable, add screenshots to help explain your problem./如果可能请将截图放于此处 | ||
|
||
**Environment/ 你的运行环境** | ||
- OS: [e.g. Linux] | ||
- Python Version: [e.g.Python36] | ||
- ctpbee Version: [e.g. 0.50] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: Suggestions / 功能建议 | ||
about: 让我们了解你的需求 | ||
title: CEP.[Number] | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**需求/request** | ||
|
||
> 请在此处详细描述你的诉求/这样做的理由 / The reason why should I add the function to this framework | ||
**最终表现效果 / result** | ||
> 请在此处描述你的功能的最终表现效果 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Python: | ||
*.py[c] | ||
# *.so | ||
*.egg | ||
*.egg-info | ||
.pytest_cache | ||
dist | ||
build | ||
|
||
workspace | ||
|
||
|
||
# pycharm | ||
*.idea | ||
|
||
# ctp | ||
temp | ||
|
||
# txt | ||
*.txt | ||
|
||
# virturalenv | ||
venv | ||
|
||
# personal info | ||
test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: python | ||
os: "ubuntu" # set the system | ||
|
||
matrix: | ||
include: | ||
- python: 3.6 | ||
- python: 3.7 | ||
- python: 3.8 | ||
|
||
script: | ||
- python setup.py install | ||
|
||
before_install: | ||
- sudo locale-gen zh_CN.GB18030 | ||
- sudo apt install gcc | ||
- pip install ctpbee_api | ||
- pip install flask | ||
- pip install simplejson | ||
- pip install pandas | ||
|
||
|
||
# running test after install | ||
after_script: | ||
- sudo ctpbee -auto generate | ||
- python ./ci_script/test_module.py | ||
- python ./examples/looper_example.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 somewheve | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" , WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
# include MANIFEST.in | ||
include README.md | ||
recursive-include ctpbee/api * | ||
include ctpbee/holiday.json | ||
recursive-include ctpbee/looper *.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# ctpbee | ||
bee bee .... 为二次开发而生 ~~ | ||
|
||
> tiny but strong | ||
ctpbee 提供了一个可供使用的交易微框架, 你可以通过这个微小的核心来构建值得信赖的工具, | ||
当然这需要你的编程功力。 你所需要关心的是如何编程来处理行情和交易信息即可。 | ||
|
||
## 开始之前 | ||
```bash | ||
# just for linux/ 生成中文环境 | ||
sudo ctpbee -auto generate | ||
``` | ||
## 起源 | ||
|
||
- 衍生自 [vnpy](https://github.com/vnpy/vnpy) 和 [flask](https://github.com/pallets/flask) | ||
|
||
## 安装 | ||
```bash | ||
# code install | ||
git clone https://github.com/ctpbee/ctpbee && cd ctpbee && python3 setup.py install | ||
|
||
# pip install | ||
pip3 install ctpbee | ||
``` | ||
|
||
## 文档 | ||
文档中描述相关教程,请认真阅读。如有问题,请到底部加群或者邮件联系作者 ^_^ | ||
> 当前文档已经落后, 请等待作者进行更新 ~ | ||
[文档](http://docs.ctpbee.com) | ||
|
||
|
||
## 功能支持 | ||
|
||
- [x] k线数据支持/home/somewheve/Templates | ||
- [x] 分时图数据支持 | ||
- [x] 交易支持 | ||
- [x] 行情支持 --> 需要自己编写相应的数据库写入代码。 | ||
- [x] 自由自在的发单方式 | ||
- [x] 多账户支持 | ||
- [x] 支持申请穿透式接口 | ||
- [x] 快速下单助手 | ||
- [x] 风控层建立 | ||
- [x] 跟单信号 | ||
- [x] 多路行情对比 --> [looper_me](https://github.com/ctpbee/looper_me) | ||
- [x] 数据快速支持 --> [ctpbee_converter](https://github.com/ctpbee/data_converter) | ||
- [x] cta support | ||
- [x] 回测系统搭建 --> interface/looper | ||
|
||
## Todo | ||
- [x] 对接自定义行情 | ||
- [ ] 对接账户qifi格式 | ||
- [ ] 对接qifi_struct | ||
- [ ] bug/维护 | ||
- [ ] 模拟实现 ---> sim interface ==> will send to next release | ||
- [ ] [fast_pub 计划](https://github.com/ctpbee/fast-pub) ---> 描述为提供HTTP API进行实盘下单的解决方案 | ||
|
||
|
||
## 插件支持 | ||
|
||
- [ ] 套利 ---> ready to support | ||
- [ ] 历史数据 support | ||
|
||
|
||
## QA_SUPPORT | ||
当前针对[QUANTAXIS](http://github.com/QUANTAXIS/QUANTAXIS)的数据对接! | ||
ctpbee作为开发框架并不具有历史数据的功能,我们也因为条件所限无法提供,**但是现在这些都不是问题** | ||
我们提供了QA_SUPPORT版本支持,能让你轻松通过几个命令来获取历史数据。 | ||
> 此处感谢[QA作者yutiansut](https://github.com/yutiansut),阻止了我重复造轮子 | ||
关于此个版本的支持,请参见[文档](https://docs.ctpbee.com/)中的[安装](https://docs.ctpbee.com/install) | ||
|
||
## 模拟/SIM | ||
ctpbee基于回测的机制添加了`sim`接口, 通过配置的接口`INTERFACE`填入`sim`即可进行载入, | ||
此处描述为通过[fast-pub](https://github.com/ctpbee/fast-pub)拉起一个模拟服务器,通过`HTTP API`来获取策略机制. 此项功能正在研发中~~ 欢迎通过`issue`来进行反馈! | ||
|
||
|
||
## 一些可能会减少你工作量的工作 | ||
- [x] 7×24小时无人值守 (可选) | ||
- [x] 定时查持仓和账户信息 (可选) | ||
- [x] 策略对应订阅行情 (可选) | ||
- [ ] 对接多种指标计算 | ||
- [ ] 优化代码 / Hope for your work ^_^ | ||
|
||
## 快速开始 | ||
```python | ||
from ctpbee import CtpBee | ||
app = CtpBee("ctpbee", __name__) | ||
info = { | ||
"CONNECT_INFO": { | ||
"userid": "", | ||
"password": "", | ||
"brokerid": "", | ||
"md_address": "", | ||
"td_address": "", | ||
"appid": "", | ||
"auth_code": "", | ||
"product_info":"" | ||
}, | ||
"INTERFACE":"ctp", | ||
"TD_FUNC": True, # 开启交易功能 | ||
} | ||
app.config.from_mapping(info) # 从dict中载入信息 对于更多配置载入方式, 请参阅文档或者阅读代码 | ||
app.start() | ||
``` | ||
|
||
## 贡献代码 | ||
如果你希望贡献代码,请遵循以下步骤,注意我们仅仅接受向dev`分支提交代码 ! ! ! ! | ||
|
||
1. `fork`本项目到你的`github`本地仓库 | ||
2. `clone`你账户的`ctpbee dev`分支的代码到本地 | ||
3. 修改提交到你自己本地仓库到dev分支中。 | ||
4. 打开[地址](https://github.com/ctpbee/ctpbee/compare/dev?expand=1)。点击`compare across forks`,将`base`中的`branch`选为`dev`,`head`选取你自己的项目地址,分支选取`dev`,点击提交即可。 | ||
|
||
|
||
## 最后一句 | ||
ctpbee是开源项目, 如果你同意使用ctpbee, 那么我们默认你 *清楚* 你的每个行为带来的*后果*, 加以思考并自行承担后果! | ||
|
||
如果这个能帮助到你, 请点击star来支持我噢. ^_^ | ||
|
||
QQ群号(: 756319143), [点进加入群聊以了解更多](https://jq.qq.com/?_wv=1027&k=5xWbIq3) | ||
|
||
如果你有遇到问题请发邮件给我 邮箱: [email protected] 我会及时回复! | ||
最后一句 ----> 祝各位大佬都能赚钱 ! | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# ctpbee | ||
|
||
bee bee .... created for secondary development ~~ | ||
|
||
ctpbee just provide a micro framework, you can extent the function by this tiny core. of course your programm | ||
|
||
![ctpbee](https://github.com/ctpbee/ctpbee/blob/master/docs/source/ctpbee.jpg) | ||
|
||
# Before you start | ||
```bash | ||
# just for linux | ||
sudo locale-gen zh_CN.GB18030 | ||
``` | ||
|
||
## Download the code | ||
|
||
``` | ||
git clone https://github.com/somewheve/ctpbee | ||
``` | ||
|
||
|
||
## Origin | ||
|
||
- Derived from [vnpy](https://github.com/vnpy/vnpy) and [flask](https://github.com/pallets/flask) | ||
|
||
## Install | ||
```bash | ||
git clone https://github.com/somewheve/ctpbee & cd ctpbee & python3 setup.py install | ||
|
||
or | ||
|
||
pip3 install ctpbee | ||
``` | ||
|
||
## Docker | ||
|
||
```bash | ||
docker pull yutiansut/ctpbee:latest | ||
docker run -p 5000:5000 yutiansut/ctpbee:latest | ||
``` | ||
|
||
## Documention | ||
local generated: | ||
1. git clone https://github.com/somewheve/ctpbee | ||
2. pip3 install sphinx | ||
3. cd ./ctpbee/docs && make html | ||
4. you can see the index.html at /build/html, just use web browser to open it | ||
[Online docs](http://docs.ctpbee.com) | ||
|
||
## Function | ||
|
||
- [x] k-line data support | ||
- [x] time-shared data support | ||
- [x] trade support | ||
- [x] market support | ||
- [x] multiple style of sending order | ||
- [x] multi-account support | ||
- [x] apply penetrating interface | ||
- [x] generate the order fastly | ||
- [x] risk level | ||
- [x] documentary signal | ||
- [x] multiplex market comparison | ||
- [ ] optimizing code | ||
- [ ] establishment of back measuring system | ||
- [ ] cta support | ||
|
||
|
||
|
||
## Quick start | ||
```python | ||
from ctpbee import CtpBee | ||
app = CtpBee("ctpbee", __name__) | ||
info = { | ||
"CONNECT_INFO": { | ||
"userid": "", | ||
"password": "", | ||
"brokerid": "", | ||
"md_address": "", | ||
"td_address": "", | ||
"appid": "", | ||
"auth_code": "", | ||
"product_info":"" | ||
}, | ||
"INTERFACE":"ctp", | ||
"TD_FUNC": True, # 开启交易功能 | ||
} | ||
app.config.from_mapping(info) # 从dict中载入信息 对于更多配置载入方式, 请参阅文档或者阅读代码 | ||
app.start() | ||
``` | ||
|
||
## More | ||
read the [examples](https://github.com/somewheve/ctpbee/blob/master/examples/) | ||
|
||
## End | ||
If this is helpful for you, click the star to support me. QAQ, if you want to communicate together just [click](https://jq.qq.com/?_wv=1027&k=5xWbIq3) if you have a Tencent QQ Account | ||
|
||
|
Oops, something went wrong.