def __init__(self):
        super().__init__()
        self.processID = os.getpid()

        telgm_token = '1013576743:AAFkCdmafOY61N-I1FAEIEsOdFZwR47_ZQ8'
        self.bot = telegram.Bot(token=telgm_token)
        self.realTimeLogger = logging_instance(
            "realTimeConclusion.py 실시간 체결 확인 PID: " +
            (str)(self.processID)).mylogger
        self.realTimeLogger.info("realTimeConclusion  OCX call")
        self.indiReal = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        # Indi API event
        self.indiReal.ReceiveRTData.connect(self.ReceiveRTData)

        db_name = str(datetime.today().strftime("%Y%m%d"))
        client = MongoClient('127.0.0.1', 27017)
        self.db = client[db_name]
        self.collection_name = "AA" + db_name
        self.collection = self.db[self.collection_name]
        self.realTimeLogger.info("realTimeConclusion  AA call")

        ret1 = self.indiReal.dynamicCall("RequestRTReg(QString, QString)",
                                         "AA", '*')
        if ret1:
            self.realTimeLogger.info("AA 등록성공")

        if not ret1:
            self.realTimeLogger.info("AA 등록실패")
        self.realTimeLogger.info("realTimeConclusion  AA call 완료")
Beispiel #2
0
def buy_sell():
    appLogger = logging_instance("buy_sell_").mylogger
    try:
        return render_template('buy_sell.html')
    except Exception:
        appLogger.error("buy_sell function Exception occurs")
        return redirect(url_for('index'))
Beispiel #3
0
def SC_function():
    try:
        realTimeLogger = logging_instance("SC_function.py_").mylogger
        py_day = datetime.datetime.today().strftime("%Y%m%d")
        date = str(datetime.datetime.today().strftime("%Y%m%d"))
        #date="20200221"
        py_time = datetime.datetime.now()
        hour = py_time.hour
        min = py_time.minute

        client = MongoClient('127.0.0.1', 27017)
        db = client[date]
        collection_name = date + "_pr_input"
        collection1 = db[collection_name]
        total_len = collection1.count()
        checkIndex = 0
        realTimePriceEvent = QApplication(sys.argv)
        realTimeLogger.info("현재 가장 마지막으로 기록될 SC 시간은   " + str(hour) + ":" +
                            str(min))
        realTimeLogger.info("종목의 총 갯수 는 " + str(total_len))
        for i in collection1.find():
            realTimeLogger.info(i['종목코드'])
            SC_vari = SC(i['종목코드'], i['korName'].strip(), date)
            time.sleep(0.3)
            checkIndex += 1
        if checkIndex != total_len + 1:
            realTimePriceEvent.exec()
    except Exception:
        realTimeLogger.info("지금은 SC 데이터 저장 실패")
    realTimeLogger.info("지금은 현재가 SC 저장 성공")
Beispiel #4
0
    def __init__(self):
        super().__init__()
        self.processID = os.getpid()
        telgm_token = '1013576743:AAFkCdmafOY61N-I1FAEIEsOdFZwR47_ZQ8'
        self.bot = telegram.Bot(token=telgm_token)
        self.realTimeLogger = logging_instance("SP.py_ PID: " +
                                               (str)(self.processID)).mylogger
        self.indiReal = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        # Indi API event
        self.indiReal.ReceiveRTData.connect(self.ReceiveRTData)
        self.timeline = common_min_shortTime(5).timeline

        #collection_name ="20200224" + "_pr_input"
        collection_name = str(
            datetime.today().strftime("%Y%m%d")) + "_pr_input"
        client = MongoClient('127.0.0.1', 27017)
        #db = client["20200224"]
        db = client[str(datetime.today().strftime("%Y%m%d"))]
        collection = db[collection_name]

        collection_title1 = "SP_" + str(datetime.today().strftime("%Y%m%d"))
        collection_title2 = "SP_5min_" + str(
            datetime.today().strftime("%Y%m%d"))

        self.collection1 = db[collection_title1]
        self.collection2 = db[collection_title2]

        collection_title3 = "SC_check_" + str(
            datetime.today().strftime("%Y%m%d"))
        self.collection3 = db[collection_title3]

        collection_title4 = "SP_check_" + str(
            datetime.today().strftime("%Y%m%d"))
        self.collection4 = db[collection_title4]

        collection_title5 = "TR_1206_new_2"
        self.collection5 = db[collection_title5]

        #db = client["20200222"]
        collection = db[collection_name]
        for i in collection.find():
            ret1 = self.indiReal.dynamicCall(
                "UnRequestRTReg(QString, QString)", "SP", i['종목코드'].strip())
            self.realTimeLogger.info("ret1 " + str(ret1))
            if not ret1:
                self.realTimeLogger.info("종목코드 " + i['종목코드'] +
                                         " 에 대한 SP 실시간 등록 해제 실패!!!")
            else:
                self.realTimeLogger.info("종목코드 " + i['종목코드'] +
                                         " 에 대한 SP 실시간 등록 해제 성공!!!")
        for i in collection.find():
            ret1 = self.indiReal.dynamicCall("RequestRTReg(QString, QString)",
                                             "SP", i['종목코드'].strip())
            self.realTimeLogger.info("ret1 " + str(ret1))
            if not ret1:
                self.realTimeLogger.info("종목코드 " + i['종목코드'] +
                                         " 에 대한 SP 실시간 등록 실패!!!")
            else:
                self.realTimeLogger.info("종목코드 " + i['종목코드'] +
                                         " 에 대한 SP 실시간 등록 성공!!!")
