修复部分中信期权接口的bug
This commit is contained in:
parent
b043f45f30
commit
7f90fda205
Binary file not shown.
@ -1,141 +0,0 @@
|
||||
#ifndef __CITICS_HSHLP_H__
|
||||
#define __CITICS_HSHLP_H__
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef CITICS_HSHLP_EXPORTS
|
||||
#define CITICS_HSHLP_API __declspec(dllexport)
|
||||
#else
|
||||
#define CITICS_HSHLP_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define CITICSSTDCALL __stdcall /* ensure stcall calling convention on NT */
|
||||
#else
|
||||
#define CITICS_HSHLP_API
|
||||
#define CITICSSTDCALL /* leave blank for other systems */
|
||||
#endif
|
||||
|
||||
#define ERROR_MSG_SIZE 512
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 同步业务调用
|
||||
* 使用该标识调用业务时,系统处于阻塞状态直到返回应答信息或超时
|
||||
*/
|
||||
#define BIZCALL_SYNC 0
|
||||
|
||||
/**
|
||||
* 异步业务调用
|
||||
* 使用该标识调用业务时,系统立即返回而不等待应答信息。
|
||||
* 需要调用QueueGetMsg获取应答结果信息
|
||||
*/
|
||||
#define BIZCALL_ASYNC 1
|
||||
|
||||
/**
|
||||
* 订阅消息中心发布的消息信息
|
||||
* 标识该业务为消息订阅请求。如订阅成交推送数据、系统通知消息等
|
||||
* 需要调用QueueGetMsg获取订阅的信息
|
||||
*/
|
||||
#define BIZCALL_SUBSCRIBE 3
|
||||
|
||||
typedef void *HSHLPCFGHANDLE;
|
||||
typedef void *HSHLPHANDLE;
|
||||
typedef void *HSHLPASYNCMSG;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* 异步和订阅消息控制信息*/
|
||||
typedef struct
|
||||
{
|
||||
int nFlags; // 位标识信息,0x0:正常消息, >0:系统状态消息
|
||||
int nFuncID; // 异步请求功能号
|
||||
int nReqNo; // 异步请求接受序号,根据该序号和功能号对请求和应答数据匹配
|
||||
int nIssueType; // 发布消息类别
|
||||
int nErrorNo; // 错误代码
|
||||
HSHLPASYNCMSG HAsyncMsg; // 消息句柄
|
||||
char szErrorInfo[ERROR_MSG_SIZE+1]; // 错误信息
|
||||
}MSG_CTRL, *LPMSG_CTRL;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// 初始化配置项,szConfigFile为空时则按系统默认值初始化,hConfig为出参
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_InitConfig(HSHLPCFGHANDLE* hConfig, const char* szConfigFile=NULL);
|
||||
|
||||
// 加载配置文件项,可以加载多个不同的配置文件,返回不同的配置句柄。等同于InitConfig
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_LoadConfig(HSHLPCFGHANDLE* hConfig, const char* szConfigFile);
|
||||
|
||||
// 重置服务器连接地址。格式:ip1:port1;ip2:port2;
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_ResetServer(HSHLPCFGHANDLE hConfig, const char* szAddr);
|
||||
|
||||
// 根据配置句柄,初始化一个连接对象。
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_Init(HSHLPHANDLE* HlpHandle, HSHLPCFGHANDLE hConfig);
|
||||
// 释放连接句柄系统资源
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_Exit(HSHLPHANDLE HlpHandle);
|
||||
|
||||
// 与服务器建立连接
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_ConnectServer(HSHLPHANDLE HlpHandle);
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_DisConnect(HSHLPHANDLE HlpHandle);
|
||||
|
||||
// 提交业务请求,如果szParam参数为NULL,则认为是通过SetValue函数设置的请求参数
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_BizCallAndCommit(HSHLPHANDLE HlpHandle, int iFuncID, const char* szParam=NULL, int nBizCallType=BIZCALL_SYNC, LPMSG_CTRL lpMsgCtrl=NULL);
|
||||
|
||||
// 获取记录行、列数,返回值为行、列数
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetRowCount(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl=NULL);
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetColCount(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl=NULL);
|
||||
|
||||
// 获取字段名称,序号以0为基数
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetColName(HSHLPHANDLE HlpHandle, int iColumn, char* szColName, LPMSG_CTRL lpMsgCtrl=NULL);
|
||||
|
||||
// 获取下一行记录,第一次调用则首先打开结果集,并把第0行作为当前记录行
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetNextRow(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl=NULL);
|
||||
|
||||
// 根据字段名称,获取字段值
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetValue(HSHLPHANDLE HlpHandle, const char* szKeyName, char* szValue, LPMSG_CTRL lpMsgCtrl=NULL);
|
||||
|
||||
// 根据字段序号获取字段值,序号以0为基数
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetValueByIndex(HSHLPHANDLE HlpHandle, int iColumn, char* szValue, LPMSG_CTRL lpMsgCtrl=NULL);
|
||||
|
||||
// 获取当前错误代码和信息
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_GetErrorMsg(HSHLPHANDLE HlpHandle, int* piErrorCode, char* szErrorMsg);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
// 另一种请求参数设置的方法,一个一个的设置。
|
||||
// 初始化请求参数
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_BeginParam(HSHLPHANDLE HlpHandle);
|
||||
// 设置每个请求参数字段名称和值
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_SetValue(HSHLPHANDLE HlpHandle, const char* szKeyName, const char* szValue);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
// 异步请求和消息订阅相关函数
|
||||
|
||||
// 获取异步消息队列中的消息数量
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_QueueMsgCount(HSHLPHANDLE HlpHandle);
|
||||
|
||||
// 从队列中读取一条消息,如果队列中没有数据,该函数会一直阻塞不返回,直到nWaitTime超时时间后才返回。
|
||||
// nWaitTime: 单位毫秒
|
||||
// = 0: 立即返回;如果队列中有数据则返回Msg,且return值为 0,否则return值为-5(超时错误)
|
||||
// =-1: 阻塞,直到队列中有数据获取到Msg 才返回。否则将永久阻塞等待。return值为 0,
|
||||
// = 其它值:超时时间,如果队列中有数据则立即返回,否则等待time时间后返回。return值为 -5(超时错误)。
|
||||
// Return: 0: 队列中有数据且获取消息成功;
|
||||
// -5: 超时错误,在设定的时间内队列中没有数据。
|
||||
// 其它错误:
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_QueueGetMsg(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl /*Out*/, int nWaitTime=0);
|
||||
|
||||
// 处理完成或者不需要该消息时,应及时删除该消息,否则消息将占用大量内存。
|
||||
// 如果不删除有可能每次都Get到同一条消息
|
||||
CITICS_HSHLP_API int CITICSSTDCALL CITICs_HsHlp_QueueEraseMsg(HSHLPHANDLE HlpHandle, LPMSG_CTRL lpMsgCtrl /*In*/);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
Binary file not shown.
@ -1,53 +0,0 @@
|
||||
[t2sdk]
|
||||
; 客户端要连接的服务端的IP和端口,可以配置一个或多个,中间以;分割,连接初始化时,会从这串服务端地址中,随即选择一个作为要建立连接的服务端
|
||||
servers=114.251.228.136:20008
|
||||
; 接收缓存的初始大小,单位字节,实际接收到服务端的数据时,可能会扩大(如果需要)
|
||||
init_recv_buf_size=512
|
||||
|
||||
; 每块发送缓存的初始大小,单位字节,该大小也会根据需要动态扩大
|
||||
init_send_buf_size=512
|
||||
|
||||
; 发送队列的大小,该大小不会动态变化,若该配置项很小,且连接发包很频繁,则可能
|
||||
; 因为发送队列满而造成发送失败
|
||||
send_queue_size=1000
|
||||
|
||||
; lang用于指定T2_SDK错误信息的语言ID(2052为简体中文,1033为英文)
|
||||
; 默认为2052
|
||||
lang=2052
|
||||
|
||||
; 此配置项请参看“注意事项”
|
||||
event_count=10
|
||||
|
||||
; 许可证文件的路径,默认为当前目录下的license.dat。
|
||||
license_file=./license.dat
|
||||
|
||||
|
||||
[proxy]
|
||||
; 可配置采用何种代理配置http/socks4/socks5,空表示不采用代理
|
||||
proxy_type=
|
||||
|
||||
; 代理服务器的IP地址
|
||||
ip=
|
||||
port=
|
||||
|
||||
; 登陆代理服务器的用户名
|
||||
user_name=guest
|
||||
password=
|
||||
|
||||
[safe]
|
||||
; 连接的安全模式,明文(none),通信密码(pwd),SSL(ssl)
|
||||
; 注意大小写敏感
|
||||
safe_level=none
|
||||
|
||||
; 当连接的安全模式为pwd时,client_id配置项才生效
|
||||
client_id=
|
||||
|
||||
; 在pwd模式下,当client_id为空时,comm_pwd为默认的密钥
|
||||
; 注意当client_id为空时,comm_pwd必须和服务端的配置一致方可正常使用,目前服务
|
||||
; 端的配置为888888
|
||||
comm_pwd=888888
|
||||
|
||||
; 当连接的安全模式为ssl时,cert_file和cert_pwd配置项才生效
|
||||
; 证书文件路径
|
||||
cert_file=xxx.pem
|
||||
cert_pwd=xxxxxxxx
|
Binary file not shown.
@ -1,20 +0,0 @@
|
||||
|
||||
[t2sdk]
|
||||
#第三方许可证
|
||||
license_file=
|
||||
servers=192.168.94.85:8001
|
||||
login_name=
|
||||
init_recv_buf_size=512
|
||||
init_send_buf_size=512
|
||||
send_queue_size=1000
|
||||
#心跳时间
|
||||
heartbeat_time=10
|
||||
#接入用户密码
|
||||
license_pwd=
|
||||
|
||||
[safe]
|
||||
safe_level=ssl
|
||||
#SSL证书
|
||||
cert_file=
|
||||
#SSL证书密码
|
||||
cert_pwd=
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,53 +0,0 @@
|
||||
[t2sdk]
|
||||
; 客户端要连接的服务端的IP和端口,可以配置一个或多个,中间以;分割,连接初始化时,会从这串服务端地址中,随即选择一个作为要建立连接的服务端
|
||||
servers=114.251.228.136:20008
|
||||
; 接收缓存的初始大小,单位字节,实际接收到服务端的数据时,可能会扩大(如果需要)
|
||||
init_recv_buf_size=512
|
||||
|
||||
; 每块发送缓存的初始大小,单位字节,该大小也会根据需要动态扩大
|
||||
init_send_buf_size=512
|
||||
|
||||
; 发送队列的大小,该大小不会动态变化,若该配置项很小,且连接发包很频繁,则可能
|
||||
; 因为发送队列满而造成发送失败
|
||||
send_queue_size=1000
|
||||
|
||||
; lang用于指定T2_SDK错误信息的语言ID(2052为简体中文,1033为英文)
|
||||
; 默认为2052
|
||||
lang=2052
|
||||
|
||||
; 此配置项请参看“注意事项”
|
||||
event_count=10
|
||||
|
||||
; 许可证文件的路径,默认为当前目录下的license.dat。
|
||||
license_file=./license.dat
|
||||
|
||||
|
||||
[proxy]
|
||||
; 可配置采用何种代理配置http/socks4/socks5,空表示不采用代理
|
||||
proxy_type=
|
||||
|
||||
; 代理服务器的IP地址
|
||||
ip=
|
||||
port=
|
||||
|
||||
; 登陆代理服务器的用户名
|
||||
user_name=guest
|
||||
password=
|
||||
|
||||
[safe]
|
||||
; 连接的安全模式,明文(none),通信密码(pwd),SSL(ssl)
|
||||
; 注意大小写敏感
|
||||
safe_level=none
|
||||
|
||||
; 当连接的安全模式为pwd时,client_id配置项才生效
|
||||
client_id=
|
||||
|
||||
; 在pwd模式下,当client_id为空时,comm_pwd为默认的密钥
|
||||
; 注意当client_id为空时,comm_pwd必须和服务端的配置一致方可正常使用,目前服务
|
||||
; 端的配置为888888
|
||||
comm_pwd=888888
|
||||
|
||||
; 当连接的安全模式为ssl时,cert_file和cert_pwd配置项才生效
|
||||
; 证书文件路径
|
||||
cert_file=xxx.pem
|
||||
cert_pwd=xxxxxxxx
|
@ -1,16 +0,0 @@
|
||||
[auth_info]
|
||||
ProfileCode=af2ebd99da3c6636171ea72747a5e32d
|
||||
LimitDate=20300101
|
||||
AllowPushTransation=0
|
||||
AllowWbp=0
|
||||
AuthCode=AQAAAABo23AyYmI1MWQ2ZGFhN2ExMjI1OTQyODgzZjA2OWFhNDBmOQAAAAAAAAAAAAAAAA==
|
||||
[functions]
|
||||
func=
|
||||
;[ProcessInfo_0]
|
||||
;ProcessName=HsT2Hlp_Demo.exe,Hs.exe
|
||||
;NetIP=172.23.123.9
|
||||
;NetMask=255.255.255.0
|
||||
;[ProcessInfo_0]
|
||||
;ProcessName=Option_Demo.exe
|
||||
;NetIP=10.0.0.0
|
||||
;NetMask=255.0.0.0
|
@ -1,2 +0,0 @@
|
||||
[114.251.228.136:20008 h034fd2a0/t2adc]14:40:07.278 -10033.54ms [-20] !Connect HSAR Server [-20] 注册超时。......
|
||||
[114.251.228.136:20008 h034fd2a0/t2adc]14:40:22.639 -0.01ms [0] !DisConnect HSAR Server, Last error message: [0] 注册超时。......
|
@ -1 +0,0 @@
|
||||
[114.251.228.136:20008 h0302ce38/t2818]22:52:07.954 -10099.03ms [-11] !Connect HSAR Server [-11] 同步连接超时或发生错误。......
|
@ -1,17 +0,0 @@
|
||||
2015-03-31 14:15:01.664: --Get This machine ID【203】failed!
|
||||
2015-03-31 14:17:40.303: --Get This machine ID【203】failed!
|
||||
2015-03-31 14:20:04.287: --Get This machine ID【203】failed!
|
||||
2015-03-31 14:20:19.251: --Get This machine ID【203】failed!
|
||||
20150331 14:39:57.407 1: [h034fd2a0/t334c] the Connection has been disconnected.
|
||||
2015-03-31 14:44:13.047: --Get This machine ID【203】failed!
|
||||
2015-03-31 15:34:12.591: --Get This machine ID【203】failed!
|
||||
2015-04-01 10:33:25.959: --Get This machine ID【203】failed!
|
||||
2015-04-01 13:39:17.232: --Get This machine ID【203】failed!
|
||||
2015-04-01 13:44:00.590: --Get This machine ID【203】failed!
|
||||
2015-04-01 13:44:54.336: --Get This machine ID【203】failed!
|
||||
2015-04-01 13:45:17.417: --Get This machine ID【203】failed!
|
||||
20150401 13:48:50.439 1: [h04557720/t3530] the Connection has been disconnected.
|
||||
20150401 13:49:13.822 1: [h045f7720/t317c] the Connection has been disconnected.
|
||||
20150401 14:34:59.175 1: [h045a7720/t2f80] the Connection has been disconnected.
|
||||
2017-04-11 22:51:57.843: --The license infomation is error. This machine ID is:[16ec65f21e6068d6e3d4de7a6ce6979b] and you can find this ID code in 'cserror.log' file!
|
||||
2017-04-11 22:51:57.844: --'CITICs_HsT2Hlp.dll' Moudle is not licensed. The date of license to:[2017-06-11] , The all functions is not limited on the trail period!
|
@ -1,56 +0,0 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from vncshshlp import *
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
|
||||
class TestHlp(CsHsHlp):
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self):
|
||||
""""""
|
||||
super(TestHlp, self).__init__()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onMsg(self, data):
|
||||
""""""
|
||||
print_dict(data)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def test():
|
||||
"""测试用"""
|
||||
api = TestHlp()
|
||||
|
||||
# 读取配置文件
|
||||
print api.loadConfig("Hsconfig.ini")
|
||||
|
||||
# 初始化
|
||||
print api.init()
|
||||
|
||||
# 连接服务器
|
||||
print api.connectServer()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test()
|
Binary file not shown.
Binary file not shown.
@ -1,20 +0,0 @@
|
||||
|
||||
[t2sdk]
|
||||
#第三方许可证
|
||||
license_file=
|
||||
servers=192.168.94.85:8001
|
||||
login_name=
|
||||
init_recv_buf_size=512
|
||||
init_send_buf_size=512
|
||||
send_queue_size=1000
|
||||
#心跳时间
|
||||
heartbeat_time=10
|
||||
#接入用户密码
|
||||
license_pwd=
|
||||
|
||||
[safe]
|
||||
safe_level=ssl
|
||||
#SSL证书
|
||||
cert_file=
|
||||
#SSL证书密码
|
||||
cert_pwd=
|
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<SubscriptionDataContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Authentication.CacheManagement">
|
||||
<Items />
|
||||
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA25n/ahjWHUaDiThcqA7VUAAAAAACAAAAAAAQZgAAAAEAACAAAACp8rAE6Rs+eDDGKoeibA0/oqMmdaA7onKWWZ9vNCMEegAAAAAOgAAAAAIAACAAAAArczqvArBQ6ZrDcryIUkYKHoCnxCFdBrwI86J8FMUqgxAAAADeYX9RIZdGPQWXXdIuo+DqQAAAAJVN3ajzOqDwXdZ1xR01lsdwXOYV0Tmyho0kIwaDp6GC5AH0RbotPHV7hgmKRkWjOR/bALilvW6H6V42wNTqvb8=</TokenCache>
|
||||
</SubscriptionDataContainer>
|
@ -1,22 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vncshshlp", "vncshshlp\vncshshlp.vcxproj", "{982DF24C-BCD1-4F25-BDE8-84ADB719588B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{982DF24C-BCD1-4F25-BDE8-84ADB719588B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{982DF24C-BCD1-4F25-BDE8-84ADB719588B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{982DF24C-BCD1-4F25-BDE8-84ADB719588B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{982DF24C-BCD1-4F25-BDE8-84ADB719588B}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,32 +0,0 @@
|
||||
========================================================================
|
||||
动态链接库:vncshshlp 项目概述
|
||||
========================================================================
|
||||
|
||||
应用程序向导已为您创建了此 vncshshlp DLL。
|
||||
|
||||
本文件概要介绍组成 vncshshlp 应用程序的每个文件的内容。
|
||||
|
||||
|
||||
vncshshlp.vcxproj
|
||||
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
|
||||
|
||||
vncshshlp.vcxproj.filters
|
||||
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
|
||||
|
||||
vncshshlp.cpp
|
||||
这是主 DLL 源文件。
|
||||
|
||||
此 DLL 在创建时不导出任何符号。因此,生成时不会产生 .lib 文件。如果希望此项目成为其他某个项目的项目依赖项,则需要添加代码以从 DLL 导出某些符号,以便产生一个导出库,或者,也可以在项目“属性页”对话框中的“链接器”文件夹中,将“常规”属性页上的“忽略输入库”属性设置为“是”。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
其他标准文件:
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
这些文件用于生成名为 vncshshlp.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
其他注释:
|
||||
|
||||
应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@ -1,19 +0,0 @@
|
||||
// dllmain.cpp : 定义 DLL 应用程序的入口点。
|
||||
#include "stdafx.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// vncshshlp.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
// 引用任何所需的附加头文件,而不是在此文件中引用
|
@ -1,16 +0,0 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的信息
|
||||
// Windows 头文件:
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
// TODO: 在此处引用程序需要的其他头文件
|
@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||
|
||||
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||
|
||||
#include <SDKDDKVer.h>
|
@ -1,165 +0,0 @@
|
||||
// vncshshlp.cpp : 定义 DLL 应用程序的导出函数。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "vncshshlp.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//主动函数部分
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//读取配置文件
|
||||
int CsHsHlp::loadConfig(string fileName)
|
||||
{
|
||||
int i = CITICs_HsHlp_LoadConfig(&this->cfgHandle, fileName.c_str());
|
||||
return i;
|
||||
};
|
||||
|
||||
//初始化
|
||||
int CsHsHlp::init()
|
||||
{
|
||||
int i = CITICs_HsHlp_Init(&this->handle, this->cfgHandle);
|
||||
return i;
|
||||
};
|
||||
|
||||
//连接服务器
|
||||
int CsHsHlp::connectServer()
|
||||
{
|
||||
int i = CITICs_HsHlp_ConnectServer(this->handle);
|
||||
return i;
|
||||
};
|
||||
|
||||
//获取错误信息
|
||||
string CsHsHlp::getErrorMsg()
|
||||
{
|
||||
char msg[512];
|
||||
CITICs_HsHlp_GetErrorMsg(this->handle, NULL, msg);
|
||||
string errorMsg = msg;
|
||||
return errorMsg;
|
||||
};
|
||||
|
||||
//初始化发包请求
|
||||
int CsHsHlp::beginParam()
|
||||
{
|
||||
int i = CITICs_HsHlp_BeginParam(this->handle);
|
||||
return i;
|
||||
};
|
||||
|
||||
//设置发包的参数字段名称和值
|
||||
int CsHsHlp::setValue(string key, string value)
|
||||
{
|
||||
int i = CITICs_HsHlp_SetValue(this->handle, key.c_str(), value.c_str());
|
||||
return i;
|
||||
};
|
||||
|
||||
//发包
|
||||
int CsHsHlp::bizCallAndCommit(int iFuncID)
|
||||
{
|
||||
int i = CITICs_HsHlp_BizCallAndCommit(this->handle, iFuncID, NULL, BIZCALL_ASYNC);
|
||||
return i;
|
||||
};
|
||||
|
||||
//断开服务器
|
||||
int CsHsHlp::disconnect()
|
||||
{
|
||||
int i = CITICs_HsHlp_DisConnect(this->handle);
|
||||
return i;
|
||||
};
|
||||
|
||||
//退出
|
||||
int CsHsHlp::exit()
|
||||
{
|
||||
int i = CITICs_HsHlp_Exit(this->handle);
|
||||
return i;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//异步消息处理线程
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//连续运行的消息处理函数
|
||||
void CsHsHlp::processMsg()
|
||||
{
|
||||
LPMSG_CTRL msg;
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
char key[64] = {0};
|
||||
char value[512] = {0};
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
|
||||
while (1)
|
||||
{
|
||||
//读取消息
|
||||
CITICs_HsHlp_QueueGetMsg(this->handle, msg, -1);
|
||||
|
||||
//生成字典并推送到Python中
|
||||
row = CITICs_HsHlp_GetRowCount(this->handle, msg); //获取msg行数(有多少个回应)
|
||||
col = CITICs_HsHlp_GetColCount(this->handle, msg); //获取msg列数(有哪些字段)
|
||||
|
||||
for (int i = 0; i < row; i++)
|
||||
{
|
||||
if (0 == CITICs_HsHlp_GetNextRow(this->handle, msg))
|
||||
{
|
||||
dict data;
|
||||
for (int j = 0; j < col; j++)
|
||||
{
|
||||
CITICs_HsHlp_GetColName(this->handle, j, key);
|
||||
CITICs_HsHlp_GetValueByIndex(this->handle, j, value);
|
||||
string str_key = key;
|
||||
string str_value = value;
|
||||
data[str_key] = str_value;
|
||||
this->onMsg(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//从队列删除消息
|
||||
CITICs_HsHlp_QueueEraseMsg(this->handle, msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///Boost.Python封装
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
struct CsHsHlpWrap : CsHsHlp, wrapper < CsHsHlp >
|
||||
{
|
||||
virtual void onMsg(dict data)
|
||||
{
|
||||
//在向python环境中调用回调函数推送数据前,需要先获取全局锁GIL,防止解释器崩溃
|
||||
PyLock lock;
|
||||
|
||||
//以下的try...catch...可以实现捕捉python环境中错误的功能,防止C++直接出现原因未知的崩溃
|
||||
try
|
||||
{
|
||||
this->get_override("onMsg")(data);
|
||||
}
|
||||
catch (error_already_set const &)
|
||||
{
|
||||
PyErr_Print();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
BOOST_PYTHON_MODULE(vncshshlp)
|
||||
{
|
||||
PyEval_InitThreads(); //导入时运行,保证先创建GIL
|
||||
|
||||
class_<CsHsHlpWrap, boost::noncopyable>("CsHsHlp")
|
||||
.def("loadConfig", &CsHsHlpWrap::loadConfig)
|
||||
.def("init", &CsHsHlpWrap::init)
|
||||
.def("connectServer", &CsHsHlpWrap::connectServer)
|
||||
.def("getErrorMsg", &CsHsHlpWrap::getErrorMsg)
|
||||
.def("beginParam", &CsHsHlpWrap::beginParam)
|
||||
.def("setValue", &CsHsHlpWrap::setValue)
|
||||
.def("bizCallAndCommit", &CsHsHlpWrap::bizCallAndCommit)
|
||||
.def("disconnect", &CsHsHlpWrap::disconnect)
|
||||
.def("exit", &CsHsHlpWrap::exit)
|
||||
|
||||
.def("onMsg", pure_virtual(&CsHsHlpWrap::onMsg))
|
||||
;
|
||||
};
|
@ -1,123 +0,0 @@
|
||||
//说明部分
|
||||
|
||||
//系统
|
||||
#include "stdafx.h"
|
||||
#include <string>
|
||||
#include <queue>
|
||||
|
||||
//Boost
|
||||
#define BOOST_PYTHON_STATIC_LIB
|
||||
#include <boost/python/module.hpp> //python封装
|
||||
#include <boost/python/def.hpp> //python封装
|
||||
#include <boost/python/dict.hpp> //python封装
|
||||
#include <boost/python/object.hpp> //python封装
|
||||
#include <boost/python.hpp> //python封装
|
||||
#include <boost/thread.hpp> //任务队列的线程功能
|
||||
#include <boost/bind.hpp> //任务队列的线程功能
|
||||
#include <boost/any.hpp> //任务队列的任务实现
|
||||
|
||||
//API
|
||||
#include "CITICs_HsT2Hlp.h"
|
||||
|
||||
//命名空间
|
||||
using namespace std;
|
||||
using namespace boost::python;
|
||||
using namespace boost;
|
||||
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///API中的部分组件
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
//GIL全局锁简化获取用,
|
||||
//用于帮助C++线程获得GIL锁,从而防止python崩溃
|
||||
class PyLock
|
||||
{
|
||||
private:
|
||||
PyGILState_STATE gil_state;
|
||||
|
||||
public:
|
||||
//在某个函数方法中创建该对象时,获得GIL锁
|
||||
PyLock()
|
||||
{
|
||||
gil_state = PyGILState_Ensure();
|
||||
}
|
||||
|
||||
//在某个函数完成后销毁该对象时,解放GIL锁
|
||||
~PyLock()
|
||||
{
|
||||
PyGILState_Release(gil_state);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///封装类
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
class CsHsHlp
|
||||
{
|
||||
private:
|
||||
HSHLPCFGHANDLE cfgHandle; //配置指针
|
||||
HSHLPHANDLE handle; //操作对象指针
|
||||
thread *task_thread; //工作线程指针(向python中推送数据)
|
||||
|
||||
public:
|
||||
CsHsHlp()
|
||||
{
|
||||
function0<void> f = boost::bind(&CsHsHlp::processMsg, this);
|
||||
//thread t(f);
|
||||
//this->task_thread = &t;
|
||||
};
|
||||
|
||||
~CsHsHlp()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//主动函数部分
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//读取配置文件
|
||||
int loadConfig(string fileName);
|
||||
|
||||
//初始化
|
||||
int init();
|
||||
|
||||
//连接服务器
|
||||
int connectServer();
|
||||
|
||||
//获取错误信息
|
||||
string getErrorMsg();
|
||||
|
||||
//初始化发包请求
|
||||
int beginParam();
|
||||
|
||||
//设置发包的参数字段名称和值
|
||||
int setValue(string key, string value);
|
||||
|
||||
//发包
|
||||
int bizCallAndCommit(int iFuncID);
|
||||
|
||||
//断开服务器
|
||||
int disconnect();
|
||||
|
||||
//退出
|
||||
int exit();
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//异步消息处理线程
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//连续运行的消息处理函数
|
||||
void processMsg();
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//Python中继承的回调函数
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//向Python中推送消息的函数
|
||||
virtual void onMsg(dict data) {};
|
||||
};
|
@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{982DF24C-BCD1-4F25-BDE8-84ADB719588B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>vncshshlp</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>X:\GithubProject\vnpy\vn.archive\vn.cs\hshlp;D:\Anaconda2\include;D:\boost_1_57_0;$(IncludePath)</IncludePath>
|
||||
<ReferencePath>D:\boost_1_57_0\libs;D:\Anaconda2\libs;X:\GithubProject\vnpy\vn.archive\vn.cs\hshlp;$(ReferencePath)</ReferencePath>
|
||||
<TargetExt>.pyd</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;VNCSHSHLP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;VNCSHSHLP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>X:\GithubProject\vnpy\vn.archive\vn.cs\hshlp;D:\Anaconda2\libs;D:\boost_1_57_0\stage\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\hshlp\CITICs_HsT2Hlp.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="vncshshlp.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
</PrecompiledHeader>
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vncshshlp.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\hshlp\CITICs_HsT2Hlp.dll" />
|
||||
<None Include="..\..\hshlp\t2sdk.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="..\..\hshlp\CITICs_HsT2Hlp.lib" />
|
||||
<Library Include="..\..\hshlp\t2sdk.lib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,61 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vncshshlp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\hshlp\CITICs_HsT2Hlp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vncshshlp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\hshlp\CITICs_HsT2Hlp.dll">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="..\..\hshlp\t2sdk.dll">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="..\..\hshlp\CITICs_HsT2Hlp.lib">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Library>
|
||||
<Library Include="..\..\hshlp\t2sdk.lib">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Library>
|
||||
</ItemGroup>
|
||||
</Project>
|
26
setup.py
Normal file
26
setup.py
Normal file
@ -0,0 +1,26 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from setuptools import setup
|
||||
import vnpy
|
||||
|
||||
|
||||
long_desc = """
|
||||
"""
|
||||
|
||||
|
||||
setup(
|
||||
name='vnpy',
|
||||
version=vnpy.__version__,
|
||||
description='A utility for crawling historical and Real-time Quotes data of China stocks',
|
||||
long_description = long_desc,
|
||||
author=vnpy.__author__,
|
||||
author_email='vn.py@foxmail.com',
|
||||
license='MIT',
|
||||
url='http://www.vnpy.org',
|
||||
keywords='Python quantitative trading framework',
|
||||
classifiers=['Development Status :: 4 - Beta',
|
||||
'Programming Language :: Python :: 2.7'
|
||||
'License :: OSI Approved :: MIT License'],
|
||||
packages=['vnpy','vnpy.api', 'vnpy.event', 'vnpy.rpc', 'vnpy.trader'],
|
||||
package_data={'': ['*.json']},
|
||||
)
|
@ -411,8 +411,6 @@ class CshshlpTdApi(CsHsHlp):
|
||||
order.exchange = exchangeMapReverse.get(d['exchange_type'], EXCHANGE_UNKNOWN)
|
||||
order.vtSymbol = '.'.join([order.symbol, order.exchange])
|
||||
|
||||
#self.batchNo += 1
|
||||
#batchNo = str(self.batchNo)
|
||||
batchNo = d['batch_no']
|
||||
self.batchNo = max(self.batchNo, int(batchNo))
|
||||
|
||||
@ -424,8 +422,7 @@ class CshshlpTdApi(CsHsHlp):
|
||||
|
||||
order.direction = directionMapReverse.get(d['entrust_bs'], DIRECTION_UNKNOWN)
|
||||
order.offset = offsetMapReverse.get(d['entrust_oc'], OFFSET_UNKNOWN)
|
||||
#order.status = statusMapReverse.get(d['entrust_status'], STATUS_UNKNOWN)
|
||||
order.status = statusMapReverse.get(d['entrust_status'], d['entrust_status'])
|
||||
order.status = statusMapReverse.get(d['entrust_status'], STATUS_UNKNOWN)
|
||||
|
||||
order.price = float(d['opt_entrust_price'])
|
||||
order.totalVolume = int(float(d['entrust_amount']))
|
||||
@ -494,10 +491,10 @@ class CshshlpTdApi(CsHsHlp):
|
||||
pos.direction = posDirectionMapReverse.get(d['opthold_type'], DIRECTION_UNKNOWN)
|
||||
pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction])
|
||||
|
||||
pos.position = int(float(d['current_amount']))
|
||||
pos.position = int(float(d['hold_amount']))
|
||||
pos.positionProfit = float(d['income_balance'])
|
||||
pos.price = float(d['opt_cost_price'])
|
||||
pos.frozen = int((float(d['current_amount']) - float(d['enable_amount'])))
|
||||
pos.frozen = int((float(d['hold_amount']) - float(d['enable_amount'])))
|
||||
|
||||
self.gateway.onPosition(pos)
|
||||
|
||||
@ -689,7 +686,7 @@ class CshshlpTdApi(CsHsHlp):
|
||||
def qryContract(self):
|
||||
""""""
|
||||
req = self.generateReq()
|
||||
#req = {}
|
||||
req['request_num'] = '10000'
|
||||
self.sendReq(FUNCTION_QRYCONTRACT, req)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@ -699,7 +696,7 @@ class CshshlpTdApi(CsHsHlp):
|
||||
return
|
||||
|
||||
req = self.generateReq()
|
||||
d['request_num'] = '1000'
|
||||
req['request_num'] = '10000'
|
||||
self.sendReq(FUNCTION_QRYPOSITION, req)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@ -709,7 +706,6 @@ class CshshlpTdApi(CsHsHlp):
|
||||
return
|
||||
|
||||
req = self.generateReq()
|
||||
d['money_type'] = 'cny'
|
||||
self.sendReq(FUNCTION_QRYACCOUNT, req)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"brokerID": "9999",
|
||||
"tdAddress": "tcp://180.168.146.187:10030",
|
||||
"password": "19890624",
|
||||
"mdAddress": "tcp://180.168.146.187:10031",
|
||||
"userID": "000300"
|
||||
"mdAddress": "tcp://180.168.146.187:10011",
|
||||
"tdAddress": "tcp://180.168.146.187:10001",
|
||||
"userID": "simnow申请",
|
||||
"password": "simnow申请"
|
||||
}
|
Loading…
Reference in New Issue
Block a user