This commit is contained in:
dsyoon
2023-10-26 23:03:30 +09:00
parent 9d8f174ec6
commit 1489508d8e
13 changed files with 181 additions and 96 deletions

View File

@@ -10,7 +10,7 @@ from hts.OrderType import OrderType
from hts.BuySellChecker import BuySellChecker
from hts.OrderChecker import OrderChecker
from stock.util.LabelChecker import LabelChecker
from stock.util.SlackBot import SlackBot
from stock.util.TelegramBot import TelegramBot
from stock.analysis.StockStatus import StockStatus
class HTS_etf (HTS):
@@ -21,7 +21,7 @@ class HTS_etf (HTS):
orderChecker = None
buySellChecker = None
labelChecker = None
slackBot = None
bot = None
stockStatus = None
def __init__(self, RESOURCE_PATH):
@@ -32,7 +32,7 @@ class HTS_etf (HTS):
self.orderChecker = OrderChecker(self.RESOURCE_PATH, "ETF")
self.buySellChecker = BuySellChecker()
self.labelChecker = LabelChecker(RESOURCE_PATH)
self.slackBot = SlackBot()
self.bot = TelegramBot()
self.stockStatus = StockStatus(RESOURCE_PATH)
return
@@ -60,7 +60,7 @@ class HTS_etf (HTS):
if jangoDic[code]['매도가능'] > 0:
if 2 < jangoDic[code]['평가손익']:
self.requestOrder(OrderType.sell, code[1:], jangoDic[code]['매도가능'], bs_sell_price)
self.slackBot.post_to_slack(code, jangoDic[code]['종목명'], "SELL", bs_sell_price, jangoDic[code]['매도가능'])
self.bot.post(code, jangoDic[code]['종목명'], "SELL", bs_sell_price, jangoDic[code]['매도가능'])
check = True
else:
continue
@@ -70,7 +70,7 @@ class HTS_etf (HTS):
# 3% 이상 시 수익 매도
currentStock = self.currentStock(code[1:])
self.requestOrder(OrderType.sell, code[1:], jangoDic[code]['매도가능'], currentStock['close'])
self.slackBot.post_to_slack(code, jangoDic[code]['종목명'], "SELL", currentStock['close'], jangoDic[code]['매도가능'])
self.bot.post(code, jangoDic[code]['종목명'], "SELL", currentStock['close'], jangoDic[code]['매도가능'])
check = True
return check
@@ -281,8 +281,8 @@ class HTS_etf (HTS):
orderNum = self.requestOrder(OrderType.buy, stock['stock_code'], buy_count , bs_buy_price)
self.orderChecker.buy(today, "A" + stock['stock_code'], buy_count, bs_buy_price, orderNum)
# slackbot에 메시지를 보냄
self.slackBot.post_to_slack(stock['stock_code'], stock['stock_name'], "BUY", bs_buy_price, buy_count)
# bot에 메시지를 보냄
self.bot.post(stock['stock_code'], stock['stock_name'], "BUY", bs_buy_price, buy_count)
# 로그 출력
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock['stock_code'], stock['stock_name'], bs_buy_price, buy_count)