Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac version #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions ctp/header/ThostFtdcMdApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,20 @@ class MD_API_EXPORT CThostFtdcMdApi {
virtual const char *GetTradingDay() = 0;

///注册前置机网络地址
///@param pszFrontAddress前置机网络地址。
///@param pszFrontAddress 前置机网络地址。
///@remark 网络地址的格式为:“protocol://ipaddress:port”,如:”tcp://127.0.0.1:17001”。
///@remark “tcp”代表传输协议,“127.0.0.1”代表服务器地址。”17001”代表服务器端口号。
virtual void RegisterFront(char *pszFrontAddress) = 0;

///注册名字服务器网络地址
///@param pszNsAddress名字服务器网络地址。
///@param pszNsAddress 名字服务器网络地址。
///@remark 网络地址的格式为:“protocol://ipaddress:port”,如:”tcp://127.0.0.1:12001”。
///@remark “tcp”代表传输协议,“127.0.0.1”代表服务器地址。”12001”代表服务器端口号。
///@remark RegisterNameServer优先于RegisterFront
virtual void RegisterNameServer(char *pszNsAddress) = 0;

///注册名字服务器用户信息
///@param pFensUserInfo用户信息。
///@param pFensUserInfo 用户信息。
virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField *pFensUserInfo) = 0;

///注册回调接口
Expand All @@ -129,25 +129,21 @@ class MD_API_EXPORT CThostFtdcMdApi {
///订阅行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount) = 0;

///退订行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount) = 0;

///订阅询价。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;

///退订询价。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;

///用户登录请求
Expand Down
8 changes: 4 additions & 4 deletions ctp/header/ThostFtdcTraderApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,20 +480,20 @@ class TRADER_API_EXPORT CThostFtdcTraderApi {
virtual const char *GetTradingDay() = 0;

///注册前置机网络地址
///@param pszFrontAddress前置机网络地址。
///@param pszFrontAddress 前置机网络地址。
///@remark 网络地址的格式为:“protocol://ipaddress:port”,如:”tcp://127.0.0.1:17001”。
///@remark “tcp”代表传输协议,“127.0.0.1”代表服务器地址。”17001”代表服务器端口号。
virtual void RegisterFront(char *pszFrontAddress) = 0;

///注册名字服务器网络地址
///@param pszNsAddress名字服务器网络地址。
///@param pszNsAddress 名字服务器网络地址。
///@remark 网络地址的格式为:“protocol://ipaddress:port”,如:”tcp://127.0.0.1:12001”。
///@remark “tcp”代表传输协议,“127.0.0.1”代表服务器地址。”12001”代表服务器端口号。
///@remark RegisterNameServer优先于RegisterFront
virtual void RegisterNameServer(char *pszNsAddress) = 0;

///注册名字服务器用户信息
///@param pFensUserInfo用户信息。
///@param pFensUserInfo 用户信息。
virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField *pFensUserInfo) = 0;

///注册回调接口
Expand Down Expand Up @@ -529,7 +529,7 @@ class TRADER_API_EXPORT CThostFtdcTraderApi {
virtual int SubmitUserSystemInfo(CThostFtdcUserSystemInfoField *pUserSystemInfo) = 0;

///用户登录请求
virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;
virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID, TThostFtdcSystemInfoLenType length, TThostFtdcClientSystemInfoType systemInfo) = 0;

///登出请求
virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0;
Expand Down
Binary file added ctp/mac/libs/comunicationkeylib.a
Binary file not shown.
Binary file added ctp/mac/libs/libcrypto.a
Binary file not shown.
Binary file added ctp/mac/libs/libssl.a
Binary file not shown.
Binary file added ctp/mac/libthostmduserapi_se.a
Binary file not shown.
Binary file added ctp/mac/libthosttraderapi_se.a
Binary file not shown.
3 changes: 2 additions & 1 deletion ctp/version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
V6.6.9
windows-64x
linux-64x
linux-64x
max-arm/x86
4 changes: 2 additions & 2 deletions ctpwrapper/Trader.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ def ReqAuthenticate(self, pReqAuthenticate: "ReqAuthenticateField", nRequestID:
"""
return super(TraderApiPy, self).ReqAuthenticate(pReqAuthenticate, nRequestID)

def ReqUserLogin(self, pReqUserLogin: "ReqUserLoginField", nRequestID: int) -> int:
def ReqUserLogin(self, pReqUserLogin: "ReqUserLoginField", nRequestID: int, length: int, systeminfo: str) -> int:
"""
用户登录请求
"""
return super(TraderApiPy, self).ReqUserLogin(pReqUserLogin, nRequestID)
return super(TraderApiPy, self).ReqUserLogin(pReqUserLogin, nRequestID, length, systeminfo)

def ReqUserAuthMethod(self, pReqUserAuthMethod: "ReqUserAuthMethod", nRequestID: int) -> int:
"""
Expand Down
4 changes: 2 additions & 2 deletions ctpwrapper/TraderApi.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ cdef class TraderApiWrapper:
return result

# 用户登录请求
def ReqUserLogin(self, pReqUserLoginField, int nRequestID):
def ReqUserLogin(self, pReqUserLoginField, int nRequestID, int length, char *systemInfo):
cdef int result
cdef size_t address
if self._spi is not NULL:
address = ctypes.addressof(pReqUserLoginField)
with nogil:
result = self._api.ReqUserLogin(<CThostFtdcReqUserLoginField *> address, nRequestID)
result = self._api.ReqUserLogin(<CThostFtdcReqUserLoginField *> address, nRequestID, length, systemInfo)
return result

# 登出请求
Expand Down
2 changes: 1 addition & 1 deletion ctpwrapper/headers/cTraderApi.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ cdef extern from "ThostFtdcTraderApi.h":
int SubmitUserSystemInfo(CThostFtdcUserSystemInfoField *pUserSystemInfo) nogil except +

#用户登录请求
int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) nogil except +
int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID, TThostFtdcSystemInfoLenType length, TThostFtdcClientSystemInfoType systemInfo) nogil except +

