[Mod]change apex FixApi.dll to x64 version

This commit is contained in:
vn.py 2019-04-02 10:04:48 +08:00
parent 548cd22ef3
commit 59d2219785
3 changed files with 42 additions and 27 deletions

View File

@ -1,7 +1,15 @@
# By Traders, For Traders.
<p align="center">
<img src ="https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png" />
<img src ="https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png"/>
</p>
<p align="center">
<img src ="https://img.shields.io/badge/version-2.0.1-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
<img src ="https://img.shields.io/badge/python-3.7-blue.svg" />
<img src ="https://img.shields.io/travis/com/vnpy/vnpy/master.svg"/>
<img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
</p>
vn.py是一套基于Python的开源量化交易系统开发框架自2015年1月正式发布以来在开源社区5年持续不断的贡献下一步步成长为全功能量化交易平台目前国内外金融机构用户已经超过300家包括私募基金、证券自营和资管、期货资管和子公司、高校研究机构、自营交易公司、交易所、Token Fund等。

Binary file not shown.

View File

@ -31,7 +31,7 @@ class ApexApi:
def set_app_info(self, name: str, version: str):
"""设置应用信息"""
n = APEX.Fix_SetAppInfo(c_char_p(name), c_char_p(version))
n = APEX.Fix_SetAppInfo(to_bytes(name), to_bytes(version))
return bool(n)
def uninitialize(self):
@ -42,19 +42,19 @@ class ApexApi:
def set_default_info(self, user: str, wtfs: str, fbdm: str, dest: str):
"""设置默认信息"""
n = APEX.Fix_SetDefaultInfo(
c_char_p(user),
c_char_p(wtfs),
c_char_p(fbdm),
c_char_p(dest)
to_bytes(user),
to_bytes(wtfs),
to_bytes(fbdm),
to_bytes(dest)
)
return bool(n)
def connect(self, address: str, khh: str, pwd: str, timeout: int):
"""连接交易"""
conn = APEX.Fix_Connect(
c_char_p(address),
c_char_p(khh),
c_char_p(pwd),
to_bytes(address),
to_bytes(khh),
to_bytes(pwd),
timeout
)
return conn
@ -66,13 +66,13 @@ class ApexApi:
):
"""连接交易"""
conn = APEX.Fix_ConnectEx(
c_char_p(address),
c_char_p(khh),
c_char_p(pwd),
c_char_p(file_cert),
c_char_p(cert_pwd),
c_char_p(file_ca),
c_char_p(procotol),
to_bytes(address),
to_bytes(khh),
to_bytes(pwd),
to_bytes(file_cert),
to_bytes(cert_pwd),
to_bytes(file_ca),
to_bytes(procotol),
verify,
timeout
)
@ -100,27 +100,27 @@ class ApexApi:
def set_wtfs(self, sess: int, wtfs: str):
"""设置委托方式"""
n = APEX.Fix_SetWTFS(sess, c_char_p(wtfs))
n = APEX.Fix_SetWTFS(sess, to_bytes(wtfs))
return bool(n)
def set_fbdm(self, sess: int, fbdm: str):
"""设置来源营业部"""
n = APEX.Fix_SetFBDM(sess, c_char_p(fbdm))
n = APEX.Fix_SetFBDM(sess, to_bytes(fbdm))
return bool(n)
def set_dest_fbdm(self, sess: int, fbdm: str):
"""设置目标营业部"""
n = APEX.Fix_SetDestFBDM(sess, c_char_p(fbdm))
n = APEX.Fix_SetDestFBDM(sess, to_bytes(fbdm))
return bool(n)
def set_node(self, sess: int, node: str):
"""设置业务站点"""
n = APEX.Fix_SetNode(sess, c_char_p(node))
n = APEX.Fix_SetNode(sess, to_bytes(node))
return bool(n)
def set_gydm(self, sess: int, gydm: str):
"""设置柜员号"""
n = APEX.Fix_SetGYDM(sess, c_char_p(gydm))
n = APEX.Fix_SetGYDM(sess, to_bytes(gydm))
return bool(n)
def create_head(self, sess: int, func: int):
@ -215,14 +215,16 @@ class ApexApi:
APEX.Fix_GetToken(sess, out, size)
return out.value
def encode(self, data):
def encode(self, data: str):
"""加密"""
data = to_bytes(data)
buf = create_string_buffer(data, 512)
APEX.Fix_Encode(buf)
return buf.value
def add_backup_svc_addr(self, address: str):
"""设置业务令牌"""
address = to_bytes(address)
n = APEX.Fix_AddBackupSvrAddr(address)
return bool(n)
@ -239,7 +241,7 @@ class ApexApi:
def subscribe_by_customer(self, conn: int, svc: int, khh: str, pwd: str):
"""订阅数据"""
func = APEX[93]
n = func(conn, svc, self.push_call_func, c_char_p(""), khh, pwd)
n = func(conn, svc, self.push_call_func, to_bytes(""), khh, pwd)
return bool(n)
def unsubscribe_by_handle(self, handle: int):
@ -264,12 +266,12 @@ class ApexApi:
def set_system_no(self, sess: int, val: str):
"""设置系统编号"""
n = APEX.Fix_SetSystemNo(sess, c_char_p(val))
n = APEX.Fix_SetSystemNo(sess, to_bytes(val))
return bool(n)
def set_default_system_no(self, val: str):
"""设置默认系统编号"""
n = APEX.Fix_SetDefaultSystemNo(c_char_p(val))
n = APEX.Fix_SetDefaultSystemNo(to_bytes(val))
return bool(n)
def set_auto_reconnect(self, conn: int, reconnect: int):
@ -298,13 +300,13 @@ class ApexApi:
def set_item(self, sess: int, fid: int, val: str):
"""设置请求内容"""
n = APEX.Fix_SetString(sess, fid, c_char_p(val))
n = APEX.Fix_SetString(sess, fid, to_bytes(val))
return bool(n)
def get_last_err_msg(self):
"""获取错误信息"""
size = 256
out = create_string_buffer("", size)
out = create_string_buffer(b"", size)
APEX.Fix_GetLastErrMsg(out, size)
return out.value
@ -328,3 +330,8 @@ class ApexApi:
def on_conn(self, conn: int, event, recv):
"""连接回调(需要继承)"""
return True
def to_bytes(data: str):
""""""
return data.encode("GBK")