def __init__(self): QMainWindow.__init__(self) # Application Configuration # UI self.setupUi(self) # Font(ko) self.set_ko_font() # Logger self.logger = TTlog(logger_name="TTRealCondi").logger # DB self.mongo = MongoClient() self.db = self.mongo.TopTrader # Slack self.slack = Slacker(config_manager.get_slack_token()) # Kiwoom self.kw = Kiwoom() self.login() self.stock_info = self.kw.get_stock_basic_info() # app main self.main()
def __init__(self): super().__init__() # self.setupUi(self) # load app screen duration = sys.argv[1] self.logger = TTlog(logger_name="TT"+duration).logger self.mongo = MongoClient() self.tt_db = self.mongo.TopTrader self.slack = Slack(config_manager.get_slack_token()) today = datetime.today() self.end_date = datetime(today.year, today.month, today.day, 16, 0, 0) self.kw = Kiwoom() self.login() self.get_screen_no = { "min1": "3000", "min3": "3001", "min5": "3002", "min10": "3003", "min60": "3004", "day": "3005", "week": "3006", "month": "3007", "year": "3008" } if duration.startswith("min"): self.collect_n_save_data_min(duration) else: self.collect_n_save_data(duration)
def __init__(self): super().__init__() # self.setupUi(self) # load app screen self.logger = TTlog(logger_name="RealCondi").logger self.mongo = MongoClient() self.tt_db = self.mongo.TopTrader self.slack = Slack(config_manager.get_slack_token()) self.kw = Kiwoom() self.login() # ready to search condi self.load_stock_info() t = datetime.today() self.s_time = datetime(t.year, t.month, t.day, 9, 0, 0) # 장 시작시간, 오전9시 # fake trading self.timer = None self.start_timer() # core function self.screen_no = 4000 self.N1, self.N2 = 0, 10 # self.screen_no = 4001 # self.N1, self.N2 = 10, 20 self.real_condi_search()
def __init__(self): QMainWindow.__init__(self) # Application Configuration # UI self.setupUi(self) # Font(ko) self.set_ko_font() # Logger self.logger = TTlog(logger_name="TTRealCondi").logger # DB self.mongo = MongoClient() self.db = self.mongo.TopTrader self.dbm = DBM('TopTrader') # Slack self.slack = Slack(cfg_mgr.get_slack_token()) # Kiwoom self.kw = Kiwoom() self.login() cfg_mgr.STOCK_INFO = self.kw.get_stock_basic_info() # app main cfg_mgr.MODE = constant.DEBUG self.main()
def __init__(self): super().__init__() self.logger = TTlog().logger self.mongo = MongoClient() self.tt_db = self.mongo.TopTrader self.slack = Slack(config_manager.get_slack_token()) self.kw = Kiwoom() self.init_trading() # self.just_sell_all_stocks() self.auto_trading()
def __init__(self): super().__init__() # self.setupUi(self) # load app screen self.logger = TTlog().logger self.dbm = DBM('TopTrader') self.mongo = MongoClient() self.db = self.mongo.TopTrader self.slack = Slack(config_manager.get_slack_token()) self.kw = Kiwoom() self.login() self.main()
def main(duration_list): mongo = MongoClient() db = mongo.TopTrader today = datetime.today() end_date = datetime(today.year, today.month, today.day, 16, 0, 0) slack = Slack(config_manager.get_slack_token()) for duration in duration_list: slack.send_message("[Automation] Start to collect stock data -> {}".format(duration)) while True: cmd = "python collect_stock_data_time_unit.py {}".format(duration) print(cmd) os.system(cmd) error_status = db.urgent.find({'type': 'error'}).next() ret = error_status['error_code'] print("ret_code:{} -> python collect_stock_data_time_unit.py {}".format(ret, duration)) if ret == -100: # kiwoom server check time (mon~sat) delay = 20 print("Delay {} minutes due to Kiwoom server check time. Mon~Sat".format(delay)) print("Until : {}".format(datetime.today() + timedelta(minutes=delay))) delay_min(delay) elif ret == -101: # kiwoom server check time (mon~sat) delay = 45 print("Delay {} minutes due to Kiwoom server check time. Sun".format(delay)) print("Until : {}".format(datetime.today() + timedelta(minutes=delay))) delay_min(delay) cur = db.time_series_temp.find({'type': duration}) if cur.count() == 0: # exception case.. retry continue status = cur.next() if status['last'] == (status['total']-1) and status['end_date'] == end_date: print("Collecting & Storing Stock {} Data is completed!".format(duration)) break slack.send_message("[Automation] Complete to collect stock data -> {}".format(duration))
def __init__(self): super().__init__() self.logger = TTlog().logger self.slack = Slack(config_manager.get_slack_token()) self.dbm = DBM('TopTrader') self.main()