init
This commit is contained in:
14
HTS_etf.py
14
HTS_etf.py
@@ -9,7 +9,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
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class HTS_etf(HTS):
|
||||
orderChecker = None
|
||||
buySellChecker = None
|
||||
labelChecker = None
|
||||
slackBot = None
|
||||
bot = None
|
||||
stockStatus = None
|
||||
|
||||
def __init__(self, RESOURCE_PATH, stock_code, stock_name, SELL_GAP):
|
||||
@@ -36,7 +36,7 @@ class HTS_etf(HTS):
|
||||
self.orderChecker = OrderChecker(self.RESOURCE_PATH, self.stock_code)
|
||||
self.buySellChecker = BuySellChecker()
|
||||
self.labelChecker = LabelChecker(RESOURCE_PATH)
|
||||
self.slackBot = SlackBot()
|
||||
self.bot = TelegramBot()
|
||||
self.stockStatus = StockStatus(RESOURCE_PATH)
|
||||
|
||||
return
|
||||
@@ -132,7 +132,7 @@ class HTS_etf(HTS):
|
||||
def buyRealTime(self, today, analyzed_day=1000, MAX_PRICE=10000, logFp=None):
|
||||
rsi = self.getTodayRSI()
|
||||
if rsi > 79:
|
||||
self.slackBot.sendMsg("exit... {} ({}) RSI: {}".format(self.stock_code, self.stock_name, rsi))
|
||||
self.bot.sendMsg("exit... {} ({}) RSI: {}".format(self.stock_code, self.stock_name, rsi))
|
||||
return
|
||||
|
||||
print("START...")
|
||||
@@ -142,9 +142,9 @@ class HTS_etf(HTS):
|
||||
|
||||
while datetime.strptime(today + " 063000", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 153100",'%Y%m%d %H%M%S'):
|
||||
if THIS_TIME < datetime.strptime(today + " 085500", '%Y%m%d %H%M%S'):
|
||||
self.slackBot.sendMsg("WAIT... {} ({}) RSI: {}".format(self.stock_code, self.stock_name, rsi))
|
||||
self.bot.sendMsg("WAIT... {} ({}) RSI: {}".format(self.stock_code, self.stock_name, rsi))
|
||||
if datetime.strptime(today + " 090000", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 090100", '%Y%m%d %H%M%S'):
|
||||
self.slackBot.sendMsg("START... {} ({}) RSI: {}".format(self.stock_code, self.stock_name, rsi))
|
||||
self.bot.sendMsg("START... {} ({}) RSI: {}".format(self.stock_code, self.stock_name, rsi))
|
||||
logFp.write("START {} ({}) RSI: {}\n".format(self.stock_code, self.stock_name, rsi))
|
||||
|
||||
if datetime.strptime(today + " 090000", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 151500", '%Y%m%d %H%M%S'):
|
||||
@@ -205,7 +205,7 @@ class HTS_etf(HTS):
|
||||
(str(THIS_TIME), self.stock_code, bs_buy_price, bs_sell_price, data["open"][len(data["open"])-1], data["close"][len(data["close"])-1], data["high"][len(data["high"])-1], data["low"][len(data["low"])-1], data["macd"][len(data["macd"])-1]))
|
||||
|
||||
if (int(THIS_TIME.strftime("%M")) % 50 == 0 or int(THIS_TIME.strftime("%M")) % 20 == 0):
|
||||
self.slackBot.post_live_to_slack(self.stock_code, self.stock_name, data["close"][len(data["close"])-1], data["macd"][len(data["macd"])-1])
|
||||
self.bot.alarm_live(self.stock_code, self.stock_name, data["close"][len(data["close"])-1], data["macd"][len(data["macd"])-1])
|
||||
|
||||
logFp.flush()
|
||||
time.sleep(60)
|
||||
|
||||
Reference in New Issue
Block a user