From 3a87b1c89a76d858e8e7e4e54ff360dc0b8670f5 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 11 九月 2025 16:27:20 +0800 Subject: [PATCH] L撤删除L前撤单与L后后半段撤单 --- huaxin_client/l1_api_client.py | 76 ++++++++++++++++++++++---------------- 1 files changed, 44 insertions(+), 32 deletions(-) diff --git a/huaxin_client/l1_api_client.py b/huaxin_client/l1_api_client.py index bd8d3ec..7aab40a 100644 --- a/huaxin_client/l1_api_client.py +++ b/huaxin_client/l1_api_client.py @@ -3,8 +3,9 @@ import threading import time +import constant import qcvalueaddproapi -from log_module.log import logger_system +from log_module.log import logger_system, logger_debug from utils import tool global g_userid, g_passwd, g_address, g_port, g_seqnum @@ -73,7 +74,7 @@ page_locate += 1 print("queryTradeCalendar:", len(fresults)) except Exception as e: - logging.exception(e) + logger_debug.exception(e) return fresults def __query_bars(self, code, begin_date, end_date, page_locate=1, page_count=200): @@ -185,12 +186,18 @@ # target=lambda: print("鏃锛�", self.queryBars("601298", "2024-12-15", "2024-12-31"))).start() def ReqQryGGTEODPrices(self): - QryField = qcvalueaddproapi.CQCVDQryGGTEODPricesField() - self.m_api.ReqQryGGTEODPrices(QryField, new_seqnum()) + try: + QryField = qcvalueaddproapi.CQCVDQryGGTEODPricesField() + self.m_api.ReqQryGGTEODPrices(QryField, new_seqnum()) + except: + pass def ReqQryInvestor(self): - QryField = qcvalueaddproapi.CQCVDQryInvestorField() - self.m_api.ReqQryInvestor(QryField, new_seqnum()) + try: + QryField = qcvalueaddproapi.CQCVDQryInvestorField() + self.m_api.ReqQryInvestor(QryField, new_seqnum()) + except: + pass def OnRspInquiryShareCalendar(self, pShareCalendar, pRspInfo, nRequestID, bIsPageLast, bIsTotalLast): """ @@ -204,13 +211,15 @@ """ if nRequestID not in self.__temp_cache: self.__temp_cache[nRequestID] = [] - - if pShareCalendar: - self.__temp_cache[nRequestID].append(pShareCalendar.TradingDay) - else: - self.__result_cache[nRequestID] = self.__temp_cache[nRequestID] - self.__temp_cache.pop(nRequestID) - print("OnRspInquiryShareCalendar:", self.__result_cache[nRequestID]) + try: + if pShareCalendar: + self.__temp_cache[nRequestID].append(pShareCalendar.TradingDay) + else: + self.__result_cache[nRequestID] = self.__temp_cache[nRequestID] + self.__temp_cache.pop(nRequestID) + print("OnRspInquiryShareCalendar:", self.__result_cache[nRequestID]) + except: + pass def OnRspInquiryStockDayQuotation(self, pStockDayQuotation, pRspInfo, nRequestID, bIsPageLast, bIsTotalLast): """ @@ -226,20 +235,23 @@ self.__temp_cache[nRequestID] = [] # print("鏄惁鏈〉鏌ヨ瀹屾瘯锛�", bIsPageLast) + try: - if not bIsPageLast: - self.__temp_cache[nRequestID].append({ - "SecurityID": pStockDayQuotation.SecurityID, "TradingDay": pStockDayQuotation.TradingDay, - "AdjustFactor": pStockDayQuotation.AdjustFactor, "PreClosePrice": pStockDayQuotation.PreClosePrice, - "OpenPrice": pStockDayQuotation.OpenPrice, "HighPrice": pStockDayQuotation.HighPrice, - "LowPrice": pStockDayQuotation.LowPrice, - "ClosePrice": pStockDayQuotation.ClosePrice, "Volume": int(pStockDayQuotation.Volume * 100), - "Turnover": int(pStockDayQuotation.Turnover * 1000) - }) - else: - self.__result_cache[nRequestID] = self.__temp_cache[nRequestID] - self.__temp_cache.pop(nRequestID) - print("OnRspInquiryStockDayQuotation:", len(self.__result_cache[nRequestID])) + if not bIsPageLast: + self.__temp_cache[nRequestID].append({ + "SecurityID": pStockDayQuotation.SecurityID, "TradingDay": pStockDayQuotation.TradingDay, + "AdjustFactor": pStockDayQuotation.AdjustFactor, "PreClosePrice": pStockDayQuotation.PreClosePrice, + "OpenPrice": pStockDayQuotation.OpenPrice, "HighPrice": pStockDayQuotation.HighPrice, + "LowPrice": pStockDayQuotation.LowPrice, + "ClosePrice": pStockDayQuotation.ClosePrice, "Volume": int(pStockDayQuotation.Volume * 100), + "Turnover": int(pStockDayQuotation.Turnover * 1000) + }) + else: + self.__result_cache[nRequestID] = self.__temp_cache[nRequestID] + self.__temp_cache.pop(nRequestID) + print("OnRspInquiryStockDayQuotation:", len(self.__result_cache[nRequestID])) + except: + pass def __read_request(request_queue: multiprocessing.Queue, response_queue: multiprocessing.Queue): @@ -266,7 +278,7 @@ code = data['code'] results = thespi.queryBars(code, start_date, end_date) __set_response_data(request_id, results) - except: + except Exception as e: pass @@ -282,10 +294,10 @@ g_port = 25556 g_userid = "388000013942" g_passwd = "110808" - - # 鍐呯綉 - g_address = "192.168.84.61" - g_port = 25557 + if not constant.is_windows(): + # 鍐呯綉 + g_address = "192.168.84.61" + g_port = 25557 #IP锛�192.168.84.61锛夈�佺鍙o紙25557 @@ -305,7 +317,7 @@ def main(): - request_queue, response_queue = multiprocessing.Queue(), multiprocessing.Queue() + request_queue, response_queue = multiprocessing.Queue(maxsize=1024), multiprocessing.Queue(maxsize=1024) run(request_queue, response_queue) -- Gitblit v1.8.0