This commit is contained in:
dsyoon
2022-09-12 21:51:30 +09:00
parent 7efddaad41
commit 6be9112bdb
2 changed files with 98 additions and 22 deletions

View File

@@ -113,23 +113,16 @@ class BuySellChecker:
START_TIME_INDEX = c
break
if i > START_TIME_INDEX:
if START_TIME_INDEX + 10 < i < START_TIME_INDEX + 350:
# 매수 분석
if i > 381 + 70:
if data['macdo'][i-1] < data['macdo'][i] and data['macdo'][i] < -10:
buy = max(data["open"][i], data["close"][i])
weight = 1
type = 1
return buy, weight, type
else:
if data['macdo'][i - 1] < data['macdo'][i] and data['macdo'][i] < -10:
if -2 < data['macds'][381]:
buy = max(data["open"][i], data["close"][i])
weight = 1
type = 1
return buy, weight, type
if data['macd'][i] < -7:
buy = max(data["open"][i], data["close"][i])
weight = 1
type = 1
return buy, weight, type
"""
if data['changeLine'][i - 1] <= data['baseLine'][i - 1] and data['baseLine'][i] < data['changeLine'][i]:
changeLine_count = sum([1 if data['changeLine'][c] <= data['baseLine'][c] else 0 for c in range(i-30, i-10)])
if changeLine_count >= 15:
@@ -139,6 +132,7 @@ class BuySellChecker:
weight = 1
type = 1
return buy, weight, type
"""
"""
if i > 381 + 26:
@@ -176,6 +170,72 @@ class BuySellChecker:
return sell, weight, type
def getBuyPriceAndWeight_122630(self, data, i):
buy, weight, type = -1, -1, -1
START_TIME_INDEX = 0
for c in range(370, len(data.index)):
if data.index[c].strftime("%H:%M:%S") == "09:01:00":
START_TIME_INDEX = c
break
if START_TIME_INDEX + 10 < i < START_TIME_INDEX + 350:
# 매수 분석
if data['macd'][i] < -50:
buy = max(data["open"][i], data["close"][i])
weight = 1
type = 1
return buy, weight, type
"""
if data['changeLine'][i - 1] <= data['baseLine'][i - 1] and data['baseLine'][i] < data['changeLine'][i]:
changeLine_count = sum([1 if data['changeLine'][c] <= data['baseLine'][c] else 0 for c in range(i-30, i-10)])
if changeLine_count >= 15:
changeLine_count = sum([1 if data['changeLine'][c] <= data['baseLine'][c] else 0 for c in range(i-10, i)])
if changeLine_count >= 7:
buy = min(data["open"][i], data["close"][i])
weight = 1
type = 1
return buy, weight, type
"""
"""
if i > 381 + 26:
if data['laggingSpan'][i-1] < data['avg3'][i-1] and data['avg3'][i] < data['laggingSpan'][i]:
if self.checkUpDirection(data, i) == 1:
avg20_line = sum([1 if data['avg20'][c] < data['avg20'][c-1] else 0 for c in range(i - 10, i)])
if avg20_line < 10:
if data["macd"][i] < 0:
buy = min(data["open"][i], data["close"][i])
weight = 1
type = 1
return buy, weight, type
"""
return buy, weight, type
def getSellPriceAndWeight_122630(self, data, i):
sell, weight, type = -1, -1, -1
START_TIME_INDEX = 0
for c in range(370, len(data.index)):
if data.index[c].strftime("%H:%M:%S") == "09:01:00":
START_TIME_INDEX = c
break
if i > START_TIME_INDEX:
# 매도 분석
if data['changeLine'][i - 1] >= data['laggingSpan'][i - 1] and data['laggingSpan'][i] < data['changeLine'][i]:
changeLine_count = sum([1 if data['changeLine'][c] <= data['laggingSpan'][c] else 0 for c in range(i - 20, i)])
if changeLine_count >= 17:
sell = min(data["open"][i], data["close"][i])
weight = 1
type = 1
return sell, weight, type
return sell, weight, type
def analyze(self, result):
# 기본 캔들 정보
open = result["open"]
@@ -708,8 +768,12 @@ class BuySellChecker:
bsLine['sell_weight'] = [-1 for i in range(size)]
for i in range(size):
buy, buy_weight, buy_type = self.getBuyPriceAndWeight(data, i)
sell, sell_weight, sell_type = self.getSellPriceAndWeight(data, i)
if stock_code == "252670":
buy, buy_weight, buy_type = self.getBuyPriceAndWeight(data, i)
sell, sell_weight, sell_type = self.getSellPriceAndWeight(data, i)
else:
buy, buy_weight, buy_type = self.getBuyPriceAndWeight_122630(data, i)
sell, sell_weight, sell_type = self.getSellPriceAndWeight_122630(data, i)
if buy > -1 or self.BUY_COUNT == 1:
if buy == -1 or self.BUY_COUNT == 1: