init
This commit is contained in:
27
monitor.py
27
monitor.py
@@ -227,21 +227,21 @@ class Monitor(HTS):
|
||||
# ------------- Strategy -------------
|
||||
def buy_sell_ticker_1h(self, symbol: str, data: pd.DataFrame, balances=None, is_inverse: bool = False) -> bool:
|
||||
try:
|
||||
# BUY_MINUTE_LIMIT 이내라면 매수하지 않음
|
||||
current_time = datetime.now()
|
||||
last_buy_dt = self.buy_cooldown.get(symbol, {}).get('buy', {}).get('datetime')
|
||||
if last_buy_dt:
|
||||
time_diff = current_time - last_buy_dt
|
||||
if time_diff.total_seconds() < BUY_MINUTE_LIMIT:
|
||||
print(f"{symbol}: 매수 금지 중 (남은 시간: {BUY_MINUTE_LIMIT - time_diff.total_seconds():.0f}초)")
|
||||
return False
|
||||
|
||||
# 신호 생성 및 최신 포인트 확인
|
||||
data = self.annotate_signals(symbol, data)
|
||||
if data['point'].iloc[-1] != 1:
|
||||
return False
|
||||
|
||||
if is_inverse:
|
||||
# BUY_MINUTE_LIMIT 이내라면 매수하지 않음
|
||||
current_time = datetime.now()
|
||||
last_buy_dt = self.buy_cooldown.get(symbol, {}).get('sell', {}).get('datetime')
|
||||
if last_buy_dt:
|
||||
time_diff = current_time - last_buy_dt
|
||||
if time_diff.total_seconds() < BUY_MINUTE_LIMIT:
|
||||
print(f"{symbol}: 매수 금지 중 (남은 시간: {BUY_MINUTE_LIMIT - time_diff.total_seconds():.0f}초)")
|
||||
return False
|
||||
|
||||
# 인버스 데이터: 매수 신호를 매도로 처리 (fall_6p, deviation40 만 허용)
|
||||
# 허용된 인버스 매도 신호만 처리
|
||||
last_signal = str(data['signal'].iloc[-1]) if 'signal' in data.columns else ''
|
||||
@@ -271,6 +271,15 @@ class Monitor(HTS):
|
||||
else:
|
||||
check_5_week_lowest = False
|
||||
|
||||
# BUY_MINUTE_LIMIT 이내라면 매수하지 않음
|
||||
current_time = datetime.now()
|
||||
last_buy_dt = self.buy_cooldown.get(symbol, {}).get('buy', {}).get('datetime')
|
||||
if last_buy_dt:
|
||||
time_diff = current_time - last_buy_dt
|
||||
if time_diff.total_seconds() < BUY_MINUTE_LIMIT:
|
||||
print(f"{symbol}: 매수 금지 중 (남은 시간: {BUY_MINUTE_LIMIT - time_diff.total_seconds():.0f}초)")
|
||||
return False
|
||||
|
||||
try:
|
||||
# 5주봉이 20주봉이나 40주봉보다 아래에 있는지 체크
|
||||
# Convert hourly data to week-based rolling periods (5, 20, 40 weeks)
|
||||
|
||||
Reference in New Issue
Block a user