This commit is contained in:
dosangyoon
2022-02-07 03:38:15 +09:00
parent 3db4f6e72d
commit 93966cea1e
8 changed files with 76 additions and 38 deletions

View File

@@ -63,7 +63,7 @@ class Analyzer:
rowid = 1
cursor.execute('SELECT * FROM fnguide WHERE rowid=?', (rowid,))
result = cursor.fetchone()
while result != None:
while result is not None:
if result[2] == "227950":
print (1)
data = json.loads(result[2])
@@ -144,7 +144,7 @@ class Analyzer:
rowid = 1
cursor.execute('SELECT * FROM ' + self.tableName + ' WHERE rowid=?', (rowid,))
result = cursor.fetchone()
while result != None:
while result is not None:
stock = {"CODE": result[0], "NAME": result[1], "PRICE": json.loads(result[2])}
results = self.stochastic.analyze(stock)
text = json.dumps(results, ensure_ascii=False)
@@ -466,7 +466,7 @@ class Analyzer:
for check_index in range(365):
inde_check.append([0,0])
while result != None:
while result is not None:
item_code = result[0]
item_name = result[1]
print("#html", rowid, item_name)
@@ -589,7 +589,7 @@ class Analyzer:
rowid = 1
cursor.execute('SELECT * FROM ' + self.tableName + ' WHERE rowid=?', (rowid,))
result = cursor.fetchone()
while result != None:
while result is not None:
stock = {"CODE": result[0], "NAME": result[1], "PRICE": json.loads(result[2])}
try:

View File