Beispiel #5
0
    def __init__(self, stock_code, korName, date):
        super().__init__()
        self.realTimeLogger = logging_instance("SC.py_").mylogger
        self.timeline = common_min_shortTime(5).timeline
        telgm_token = '1013576743:AAFkCdmafOY61N-I1FAEIEsOdFZwR47_ZQ8'
        self.bot = telegram.Bot(token=telgm_token)

        # 인디의 TR을 처리할 변수를 생성합니다.
        self.IndiTR = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        self.realTimeLogger.info("start")
        # Indi API event
        self.IndiTR.ReceiveData.connect(self.ReceiveData)
        self.IndiTR.ReceiveSysMsg.connect(self.ReceiveSysMsg)
        self.stock_code = stock_code
        self.date = date
        self.korName = korName

        self.client = MongoClient('127.0.0.1', 27017)
        db_name = self.date
        self.db = self.client[db_name]
        self.collection_name1 = "SC_" + db_name

        self.collection1 = self.db[self.collection_name1]

        self.realTimeLogger.info("start SC")
        self.btn_Search()
Beispiel #6
0
    def startProcess(self):
        # 데이터 요청 형식
        self.realTimeLogger = logging_instance(
            "show_order_history.py 주문 체결/미체결 내역 조회").mylogger
        ret = self.IndiTR.dynamicCall("SetQueryName(QString)", "SABA231Q1")
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 0,
                                      self.day)  # 매매일자
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 1,
                                      "27024779616")  # 계좌번호
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 2,
                                      "6930")  #계좌 비밀번호
        ret = self.IndiTR.dynamicCall(
            "SetSingleData(int, QString)", 3, "00"
        )  # 장구분 00:전체  		01:KOSPI 02:KOSDAQ 		03:OTCBB  04:ECN  		05:단주  11:매도주문  		12:매수주문
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 4,
                                      "00")  # 체결구분 0:전체  		1:체결  2:미체결
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 5,
                                      "0")  # 0:합산(주문건별 합산)  	1:건별(체결건)
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 6,
                                      "*")  # 입력 종목 코드 * 전체
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 7,
                                      "01")  # 작업자 사번?
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 8, "Y")  #

        self.realTimeLogger.info("SABA231Q1 RequestData 호출 전")
        rqid = self.IndiTR.dynamicCall("RequestData()")  # 데이터 요청
        self.realTimeLogger.info("SABA231Q1 RequestData 호출 후")
Beispiel #7
0
    def ReceiveData(self, rqid):

        self.realTimeLogger = logging_instance(
            "TR_1406.py_   received DATA   PID: " +
            (str)(self.processID)).mylogger
        # TR을 날릴때 ID를 통해 TR이름을 가져옵니다.
        # GetMultiRowCount()는 TR 결과값의 multi row 개수를 리턴합니다.
        nCnt = self.IndiTR.dynamicCall("GetMultiRowCount()")
        for i in range(0, nCnt):
            # 데이터 양식
            DATA = {}
            DATA['단축코드'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i,
                                                   0)
            DATA['종목명'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i,
                                                  2)
            DATA['구분코드'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i,
                                                   4)
            if DATA['구분코드'] == "5":
                DATA['구분'] = "전일 하락"
            if DATA['구분코드'] == "2":
                DATA['구분'] = "전일 상승"
            if DATA['구분코드'] == "3":
                DATA['구분'] = "전일 보합"
            self.TR_1406.insert_one(DATA)
            self.realTimeLogger.info('TR_1406 데이터 저장  ' + str(DATA))

        return
Beispiel #8
0
    def ReceiveData(self, rqid):
        # TR을 날릴때 ID를 통해 TR이름을 가져옵니다.
        print("receive Data")
        self.realTimeLogger = logging_instance("TR_SCHART.py_receive Data_").mylogger

        # GetMultiRowCount()는 TR 결과값의 multi row 개수를 리턴합니다.
        nCnt = self.IndiTR.dynamicCall("GetMultiRowCount()")
        print(nCnt)

        # 받을 열만큼 가거 데이터를 받도록 합니다.
        for i in range(0, nCnt):
            # 데이터 양식
            DATA = {}

            # 데이터 받기
            DATA['DATE'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 0)  # 일자
            DATA['TIME'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 1)  # 시간
            DATA['OPEN'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 2)  # 시가
            DATA['HIGH'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 3)  # 고가
            DATA['Low'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 4)  # 저가
            DATA['Close'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 5)  # 종가
            DATA['Price_ADJ'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 6)  # 주가수정계수
            DATA['Vol_ADJ'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 7)  # 거래량 수정계수
            DATA['Rock'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 8)  # 락구분
            DATA['Vol'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 9)  # 단위거래량
            DATA['Trading_Value'] = self.IndiTR.dynamicCall("GetMultiData(int, int)", i, 10)  # 단위거래대금

            DATA['stock_code'] = self.stock_code # 주식코드
            DATA['korName'] = self.korName.strip() # 한글 이름
            #DATA['start_date'] = self.start_date # 시작일
            #DATA['end_date'] = self.end_date  # 마지막일
            #DATA['market'] = self.market # market




            self.realTimeLogger.info(DATA)
            self.realTimeLogger.info("실시간 현재가 데이터 저장 전")
            if self.collection1.find_one({'stock_code':  self.stock_code, 'TIME':  DATA['TIME'] }):
                self.collection1.update(self.collection1.find_one({'stock_code':  self.stock_code, 'TIME':  DATA['TIME'] }), DATA, upsert=True)
            else:
                self.collection1.insert(DATA)
            self.realTimeLogger.info("실시간 현재가  데이터 저장 후")

            data_time = (int)(DATA['TIME'])
            self.realTimeLogger.info("5분 간격 현재가 데이터 저장 전")
            for times in self.timeline:
                if (int)(times) < data_time:
                    continue
                elif (int)(times) >= data_time:
                    DATA['TIME'] = times
                    if self.collection2.find_one({'stock_code': DATA['stock_code'], 'TIME': times}):
                        self.collection2.update(self.collection2.find_one({'stock_code': DATA['stock_code'], 'TIME': times}), DATA,upsert=True)
                        break
                    else:
                        self.collection2.insert(DATA)
                        break
            self.realTimeLogger.info("5분 간격현재가 데이터 저장  후")
        QCoreApplication.instance().exit(0)
