diff --git a/HTS_etf.py b/HTS_etf.py index a96ef92..a20bc9a 100644 --- a/HTS_etf.py +++ b/HTS_etf.py @@ -138,6 +138,9 @@ class HTS_etf (HTS): if items is not None and len(items)>0: slow_k_month = items[0] + if slow_k_week is None: slow_k_week = -1 + if slow_k_month is None: slow_k_month = -1 + return slow_k_week, slow_k_month def buyRealTime(self, today, stocks, analyzed_day=1000): @@ -157,12 +160,14 @@ class HTS_etf (HTS): # 매도를 체크한다. self.sellStocks() - for stock in stocks: + for idx, stock in enumerate(stocks): time.sleep(0.1) + print(idx, stock['stock_code'], stock['stock_name']) + slow_k_week, slow_k_month = self.getSlowK(stock['stock_code']) - if slow_k_week < 0 or 20 < slow_k_week or slow_k_month < 0 or 20 < slow_k_month: + if slow_k_week < 0 or 50 < slow_k_week or slow_k_month < 0 or 50 < slow_k_month: continue try: diff --git a/HTS_stocks.py b/HTS_stocks.py index d742d19..60e600d 100644 --- a/HTS_stocks.py +++ b/HTS_stocks.py @@ -126,6 +126,9 @@ class HTS_Stocks (HTS): if items is not None and len(items)>0: slow_k_month = items[0] + if slow_k_week is None: slow_k_week = -1 + if slow_k_month is None: slow_k_month = -1 + return slow_k_week, slow_k_month def getMaxPrice(self, code, valid_company): @@ -145,7 +148,6 @@ class HTS_Stocks (HTS): def buyRealTime(self, today, n = 200): - a,b = self.getSlowK("001430") print ("START...") THIS_TIME = datetime.now() @@ -171,10 +173,10 @@ class HTS_Stocks (HTS): re.search("\d.*?호", stock_name) is not None) and stock_code not in valid_company): continue - print(idx, stock_code, stock_name, ", CODE: ", stock_code, ", NAME: ", stock_name) + print(idx, stock_code, stock_name) slow_k_week, slow_k_month = self.getSlowK(stock_code) - if slow_k_week < 0 or 20 < slow_k_week or slow_k_month < 0 or 20 < slow_k_month: + if slow_k_week < 0 or 50 < slow_k_week or slow_k_month < 0 or 50 < slow_k_month: continue stock = self.stockStatus.fetchLastData(self.cursor_stock, stock_code, n)