This commit is contained in:
dsyoon
2023-10-10 21:04:34 +09:00
parent b8199a399e
commit 007e060bd9
2 changed files with 3 additions and 3 deletions

View File

@@ -76,7 +76,7 @@ if __name__ == "__main__":
while True: while True:
print("insert...", stock["stock_code"], stock["stock_name"], this_day.strftime('%Y%m%d')) print("insert...", stock["stock_code"], stock["stock_name"], this_day.strftime('%Y%m%d'))
hts.insertStockData(stocks, this_day) hts.insertStockData(stock, this_day)
this_day = this_day + timedelta(days=1) this_day = this_day + timedelta(days=1)
if this_day > stock["end_date"]: if this_day > stock["end_date"]:
break break

View File

@@ -463,7 +463,7 @@ class HTS:
return data return data
def insertStockData(self, stock_code, this_day): def insertStockData(self, stock, this_day):
# 테이블 생성 # 테이블 생성
self.cursor.execute("CREATE TABLE IF NOT EXISTS hts (CODE text, NAME text, ymd text, hms text, close REAL, open REAL, high REAL, low REAL, volume REAL, label INTEGER DEFAULT 0)") self.cursor.execute("CREATE TABLE IF NOT EXISTS hts (CODE text, NAME text, ymd text, hms text, close REAL, open REAL, high REAL, low REAL, volume REAL, label INTEGER DEFAULT 0)")
@@ -472,7 +472,7 @@ class HTS:
create_key = "CREATE INDEX IF NOT EXISTS hts_idx on hts(CODE, ymd, hms) " create_key = "CREATE INDEX IF NOT EXISTS hts_idx on hts(CODE, ymd, hms) "
self.cursor.execute(create_key) self.cursor.execute(create_key)
items = self.getStockInfo(stock_code, this_day.strftime('%Y%m%d')) items = self.getStockInfo(stock["stock_code"], this_day.strftime('%Y%m%d'))
for item in items: for item in items:
ymd = item[0] ymd = item[0]