Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    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))
Exemplo n.º 6
0
    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))
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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
Exemplo n.º 10
0
    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