init
This commit is contained in:
14
hts/HTS.py
14
hts/HTS.py
@@ -553,7 +553,7 @@ class HTS:
|
||||
conn = sqlite3.connect(os.path.join(self.RESOURCE_PATH, "hts.db"))
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute('SELECT ymd, hms, open, high, low, close, volume FROM ' + tableName + ' WHERE CODE=? and ymd=? order by ymd, hms', (stock_code, day,))
|
||||
cursor.execute('SELECT ymd, hms, open, high, low, close, volume, label FROM ' + tableName + ' WHERE CODE=? and ymd=? order by ymd, hms', (stock_code, day,))
|
||||
db_result = cursor.fetchall()
|
||||
for rows in db_result:
|
||||
ymd = rows[0] # hts.날짜
|
||||
@@ -563,6 +563,7 @@ class HTS:
|
||||
low = rows[4] # hts.저가
|
||||
close = rows[5] # hts.종가
|
||||
vol = rows[6] # hts.거래량
|
||||
label = 0 if rows[7] is None else rows[7] # hts.매매구분
|
||||
|
||||
temp = datetime.strptime(str(ymd) + " " + str(hms).zfill(4) + "00", '%Y%m%d %H%M%S')
|
||||
|
||||
@@ -572,6 +573,7 @@ class HTS:
|
||||
result["high"].append(int(high))
|
||||
result["low"].append(int(low))
|
||||
result["vol"].append(int(vol))
|
||||
result["label"].append(int(label))
|
||||
|
||||
return
|
||||
|
||||
@@ -593,7 +595,8 @@ class HTS:
|
||||
"close": [],
|
||||
"high": [],
|
||||
"low": [],
|
||||
"vol": []}
|
||||
"vol": [],
|
||||
"label": []}
|
||||
|
||||
days = []
|
||||
for i in range(1, 10):
|
||||
@@ -601,10 +604,10 @@ class HTS:
|
||||
isValid = self.isValidYMD(stock_code, last_day)
|
||||
if isValid:
|
||||
days.append(last_day)
|
||||
if len(days) >= 3:
|
||||
if len(days) >= n:
|
||||
break
|
||||
|
||||
days.sort()
|
||||
days = sorted(days)
|
||||
for day in days:
|
||||
self.getDBData(stock_code, day, result)
|
||||
|
||||
@@ -615,10 +618,11 @@ class HTS:
|
||||
if LAST_DATA is not None:
|
||||
result = copy.deepcopy(LAST_DATA)
|
||||
else:
|
||||
result = {"check": set(), "time": [], "open": [], "close": [], "high": [], "low": [], "vol": []}
|
||||
result = {"check": set(), "time": [], "open": [], "close": [], "high": [], "low": [], "vol": [], "label": []}
|
||||
|
||||
self.getDBData(stock_code, today, result)
|
||||
|
||||
|
||||
int_given_day = int(today)
|
||||
objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
|
||||
bConnect = objCpCybos.IsConnect
|
||||
|
||||
Reference in New Issue
Block a user