#登出请求
int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) nogil except +
Expand Down
5 changes: 5 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ clean:
find ./ctpwrapper/ -name "Md*.so" -delete
find ./ctpwrapper/ -name "Trader*.so" -delete
find ./ctpwrapper/ -name "*.cpp" -delete
find ./ -name "*.con" -delete
find ./ctpwrapper/ -name "error.dtd" -delete
find ./ctpwrapper/ -name "error.xml" -delete
find ./ctpwrapper/ -name "*.a" -delete



.PHONY: build-local
Expand Down
19 changes: 12 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,24 @@ def find_version(*file_paths):
package_data.append("*.so")
extra_compile_args = ["-Wall"]
extra_link_args = ['-Wl,-rpath,$ORIGIN']

elif sys.platform == "win32":
lib_dir = os.path.join(ctp_dir, "win")
extra_compile_args = ["/GR", "/EHsc"]
# extra_link_args = []
package_data.append("*.dll")

elif sys.platform == "darwin":
lib_dir = os.path.join(ctp_dir, "mac")
# https://github.com/python/cpython/issues/97524
extra_link_args = ['-Wl,-no_fixup_chains']
package_data.append("*.a")

package_data.append("error.dtd")
package_data.append("error.xml")
shutil.copy2(header_dir + "/error.dtd", project_dir + "/error.dtd")
shutil.copy2(header_dir + "/error.xml", project_dir + "/error.xml")

if sys.platform in ["linux", "win32"]:
if sys.platform in ["linux", "win32", "darwin"]:
copy_tree(lib_dir, project_dir)

common_args = {
Expand All @@ -88,10 +93,10 @@ def find_version(*file_paths):
sources=["ctpwrapper/TraderApi.pyx"],
libraries=["thosttraderapi_se"],
**common_args),
Cython_Extension(name="ctpwrapper.datacollect",
sources=["ctpwrapper/datacollect.pyx"],
libraries=["LinuxDataCollect"] if sys.platform == "linux" else ["WinDataCollect"],
**common_args)
# Cython_Extension(name="ctpwrapper.datacollect",
# sources=["ctpwrapper/datacollect.pyx"],
# libraries=["LinuxDataCollect"] if sys.platform == "linux" else ["WinDataCollect"],
# **common_args)
]

setup(
Expand All @@ -106,7 +111,7 @@ def find_version(*file_paths):
author_email="[email protected]",
url="https://github.com/nooperpudd/ctpwrapper",
include_dirs=[header_dir, cpp_header_dir],
platforms=["win32", "linux"],
platforms=["win32", "linux", "darwin"],
packages=["ctpwrapper"],
package_data={"": package_data},
python_requires=">=3.7",
Expand Down