Beispiel #9
0
    def ReceiveData(self, rqid):
        # TR을 날릴때 ID를 통해 TR이름을 가져옵니다.
        self.realTimeLogger = logging_instance("SC.py_receive Data_").mylogger
        # 데이터 양식
        DATA = {}
        # 데이터 받기
        DATA['stock_code'] = self.IndiTR.dynamicCall("GetSingleData(int)",
                                                     1)  # 단축코드
        DATA['TIME'] = self.IndiTR.dynamicCall("GetSingleData(int)", 2)  # 체결시간
        DATA['GUBUN'] = self.IndiTR.dynamicCall("GetSingleData(int)",
                                                4)  # 전일대비구분
        DATA['PRICE'] = self.IndiTR.dynamicCall("GetSingleData(int)", 3)  # 현재가
        DATA['Trading_Value'] = (int)(self.IndiTR.dynamicCall(
            "GetSingleData(int)", 8))  # 누적거래대금
        DATA['korName'] = self.korName

        py_time = datetime.datetime.now()
        hour = py_time.hour
        min = py_time.minute
        if hour == 9 and min >= 5 and DATA['Trading_Value'] >= 100000000:
            self.bot.sendMessage(chat_id='813531834',
                                 text="종목명 : " + DATA['stock_code'] +
                                 "   첫 5분 거래대금 1억 돌파   " +
                                 DATA['Trading_Value'])
        elif DATA['Trading_Value'] >= 2000000000:
            self.bot.sendMessage(chat_id='813531834',
                                 text="종목명 : " + DATA['stock_code'] +
                                 "   거래대금 20억 돌파   " + DATA['Trading_Value'])

        self.realTimeLogger.info(DATA)
        self.realTimeLogger.info("5분 간격 누적거래대금 데이터 저장 전")
        if self.collection1.find_one({'stock_code': DATA['stock_code']}):
            data_input = self.collection1.find_one({
                'stock_code':
                DATA['stock_code']
            }).copy()
            DATA['_id'] = data_input['_id']
            if data_input['Trading_Value'] * 10 < DATA['Trading_Value']:
                self.bot.sendMessage(chat_id='813531834',
                                     text="종목명 : " + DATA['stock_code'] +
                                     "   거래대금 10배터짐   ")
            elif data_input['Trading_Value'] * 5 < DATA['Trading_Value']:
                self.bot.sendMessage(chat_id='813531834',
                                     text="종목명 : " + DATA['stock_code'] +
                                     "   거래대금 5배터짐   ")
            elif data_input['Trading_Value'] * 3 < DATA['Trading_Value']:
                self.bot.sendMessage(chat_id='813531834',
                                     text="종목명 : " + DATA['stock_code'] +
                                     "   거래대금 3배터짐   ")
            elif data_input['Trading_Value'] * 2 < DATA['Trading_Value']:
                self.bot.sendMessage(chat_id='813531834',
                                     text="종목명 : " + DATA['stock_code'] +
                                     "   거래대금 2배터짐   ")
            self.collection1.replace_one(data_input, DATA, upsert=True)
        else:
            self.collection1.insert_one(DATA)

        self.realTimeLogger.info("5분 간격 누적거래대금 데이터 저장  후")
        QCoreApplication.instance().exit(0)
Beispiel #10
0
def index():
    appLogger = logging_instance("index_").mylogger
    try:
        appLogger.info("index function success")
        return render_template('controller.html')
    except Exception:
        appLogger.error("index function exception occur")
        return render_template('controller.html')
Beispiel #11
0
    def ReceiveRTData(self, realType):
        # TR을 날릴때 ID를 통해 TR이름을 가져옵니다.
        self.realTimeLogger = logging_instance("SC ReceiveRTData PID: "+(str)(self.processID)).mylogger

        if realType == "SC":
            DATA = {}
            # 데이터 받기
            DATA['DATE'] = self.date
            DATA['TIME'] = self.indiReal.dynamicCall("GetSingleData(int)", 2) #1630 0000
            DATA['OPEN'] = (int)(self.indiReal.dynamicCall("GetSingleData(int)", 10))
            DATA['HIGH'] = (int)(self.indiReal.dynamicCall("GetSingleData(int)", 11))
            DATA['LOW'] = (int)(self.indiReal.dynamicCall("GetSingleData(int)", 12))
            DATA['Close'] = (int)(self.indiReal.dynamicCall("GetSingleData(int)", 3))
            DATA['Vol'] = (int)(self.indiReal.dynamicCall("GetSingleData(int)", 7))
            DATA['Trading_Value'] = (int)(self.indiReal.dynamicCall("GetSingleData(int)", 8))
            DATA['stock_code'] = self.indiReal.dynamicCall("GetSingleData(int)", 1)

            self.realTimeLogger.info(DATA)
            data_time = (int)((int)(DATA['TIME'])/10000)
            self.realTimeLogger.info("5분 간격 현물 현제가 데이터 저장 전")
            for times in self.timeline:
                if (int)(times)<data_time:
                    continue
                elif (int)(times) >= data_time:
                    DATA['TIME'] = times
                    DATA['SortTime'] = (int)(times)
                    if DATA['SortTime'] <=905:
                        if self.indiReal.dynamicCall("GetSingleData(int)", 4) == "2":
                            self.bot.sendMessage(chat_id='813531834', text="종목코드  "+  DATA['stock_code']+ "  장 시작 5분내  전일 종가 대비 상승")
                            if self.collection2.find_one({'stock_code': DATA['stock_code']}):
                                data_input = self.collection2.find_one({'stock_code': DATA['stock_code']}).copy()
                                DATA['_id'] = data_input['_id']
                                self.realTimeLogger.info(self.collection2.replace_one(data_input, DATA, upsert=True))
                            else:
                                self.realTimeLogger.info(self.collection2.insert_one(DATA))
                        else:
                            if self.collection2.find_one({'stock_code': DATA['stock_code']}):
                                self.bot.sendMessage(chat_id='813531834',text="종목코드  " + DATA['stock_code'] + "  장 시작 5분내  전일 종가 대비 하락")
                                self.collection2.delete_one({'stock_code': DATA['stock_code']})
                            else:
                                pass
                    print("DATA")
                    print(DATA)
                    if '_id' in DATA.keys():
                        print(DATA['_id'])
                        del DATA['_id']
                    self.realTimeLogger.info("self.collection1.find_one({'stock_code': DATA['stock_code'], 'TIME': times})")
                    self.realTimeLogger.info(self.collection1.find_one({'stock_code': DATA['stock_code'], 'TIME': times}))
                    self.realTimeLogger.info("self.collection1.find_one({'stock_code': DATA['stock_code'], 'TIME': times})")
                    if self.collection1.find_one({'stock_code': DATA['stock_code'], 'TIME': times}):
                        data_input = self.collection1.find_one({'stock_code': DATA['stock_code'], 'TIME': times}).copy()
                        DATA['_id'] = data_input['_id']
                        self.realTimeLogger.info(self.collection1.replace_one(data_input, DATA, upsert=True))
                        break
                    else:
                        self.realTimeLogger.info(self.collection1.insert_one(DATA))
                        break
            self.realTimeLogger.info("5분 간격 현물 현제가 데이터 저장 후")
