This commit is contained in:
dsyoon
2023-02-24 23:47:46 +09:00
parent 900d88bfd0
commit e66d950df9

View File

@@ -117,20 +117,22 @@ class HTS_Stocks (HTS):
return all_stocks, valid_company
def getSlowK(self, stock_code):
slow_k_week, slow_k_month = -1, -1
slow_k_week, p_slow_k_week, slow_k_month, p_slow_k_month = -1, -1, -1, -1
self.cursor_stock.execute('select stochastic_slow_k, max(ymd) from stock_analysis_weekly where code=? group by 1 order by ymd desc', (stock_code, ))
items = self.cursor_stock.fetchone()
if items is not None and len(items)>0:
slow_k_week = items[0]
slow_k_week, p_slow_k_week = items[0], items[1]
self.cursor_stock.execute('select stochastic_slow_k, max(ymd) from stock_analysis_monthly where code=? group by 1 order by ymd desc', (stock_code, ))
items = self.cursor_stock.fetchone()
if items is not None and len(items)>0:
slow_k_month = items[0]
slow_k_month, p_slow_k_month = items[0], items[1]
if slow_k_week is None: slow_k_week = -1
if slow_k_month is None: slow_k_month = -1
if slow_k_week is None or p_slow_k_week is None:
slow_k_week, p_slow_k_week = -1, -1
if slow_k_month is None or p_slow_k_month is None:
slow_k_month, p_slow_k_month = -1, -1
return slow_k_week, slow_k_month
return slow_k_week, p_slow_k_week, slow_k_month, p_slow_k_month
def getMaxPrice(self, code, valid_company):
max_price = 100000
@@ -177,8 +179,8 @@ class HTS_Stocks (HTS):
print("%5d: %8s, %-50s" % (idx, stock_code, stock_name))
slow_k_week, slow_k_month = self.getSlowK(stock_code)
if slow_k_week < 0 or 50 < slow_k_week or slow_k_month < 0 or 50 < slow_k_month:
slow_k_week, p_slow_k_week, slow_k_month, p_slow_k_month = self.getSlowK(stock_code)
if (slow_k_week < 0 or 50 < slow_k_week or slow_k_month < 0 or 50 < slow_k_month) or (slow_k_week < p_slow_k_week or slow_k_month < p_slow_k_month):
continue
stock = self.stockStatus.fetchLastData(self.cursor_stock, stock_code, n)