This commit is contained in:
dsyoon
2023-11-05 19:28:12 +09:00
parent e4a3d6c412
commit e832b629e1
12 changed files with 546 additions and 157 deletions

View File

@@ -124,6 +124,7 @@ class BuySellChecker:
return False
"""
def getBuyPriceAndWeight_122630(self, i, data):
buy, weight = -1, -1
@@ -277,7 +278,7 @@ class BuySellChecker:
sell, weight = data['close'][i], 1
return sell, weight
"""
def analyze(self, result):
@@ -388,6 +389,7 @@ class BuySellChecker:
data = data.fillna(-1)
return data
"""
def checkTransaction(self, stock_code, data, data_5=None, data_30=None, isRealTime=True):
# 어제 오늘 데이터로 분석
bsLine = {}
@@ -429,53 +431,8 @@ class BuySellChecker:
return bsLine
def checkTransactionML(self, data, stock_code, predY, isRealTime=True):
# 4일치 중에서 앞에 2일은 제거한다.
date = data['date'].dt.date.unique().tolist()
data = data[data['date'].dt.date != date[0]]
data = data[data['date'].dt.date != date[1]]
"""
# 어제 오늘 데이터로 분석
bsLine = {}
size = len(data["close"])
if isRealTime:
# isRealTime=True, 실시간 적용
last_index = size - 1
# Type=False, 시뮬레이션 적용
bsLine['buy'] = [-1 for i in range(size)]
bsLine['buy_weight'] = [-1 for i in range(size)]
bsLine['sell'] = [-1 for i in range(size)]
bsLine['sell_weight'] = [-1 for i in range(size)]
sell, sell_weight, buy, buy_weight = -1, -1, -1, -1
if predY[last_index] == 1:
sell = int((data["open"][last_index] + data["close"][last_index]) / 2)
sell_weight = 1
elif predY[last_index] == 2:
buy = int((data["open"][last_index] + data["close"][last_index]) / 2)
buy_weight = 1
bsLine['buy'] = [buy]
bsLine['buy_weight'] = [buy_weight]
bsLine['sell'] = [sell]
bsLine['sell_weight'] = [sell_weight]
else:
# Type=False, 시뮬레이션 적용
bsLine['buy'] = [-1 for i in range(size)]
bsLine['buy_weight'] = [-1 for i in range(size)]
bsLine['sell'] = [-1 for i in range(size)]
bsLine['sell_weight'] = [-1 for i in range(size)]
for i in range(size):
if predY[i] == 1:
bsLine['sell'][i] = int((data["open"][i] + data["close"][i]) / 2)
bsLine['sell_weight'][i] = 1
elif predY[i] == 2:
bsLine['buy'][i] = int((data["open"][i] + data["close"][i]) / 2)
bsLine['buy_weight'][i] = 1
return bsLine, data
# middle line에 맞다은 적 없이, low line에 붙었거나 아래에 있었던 캔들의 높은 가격을 얻어옴
def getPrice_UnderLowWithoutMiddle(self, last_index, data):