Beispiel #12
0
def SP_call_start():
    appLogger = logging_instance("SP_Call_").mylogger
    try:
        subprocess.call(
            ['sudo', 'python', 'C:\dev\indiPyProject\process\SP.py'])
    except Exception:
        appLogger.error("SP_Call Exception occurs")
        return render_template('process_result.html', message="SP 함수 실행 실패")
    return render_template('process_result.html', message="SP 함수 실행 완료")
Beispiel #13
0
def modify():
    appLogger = logging_instance("modify_").mylogger
    try:
        today = datetime.datetime.today()
        today = today.strftime("%Y%m%d")
        return render_template("modify_page.html", today=today)
    except Exception:
        appLogger.error("modify procss Exception occur")
        return redirect(url_for('index'))
Beispiel #14
0
    def __init__(self):
        super().__init__()
        self.processID = os.getpid()
        telgm_token = '1013576743:AAFkCdmafOY61N-I1FAEIEsOdFZwR47_ZQ8'
        self.bot = telegram.Bot(token=telgm_token)
        self.realTimeLogger = logging_instance("SK_new.py_ PID: " +
                                               (str)(self.processID)).mylogger
        self.realTimeLogger.info("SK_new 클래스 실행")
        self.realTimeLogger.info("QAxWidget Call")
        self.indiReal = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        self.indiReal.ReceiveRTData.connect(self.ReceiveRTData)

        self.indiReal_candidate = QAxWidget(
            "GIEXPERTCONTROL.GiExpertControlCtrl.1")
        self.indiReal.ReceiveRTData.connect(self.ReceiveRTData)

        self.realTimeLogger.info("QAxWidget Call 이후")
        self.timeline = common_min_shortTime(5).timeline

        # Indi API event

        collection_name = str(
            datetime.today().strftime("%Y%m%d")) + "_pr_input"

        client = MongoClient('127.0.0.1', 27017)
        db = client[str(datetime.today().strftime("%Y%m%d"))]
        self.collection = db[collection_name]

        collection_title1 = "SK_" + str(datetime.today().strftime("%Y%m%d"))
        collection_title2 = "SK_5min_" + str(
            datetime.today().strftime("%Y%m%d"))

        self.SK = db[collection_title1]
        self.SK_5min = db[collection_title2]

        for i in self.collection.find():
            ret1 = self.indiReal.dynamicCall(
                "UnRequestRTReg(QString, QString)", "SK", i['단축코드'].strip())
            self.realTimeLogger.info("ret1 " + str(ret1))
            if not ret1:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SK 실시간 등록 해제 실패!!!")
            else:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SK 실시간 등록 해제 성공!!!")
        for i in self.collection.find():
            ret1 = self.indiReal.dynamicCall("RequestRTReg(QString, QString)",
                                             "SK", i['종목코드'].strip())
            self.realTimeLogger.info("ret1 " + str(ret1))
            if not ret1:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SK 실시간 등록 실패!!!")
            else:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SK 실시간 등록 성공!!!")
Beispiel #15
0
    def ReceiveRTData(self, realType):
        # TR을 날릴때 ID를 통해 TR이름을 가져옵니다.
        self.realTimeLogger = logging_instance("SK_new 데이터 받기 PID: " +
                                               (str)(self.processID)).mylogger

        if realType == "SK":
            DATA = {}
            # 데이터 받기
            DATA['단축코드'] = self.indiReal.dynamicCall("GetSingleData(int)", 1)
            DATA['시간'] = self.indiReal.dynamicCall("GetSingleData(int)", 2)
            DATA['외국계순매수수량'] = (int)(self.indiReal.dynamicCall(
                "GetSingleData(int)", 47))
            if self.collection.find_one({"단축코드": DATA['단축코드']}) != None:
                if self.collection.find_one({"단축코드": DATA['단축코드']
                                             })['로직구분'] != "":
                    DATA['로직구분'] = self.collection.find_one(
                        {"단축코드": DATA['단축코드']})['로직구분']
                else:
                    DATA['로직구분'] = "없음"
            else:
                DATA['로직구분'] = "없음"

            self.realTimeLogger.info("실시간 외국인 수급 데이터 종목코드  " + DATA['단축코드'])
            self.realTimeLogger.info(DATA)
            self.realTimeLogger.info("실시간 외국인 수급 데이터 저장 전 종목코드  " +
                                     DATA['단축코드'])
            self.realTimeLogger.info(self.SK.insert_one(DATA))
            self.realTimeLogger.info("실시간 외국인 수급 데이터 저장 후 종목코드  " +
                                     DATA['단축코드'])

            data_time = make_five_min(DATA['시간'])
            DATA['sortTime'] = data_time
            DATA['sortTimeInt'] = (int)(data_time)
            self.realTimeLogger.info("5분 간격 외국인 수급 데이터 저장 전")
            print("data_time")
            print(data_time)
            if self.SK_5min.find_one({
                    '단축코드': DATA['단축코드'],
                    'sortTime': data_time
            }) != None:
                data_input = self.SK_5min.find_one({
                    '단축코드': DATA['단축코드'],
                    'sortTime': data_time
                }).copy()
                DATA['_id'] = data_input['_id']
                self.SK_5min.replace_one(data_input, DATA, upsert=True)
                self.realTimeLogger.info("SK_new 전송 받은 데이터 시간 " + data_time +
                                         " 새 데이터로 교체 종목코드  " + DATA['단축코드'])
            else:
                self.SK_5min.insert_one(DATA)
                self.realTimeLogger.info("SK_new 전송 받은 데이터 시간 " + data_time +
                                         " 새 데이터로 입력 종목코드  " + DATA['단축코드'])
            self.realTimeLogger.info("5분 간격 외국인 수급 데이터 저장  후")
