def db_response_process(self, command, tr, request_date, curs): result_count = tr.GetBlockCount("t8428OutBlock1") for i in range(0, result_count): try: curs.execute( self.T8428_INSERT, (request_date, tr.GetFieldData( "t8428OutBlock1", "date", i), tr.GetFieldData("t8428OutBlock1", "custmoney", i), tr.GetFieldData("t8428OutBlock1", "yecha", i), tr.GetFieldData("t8428OutBlock1", "vol", i), tr.GetFieldData("t8428OutBlock1", "outmoney", i), tr.GetFieldData("t8428OutBlock1", "trjango", i), tr.GetFieldData("t8428OutBlock1", "futymoney", i), tr.GetFieldData("t8428OutBlock1", "stkmoney", i), tr.GetFieldData("t8428OutBlock1", "mstkmoney", i), tr.GetFieldData("t8428OutBlock1", "mbndmoney", i), tr.GetFieldData("t8428OutBlock1", "bndmoney", i), tr.GetFieldData("t8428OutBlock1", "bndsmoney", i), tr.GetFieldData("t8428OutBlock1", "mmfmoney", i))) except Exception as ex: Log.write(str(ex)) continue
def _init(self): Log.write(self._thread_name + " init..") self._connection_manager = ConnectionManagerFactory.get_instance() #기본 오퍼레이션 등록 self._operation_dict[self._OP_CALL] = self._operation_call self._operation_init()
def run(self): while self._RUNNING_FLAG: try: message = self.client.recv(self._READ_SIZE) data = message.decode() packet_split = data.split('|&|') for packet in packet_split: if packet is None or len(packet) < 1: continue command = None tr_split = packet.split('|#|') header_split = tr_split[0].split('|||') Log.write(tr_split[1]) if header_split[0] == T8417Command.TR_NAME: command = T8417Command(self.client, tr_split[1]) elif header_split[0] == T4203Command.TR_NAME: command = T4203Command(self.client, tr_split[1]) command.set_uuid(header_split[1]) command.set_res_type(CM.RES_TYPE_SOCKET) command.set_outbound(self.outbound) self.grinder.push_command(self.grinder.PRIORITY_LEVEL_A, command) except Exception as ex: Log.write("xaqueryconnector.InBound *EXCEPTION* : " + str(ex)) self.client.close() self._RUNNING_FLAG = False
def OnReceiveRealData(self, code): response_dict = dict() response_dict["time"] = self.event.GetFieldData("OutBlock", "time") response_dict["jisu"] = self.event.GetFieldData("OutBlock", "jisu") response_dict["sign"] = self.event.GetFieldData("OutBlock", "sign") response_dict["change"] = self.event.GetFieldData("OutBlock", "change") response_dict["drate"] = self.event.GetFieldData("OutBlock", "drate") response_dict["cvolume"] = self.event.GetFieldData("OutBlock", "cvolume") response_dict["volume"] = self.event.GetFieldData("OutBlock", "volume") response_dict["value"] = self.event.GetFieldData("OutBlock", "value") response_dict["upjo"] = self.event.GetFieldData("OutBlock", "upjo") response_dict["highjo"] = self.event.GetFieldData("OutBlock", "highjo") response_dict["unchgjo"] = self.event.GetFieldData("OutBlock", "unchgjo") response_dict["lowjo"] = self.event.GetFieldData("OutBlock", "lowjo") response_dict["downjo"] = self.event.GetFieldData("OutBlock", "downjo") response_dict["upjrate"] = self.event.GetFieldData("OutBlock", "upjrate") response_dict["openjisu"] = self.event.GetFieldData("OutBlock", "openjisu") response_dict["opentime"] = self.event.GetFieldData("OutBlock", "opentime") response_dict["highjisu"] = self.event.GetFieldData("OutBlock", "highjisu") response_dict["hightime"] = self.event.GetFieldData("OutBlock", "hightime") response_dict["lowjisu"] = self.event.GetFieldData("OutBlock", "lowjisu") response_dict["lowtime"] = self.event.GetFieldData("OutBlock", "lowtime") response_dict["frgsvolume"] = self.event.GetFieldData("OutBlock", "frgsvolume") response_dict["orgsvolume"] = self.event.GetFieldData("OutBlock", "orgsvolume") response_dict["frgsvalue"] = self.event.GetFieldData("OutBlock", "frgsvalue") response_dict["orgsvalue"] = self.event.GetFieldData("OutBlock", "orgsvalue") response_dict["upcode"] = self.event.GetFieldData("OutBlock", "upcode") Log.write(code + " : " + response_dict["upcode"] + " - " + response_dict["jisu"]) self._data_pusher.push_response("IJ_", response_dict)
def request_process(self, command): Log.write(command.get_tr_name() + " - " + command.get_hname() + " Request") self.tr.SetFieldData("t1514InBlock", "upcode", 0, command.get_upcode()) self.tr.SetFieldData("t1514InBlock", "gubun2", 0, "1") self.tr.SetFieldData("t1514InBlock", "cnt", 0, command.get_cnt()) self.tr.Request(0) return True
def request_process(self, command): Log.write(command.get_tr_name() + " - " + command.get_hname() + " Request") self.tr.SetFieldData("t1305InBlock", "shcode", 0, command.get_shcode()) self.tr.SetFieldData("t1305InBlock", "dwmcode", 0, "1") # self.tr.SetFieldData("t1305InBlock", "date", 0, " ") # self.tr.SetFieldData("t1305InBlock", "idx", 0, " ") self.tr.SetFieldData("t1305InBlock", "cnt", 0, command.get_cnt()) self.tr.Request(0) return True
def request_process(self, command): Log.write(command.get_tr_name() + " - " + command.get_hname() + " Request") self.tr.SetFieldData("t1717InBlock", "shcode", 0, command.get_shcode()) self.tr.SetFieldData("t1717InBlock", "gubun", 0, "0") self.tr.SetFieldData("t1717InBlock", "fromdt", 0, command.get_max_date()) self.tr.SetFieldData("t1717InBlock", "todt", 0, command.get_today()) self.tr.Request(0) return True
def OnReceiveRealData(self, code): response_dict = dict() response_dict["jangubun"] = self.event.GetFieldData( "OutBlock", "jangubun") response_dict["jstatus"] = self.event.GetFieldData( "OutBlock", "jstatus") Log.write(code + " : " + response_dict["jangubun"] + " , " + response_dict["jstatus"]) self._data_pusher.push_response("JIF", response_dict)
def _push_message(self, msg): for client in self.client_list: try: client.send(msg.encode()) Log.write(msg) except Exception as ex: Log.write("DataPusher *EXCEPTION* : " + str(ex)) self.client_list.remove(client) client.close() continue
def tr_instance_init(self): self.tr_instance_dict = dict() self.tr_instance_dict["S3_"] = S3() self.tr_instance_dict["NWS"] = NWS() self.tr_instance_dict["IJ_"] = IJ() self.tr_instance_dict["JIF"] = JIF() for key, value in self.tr_instance_dict.items(): value.start() Log.write(key + " started.")
def execute(self): Log.write("Process Start Up.. -- XAQuery -- ") self.ebest_connector_start() self.grinder_start() # self.scheduler_job_start() self.ebestpy_tcp_listener_start() while self.process_flag: time.sleep(1)
def _execute(self, command): if not XASessionEventHandler.login_flag: self._connection_manager.login_call() try: operation = self._operation_dict[command[self.CM_COMMAND]] operation(command[self._CM_DATA]) # except KeyError: # Log.write("Not found operation key : " + command[self.CM_COMMAND]) except Exception as ex: Log.write(str(ex))
def execute(self): Log.write("Process Start Up.. -- XAReal -- ") self.tr_instance_init() self.ebest_connector_start() self.broadcast_sender_start() self.request_receiver_start() self.ebestpy_tcp_listener_start() while self.process_flag: time.sleep(5)
def db_response_process(self, command, tr, request_date, curs): try: curs.execute(self.T3320_A_INSERT, (command.get_request_date(), command.get_shcode(), tr.GetFieldData("t3320OutBlock", "upgubunnm", 0), tr.GetFieldData("t3320OutBlock", "sijangcd", 0), tr.GetFieldData("t3320OutBlock", "marketnm", 0), tr.GetFieldData("t3320OutBlock", "company", 0), tr.GetFieldData("t3320OutBlock", "baddress", 0), tr.GetFieldData("t3320OutBlock", "btelno", 0), tr.GetFieldData("t3320OutBlock", "gsyyyy", 0), tr.GetFieldData("t3320OutBlock", "gsmm", 0), tr.GetFieldData("t3320OutBlock", "gsym", 0), tr.GetFieldData("t3320OutBlock", "lstprice", 0), tr.GetFieldData("t3320OutBlock", "gstock", 0), tr.GetFieldData("t3320OutBlock", "homeurl", 0), tr.GetFieldData("t3320OutBlock", "grdnm", 0), tr.GetFieldData("t3320OutBlock", "foreignratio", 0), tr.GetFieldData("t3320OutBlock", "irtel", 0), tr.GetFieldData("t3320OutBlock", "capital", 0), tr.GetFieldData("t3320OutBlock", "sigavalue", 0), tr.GetFieldData("t3320OutBlock", "cashsis", 0), tr.GetFieldData("t3320OutBlock", "cashrate", 0), tr.GetFieldData("t3320OutBlock", "price", 0), tr.GetFieldData("t3320OutBlock", "jnilclose", 0))) except Exception as ex: Log.write(str(ex)) try: curs.execute(self.T3320_B_INSERT, (command.get_request_date(), command.get_shcode(), tr.GetFieldData("t3320OutBlock1", "gicode", 0), tr.GetFieldData("t3320OutBlock1", "gsym", 0), tr.GetFieldData("t3320OutBlock1", "gsgb", 0), tr.GetFieldData("t3320OutBlock1", "per", 0), tr.GetFieldData("t3320OutBlock1", "eps", 0), tr.GetFieldData("t3320OutBlock1", "pbr", 0), tr.GetFieldData("t3320OutBlock1", "roa", 0), tr.GetFieldData("t3320OutBlock1", "roe", 0), tr.GetFieldData("t3320OutBlock1", "ebitda", 0), tr.GetFieldData("t3320OutBlock1", "evebitda", 0), tr.GetFieldData("t3320OutBlock1", "par", 0), tr.GetFieldData("t3320OutBlock1", "sps", 0), tr.GetFieldData("t3320OutBlock1", "cps", 0), tr.GetFieldData("t3320OutBlock1", "bps", 0), tr.GetFieldData("t3320OutBlock1", "t_per", 0), tr.GetFieldData("t3320OutBlock1", "t_eps", 0), tr.GetFieldData("t3320OutBlock1", "peg", 0), tr.GetFieldData("t3320OutBlock1", "t_peg", 0), tr.GetFieldData("t3320OutBlock1", "t_gsym", 0))) except Exception as ex: Log.write(str(ex))
def login(self): try: if XASessionEventHandler.login_flag is False: self.__xa_session.Login(self.__ebest_id, self.__ebest_pw, self.__ebest_cpwd, 0, 0) while not XASessionEventHandler.login_flag: pythoncom.PumpWaitingMessages() except Exception as ex: Log.write(str(ex)) XASessionEventHandler.login_flag = False return XASessionEventHandler.login_flag
def _init(self): self._assistant_dict = dict() self._assistant_dict[T1305Command.TR_NAME] = T1305Assistant() self._assistant_dict[T1514Command.TR_NAME] = T1514Assistant() self._assistant_dict[T1717Command.TR_NAME] = T1717Assistant() self._assistant_dict[T3320Command.TR_NAME] = T3320Assistant() self._assistant_dict[T8424Command.TR_NAME] = T8424Assistant() self._assistant_dict[T8428Command.TR_NAME] = T8428Assistant() self._assistant_dict[T8430Command.TR_NAME] = T8430Assistant() self._assistant_dict[T8417Command.TR_NAME] = T8417Assistant() self._assistant_dict[T4203Command.TR_NAME] = T4203Assistant() Log.write("Grinder init.. Done.")
def _xa_connect(self): if not self._xa_connector.is_connected(): if self._xa_connector.connect_server(): try: self._login_result = self._xa_connector.login() # if self.__login_result: # account_list = self.__xa_connector.get_account_list() # for account in account_list: # Log.write("account number : " + account) except Exception as ex: Log.write(str(ex)) self._login_result = False return self._login_result
def OnReceiveRealData(self, code): response_dict = dict() response_dict["date"] = self.event.GetFieldData("OutBlock", "date") response_dict["time"] = self.event.GetFieldData("OutBlock", "time") response_dict["id"] = self.event.GetFieldData("OutBlock", "id") response_dict["realkey"] = self.event.GetFieldData( "OutBlock", "realkey") response_dict["title"] = self.event.GetFieldData("OutBlock", "title") response_dict["code"] = self.event.GetFieldData("OutBlock", "code") response_dict["bodysize"] = self.event.GetFieldData( "OutBlock", "bodysize") Log.write(code + " : " + response_dict["title"]) self._data_pusher.push_response("NWS", response_dict)
def _execute(self, command): start_time = time.time() # 커넥션 확인 try: if self.cm.is_connected() is False: self._create_new_session() self.cm.login_call() assistant = self._assistant_dict[command.get_tr_name()] assistant.operation(command) if self.command_queue.qsize() < 1 and self.command_priority_queue.qsize() < 1: self.cm.disconnect_call() else: Log.write("* Command Queue Size : " "A (" + str(self.command_priority_queue.qsize()) + ") " "B (" + str(self.command_queue.qsize()) + ")") except KeyError: Log.write("* Not found operation key : " + command.get_tr_name()) except Exception as ex: Log.write("*EXCEPTION* EXECUTE COMMAND : " + str(ex)) finally: elapsed_time = time.time() - start_time Log.write("[" + command.get_tr_name() + "] EXECUTE JOB END. ELAPSED TIME : " + str(round(elapsed_time, 1)))
def _execute(self): Log.write("ClientPacketReceiver start") while self._RUNNING_FLAG: try: packet = self.client.recv(self._READ_SIZE) packet_msg = packet.decode() if packet_msg is None or packet_msg == '': continue self.request_receiver.push_request(packet_msg) except Exception as ex: Log.write(str(ex)) self._RUNNING_FLAG = False
def OnLogin(self, code, msg): try: if code == "0000": Log.write("login success") Log.write(str(msg)) XASessionEventHandler.connect_flag = True XASessionEventHandler.login_flag = True else: Log.write("login fail") Log.write(str(msg)) XASessionEventHandler.login_flag = False except Exception as ex: Log.write(str(ex)) XASessionEventHandler.login_flag = False
def db_response_process(self, command, tr, request_date, curs): result_count = self.t_query.GetBlockCount("t8424OutBlock") for i in range(0, result_count): try: curs.execute( self.T8424_INSERT, (request_date, self.t_query.GetFieldData("t8424OutBlock", "hname", i), self.t_query.GetFieldData("t8424OutBlock", "upcode", i))) except Exception as ex: Log.write(str(ex)) continue
def run(self): while self._RUNNING_FLAG: try: command = self.send_queue.get(True, 3) except queue.Empty as em: continue client = command.get_client() response = PacketUtil.get_packet(command.get_tr_name(), command.get_uuid(), command.get_response()) try: client.send(response.encode()) except Exception as ex: Log.write("OutBound *EXCEPTION* : " + str(ex)) client.close()
def db_response_process(self, command, tr, request_date, curs): result_count = tr.GetBlockCount("t1717OutBlock") for i in range(0, result_count): try: curs.execute( self.T1717_INSERT, (command.get_request_date(), command.get_shcode(), tr.GetFieldData("t1717OutBlock", "date", i), tr.GetFieldData("t1717OutBlock", "close", i), tr.GetFieldData("t1717OutBlock", "sign", i), tr.GetFieldData("t1717OutBlock", "change", i), tr.GetFieldData("t1717OutBlock", "diff", i), tr.GetFieldData("t1717OutBlock", "volume", i), tr.GetFieldData("t1717OutBlock", "tjj0000_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0001_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0002_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0003_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0004_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0005_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0006_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0007_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0008_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0009_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0010_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0011_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0018_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0016_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0017_vol", i), tr.GetFieldData("t1717OutBlock", "tjj0000_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0001_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0002_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0003_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0004_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0005_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0006_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0007_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0008_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0009_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0010_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0011_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0018_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0016_dan", i), tr.GetFieldData("t1717OutBlock", "tjj0017_dan", i))) except Exception as ex: Log.write(str(ex)) continue
def _waiting_queue(self): while self.running: try: # command = self.command_queue.get(True, self.command_queue_timeout) command = self.command_queue.get_nowait() except queue.Empty as em: pythoncom.PumpWaitingMessages() continue Log.write("Request Command : " + command[self.CM_COMMAND]) if command[self.CM_COMMAND] == self.CM_SHUTDOWN: self._shutdown() pythoncom.CoUninitialize() else: try: self._execute(command) except Exception as ex: Log.write("*EXCEPTION* EXECUTE COMMAND : " + str(ex))
def OnReceiveRealData(self, code): response_dict = dict() response_dict["chetime"] = self.event.GetFieldData( "OutBlock", "chetime") response_dict["sign"] = self.event.GetFieldData("OutBlock", "sign") response_dict["change"] = self.event.GetFieldData("OutBlock", "change") response_dict["drate"] = self.event.GetFieldData("OutBlock", "drate") response_dict["price"] = self.event.GetFieldData("OutBlock", "price") response_dict["opentime"] = self.event.GetFieldData( "OutBlock", "opentime") response_dict["open"] = self.event.GetFieldData("OutBlock", "open") response_dict["hightime"] = self.event.GetFieldData( "OutBlock", "hightime") response_dict["high"] = self.event.GetFieldData("OutBlock", "high") response_dict["lowtime"] = self.event.GetFieldData( "OutBlock", "lowtime") response_dict["low"] = self.event.GetFieldData("OutBlock", "low") response_dict["cgubun"] = self.event.GetFieldData("OutBlock", "cgubun") response_dict["cvolume"] = self.event.GetFieldData( "OutBlock", "cvolume") response_dict["volume"] = self.event.GetFieldData("OutBlock", "volume") response_dict["value"] = self.event.GetFieldData("OutBlock", "value") response_dict["mdvolume"] = self.event.GetFieldData( "OutBlock", "mdvolume") response_dict["mdchecnt"] = self.event.GetFieldData( "OutBlock", "mdchecnt") response_dict["msvolume"] = self.event.GetFieldData( "OutBlock", "msvolume") response_dict["mschecnt"] = self.event.GetFieldData( "OutBlock", "mschecnt") response_dict["cpower"] = self.event.GetFieldData("OutBlock", "cpower") response_dict["w_avrg"] = self.event.GetFieldData("OutBlock", "w_avrg") response_dict["offerho"] = self.event.GetFieldData( "OutBlock", "offerho") response_dict["bidho"] = self.event.GetFieldData("OutBlock", "bidho") response_dict["status"] = self.event.GetFieldData("OutBlock", "status") response_dict["jnilvolume"] = self.event.GetFieldData( "OutBlock", "jnilvolume") response_dict["shcode"] = self.event.GetFieldData("OutBlock", "shcode") Log.write(code + " : " + response_dict["shcode"] + " - " + response_dict["price"]) self._data_pusher.push_response("S3_", response_dict)
def db_response_process(self, command, tr, request_date, curs): result_count = tr.GetBlockCount("t1305OutBlock1") for i in range(0, result_count): try: curs.execute(self.T1305_INSERT, ( request_date, tr.GetFieldData("t1305OutBlock1", "date", i), tr.GetFieldData("t1305OutBlock1", "open", i), tr.GetFieldData("t1305OutBlock1", "high", i), tr.GetFieldData("t1305OutBlock1", "low", i), tr.GetFieldData("t1305OutBlock1", "close", i), tr.GetFieldData("t1305OutBlock1", "sign", i), tr.GetFieldData("t1305OutBlock1", "change", i), tr.GetFieldData("t1305OutBlock1", "diff", i), tr.GetFieldData("t1305OutBlock1", "volume", i), tr.GetFieldData("t1305OutBlock1", "diff_vol", i), tr.GetFieldData("t1305OutBlock1", "chdegree", i), tr.GetFieldData("t1305OutBlock1", "sojinrate", i), tr.GetFieldData("t1305OutBlock1", "changerate", i), tr.GetFieldData("t1305OutBlock1", "fpvolume", i), tr.GetFieldData("t1305OutBlock1", "covolume", i), tr.GetFieldData("t1305OutBlock1", "shcode", i), tr.GetFieldData("t1305OutBlock1", "value", i), tr.GetFieldData("t1305OutBlock1", "ppvolume", i), tr.GetFieldData("t1305OutBlock1", "o_sign", i), tr.GetFieldData("t1305OutBlock1", "o_change", i), tr.GetFieldData("t1305OutBlock1", "o_diff", i), tr.GetFieldData("t1305OutBlock1", "h_sign", i), tr.GetFieldData("t1305OutBlock1", "h_change", i), tr.GetFieldData("t1305OutBlock1", "h_diff", i), tr.GetFieldData("t1305OutBlock1", "l_sign", i), tr.GetFieldData("t1305OutBlock1", "l_change", i), tr.GetFieldData("t1305OutBlock1", "l_diff", i), tr.GetFieldData("t1305OutBlock1", "marketcap", i) ) ) except Exception as ex: Log.write(str(ex)) continue
def db_response_process(self, command, tr, request_date, curs): result_count = tr.GetBlockCount("t8430OutBlock") for i in range(0, result_count): try: curs.execute( self.T8430_INSERT, (request_date, tr.GetFieldData( "t8430OutBlock", "hname", i), tr.GetFieldData("t8430OutBlock", "shcode", i), tr.GetFieldData("t8430OutBlock", "expcode", i), tr.GetFieldData("t8430OutBlock", "etfgubun", i), tr.GetFieldData("t8430OutBlock", "uplmtprice", i), tr.GetFieldData("t8430OutBlock", "dnlmtprice", i), tr.GetFieldData("t8430OutBlock", "jnilclose", i), tr.GetFieldData("t8430OutBlock", "memedan", i), tr.GetFieldData("t8430OutBlock", "recprice", i), tr.GetFieldData("t8430OutBlock", "gubun", i))) except Exception as ex: Log.write(str(ex)) continue
def socket_response_process(self, command, tr): response_dict = dict() response_dict["shcode"] = tr.GetFieldData("t8417OutBlock", "shcode",0) response_dict["jisiga"] = tr.GetFieldData("t8417OutBlock", "jisiga",0) response_dict["jihigh"] = tr.GetFieldData("t8417OutBlock", "jihigh",0) response_dict["jilow"] = tr.GetFieldData("t8417OutBlock", "jilow",0) response_dict["jiclose"] = tr.GetFieldData("t8417OutBlock", "jiclose",0) response_dict["jivolume"] = tr.GetFieldData("t8417OutBlock", "jivolume",0) response_dict["disiga"] = tr.GetFieldData("t8417OutBlock", "disiga",0) response_dict["dihigh"] = tr.GetFieldData("t8417OutBlock", "dihigh",0) response_dict["dilow"] = tr.GetFieldData("t8417OutBlock", "dilow",0) response_dict["diclose"] = tr.GetFieldData("t8417OutBlock", "diclose",0) response_dict["cts_date"] = tr.GetFieldData("t8417OutBlock", "cts_date",0) response_dict["cts_time"] = tr.GetFieldData("t8417OutBlock", "cts_time",0) response_dict["s_time"] = tr.GetFieldData("t8417OutBlock", "s_time",0) response_dict["e_time"] = tr.GetFieldData("t8417OutBlock", "e_time",0) response_dict["dshmin"] = tr.GetFieldData("t8417OutBlock", "dshmin",0) response_dict["rec_count"] = tr.GetFieldData("t8417OutBlock", "rec_count",0) result_count = tr.GetBlockCount("t8417OutBlock1") response_list = list() for i in range(0, result_count): occurs_dict = dict() occurs_dict["date"] = tr.GetFieldData("t8417OutBlock1", "date", i) occurs_dict["time"] = tr.GetFieldData("t8417OutBlock1", "time", i) occurs_dict["open"] = tr.GetFieldData("t8417OutBlock1", "open", i) occurs_dict["high"] = tr.GetFieldData("t8417OutBlock1", "high", i) occurs_dict["low"] = tr.GetFieldData("t8417OutBlock1", "low", i) occurs_dict["close"] = tr.GetFieldData("t8417OutBlock1", "close", i) occurs_dict["jdiff_vol"] = tr.GetFieldData("t8417OutBlock1", "jdiff_vol", i) response_list.append(occurs_dict) response_dict["occurs"] = response_list Log.write(json.dumps(response_dict)) return response_dict
def db_response_process(self, command, tr, request_date, curs): result_count = tr.GetBlockCount("t1514OutBlock1") for i in range(0, result_count): try: curs.execute(self.T1514_INSERT, ( request_date, tr.GetFieldData("t1514OutBlock1", "date", i), tr.GetFieldData("t1514OutBlock1", "jisu", i), tr.GetFieldData("t1514OutBlock1", "sign", i), tr.GetFieldData("t1514OutBlock1", "change", i), tr.GetFieldData("t1514OutBlock1", "diff", i), tr.GetFieldData("t1514OutBlock1", "volume", i), tr.GetFieldData("t1514OutBlock1", "diff_vol", i), tr.GetFieldData("t1514OutBlock1", "value1", i), tr.GetFieldData("t1514OutBlock1", "high", i), tr.GetFieldData("t1514OutBlock1", "unchg", i), tr.GetFieldData("t1514OutBlock1", "low", i), tr.GetFieldData("t1514OutBlock1", "uprate", i), tr.GetFieldData("t1514OutBlock1", "frgsvolume", i), tr.GetFieldData("t1514OutBlock1", "openjisu", i), tr.GetFieldData("t1514OutBlock1", "highjisu", i), tr.GetFieldData("t1514OutBlock1", "lowjisu", i), tr.GetFieldData("t1514OutBlock1", "value2", i), tr.GetFieldData("t1514OutBlock1", "up", i), tr.GetFieldData("t1514OutBlock1", "down", i), tr.GetFieldData("t1514OutBlock1", "totjo", i), tr.GetFieldData("t1514OutBlock1", "orgsvolume", i), tr.GetFieldData("t1514OutBlock1", "upcode", i), tr.GetFieldData("t1514OutBlock1", "rate", i), tr.GetFieldData("t1514OutBlock1", "divrate", i) ) ) except Exception as ex: Log.write(str(ex)) continue