This commit is contained in:
dsyoon
2023-10-16 16:50:15 +09:00
parent fadbff0780
commit 420b1a40f1
5 changed files with 12 additions and 13 deletions

View File

@@ -20,15 +20,14 @@ class SlackBot:
return
def post_live_to_slack(self, stock_code, stock_name):
def post_live_to_slack(self, stock_code, stock_name, close, macd):
try:
this_time = datetime.now()
text = "ALIVE (" + this_time.strftime('%Y-%m-%d %H:%M:%S') + ") " + stock_code + "(" + stock_name +")"
text = "ALIVE ({}, {}, {}, close: {}, macd: {:.2f}".format(this_time.strftime('%Y-%m-%d %H:%M:%S'), stock_code, stock_name, close, macd)
result = self.client.chat_postMessage(
channel=self.CHANNEL_ID,
text=text
)
print(text)
except SlackApiError as e:
print(f"Error posting message: {e}")