init
This commit is contained in:
@@ -176,6 +176,9 @@ class HTS_etf(HTS):
|
||||
print("TIMECHECK: %s, code: %s, buy: %d, sell: %d, avg5: %.2f, avg30: %.2f, open: %d, high: %d, low: %d, slow_k: %.2f" %
|
||||
(str(THIS_TIME), stock_code, bs_buy_price, bs_sell_price, data["avg5"][0], data["avg30"][0], data["open"][0], data["high"][0], data["low"][0], data["slow_k"][0]))
|
||||
|
||||
if THIS_TIME.strftime("%M") == "00" or THIS_TIME.strftime("%M") == "05":
|
||||
self.slackBot.post_live_to_slack(stock_code)
|
||||
|
||||
time.sleep(60)
|
||||
THIS_TIME = datetime.now()
|
||||
|
||||
|
||||
@@ -177,6 +177,9 @@ class HTS_etf(HTS):
|
||||
print("TIMECHECK: %s, code: %s, buy: %d, sell: %d, avg5: %.2f, avg30: %.2f, open: %d, high: %d, low: %d, slow_k: %.2f" %
|
||||
(str(THIS_TIME), stock_code, bs_buy_price, bs_sell_price, data["avg5"][0], data["avg30"][0], data["open"][0], data["high"][0], data["low"][0], data["slow_k"][0]))
|
||||
|
||||
if THIS_TIME.strftime("%M") == "00" or THIS_TIME.strftime("%M") == "05":
|
||||
self.slackBot.post_live_to_slack(stock_code)
|
||||
|
||||
time.sleep(60)
|
||||
THIS_TIME = datetime.now()
|
||||
|
||||
|
||||
@@ -20,6 +20,21 @@ class SlackBot:
|
||||
|
||||
return
|
||||
|
||||
def post_live_to_slack(self, stock_code):
|
||||
try:
|
||||
this_time = datetime.now()
|
||||
text = "ALIVE (" + this_time.strftime('%Y-%m-%d %H:%M:%S') + ") " + stock_code
|
||||
result = self.client.chat_postMessage(
|
||||
channel=self.CHANNEL_ID,
|
||||
text=text
|
||||
)
|
||||
print(text)
|
||||
|
||||
except SlackApiError as e:
|
||||
print(f"Error posting message: {e}")
|
||||
|
||||
return
|
||||
|
||||
def post_to_slack(self, stock_code, stock_name, type, price, count):
|
||||
try:
|
||||
this_time = datetime.now()
|
||||
|
||||
Reference in New Issue
Block a user