init
This commit is contained in:
11
hts/HTS.py
11
hts/HTS.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user