This commit is contained in:
dsyoon
2023-10-16 12:21:43 +09:00
parent 4c558cead7
commit 149f3a45e2
3 changed files with 18 additions and 11 deletions

View File

@@ -218,7 +218,7 @@ class BuySellChecker:
def getBuyPriceAndWeight(self, i, data):
def getBuyPriceAndWeight(self, stock_code, i, data):
buy, weight = -1, -1
if i < 40:
@@ -256,13 +256,19 @@ class BuySellChecker:
if i > 30 and data['macd'][i] < min_macd + (-min_macd * 0.4):
buy, weight = data['close'][i], 1
"""
if data['macd'][i] < -4:
if data['open'][i - 1] < data['close'][i - 1] and data['volume'][i - 1] < data['volume'][i]:
buy, weight = data['close'][i], 1
if stock_code == '252670' or stock_code == '251340':
if data['macd'][i] < -4:
if data['open'][i - 1] < data['close'][i - 1] and data['volume'][i - 1] < data['volume'][i]:
buy, weight = data['close'][i], 1
elif stock_code == '122630' or stock_code == '233740':
if data['macd'][i] < -10:
if data['open'][i - 1] < data['close'][i - 1] and data['volume'][i - 1] < data['volume'][i]:
buy, weight = data['close'][i], 1
return buy, weight
def getSellPriceAndWeight(self, i, data):
def getSellPriceAndWeight(self, stock_code, i, data):
sell, weight = -1, -1
# 1) 스토캐스틱 과매수
@@ -408,8 +414,8 @@ class BuySellChecker:
# isRealTime=True, 실시간 적용
last_index = size - 1
buy, buy_weight = self.getBuyPriceAndWeight(last_index, data)
sell, sell_weight = self.getSellPriceAndWeight(last_index, data)
buy, buy_weight = self.getBuyPriceAndWeight(stock_code, last_index, data)
sell, sell_weight = self.getSellPriceAndWeight(stock_code, last_index, data)
if data.index[last_index].strftime('%H:%M:%S') > datetime.strptime(datetime.today().strftime("%Y-%m-%d 15:10:00"), "%Y-%m-%d %H:%M:%S").strftime('%H:%M:%S'):
buy, buy_weight = -1, -1
@@ -427,8 +433,8 @@ class BuySellChecker:
for last_index in range(size):
buy, buy_weight = self.getBuyPriceAndWeight(last_index, data)
sell, sell_weight = self.getSellPriceAndWeight(last_index, data)
buy, buy_weight = self.getBuyPriceAndWeight(stock_code, last_index, data)
sell, sell_weight = self.getSellPriceAndWeight(stock_code, last_index, data)
bsLine['buy'][last_index] = buy
bsLine['buy_weight'][last_index] = buy_weight