init
This commit is contained in:
18
monitor.py
18
monitor.py
@@ -84,6 +84,14 @@ class Monitor:
|
|||||||
stock_client = telegram.Bot(token=STOCK_TELEGRAM_BOT_TOKEN)
|
stock_client = telegram.Bot(token=STOCK_TELEGRAM_BOT_TOKEN)
|
||||||
asyncio.run(stock_client.send_message(chat_id=STOCK_TELEGRAM_CHAT_ID, text=text))
|
asyncio.run(stock_client.send_message(chat_id=STOCK_TELEGRAM_CHAT_ID, text=text))
|
||||||
|
|
||||||
|
def sendMsg(self, msg):
|
||||||
|
try:
|
||||||
|
pool = Pool(12)
|
||||||
|
pool.map(self._send_coin_msg, [msg])
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error sending Telegram message: {str(e)}")
|
||||||
|
return
|
||||||
|
|
||||||
def send_coin_telegram_message(self, message_list: list[str], header: str) -> None:
|
def send_coin_telegram_message(self, message_list: list[str], header: str) -> None:
|
||||||
payload = header + "\n"
|
payload = header + "\n"
|
||||||
for i, message in enumerate(message_list):
|
for i, message in enumerate(message_list):
|
||||||
@@ -152,6 +160,8 @@ class Monitor:
|
|||||||
def buy_ticker(self, symbol: str, data: pd.DataFrame) -> bool:
|
def buy_ticker(self, symbol: str, data: pd.DataFrame) -> bool:
|
||||||
try:
|
try:
|
||||||
print('BUY: {}'.format(symbol))
|
print('BUY: {}'.format(symbol))
|
||||||
|
self.sendMsg('BUY: {}'.format(symbol))
|
||||||
|
|
||||||
check_5_week_lowest = False
|
check_5_week_lowest = False
|
||||||
|
|
||||||
# 5주봉이 20주봉이나 40주봉보다 아래에 있는지 체크
|
# 5주봉이 20주봉이나 40주봉보다 아래에 있는지 체크
|
||||||
@@ -224,13 +234,7 @@ class Monitor:
|
|||||||
self._save_buy_cooldown()
|
self._save_buy_cooldown()
|
||||||
|
|
||||||
print(f"{KR_COINS[symbol]} ({symbol}) [{data['buy_signal'].iloc[-1]}], 현재가: {data['Close'].iloc[-1]:.4f}, 20분간 매수 금지 시작")
|
print(f"{KR_COINS[symbol]} ({symbol}) [{data['buy_signal'].iloc[-1]}], 현재가: {data['Close'].iloc[-1]:.4f}, 20분간 매수 금지 시작")
|
||||||
try:
|
self.sendMsg("[KRW-COIN]" + "\n" + self.format_message('COIN', symbol, KR_COINS[symbol], data['Close'].iloc[-1], data['buy_signal'].iloc[-1]))
|
||||||
pool = Pool(12)
|
|
||||||
pool.map(self._send_coin_msg, [
|
|
||||||
"[KRW-COIN]" + "\n" + self.format_message('COIN', symbol, KR_COINS[symbol], data['Close'].iloc[-1], data['buy_signal'].iloc[-1])
|
|
||||||
])
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error sending Telegram message: {str(e)}")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error buying {symbol}: {str(e)}")
|
print(f"Error buying {symbol}: {str(e)}")
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user