1 Star 0 Fork 36

QinLikang / hf_go_ctp

forked from zhuzhenping / hf_goctp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

goctp

介绍

CTP封装之golang版,支持Windows Linux x64. 采用二次封装,将C++封装成C,并export所用函数.

软件架构

代码与C#/PYTHON版本逻辑相同

使用说明

源码测试

需卸载已安装 `go clean -i github.com/haifengat/goctp'

安装

go get github.com/haifengat/goctp

示例

https://github.com/haifengat/goctp/raw/master/demo/main.go

编译

linux

复制所有 so文件到系统 lib下,或把当前路径加入 LD_LIBRARY_PATH 中.

windows

编译后复制 dll到应用程序目录下即可

QA

linux中quote与trade不能同时载入的问题

经测试,在trade创建子目录test_quote并载入quote测试代码可行。(test_quote下放quote代码,test_trade下放trade代码,亦报错)

解决

从python项目中复制quote.h quote.cpp过来,修改所有函数和回调函数,增加前缀q. 重新编译ctp_quote.so

cd lnx && g++ -shared -fPIC -Wl,-rpath . -o ./libctp_quote.so ../generate/quote.cpp  thostmduserapi_se.so && cd ..
cd lnx && g++ -shared -fPIC -Wl,-rpath . -o ./libctp_trade.so ../generate/trade.cpp  thosttraderapi_se.so && cd ..

VSCode launch.json 配置

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/demo/",
            "cwd": "${workspaceFolder}",
            "env": {"LD_LIBRARY_PATH":"${workspaceFolder}/go_ctp/lib64/"},
            "args": []
        }
    ]
}
MIT License Copyright (c) 2019 海风 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.

简介

CTP封装之golang版 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/qinlk/hf_go_ctp.git
git@gitee.com:qinlk/hf_go_ctp.git
qinlk
hf_go_ctp
hf_go_ctp
master

搜索帮助

14c37bed 8189591 565d56ea 8189591