init
This commit is contained in:
14
monitor.py
14
monitor.py
@@ -319,7 +319,7 @@ class Monitor(HTS):
|
|||||||
|
|
||||||
if data['signal'].iloc[-1] in ['movingaverage', 'deviation40', 'deviation240', 'deviation1440']:
|
if data['signal'].iloc[-1] in ['movingaverage', 'deviation40', 'deviation240', 'deviation1440']:
|
||||||
if check_5_week_lowest:
|
if check_5_week_lowest:
|
||||||
buy_amount *= 4
|
buy_amount *= 2
|
||||||
|
|
||||||
# 분봉 시스널이 없을 때는 이전 봉보다 높으면 60분 마다 매수
|
# 분봉 시스널이 없을 때는 이전 봉보다 높으면 60분 마다 매수
|
||||||
if data['point'].iloc[-1] != 1:
|
if data['point'].iloc[-1] != 1:
|
||||||
@@ -330,7 +330,7 @@ class Monitor(HTS):
|
|||||||
print(f"{symbol}: 매수 금지 중 (남은 시간: {3600 - time_diff.total_seconds():.0f}초)")
|
print(f"{symbol}: 매수 금지 중 (남은 시간: {3600 - time_diff.total_seconds():.0f}초)")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
_ = self.hts.buyCoinMarket(symbol, buy_amount)
|
buy_amount = self.hts.buyCoinMarket(symbol, buy_amount)
|
||||||
|
|
||||||
if self.cooldown_file is not None:
|
if self.cooldown_file is not None:
|
||||||
# 최근 매수 신호를 함께 기록하여 [신규] 포맷으로 저장
|
# 최근 매수 신호를 함께 기록하여 [신규] 포맷으로 저장
|
||||||
@@ -343,7 +343,7 @@ class Monitor(HTS):
|
|||||||
self._save_buy_cooldown()
|
self._save_buy_cooldown()
|
||||||
|
|
||||||
print(f"{KR_COINS[symbol]} ({symbol}) [{data['signal'].iloc[-1]}], 현재가: {data['Close'].iloc[-1]:.4f}, 20분간 매수 금지 시작")
|
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:
|
except Exception as e:
|
||||||
print(f"Error buying {symbol}: {str(e)}")
|
print(f"Error buying {symbol}: {str(e)}")
|
||||||
return False
|
return False
|
||||||
@@ -454,9 +454,11 @@ class Monitor(HTS):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
# ------------- Formatting -------------
|
# ------------- Formatting -------------
|
||||||
def format_message(self, market_type: str, symbol: str, symbol_name: str, close: float, signal: str) -> str:
|
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}): {signal} "
|
message = f"매수 [{market_type}] {symbol_name} ({symbol}): "
|
||||||
message += f"({'$' if market_type == 'US' else '₩'}{close:.4f})"
|
message += f"{'$' if market_type == 'US' else '₩'}{close:.4f}"
|
||||||
|
message += f"({'$' if market_type == 'US' else '₩'}{buy_amount:.4f})"
|
||||||
|
message += f"[{signal}]"
|
||||||
return message
|
return message
|
||||||
|
|
||||||
def format_ma_message(self, info: dict, market_type: str) -> str:
|
def format_ma_message(self, info: dict, market_type: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user