Beispiel #16
0
    def __init__(self):
        self.processID = os.getpid()

        loginLogger = logging_instance("autoLogin.py   PID   " +
                                       (str)(self.processID)).mylogger

        super().__init__()
        self.flag = False
        start = time.time()
        client = MongoClient('127.0.0.1', 27017)
        db_name = str(datetime.datetime.today().strftime("%Y%m%d"))
        db = client[db_name]
        collection = db["login_check"]
        collection_status_param = {"status": "Processing"}
        if collection.find():
            collection.insert(collection_status_param)
        else:
            for i in collection.find():
                try:
                    if i["status"] != "":
                        collection.update({"status": i["status"]},
                                          {"status": "Processing"})
                        break
                    else:
                        collection.insert(collection_status_param)
                except Exception:
                    print(Exception)
                    QCoreApplication.exit(0)
        try:
            # 일반 TR OCX
            self.Indi_login = QAxWidget(
                "GIEXPERTCONTROL.GiExpertControlCtrl.1")
            loginLogger.info("OCX call")
            # 신한i Indi 자동로그인
            while True:
                if time.time() - start >= 100:
                    break
                loginLogger.info("Login Trying")
                login = self.Indi_login.StartIndi(
                    'xamevh123', 'florida1!23', 'florida1!23',
                    'C:\SHINHAN-i\indi\giexpertstarter.exe')
                print(login)
                if login == True:
                    self.flag = True
                    loginLogger.info("Login Success")
                    collection.update({"status": "Processing"},
                                      {"status": "Success"})
                    break
            #QCoreApplication.exit(0)
        except Exception:
            loginLogger.info("Login Failure Exception occur")
            print(Exception)
Beispiel #17
0
def TR_SCHART_function():
    realTimeLogger = logging_instance("TR_SCHART_function.py_").mylogger
    try:
        py_day = datetime.datetime.today().strftime("%Y%m%d")
        date = str(datetime.datetime.today().strftime("%Y%m%d"))
        #test
        #date = "20200221"
        py_time = datetime.datetime.now()
        hour = py_time.hour
        min = py_time.minute
        if (hour == 15 and min >= 30) or  hour > 15:
            hour = 15
            min = 30
        if py_day != date:
            hour = 15
            min = 30
        #78개임(날) 905-1530
        total_time = (int)((hour*60+min - 9*60 -5)/5)
        if total_time <=-1:
            realTimeLogger.info("5분 간격현재가 데이터 저장  가능 시간 아님")
        elif total_time >-1 and total_time<=0:
            total_time =1
        elif total_time==77:
            total_time +=1
        else:
            total_time +=2

        client = MongoClient('127.0.0.1', 27017)
        db = client[date]

        collection_name = date+"_pr_input"
        collection1 = db[collection_name]

        total_len = collection1.count()
        checkIndex = 0
        realTimePriceEvent = QApplication(sys.argv)

        short_time = common_min_shortTime(5)
        realTimeLogger.info("현재 가장 마지막으로 기록될 현재가 시간은   "+ str(hour)+":"+str(min))
        realTimeLogger.info("종목의 총 갯수 는 "+ str(total_len))
        realTimeLogger.info("각종목별 총 기록될 현재가 갯수는 (5분기준 현시각 라스트)     "+str(total_time))
        for i in collection1.find():
            realTimeLogger.info(i['종목코드'])
            TR_SCHART_vari = TR_SCHART(i['종목코드'], i['korName'].strip(), '1', '5', "00000000", "99999999",str(total_time),date)
            time.sleep(0.3)
            checkIndex +=1
        if checkIndex != total_len+1:
            realTimePriceEvent.exec()
            print("ssibal")
        realTimeLogger.info("지금은 현재가 데이터 저장 성공")
    except Exception:
        realTimeLogger.info("지금은 현재가 데이터 저장 실패")
Beispiel #18
0
def order_list():
    appLogger = logging_instance("order_list_").mylogger
    try:
        appLogger.info("order_list Event 생성")
        show_order_historyEvent = QApplication(sys.argv)
        show_order_historyVar = show_order_history(request.form['day'])
        show_order_historyEvent.exec_()
        appLogger.info("order_list Event exec")
        return render_template("order_list_page.html",
                               my_list=show_order_historyVar.DATA_List)
    except Exception:
        appLogger.error("order_list procss Exception occur")
        return redirect(url_for('index'))
