def get_time(chart_manager, strategy_var, add_min, subject_code): # 현재 시간 정수형으로 return if const.MODE== const.REAL: # 실제투자 current_hour = time.localtime().tm_hour current_min = time.localtime().tm_min + add_min if current_min >= 60: current_hour += 1 current_min -= 60 current_time = current_hour * 100 + current_min elif const.MODE == const.TEST: # 테스트 sbv = subject.Subject() chart_type = strategy_var.info[subject_code][ sbv.info[subject_code]['전략'] ][const.차트][0][0] time_unit = strategy_var.info[subject_code][ sbv.info[subject_code]['전략'] ][const.차트][0][1] chart_data = chart_manager.data[subject_code][chart_type][time_unit] current_hour = int(str(chart_data[const.체결시간][-1])[8:10]) current_min = int(str(chart_data[const.체결시간][-1])[10:12]) + add_min if current_min >= 60: current_hour += 1 current_min -= 60 current_time = current_hour * 100 + current_min return int(current_time)
def __init__(self, stv, common_data): super(KiwoomTester, self).__init__() self.stv = stv self.sbv = subject.Subject() self.chart = ctm.ChartManger(self.stv, self.sbv) self.stm = stm.StrategyManager(self.stv, self.sbv, self.chart) self.cm = cm.ContractManager() for subject_code in common_data.keys(): self.chart.init_data(subject_code, common_data)
def __init__(self, _stv=None): super(Api, self).__init__() self.subject_var = subject.Subject() # Headong Manager Set-up self.contract_manager = contract_manager.ContractManager() self.chart_manager = chart_manager.ChartManger(_stv, self.subject_var) self.strategy_manager = strategy_manager.StrategyManager( self.subject_var) if const.MODE is const.REAL: # Kiwoom set-up self.log.info("해동이2.0 실제투자 시작 합니다.") self.app = QtWidgets.QApplication(sys.argv) self.ocx = QAxContainer.QAxWidget("KFOPENAPI.KFOpenAPICtrl.1") self.ocx.OnEventConnect[int].connect(self.OnEventConnect) self.ocx.OnReceiveTrData[str, str, str, str, str].connect(self.OnReceiveTrData) self.ocx.OnReceiveChejanData[str, int, str].connect(self.OnReceiveChejanData) self.ocx.OnReceiveRealData[str, str, str].connect(self.OnReceiveRealData) # Overall Configuration Values self.strategy_var = self.strategy_manager.get_strategy_var_from_config( ) if self.connect == 0: self.app.exec_() elif const.MODE is const.TEST: self.strategy_var = _stv self.chart_manager.set_stv(self.strategy_var) else: self.log.debug("MODE:" + str(const.MODE)) self.log.info("Headong API 종료")
def __init__(self, _stv = None): super(KiwoomTester, self).__init__() self.stv = _stv self.chart = ctm.ChartManger(self.stv) self.stm = stm.StrategyManager(subject.Subject()) self.subject_var = subject.Subject()
def __init__(self): self.log, self.res, self.err_log = LogManager.__call__().get_logger() self.sbv = subject.Subject()
def __init__(self): super(ContractManager, self).__init__() self.sbv = subject.Subject()