quote.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:hf_ctp_py_proxy 作者: haifengat 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号