init
This commit is contained in:
@@ -382,24 +382,31 @@ class AnalyzerSqlite:
|
||||
shutil.rmtree(outPath)
|
||||
os.mkdir(outPath)
|
||||
|
||||
self.makeDir("0_스토케스틱이 10 미만")
|
||||
self.makeDir("0_bolingerband 하단")
|
||||
self.makeDir("0_260일 위치 에너지가 10% 미만")
|
||||
self.makeDir("0_260일 가격 반토막 이상")
|
||||
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배 이상")
|
||||
self.makeDir("1_bolingerband 하단 돌파 상승")
|
||||
self.makeDir("1_정배열")
|
||||
self.makeDir("1_GoldenCross")
|
||||
self.makeDir("1_모든 라인 돌파")
|
||||
self.makeDir("참고_0_스토케스틱이 10 미만")
|
||||
self.makeDir("참고_0_bolingerband 하단")
|
||||
self.makeDir("참고_0_260일 위치 에너지가 10% 미만")
|
||||
self.makeDir("참고_0_260일 가격 반토막 이상")
|
||||
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배 이상")
|
||||
self.makeDir("참고_1_bolingerband 하단 돌파 상승")
|
||||
self.makeDir("참고_1_정배열")
|
||||
self.makeDir("참고_1_GoldenCross")
|
||||
self.makeDir("참고_1_모든 라인 돌파")
|
||||
|
||||
self.makeDir("1_캔들_전환선_위로_올라옴")
|
||||
self.makeDir("2_캔들_기준선_위로_올라옴")
|
||||
self.makeDir("3_후행스팬_캔들_위로_올라옴")
|
||||
self.makeDir("-1_캔들_전환선_아래로_내려옴")
|
||||
self.makeDir("-2_캔들_기준선_아래로_내려옴")
|
||||
self.makeDir("-3_후행스팬_캔들_아래로_내려옴")
|
||||
|
||||
return
|
||||
|
||||
@@ -508,27 +515,27 @@ class AnalyzerSqlite:
|
||||
|
||||
# 0_스토케스틱이 10 미만
|
||||
if len(close) > 5 and stochastic_score is not None and stochastic_score < 10:
|
||||
type = "0_스토케스틱이 10 미만"
|
||||
type = "참고_0_스토케스틱이 10 미만"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 0_bolingerband 하단
|
||||
if len(close) > 60 and bolingerband_lower[0] is not None and close[0] < bolingerband_lower[0]:
|
||||
type = "0_bolingerband 하단"
|
||||
type = "참고_0_bolingerband 하단"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 0_260일 위치 에너지가 10% 미만
|
||||
if len(close) > 5 and positionalEnergy1 is not None and positionalEnergy1 < 0.1:
|
||||
type = "0_260일 위치 에너지가 10% 미만"
|
||||
type = "참고_0_260일 위치 에너지가 10% 미만"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 0_260일 가격 반토막 이상
|
||||
if len(close) > 5 and positionalEnergy2 is not None and positionalEnergy2 < 0.5:
|
||||
type = "0_260일 가격 반토막 이상"
|
||||
type = "참고_0_260일 가격 반토막 이상"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 0_종가가 240일선 아래라면 매수한다.
|
||||
if close[0] < avg240[0]:
|
||||
type = "0_240일선 아래"
|
||||
type = "참고_0_240일선 아래"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 1_기준선 위 전환선 올라옴
|
||||
@@ -539,7 +546,7 @@ class AnalyzerSqlite:
|
||||
ichimokucloud_changeLine[3] <= ichimokucloud_baseLine[3] and
|
||||
ichimokucloud_changeLine[4] <= ichimokucloud_baseLine[4]) and
|
||||
volume[0] > volume[1]):
|
||||
type = "1_기준선 위 전환선 올라옴"
|
||||
type = "참고_1_기준선 위 전환선 올라옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# "1_기준선 위 120일선 올라옴"
|
||||
@@ -550,7 +557,7 @@ class AnalyzerSqlite:
|
||||
avg120[3] <= ichimokucloud_baseLine[3] and
|
||||
avg120[4] <= ichimokucloud_baseLine[4]) and
|
||||
volume[0] > volume[1]):
|
||||
type = "1_기준선 위 120일선 올라옴"
|
||||
type = "참고_1_기준선 위 120일선 올라옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# "1_기준선 위 200일선 올라옴"
|
||||
@@ -561,7 +568,7 @@ class AnalyzerSqlite:
|
||||
avg200[3] <= ichimokucloud_baseLine[3] and
|
||||
avg200[4] <= ichimokucloud_baseLine[4]) and
|
||||
volume[0] > volume[1]):
|
||||
type = "1_기준선 위 200일선 올라옴"
|
||||
type = "참고_1_기준선 위 200일선 올라옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# "1_기준선 위 240일선 올라옴"
|
||||
@@ -572,61 +579,92 @@ class AnalyzerSqlite:
|
||||
avg240[3] <= ichimokucloud_baseLine[3] and
|
||||
avg240[4] <= ichimokucloud_baseLine[4]) and
|
||||
volume[0] > volume[1]):
|
||||
type = "1_기준선 위 240일선 올라옴"
|
||||
type = "참고_1_기준선 위 240일선 올라옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 1_종가가 200일선 돌파
|
||||
if len(close) > 5 and 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일선 돌파"
|
||||
type = "참고_1_200일선 돌파"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 1_종가가 240일선 돌파
|
||||
if len(close) > 5 and 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일선 돌파"
|
||||
type = "참고_1_240일선 돌파"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 1_20일선 돌파
|
||||
temp_status = self.common.check_Dolpa_Jiji(stock, '20')
|
||||
if temp_status != "":
|
||||
type = "1_20일선 돌파"
|
||||
type = "참고_1_20일선 돌파"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 1_60일선 돌파
|
||||
temp_status = self.common.check_Dolpa_Jiji(stock, '60')
|
||||
if temp_status != "":
|
||||
type = "1_60일선 돌파"
|
||||
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"
|
||||
type = "참고_1_GoldenCross"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 1_거래량 5배 이상
|
||||
if len(volume)>2 and volume[0] > volume[1]*5:
|
||||
type = "1_거래량 5배 이상"
|
||||
type = "참고_1_거래량 5배 이상"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 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 하단 돌파 상승"
|
||||
type = "참고_1_bolingerband 하단 돌파 상승"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
# 1_정배열
|
||||
right_arrange = self.common.check_RightArrange(stock)
|
||||
if right_arrange != "":
|
||||
type = "1_정배열"
|
||||
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])):
|
||||
type = "1_모든 라인 돌파"
|
||||
type = "참고_1_모든 라인 돌파"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
### 코스피 지수 기준 숏 전략:
|
||||
# 캔들이 전환선 붕괴시키면 1을 매수한다.
|
||||
# 기준선 붕괴하면 3을 매수한다.
|
||||
# 후행스팬 캔들 밑으로 내려오면 1씩 매수한다.
|
||||
### 매도전략:
|
||||
# 캔들이 전환선 올라오면 1을 매도한다.
|
||||
# 기준선 올라타면 3을 매도한다.
|
||||
# 후행스팬 캔들 위로 올라오면 매도한다.
|
||||
|
||||
if (len(close) > 50 and close[1] < ichimokucloud_changeLine[1] and ichimokucloud_changeLine[0] < close[0]):
|
||||
type = "1_캔들_전환선_위로_올라옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
if (len(close) > 50 and close[1] < ichimokucloud_baseLine[1] and ichimokucloud_baseLine[0] < close[0]):
|
||||
type = "2_캔들_기준선_위로_올라옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
if (len(close) > 50 and close[0] < close[26] and close[25] < close[0]):
|
||||
type = "3_후행스팬_캔들_위로_올라옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
if (len(close) > 50 and close[1] > ichimokucloud_changeLine[1] and ichimokucloud_changeLine[0] > close[0]):
|
||||
type = "-1_캔들_전환선_아래로_내려옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
if (len(close) > 50 and close[1] > ichimokucloud_baseLine[1] and ichimokucloud_baseLine[0] > close[0]):
|
||||
type = "-2_캔들_기준선_아래로_내려옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
if (len(close) > 50 and close[0] > close[26] and close[25] > close[0]):
|
||||
type = "-3_후행스팬_캔들_아래로_내려옴"
|
||||
self.writeFile(type, CODE, NAME, stock, state)
|
||||
|
||||
|
||||
|
||||
return
|
||||
|
||||
def get_moving_average(self, stock):
|
||||
|
||||
@@ -23,8 +23,8 @@ class IchimokuCloud:
|
||||
item_code = stock["CODE"]
|
||||
|
||||
df = pd.DataFrame(stock["PRICE"])
|
||||
leadingSpan1 = go.Scatter(x=df.DATE, y=df['leadingSpan1'], name="선행스팬", line_color='#8B4513')
|
||||
leadingSpan2 = go.Scatter(x=df.DATE, y=df['leadingSpan2'], name="후행스팬", line_color='#4169E1')
|
||||
leadingSpan1 = go.Scatter(x=df.DATE, y=df['leadingSpan1'], name="선행스팬1", line_color='#8B4513')
|
||||
leadingSpan2 = go.Scatter(x=df.DATE, y=df['leadingSpan2'], name="선행스팬2", line_color='#4169E1')
|
||||
candle = go.Candlestick(x=df.DATE, open=df.open, high=df.high, low=df.low, close=df.close,
|
||||
increasing_line_color= 'red', decreasing_line_color= 'blue')
|
||||
data = [leadingSpan1, leadingSpan2, candle]
|
||||
|
||||
Reference in New Issue
Block a user