@@ -389,7 +389,10 @@ class AnalyzerSqlite:
self.makeDir("0_240일선 아래")
self.makeDir("1_기준선 위 전환선 올라옴")
self.makeDir("1_기준선 위 120일선 올라옴")
self.makeDir("1_기준선 위 200일선 올라옴")
self.makeDir("1_기준선 위 240일선 올라옴")
self.makeDir("1_240일선 돌파")
self.makeDir("1_200일선 돌파")
self.makeDir("1_20일선 돌파")
self.makeDir("1_60일선 돌파")
self.makeDir("1_거래량 5배 이상")
@@ -503,36 +506,38 @@ class AnalyzerSqlite:
# 종목 상태 체크 분석
state = self.analyzeFinalScore(stock)
# 스토케스틱이 10 미만
# 0_스토케스틱이 10 미만
if len(close) > 5 and stochastic_score is not None and stochastic_score < 10:
type = "0_스토케스틱이 10 미만"
self.writeFile(type, CODE, NAME, stock, state)
# bolingerband 하단
# 0_bolingerband 하단
if len(close) > 60 and bolingerband_lower[0] is not None and close[0] < bolingerband_lower[0]:
type = "0_bolingerband 하단"
self.writeFile(type, CODE, NAME, stock, state)
# 260일 위치 에너지가 10% 미만
# 0_260일 위치 에너지가 10% 미만
if len(close) > 5 and positionalEnergy1 is not None and positionalEnergy1 < 0.1:
type = "0_260일 위치 에너지가 10% 미만"
self.writeFile(type, CODE, NAME, stock, state)
# 260일 가격 반토막 이상
# 0_260일 가격 반토막 이상
if len(close) > 5 and positionalEnergy2 is not None and positionalEnergy2 < 0.5:
type = "0_260일 가격 반토막 이상"
self.writeFile(type, CODE, NAME, stock, state)
# 종가가 240일선 아래라면 매수한다.
# 0_종가가 240일선 아래라면 매수한다.
if close[0] < avg240[0]:
type = "0_240일선 아래"
self.writeFile(type, CODE, NAME, stock, state)
# 기준선 위 전환선 올라옴
# 1_기준선 위 전환선 올라옴
if len(close) > 50:
if ((ichimokucloud_changeLine[0] > ichimokucloud_baseLine[0] and
ichimokucloud_changeLine[1] < ichimokucloud_baseLine[1] and
ichimokucloud_changeLine[2] < ichimokucloud_baseLine[2]) and
ichimokucloud_changeLine[1] < ichimokucloud_baseLine[1] and
ichimokucloud_changeLine[2] < ichimokucloud_baseLine[2] and
ichimokucloud_changeLine[3] < ichimokucloud_baseLine[3] and
ichimokucloud_changeLine[4] < ichimokucloud_baseLine[4]) and
volume[0] > volume[1]):
type = "1_기준선 위 전환선 올라옴"
self.writeFile(type, CODE, NAME, stock, state)
@@ -540,53 +545,82 @@ class AnalyzerSqlite:
# "1_기준선 위 120일선 올라옴"
if len(close) > 50:
if ((avg120[0] > ichimokucloud_baseLine[0] and
avg120[1] < ichimokucloud_baseLine[1] and
avg120[2] < ichimokucloud_baseLine[2]) and
avg120[1] < ichimokucloud_baseLine[1] and
avg120[2] < ichimokucloud_baseLine[2] and
avg120[3] < ichimokucloud_baseLine[3] and
avg120[4] < ichimokucloud_baseLine[4]) and
volume[0] > volume[1]):
type = "1_기준선 위 120일선 올라옴"
self.writeFile(type, CODE, NAME, stock, state)
# 종가가 240일선 돌파
if close[0] > avg240[0] and close[1] < avg240[1]:
# "1_기준선 위 200일선 올라옴"
if len(close) > 50:
if ((avg200[0] > ichimokucloud_baseLine[0] and
avg200[1] < ichimokucloud_baseLine[1] and
avg200[2] < ichimokucloud_baseLine[2] and
avg200[3] < ichimokucloud_baseLine[3] and
avg200[4] < ichimokucloud_baseLine[4]) and
volume[0] > volume[1]):
type = "1_기준선 위 200일선 올라옴"
self.writeFile(type, CODE, NAME, stock, state)
# "1_기준선 위 240일선 올라옴"
if len(close) > 50:
if ((avg240[0] > ichimokucloud_baseLine[0] and
avg240[1] < ichimokucloud_baseLine[1] and
avg240[2] < ichimokucloud_baseLine[2] and
avg240[3] < ichimokucloud_baseLine[3] and
avg240[4] < ichimokucloud_baseLine[4]) and
volume[0] > volume[1]):
type = "1_기준선 위 240일선 올라옴"
self.writeFile(type, CODE, NAME, stock, state)
# 1_종가가 200일선 돌파
if close[0] > avg200[0] and close[1] < avg200[1] and close[2] < avg200[2] and close[3] < avg200[3] and close[4] < avg200[4]:
type = "1_200일선 돌파"
self.writeFile(type, CODE, NAME, stock, state)
# 1_종가가 240일선 돌파
if close[0] > avg240[0] and close[1] < avg240[1] and close[2] < avg240[2] and close[3] < avg240[3] and close[4] < avg240[4]:
type = "1_240일선 돌파"
self.writeFile(type, CODE, NAME, stock, state)
# 20일선 돌파
# 1_20일선 돌파
temp_status = self.common.check_Dolpa_Jiji(stock, '20')
if temp_status != "":
type = "1_20일선 돌파"
self.writeFile(type, CODE, NAME, stock, state)
# 60일선 돌파
# 1_60일선 돌파
temp_status = self.common.check_Dolpa_Jiji(stock, '60')
if temp_status != "":
type = "1_60일선 돌파"
self.writeFile(type, CODE, NAME, stock, state)
# 골든크로스
# 1_골든크로스
golden_cross_status = self.common.check_golded_cross(stock)
if golden_cross_status != "":
type = "1_GoldenCross"
self.writeFile(type, CODE, NAME, stock, state)
# 거래량 5배 이상
if volume[0] > volume[1]*5:
# 1_거래량 5배 이상
if len(volume)>2 and volume[0] > volume[1]*5:
type = "1_거래량 5배 이상"
self.writeFile(type, CODE, NAME, stock, state)
# bolingerband 하단 돌파 상승
# 1_bolingerband 하단 돌파 상승
if (len(close) > 60 and (bolingerband_lower[0] is not None and bolingerband_lower[1] is not None) and
close[0] > bolingerband_lower[0] and close[1] < bolingerband_lower[1]):
type = "1_bolingerband 하단 돌파 상승"
self.writeFile(type, CODE, NAME, stock, state)
# 정배열
# 1_정배열
right_arrange = self.common.check_RightArrange(stock)
if right_arrange != "":
type = "1_정배열"
self.writeFile(type, CODE, NAME, stock, state)
# 모든 라인 돌파
# 1_모든 라인 돌파
if (len(close) > 50 and
close[0] > max(open[0], avg5[0], avg20[0], avg60[0], avg120[0], avg240[0], bolingerband_upper[0], ichimokucloud_changeLine[0], ichimokucloud_baseLine[0]) and
open[0] < max(open[0], avg5[0], avg20[0], avg60[0], avg120[0], avg240[0], bolingerband_upper[0], ichimokucloud_changeLine[0], ichimokucloud_baseLine[0])):

View File

@@ -4,7 +4,7 @@ class Common:
# 상향
def checkUpward(self, type, data):
check = True
if type != None:
if type is not None:
for i in range(len(data)-1):
# 만약 이전이 이후보다 크다면, 상승이 아님
if data[i][type] > data[i+1][type]:

View File

@@ -4,7 +4,7 @@ class Common:
# 상향
def checkUpward(self, type, data):
check = True
if type != None:
if type is not None:
for i in range(len(data)-1):
# 만약 이전이 이후보다 크다면, 상승이 아님
if data[i][type] > data[i+1][type]: