init
This commit is contained in:
@@ -132,10 +132,7 @@ class StockCrawler:
|
||||
stocks.append({"NAME": 'KODEX 은행', "CODE": "091170"})
|
||||
stocks.append({"NAME": 'TIGER 탄소효율그린뉴딜', "CODE": "376410"})
|
||||
|
||||
start_time = time.time()
|
||||
for i, stock in enumerate(stocks):
|
||||
print (i, stock["NAME"], stock["CODE"], (time.time()-start_time), "s")
|
||||
start_time = time.time()
|
||||
cursor.execute('SELECT ymd FROM ' + tableName + ' WHERE CODE=? order by ymd desc', (stock["CODE"],))
|
||||
result = cursor.fetchone()
|
||||
ymd = self.START_DATE
|
||||
@@ -153,6 +150,7 @@ class StockCrawler:
|
||||
#else:
|
||||
# cursor.execute("UPDATE " + tableName + " SET close=?, diff=?, open=?, high=?, low=?, volume=? WHERE CODE=? and ymd=?", (item['close'], item['diff'], item['open'], item['high'], item['low'], item['volume'], stock["CODE"], item['ymd']))
|
||||
|
||||
print("{}. {} ({})".format(i, stock["CODE"], stock["NAME"]))
|
||||
sleep(0.5)
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
@@ -178,7 +176,6 @@ class StockCrawler:
|
||||
code_df = self.getStockInfo()
|
||||
items = code_df.values
|
||||
|
||||
start_time = time.time()
|
||||
idx = 0
|
||||
for item in items:
|
||||
idx += 1
|
||||
@@ -211,9 +208,7 @@ class StockCrawler:
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
print(idx, item_name, item_code, (time.time() - start_time), "s")
|
||||
|
||||
start_time = time.time()
|
||||
print("{}. {} ({})".format(idx, item_code, item_name))
|
||||
sleep(0.3)
|
||||
|
||||
return
|
||||
@@ -234,8 +229,6 @@ class StockCrawler:
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
pd.options.display.float_format = '{:.4f}'.format
|
||||
pd.set_option('display.max_columns', None)
|
||||
|
||||
@@ -372,9 +365,8 @@ class StockCrawler:
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
print(idx, item_code, special_stocks[item_code], (time.time() - start_time), "s")
|
||||
|
||||
start_time = time.time()
|
||||
print("{}. {} ({})".format(idx, item_code, special_stocks[item_code]))
|
||||
sleep(0.05)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user