Beispiel #19
0
    def __init__(self):
        super().__init__()

        telgm_token = '1013576743:AAFkCdmafOY61N-I1FAEIEsOdFZwR47_ZQ8'
        self.bot = telegram.Bot(token=telgm_token)
        self.processID = os.getpid()
        self.realTimeLogger = logging_instance("SC_new.py_ PID: " +
                                               (str)(self.processID)).mylogger
        self.realTimeLogger.info("SC_new 함수 실행 PID: " + (str)(self.processID))
        self.realTimeLogger.info("QAxWidget Call")
        self.indiReal = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        self.realTimeLogger.info("QAxWidget Call 이후")
        # 0905 시간 배열
        self.timeline = common_min_shortTime(5).timeline
        #오늘 날짜
        self.db_date = datetime.today().strftime("%Y%m%d")
        # Indi API event
        self.indiReal.ReceiveRTData.connect(self.ReceiveRTData)

        collection_name = self.db_date + "_pr_input"
        client = MongoClient('127.0.0.1', 27017)
        db = client[self.db_date]
        #모니터링 대상 종목 컬렉션
        self.monitoring_input_collection = db[collection_name]
        #모니터링 대상 종목 현재가 데이터 컬랙션
        collection_title1 = "SC_5min_" + self.db_date
        self.SC_5min = db[collection_title1]
        #모니터링 중 선정된 종목 여부 컬렉션
        collection_title2 = "SC_check_" + self.db_date
        self.SC_check = db[collection_title2]

        for i in self.monitoring_input_collection.find():
            ret1 = self.indiReal.dynamicCall(
                "UnRequestRTReg(QString, QString)", "SC", i['단축코드'].strip())
            self.realTimeLogger.info("ret1 " + str(ret1))
            if not ret1:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SC 실시간 등록 해제 실패!!!")
            else:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SC 실시간 등록 해제 성공!!!")
        for i in self.monitoring_input_collection.find():
            ret2 = self.indiReal.dynamicCall("RequestRTReg(QString, QString)",
                                             "SC", i['단축코드'].strip())
            self.realTimeLogger.info("ret2 " + str(ret2))
            if not ret2:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SC 실시간 등록 실패!!!")
            else:
                self.realTimeLogger.info("단축코드 " + i['단축코드'] +
                                         " 에 대한 SC 실시간 등록 성공!!!")
Beispiel #20
0
def modify_order2():
    appLogger = logging_instance("modify_order2_").mylogger

    buySellModifyEvent = QApplication(sys.argv)
    try:
        if request.form['원주문번호'] == "0":
            ordercode = request.form['주문번호']
            print('주문번호')
            print(ordercode)
        else:
            ordercode = request.form['원주문번호']
            print('원주문번호')
            print(ordercode)

        buySellModifyVar = buySellModify(request.form['flag'],
                                         request.form['출력종목코드'],
                                         request.form['주문수량'],
                                         str(int(float(request.form['주문단가']))),
                                         request.form['정규시간외구분코드'],
                                         request.form['호가유형코드'], ordercode)
        buySellModifyEvent.exec_()
        DATA = buySellModifyVar.DATA
        print(DATA)
        check = DATA["OrderNumber"]
        Message1 = DATA["Message1"]
        Message2 = DATA["Message2"]
        Message3 = DATA["Message3"]
        GetErrorCode = DATA["GetErrorCode"]
        GetErrorMessage = DATA["GetErrorMessage"]
        GetCommState = DATA["GetCommState"]

        appLogger.debug("inside modify_order2 Event Checking ")

        appLogger.debug("GetErrorCode   " + GetErrorCode)
        appLogger.debug("GetErrorMessage   " + GetErrorMessage)

        appLogger.debug("insidemodify_order2 Event Checking ")

        message = " Message1 " + Message1 + " Message2 " + Message2 + "  Message3   " + Message3 + "   GetErrorMessage    " + GetErrorMessage
        if GetErrorCode == "Z0001":
            return render_template("modify_result.html",
                                   testDataHtml="성공  " + message)
        else:
            return render_template("modify_result.html",
                                   testDataHtml="실패  " + message)
    except Exception:
        appLogger.error("modify_order2 procss Exception occur")
        return redirect(url_for('index'))
Beispiel #21
0
    def setup(self):
        self.realTimeLogger = logging_instance("TR_1406.py_   setup   PID: " +
                                               (str)(self.processID)).mylogger

        # 조회할 종목의 이름을 받아옵니다.
        ret = self.IndiTR.dynamicCall("SetQueryName(QString)", "TR_1406")
        ret = self.IndiTR.dynamicCall(
            "SetSingleData(int, QString)", 0,
            self.market)  # 인풋 : 시장구분 0 코스피 1 코스닥 2 전체
        ret = self.IndiTR.dynamicCall(
            "SetSingleData(int, QString)", 1,
            self.day)  #예 :“3”= 전영업일 기준 3일 연속 순매수/순매도( 최소값 : 1 )
        ret = self.IndiTR.dynamicCall("SetSingleData(int, QString)", 2,
                                      self.gubun)  # 1 순매수 2 순매도
        rqid = self.IndiTR.dynamicCall("RequestData()")
        self.realTimeLogger.info("TR_1406 input setup finished  RequestData")
Beispiel #22
0
 def __init__(self):
     super().__init__()
     self.processID = os.getpid()
     self.realTimeLogger = logging_instance("stock_mst.py_ PID: "+(str)(self.processID)).mylogger
     # 인디의 TR을 처리할 변수를 생성합니다.
     self.IndiTR = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
     # Indi API event
     self.IndiTR.ReceiveData.connect(self.ReceiveData)
     self.IndiTR.ReceiveSysMsg.connect(self.ReceiveSysMsg)
     self.db_day = str(datetime.datetime.today().strftime("%Y%m%d"))
     client = MongoClient('127.0.0.1', 27017)
     db = client["stock_mst"]
     self.stock_mst = db["stock_mst_collection"]
     self.realTimeLogger.info(" stock_mst tr 호출")
     ret = self.IndiTR.dynamicCall("SetQueryName(QString)", "stock_mst")
     rqid = self.IndiTR.dynamicCall("RequestData()")
Beispiel #23
0
    def __init__(self, day):
        super().__init__()
        self.IndiTR = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        # Indi API event
        self.IndiTR.ReceiveData.connect(self.ReceiveData)
        self.IndiTR.ReceiveSysMsg.connect(self.ReceiveSysMsg)
        self.realTimeLogger = logging_instance(
            "show_order_history.py 주문 체결/미체결 내역 조회").mylogger
        self.day = day
        self.DATA_List = list()
        self.DATA = {}
        self.check = False

        # 데이터 양식
        self.realTimeLogger.info("startProcess 호출")
        self.startProcess()
