init
This commit is contained in:
@@ -262,6 +262,37 @@ class AnalyzerSqlite:
|
|||||||
|
|
||||||
return energy1, energy2
|
return energy1, energy2
|
||||||
|
|
||||||
|
def writeSummary(self, param):
|
||||||
|
bull = list(reversed(param['bull']))
|
||||||
|
bear = list(reversed(param['bear']))
|
||||||
|
even = list(reversed(param['even']))
|
||||||
|
ymd = [i for i in range(len(bull))]
|
||||||
|
|
||||||
|
bull_line = go.Scatter(x=ymd, y=bull, name="bull", line_color='#FF33A2')
|
||||||
|
bear_line = go.Scatter(x=ymd, y=bear, name="bear", line_color='#1469F4')
|
||||||
|
even_line = go.Scatter(x=ymd, y=even, name="even", line_color='#8B4513')
|
||||||
|
|
||||||
|
line_data = [bull_line, bear_line, even_line]
|
||||||
|
|
||||||
|
fig = subplots.make_subplots(
|
||||||
|
rows=1, cols=1,
|
||||||
|
subplot_titles=("주식 상황"),
|
||||||
|
shared_xaxes=True, horizontal_spacing=0.03, vertical_spacing=0.01,
|
||||||
|
row_heights=[800]
|
||||||
|
)
|
||||||
|
for trace in line_data:
|
||||||
|
fig.append_trace(trace, 1, 1)
|
||||||
|
|
||||||
|
size = len(param['bull'])
|
||||||
|
fig.update_layout(height=810, xaxis_rangeslider_visible=False)
|
||||||
|
title = "[Summary] bull: %d, bear: %d, even: %d" % (param['bull'][size-1], param['bear'][size-1], param['even'][size-1])
|
||||||
|
fig['layout'].update(title=title)
|
||||||
|
|
||||||
|
fileName = "%s/summary.html" % (self.outPath)
|
||||||
|
po.write_html(fig, file=fileName, auto_open=False)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
def writeFile(self, dir_name, CODE, NAME, top, stock, state):
|
def writeFile(self, dir_name, CODE, NAME, top, stock, state):
|
||||||
# 3년 이내 한번이라도 영업이익이 났는지 체크를 함
|
# 3년 이내 한번이라도 영업이익이 났는지 체크를 함
|
||||||
fnguide = None
|
fnguide = None
|
||||||
@@ -445,6 +476,12 @@ class AnalyzerSqlite:
|
|||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
param = {'bull': [], 'bear': [], 'even': []}
|
||||||
|
for i in range(60):
|
||||||
|
param['bull'].append(0)
|
||||||
|
param['bear'].append(0)
|
||||||
|
param['even'].append(0)
|
||||||
|
|
||||||
for idx, item in enumerate(items):
|
for idx, item in enumerate(items):
|
||||||
CODE = item[0]
|
CODE = item[0]
|
||||||
NAME = item[1]
|
NAME = item[1]
|
||||||
@@ -460,7 +497,6 @@ class AnalyzerSqlite:
|
|||||||
|
|
||||||
# 거래량이 10만 이상이고, 종가가 1천원 이상인지 체크 (https://happpy-rich.tistory.com/94)
|
# 거래량이 10만 이상이고, 종가가 1천원 이상인지 체크 (https://happpy-rich.tistory.com/94)
|
||||||
if stock_daily['volume'][0] > 100000 and stock_daily['close'][0] > 1000:
|
if stock_daily['volume'][0] > 100000 and stock_daily['close'][0] > 1000:
|
||||||
|
|
||||||
# 종목 상태 체크 분석
|
# 종목 상태 체크 분석
|
||||||
|
|
||||||
# Monthly 체크
|
# Monthly 체크
|
||||||
@@ -555,6 +591,16 @@ class AnalyzerSqlite:
|
|||||||
log = "BB_" + str(top)
|
log = "BB_" + str(top)
|
||||||
self.writeFile(dir_name, CODE, NAME, top, stock_daily, log)
|
self.writeFile(dir_name, CODE, NAME, top, stock_daily, log)
|
||||||
"""
|
"""
|
||||||
|
for c in range(len(stock_daily['open'])):
|
||||||
|
if c >= 60:
|
||||||
|
break
|
||||||
|
if stock_daily['open'][c] < stock_daily['close'][c]:
|
||||||
|
param['bull'][c] += 1
|
||||||
|
elif stock_daily['close'][c] < stock_daily['open'][c]:
|
||||||
|
param['bear'][c] += 1
|
||||||
|
else:
|
||||||
|
param['even'][c] += 1
|
||||||
|
self.writeSummary(param)
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_moving_average(self, stock):
|
def get_moving_average(self, stock):
|
||||||
|
|||||||
Reference in New Issue
Block a user