init
This commit is contained in:
@@ -14,14 +14,13 @@ today = datetime.now().strftime("%Y-%m-%d")
|
|||||||
|
|
||||||
PROJECT_HOME = os.getcwd()
|
PROJECT_HOME = os.getcwd()
|
||||||
|
|
||||||
START_DATE = "1900.01.01"
|
START_DATE = "2000.01.01"
|
||||||
start = time.time()
|
start = time.time()
|
||||||
stockFileName = PROJECT_HOME + '/resources/stock.db'
|
stockFileName = PROJECT_HOME + '/resources/stock.db'
|
||||||
|
|
||||||
week = datetime.today().weekday()
|
week = datetime.today().weekday()
|
||||||
|
|
||||||
if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
|
if week in (0, 1, 2, 3, 4, 5, 6): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
|
||||||
|
|
||||||
# 재무제표는 3개월마다 다운로드를 한다.
|
# 재무제표는 3개월마다 다운로드를 한다.
|
||||||
fnGuideCrawler = FnGuideCrawler(START_DATE)
|
fnGuideCrawler = FnGuideCrawler(START_DATE)
|
||||||
print("[KOSPI 상장기업 재무제표 다운로드]")
|
print("[KOSPI 상장기업 재무제표 다운로드]")
|
||||||
@@ -52,8 +51,6 @@ if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
|
|||||||
stockCrawler.crawl_stocks(stockFileName)
|
stockCrawler.crawl_stocks(stockFileName)
|
||||||
stockCrawler.crawl_special_stocks(stockFileName)
|
stockCrawler.crawl_special_stocks(stockFileName)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("\n[종목 분석]")
|
print("\n[종목 분석]")
|
||||||
# S: 분석까지 진행
|
# S: 분석까지 진행
|
||||||
inFileName = PROJECT_HOME + '/resources/stock.db'
|
inFileName = PROJECT_HOME + '/resources/stock.db'
|
||||||
@@ -77,5 +74,6 @@ if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
|
|||||||
print("print to Html...")
|
print("print to Html...")
|
||||||
analyzerSqlite.findCandidate(outPath)
|
analyzerSqlite.findCandidate(outPath)
|
||||||
|
|
||||||
|
|
||||||
print("time : %6.2f 초", (time.time() - start))
|
print("time : %6.2f 초", (time.time() - start))
|
||||||
print ("done...")
|
print ("done...")
|
||||||
|
|||||||
@@ -291,17 +291,16 @@ class StockCrawler:
|
|||||||
us_sotck_data = {}
|
us_sotck_data = {}
|
||||||
for ticker in special_stocks:
|
for ticker in special_stocks:
|
||||||
|
|
||||||
cursor.execute('SELECT * FROM ' + tableName + ' WHERE CODE=?', (ticker,))
|
cursor.execute('SELECT ymd FROM ' + tableName + ' WHERE CODE=? order by ymd desc', (ticker,))
|
||||||
|
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
if result == None:
|
if result is not None:
|
||||||
#start_day = pd.to_datetime('2017-01-01')
|
start_day = result[0].replace(".", "-")
|
||||||
start_day = pd.to_datetime(self.START_DATE.replace(".", "-"))
|
end_day = datetime.today().strftime('%Y-%m-%d')
|
||||||
end_day = pd.to_datetime(datetime.today().strftime('%Y-%m-%d'))
|
|
||||||
else:
|
else:
|
||||||
#start = (datetime.today() - timedelta(days=300)).strftime('%Y-%m-%d')
|
#start_day = pd.to_datetime('2017-01-01')
|
||||||
start_day = pd.to_datetime(self.START_DATE.replace(".", "-"))
|
start_day = self.START_DATE.replace(".", "-")
|
||||||
end_day = pd.to_datetime(datetime.today().strftime('%Y-%m-%d'))
|
end_day = datetime.today().strftime('%Y-%m-%d')
|
||||||
|
|
||||||
data = None
|
data = None
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user