Beispiel #24
0
def monitoring_new_test3():
    appLogger = logging_instance("monitoring_new_test3_").mylogger

    try:
        py_day = datetime.datetime.today().strftime("%Y%m%d")
        date = request.form['date']

        py_time = datetime.datetime.now()
        hour = py_time.hour
        min = py_time.minute
        if (hour == 15 and min >= 30) or hour > 15:
            hour = 15
            min = 30
        if py_day != date:
            hour = 15
            min = 30
        #78개임(날) 905-1530
        total_time = (int)((hour * 60 + min - 9 * 60 - 5) / 5)
        if total_time <= 0:
            total_time = 1
        elif total_time == 77:
            total_time += 1
        else:
            total_time += 2
        #total_time =3
        appLogger.info("monitoring_new2 구동 전")
        monitoring_new_var = monitoring_new2(date)
        appLogger.info("monitoring_new2 구동 후")

        final_data = monitoring_new_var.final_data
        final_data2 = monitoring_new_var.final_data2
        final_data3 = monitoring_new_var.final_data3
        acc_stock_code = monitoring_new_var.acc_stock_code

        common_min_timeline_var2 = common_min_shortTime(
            5).timeline[:total_time]
    except Exception:
        return redirect(url_for('index'))
    return render_template('monitoring_test3.html',
                           time_line=common_min_timeline_var2,
                           values=final_data,
                           values2=final_data2,
                           values3=final_data3,
                           acc_stock_code=acc_stock_code,
                           length=total_time)
    def __init__(self):
        super().__init__()
        self.indiReal = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        self.processID = os.getpid()

        telgm_token = '1013576743:AAFkCdmafOY61N-I1FAEIEsOdFZwR47_ZQ8'
        self.bot = telegram.Bot(token=telgm_token)
        self.realTimeLogger = logging_instance(
            "RealTimeAccount.py 현물 실시간 주문 체결 PID: " +
            (str)(self.processID)).mylogger
        self.timeline = common_min_shortTime(5).timeline
        self.indiReal.ReceiveRTData.connect(self.ReceiveRTData)

        # 인디의 TR을 처리할 변수를 생성합니다.

        self.client = MongoClient('127.0.0.1', 27017)
        db_name = str(datetime.datetime.today().strftime("%Y%m%d"))
        self.db = self.client[db_name]
        self.collection_name1 = "AD_" + db_name
        self.collection1 = self.db[self.collection_name1]

        self.realTimeLogger.info("RealTimeAccount  AD UnRequestRTReg 호출")

        ret1 = self.indiReal.dynamicCall("UnRequestRTReg(QString, QString)",
                                         "AD", "*")
        if ret1:
            self.realTimeLogger.info("UnRequestRTReg  AD 완료")
            self.realTimeLogger.info("UnRequestRTReg  return 값 : " + str(ret1))
        else:
            self.realTimeLogger.error("UnRequestRTReg  AD 실패")
            self.realTimeLogger.error("UnRequestRTReg  return 값 : " +
                                      str(ret1))
            self.realTimeLogger.info("RealTimeAccount AD RequestRTReg 호출")
        ret2 = self.indiReal.dynamicCall("RequestRTReg(QString, QString)",
                                         "AD", "*")
        if ret2:
            self.realTimeLogger.info("RequestRTReg  AD완료")
            self.realTimeLogger.info("RequestRTReg  return 값 : " + str(ret2))
        else:
            self.realTimeLogger.error("RequestRTReg AD 실패")
            self.realTimeLogger.error("RequestRTReg  return 값 : " + str(ret2))

        self.realTimeLogger.info("RealTimeAccount  init() 완료")
 def ReceiveRTData(self, rqid):
     self.realTimeLogger = logging_instance(
         "RealTimeAccount.py 현물 실시간 주문 체결 PID: " +
         (str)(self.processID)).mylogger
     DATA = {}
     print(rqid)
     if rqid == "AD":
         self.realTimeLogger.info("rqid is  AD")
         DATA['종목명'] = self.indiReal.dynamicCall("GetSingleData(int)", 4)
         DATA['평가금액'] = self.indiReal.dynamicCall("GetSingleData(int)", 10)
         DATA['평가손익'] = self.indiReal.dynamicCall("GetSingleData(int)", 11)
         DATA['총평가금액'] = self.indiReal.dynamicCall("GetSingleData(int)", 19)
         self.realTimeLogger.info("AD data received")
         self.collection1.insert_one(DATA)
         self.realTimeLogger.info("AD  data saved to mongoDB")
         message = "종목명 :  " + DATA['종목명'] + "   평가금액 :  " + DATA[
             '평가금액'] + "    평가손익  :  " + DATA[
                 '평가손익'] + "    총평가금액 :  " + DATA['총평가금액']
         self.bot.sendMessage(chat_id='813531834', text=message)
Beispiel #27
0
    def __init__(self, stock_code, korName , standard, term, start_date, end_date, counts,date):
        super().__init__()
        self.realTimeLogger = logging_instance("TR_SCHART.py_").mylogger
        self.timeline = common_min_shortTime(5).timeline

        # 인디의 TR을 처리할 변수를 생성합니다.
        self.IndiTR = QAxWidget("GIEXPERTCONTROL.GiExpertControlCtrl.1")
        self.realTimeLogger.info("start")
        self.realTimeLogger.info(counts)
        self.realTimeLogger.info(stock_code)
        self.realTimeLogger.info(korName)
        self.realTimeLogger.info(standard)
        self.realTimeLogger.info(term)
        self.realTimeLogger.info(start_date)
        self.realTimeLogger.info(end_date)
        self.realTimeLogger.info(counts)
        # Indi API event
        self.IndiTR.ReceiveData.connect(self.ReceiveData)
        self.IndiTR.ReceiveSysMsg.connect(self.ReceiveSysMsg)
        self.korName= korName
        self.stock_code= stock_code
        self.standard= standard
        self.term= term
        self.start_date= start_date
        self.end_date= end_date
        self.counts= counts
        self.date= date

        self.client = MongoClient('127.0.0.1', 27017)
        db_name =self.date
        #test
        #db_name = "20200221"
        self.db = self.client[db_name]
        self.collection_name1 = "TR_SCHART_" + db_name
        self.collection_name2 = "TR_SCHART_5min_" + db_name

        self.collection1 = self.db [self.collection_name1]
        self.collection2 = self.db [self.collection_name2]
        self.realTimeLogger.info("start TR_SCHART")
        #self.market = market
        self.btn_Search()
