From a5d3fd1c42e40af2ba3a5067e84bae5c483d581a Mon Sep 17 00:00:00 2001 From: dsyoon Date: Mon, 1 Sep 2025 21:21:26 +0900 Subject: [PATCH] init --- monitor.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/monitor.py b/monitor.py index b5519dc..c3622b4 100644 --- a/monitor.py +++ b/monitor.py @@ -319,7 +319,7 @@ class Monitor(HTS): if data['signal'].iloc[-1] in ['movingaverage', 'deviation40', 'deviation240', 'deviation1440']: if check_5_week_lowest: - buy_amount *= 4 + buy_amount *= 2 # 분봉 시스널이 없을 때는 이전 봉보다 높으면 60분 마다 매수 if data['point'].iloc[-1] != 1: @@ -330,7 +330,7 @@ class Monitor(HTS): print(f"{symbol}: 매수 금지 중 (남은 시간: {3600 - time_diff.total_seconds():.0f}초)") return False - _ = self.hts.buyCoinMarket(symbol, buy_amount) + buy_amount = self.hts.buyCoinMarket(symbol, buy_amount) if self.cooldown_file is not None: # 최근 매수 신호를 함께 기록하여 [신규] 포맷으로 저장 @@ -343,7 +343,7 @@ class Monitor(HTS): self._save_buy_cooldown() print(f"{KR_COINS[symbol]} ({symbol}) [{data['signal'].iloc[-1]}], 현재가: {data['Close'].iloc[-1]:.4f}, 20분간 매수 금지 시작") - self.sendMsg("[KRW-COIN]" + "\n" + self.format_message('COIN', symbol, KR_COINS[symbol], data['Close'].iloc[-1], data['signal'].iloc[-1])) + self.sendMsg("{}".format(self.format_message('COIN', symbol, KR_COINS[symbol], data['Close'].iloc[-1], data['signal'].iloc[-1], buy_amount))) except Exception as e: print(f"Error buying {symbol}: {str(e)}") return False @@ -454,9 +454,11 @@ class Monitor(HTS): return data # ------------- Formatting ------------- - def format_message(self, market_type: str, symbol: str, symbol_name: str, close: float, signal: str) -> str: - message = f"• 매수 [{market_type}] {symbol_name} ({symbol}): {signal} " - message += f"({'$' if market_type == 'US' else '₩'}{close:.4f})" + def format_message(self, market_type: str, symbol: str, symbol_name: str, close: float, signal: str, buy_amount: float) -> str: + message = f"매수 [{market_type}] {symbol_name} ({symbol}): " + message += f"{'$' if market_type == 'US' else '₩'}{close:.4f}" + message += f"({'$' if market_type == 'US' else '₩'}{buy_amount:.4f})" + message += f"[{signal}]" return message def format_ma_message(self, info: dict, market_type: str) -> str: