更新py3的编译和说明
This commit is contained in:
parent
4ef621b8d9
commit
55d1b9ec06
@ -1,52 +1,52 @@
|
||||
# vn.ctp
|
||||
|
||||
### <20><><EFBFBD>
|
||||
CTP<EFBFBD><EFBFBD>̨API<EFBFBD>ӿڵ<EFBFBD>Python<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pyscriptĿ¼<EFBFBD>µĽű<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>飬<EFBFBD>ṩԭ<EFBFBD><EFBFBD>C++ API<50>е<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD>ܡ<EFBFBD>
|
||||
|
||||
### 简介
|
||||
CTP柜台API接口的Python封装,基于pyscript目录下的脚本自动分析头文件生成封装代码模块,提供原生C++ API中的全部功能。
|
||||
|
||||
|
||||
### Ŀ¼˵<C2BC><CBB5>
|
||||
* vnctpmd: <20><><EFBFBD><EFBFBD>API
|
||||
* vnctptd: <20><><EFBFBD><EFBFBD>API
|
||||
* pyscript: <20>Զ<EFBFBD><D4B6><EFBFBD>װ<EFBFBD>ű<EFBFBD>
|
||||
* ctpapi<70><69>C++ API<50>ļ<EFBFBD>
|
||||
### 目录说明
|
||||
* py3: Windows下编译
|
||||
* vnctpmd: 行情API(py3)
|
||||
* vnctptd: 交易API(py3)
|
||||
* pyscript: 自动封装脚本
|
||||
* ctpapi:C++ API文件
|
||||
|
||||
### ʹ<EFBFBD><EFBFBD>CMake<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
### 使用CMake编译
|
||||
|
||||
**Windows 7**
|
||||
**Windows 7/10**
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||
环境配置:
|
||||
|
||||
* Anaconda<EFBFBD><EFBFBD>Boost<EFBFBD>İ<EFBFBD>װ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ο<EFBFBD>www.vnpy.org<72>ϵĽ̳̣<CCB3><CCA3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>32λ
|
||||
* Anaconda使用64bit,python 3, 如 python 3.5 3.6
|
||||
|
||||
* cmake:<3A><>װ<EFBFBD><D7B0><EFBFBD>°汾<C2B0><E6B1BE>cmake,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1>뻷<EFBFBD><EBBBB7>
|
||||
* Boost 使用 1.57 以上
|
||||
boost 安装后,有一个stage的版本,对应include & lib的路径。
|
||||
* cmake:安装最新版本的cmake,用于配置编译环境
|
||||
|
||||
* <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOOST_ROOT = C:\boost_1_57_0
|
||||
* 设置环境变量:BOOST_ROOT = C:\boost_1_57_0
|
||||
|
||||
* <EFBFBD><EFBFBD><EFBFBD>빤<EFBFBD>ߣ<EFBFBD>Visual Studio 2013
|
||||
* 编译工具:Visual Studio 2017
|
||||
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||
编译过程:
|
||||
|
||||
* <EFBFBD><EFBFBD>vn.ctpĿ¼<C4BF><C2BC><EFBFBD>½<EFBFBD><C2BD>ļ<EFBFBD><C4BC>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊbuild, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
* 使用 Visual Studio 2017, 打开 py3/vnctpmd下解决方案vnctpmd.sln
|
||||
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺cmake-gui .. <20><><EFBFBD>cmake<6B><65><EFBFBD>ý<EFBFBD><C3BD><EFBFBD>
|
||||
* 检查“项目”配置中,对应的include和ib目录,均要包含python 3.x 和boost的include & lib路径
|
||||
|
||||
* <EFBFBD><EFBFBD><EFBFBD>configure<EFBFBD><EFBFBD>
|
||||
* 点击编译按钮,建议编译release库
|
||||
|
||||
* <20><><EFBFBD>generate<74><65><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>óɹ<C3B3>
|
||||
|
||||
* <20><><EFBFBD><EFBFBD>buildĿ¼<C4BF><C2BC>˫<EFBFBD><CBAB>vn_ctp_api.sln<6C><EFBFBD><F2BFAABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴ť,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>release<73><65>
|
||||
* vnctptd的编译同上。
|
||||
|
||||
|
||||
**Linux (Debian jessie, Ubuntu 16.04,)**
|
||||
**Linux (Debian jessie, Ubuntu 16.04)**
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
|
||||
环境配置:
|
||||
|
||||
* <EFBFBD>ο<EFBFBD>[<5B><><EFBFBD><EFBFBD>](http://www.continuum.io/downloads)<29>Ľ̳<C4BD><CCB3><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>װAnaconda<64><61>Linux 64λ<34>汾
|
||||
* 参考[这里](http://www.continuum.io/downloads)的教程下载并安装Anaconda的Linux 64位版本
|
||||
|
||||
* ʹ<EFBFBD><EFBFBD>apt-get<65><74>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صĹ<D8B5><C4B9>ߣ<EFBFBD>ע<EFBFBD><D7A2>ijЩ<C4B3>ϵ<EFBFBD>Ubuntu<74><75><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>ʹ<EFBFBD><CAB9>boost 1.58.0<EFBFBD>汾<EFBFBD><EFBFBD>
|
||||
* 使用apt-get安装编译相关的工具,注意某些老的Ubuntu必须指定使用boost 1.58.0版本:
|
||||
|
||||
- apt-get install build-essential
|
||||
|
||||
@ -56,26 +56,15 @@ CTP<54><50>̨API<50>ӿڵ<D3BF>Python<6F><6E>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pyscriptĿ¼<C4BF>µĽű<C4BD>
|
||||
|
||||
- apt-get install cmake
|
||||
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>ctp api tar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>v6.3.5_20150803_tradeapi_linux64.tar<61><72><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ctp api so<73>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD><D4BA>Ըò<D4B8><C3B2>裩<EFBFBD><E8A3A9>
|
||||
* 如果从官网下载新的ctp api tar包,比如v6.3.5_20150803_tradeapi_linux64.tar,需要重命名ctp api so文件名(否则可以忽略该步骤):
|
||||
|
||||
- thostmduserapi.so --> libthostmduserapi.so
|
||||
|
||||
- thosttraderapi.so --> libthosttraderapi.so
|
||||
|
||||
centos
|
||||
see root/readme
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>
|
||||
编译过程:
|
||||
|
||||
* <EFBFBD><EFBFBD>ǰĿ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>build.sh<73><68><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>
|
||||
* 当前目录运行build.sh,完成编译
|
||||
|
||||
### API<50>汾
|
||||
<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>2015-08-04
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>fsopt_traderapi
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȨAPI
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>[http://www.sfit.com.cn/5_2_DocumentDown.htm](http://www.sfit.com.cn/5_2_DocumentDown.htm)
|
||||
|
||||
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ctpapi<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD>Windows<EFBFBD><EFBFBD>32λ<EFBFBD>汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>x64_linux<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>Linux<EFBFBD><EFBFBD>64λ<EFBFBD>汾
|
||||
|
Loading…
Reference in New Issue
Block a user