This commit is contained in:
dsyoon
2023-01-26 10:41:26 +09:00
parent 72f04020d7
commit 372fc6f4ec

View File

@@ -120,19 +120,20 @@ class HTS_DAILY (HTS):
bsLine, data = self.buySellChecker.checkTransactionWithEnvelope(data, stock_code, self.analyzed_day, isRealTime=False)
# 다음 조건이면 매수한다.
if len(data.index) > 10 and max(bsLine['buy'][len(bsLine['buy']) - 1:]) > 1000 and not self.orderChecker.exist(stock_code):
last_index = len(bsLine['buy'])-1
if bsLine['buy'][last_index] > 0:
bs_buy_price = bsLine['buy'][last_index]
bs_buy_weight = bsLine['buy_weight'][last_index]
buy_count = int((self.MAX_BUY_PRICE*bs_buy_weight) / bs_buy_price)
if len(data.index) > 10 and max(bsLine['buy'][len(bsLine['buy']) - 1:]) > 1000:
if not self.orderChecker.exist(stock_code):
last_index = len(bsLine['buy'])-1
if bsLine['buy'][last_index] > 0:
bs_buy_price = bsLine['buy'][last_index]
bs_buy_weight = bsLine['buy_weight'][last_index]
buy_count = int((self.MAX_BUY_PRICE*bs_buy_weight) / bs_buy_price)
# 매수를 주문한다.
orderNum = self.requestOrder(OrderType.buy, stock_code, buy_count, bs_buy_price)
self.orderChecker.add(today, stock_code, 1, orderNum, buy_count, bs_buy_price)
# 매수를 주문한다.
orderNum = self.requestOrder(OrderType.buy, stock_code, buy_count, bs_buy_price)
self.orderChecker.add(today, stock_code, 1, orderNum, buy_count, bs_buy_price)
# 로그 출력
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock_code, stock_name, bs_buy_price, buy_count)
# 로그 출력
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock_code, stock_name, bs_buy_price, buy_count)
"""
# 다음 조건이면 매도한다.