| | |
| | | |
| | | 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 |
| | |
| | | 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): |
| | |
| | | # target=lambda: print("日K:", 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): |
| | | """ |
| | |
| | | """ |
| | | 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): |
| | | """ |
| | |
| | | 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): |