1) VS 2015
2) Python 3.7 64位
3) CTP API (从 http://www.sfit.com.cn/5_2_DocumentDown.htm 下载,此文档使用的是 http://www.sfit.com.cn/APIHistory1.html 下载的 6.3.11_20180109 版本)
error.dtd error.xml ThostFtdcMdApi.h ThostFtdcTraderApi.h ThostFtdcUserApiDataType.h ThostFtdcUserApiStruct.h thostmduserapi.dll thostmduserapi.lib thosttraderapi.dll thosttraderapi.lib
4) Swing
下载地址: https://sourceforge.net/projects/swig/files/。本文用的是 3.0.12 版本
使用方式:下载完成后,解压缩,然后 将存放的文件路径 加到 系统变量 PATH 中。
5) liviconv 库
这个库主要适用于字节编码转换,因为CTP的中文是GB2312编码,转换为UTF-8编码,适合python输出
编译方法:按照 https://blog.csdn.net/ghevinn/article/details/9825765 步骤
备注:1. 本次使用的是最新的 1.16 版本,可以通过 http://ftp.gnu.org/pub/gnu/libiconv/, 查询当前可用的版本
2. VS 编译生成的是 Release x64 位。
在刚刚下载得到的API文件夹20180109_tradeapi64_windows内,新建文件 thostmduserapi.i,内容如下
%module(directors="1") thostmduserapi %{ #include "ThostFtdcMdApi.h" #include "iconv.h" %}