| | |
| | | print("OnRspSubTransaction") |
| | | |
| | | def OnRspSubOrderDetail(self, pSpecificSecurity, pRspInfo, nRequestID, bIsLast): |
| | | print("OnRspSubOrderDetail") |
| | | print("OnRspSubOrderDetail", pRspInfo) |
| | | # try: |
| | | print("订阅结果:", pSpecificSecurity["ExchangeID"], pSpecificSecurity["SecurityID"], pRspInfo["ErrorID"], |
| | | pRspInfo["ErrorMsg"]) |
| | |
| | | print("订阅成功") |
| | | self.subscripted_codes.add(pSpecificSecurity['SecurityID']) |
| | | if bIsLast == 1: |
| | | t1 = threading.Thread(target=lambda: l2_data_manager.add_subscript_codes(self.subscripted_codes), |
| | | daemon=True) |
| | | # 后台运行 |
| | | t1.start() |
| | | print("订阅响应结束", self.subscripted_codes) |
| | | l2_data_manager.add_subscript_codes(self.subscripted_codes) |
| | | |
| | | def OnRspUnSubOrderDetail(self, pSpecificSecurity, pRspInfo, nRequestID, bIsLast): |
| | | print("OnRspUnSubOrderDetail") |
| | | print("OnRspUnSubOrderDetail", bIsLast) |
| | | try: |
| | | code = pSpecificSecurity['SecurityID'] |
| | | self.subscripted_codes.discard(code) |
| | | if bIsLast == 1: |
| | | t1 = threading.Thread(target=lambda: l2_data_manager.add_subscript_codes(self.subscripted_codes), |
| | | daemon=True) |
| | | # 后台运行 |
| | | t1.start() |
| | | print("取消订阅响应结束", self.subscripted_codes) |
| | | l2_data_manager.add_subscript_codes(self.subscripted_codes) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | |
| | |
| | | ]} |
| | | market_code_dict[pDepthMarketData['SecurityID']] = time.time() |
| | | |
| | | t1 = threading.Thread(target=lambda: l2_data_manager.add_market_data(d), daemon=True) |
| | | t1.start() |
| | | l2_data_manager.add_market_data(d) |
| | | |
| | | # 输出行情快照数据 |
| | | # print( |
| | |
| | | "SubSeq": pTransaction['SubSeq'], "BuyNo": pTransaction['BuyNo'], |
| | | "SellNo": pTransaction['SellNo'], |
| | | "ExecType": pTransaction['ExecType'].decode()} |
| | | print("逐笔成交", item) |
| | | # print("逐笔成交", item) |
| | | l2_data_manager.add_transaction_detail(item) |
| | | |
| | | logger_l2_transaction.info( |
| | |
| | | # 后台运行 |
| | | t1.setDaemon(True) |
| | | t1.start() |
| | | l2_data_manager.run_upload_common() |
| | | global l2CommandManager |
| | | l2CommandManager = command_manager.L2CommandManager() |
| | | l2CommandManager.init(constant.SERVER_IP, constant.SERVER_PORT, MyL2ActionCallback()) |