This commit is contained in:
dosangyoon
2022-07-29 16:26:22 +09:00
parent d1dafd524b
commit 801b650980
5 changed files with 88 additions and 8 deletions

View File

@@ -472,6 +472,8 @@ class HTS:
items = self.getStockInfo(stock_code, today)
conn = sqlite3.connect(inFileName)
cursor = conn.cursor()
idx = 0
for item in items:
ymd = item[0]
@@ -484,9 +486,6 @@ class HTS:
idx += 1
conn = sqlite3.connect(inFileName)
cursor = conn.cursor()
cursor.execute('DELETE FROM ' + tableName + ' WHERE CODE=? and ymd=? and hms=?', (stock_code, ymd, hms,))
cursor.execute('SELECT * FROM ' + tableName + ' WHERE CODE=? and ymd=? and hms=?', (stock_code, ymd, hms,))
result = cursor.fetchone()
@@ -495,9 +494,9 @@ class HTS:
"INSERT INTO " + tableName + "(CODE, NAME, ymd, hms, close, open, high, low, volume) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)",
(stock_code, stock_name, ymd, hms, close, open, high, low, volume))
conn.commit()
cursor.close()
conn.close()
conn.commit()
cursor.close()
conn.close()
print("insert...", stock_code, stock_name, today)
return