def __init__(self):
# make log dir for api log
# logdir = os.path.join(sys.path[0], "log")
# if not os.path.exists(logdir):
# os.mkdir(logdir)
dlldir = os.path.join(
os.path.split(os.path.realpath(__file__))[0], "dll")
if not os.path.exists(dlldir):
print('??DLL????')
return
# change work directory
cur_path = os.getcwd()
os.chdir(dlldir)
if isWindowsSystem():
self.h = CDLL("ctp_Quote.dll")
else:
self.h = cdll.LoadLibrary("./ctp_quote.so")
self.h.CreateApi.argtypes = []
self.h.CreateApi.restype = c_void_p
self.h.CreateSpi.argtypes = []
self.h.CreateSpi.restype = c_void_p
self.api = None
self.spi = None
self.nRequestID = 0
self.h.Release.argtypes = [c_void_p]
self.h.Release.restype = c_void_p
self.h.Init.argtypes = [c_void_p]
self.h.Init.restype = c_void_p
self.h.Join.argtypes = [c_void_p]
self.h.Join.restype = c_void_p
self.h.GetTradingDay.argtypes = [c_void_p]
self.h.GetTradingDay.restype = c_void_p
self.h.RegisterFront.argtypes = [c_void_p, c_char_p]
self.h.RegisterFront.restype = c_void_p
self.h.RegisterNameServer.argtypes = [c_void_p, c_char_p]
self.h.RegisterNameServer.restype = c_void_p
self.h.RegisterFensUserInfo.argtypes = [c_void_p, c_void_p]
self.h.RegisterFensUserInfo.restype = c_void_p
self.h.RegisterSpi.argtypes = [c_void_p, c_void_p]
self.h.RegisterSpi.restype = c_void_p
self.h.ReqUserLogin.argtypes = [c_void_p, c_void_p, c_int32]
self.h.ReqUserLogin.restype = c_void_p
self.h.ReqUserLogout.argtypes = [c_void_p, c_void_p, c_int32]
self.h.ReqUserLogout.restype = c_void_p
# restore work directory
os.chdir(cur_path)
评论列表
文章目录