Beispiel #28
0
def buy_process():
    appLogger = logging_instance("buy_process_").mylogger
    try:
        buy_processEvent = QApplication(sys.argv)
        buySellProcessVar = buySellProcess(request.form['flag'],
                                           request.form['stockCode'],
                                           request.form['stockQty'],
                                           request.form['stockPrice'],
                                           request.form['marketCode'],
                                           request.form['priceCode'])
        buy_processEvent.exec_()
        print("result check")
        print(buySellProcessVar.DATA)
        DATA = buySellProcessVar.DATA

        check = DATA["OrderNumber"]
        Message1 = DATA["Message1"]
        Message2 = DATA["Message2"]
        Message3 = DATA["Message3"]
        GetErrorCode = DATA["GetErrorCode"]
        GetErrorMessage = DATA["GetErrorMessage"]
        GetCommState = DATA["GetCommState"]
        message = " 총 주문 금액 " + Message1 + " 가계산 수수료 " + Message2 + "  가계산 제세금   " + Message3 + "   GetErrorMessage    " + GetErrorMessage

        appLogger.debug("inside buy process Event Checking ")

        appLogger.debug("GetErrorCode   " + GetErrorCode)
        appLogger.debug("check   " + check)
        appLogger.debug("GetErrorMessage   " + GetErrorMessage)

        appLogger.debug("inside buy process Event Checking ")

        if (check != '0' or check != None) and GetErrorCode == "Z0001":
            return render_template("buy_result.html",
                                   testDataHtml="성공  " + message)
        else:
            return render_template("buy_result.html",
                                   testDataHtml="실패  " + message)
    except Exception:
        appLogger.error("buy_process Exception occur")
        return redirect(url_for('index'))
Beispiel #29
0
    def ReceiveData(self, rqid):
        # TR을 날릴때 ID를 통해 TR이름을 가져옵니다.
        self.realTimeLogger = logging_instance(
            "show_order_history.py 주문 체결/미체결 내역 조회").mylogger

        if rqid == "SABA231Q1":
            # 데이터 받기
            nCnt = self.IndiTR.dynamicCall("GetMultiRowCount()")
            for i in range(0, nCnt):
                self.realTimeLogger.info("SABA231Q1 data received")
                # 데이터 양식
                DATA = {}
                DATA['주문번호'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 0)
                DATA['원주문번호'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 1)
                DATA['시장거래구분'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 2)
                DATA['정규시간외구분코드'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 8)
                DATA['호가유형코드'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 9)
                DATA['출력종목코드'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 13)
                DATA['종목명'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 14)
                DATA['주문수량'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 15)
                DATA['주문단가'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 16)
                DATA['미체결수량'] = self.IndiTR.dynamicCall(
                    "GetMultiData(int , int)", i, 26)
                self.DATA_List.append(DATA)
        else:
            self.realTimeLogger.info("SABA231Q1 data not received")
            QCoreApplication.instance().quit()
        self.realTimeLogger.info("Call Qapplication instance quit ")
        QCoreApplication.instance().quit()
    def ReceiveRTData(self, realType):
        # TR을 날릴때 ID를 통해 TR이름을 가져옵니다.
        self.realTimeLogger = logging_instance(
            "AA ReceiveRTData 실시간 체결 확인 PID: " +
            (str)(self.processID)).mylogger

        DATA = {}
        # 데이터 받기
        DATA['처리구분'] = self.indiReal.dynamicCall("GetSingleData(int)", 0)
        DATA['매수매도구분'] = self.indiReal.dynamicCall("GetSingleData(int)", 8)
        DATA['상태'] = self.indiReal.dynamicCall("GetSingleData(int)", 10)
        DATA['종목코드'] = self.indiReal.dynamicCall("GetSingleData(int)", 11)
        DATA['종목명'] = self.indiReal.dynamicCall("GetSingleData(int)", 12)
        DATA['주문수량'] = self.indiReal.dynamicCall("GetSingleData(int)", 14)
        DATA['주문가격'] = self.indiReal.dynamicCall("GetSingleData(int)", 15)
        DATA['미체결수량'] = self.indiReal.dynamicCall("GetSingleData(int)", 20)
        DATA['체결수량'] = self.indiReal.dynamicCall("GetSingleData(int)", 23)
        DATA['체결단가'] = self.indiReal.dynamicCall("GetSingleData(int)", 24)
        DATA['체결시간'] = self.indiReal.dynamicCall("GetSingleData(int)", 25)

        if DATA['매수매도구분'] == "01":
            gubun = " 매도   "
        if DATA['매수매도구분'] == "02":
            gubun = " 매수    "

        if DATA['처리구분'] == "00":
            DATA['상태메세지'] = "종목명:  " + DATA['종목명'] + "  주문가격: " + DATA[
                '주문가격'] + "  주문수량: " + DATA['주문수량'] + gubun + "정상 주문 됨"
        elif DATA['처리구분'] == "03":
            DATA['상태메세지'] = "종목명:  " + DATA['종목명'] + "  체결단가: " + DATA[
                '체결단가'] + "  체결수량: " + DATA[
                    '체결수량'] + gubun + "체결 됨" + "  미체결 수량 :   " + DATA['미체결수량']
        else:
            DATA['상태메세지'] = "작업필요"
        self.realTimeLogger.info(DATA['상태메세지'])
        self.bot.sendMessage(chat_id='813531834', text=DATA['상태메세지'])
        self.collection.insert(DATA)