diff --git a/app/config.py b/app/config.py index 4cab20d..fd1a5c1 100644 --- a/app/config.py +++ b/app/config.py @@ -8,11 +8,12 @@ STRATEGY_K = 0.5 ENTRY_START = "09:05" ENTRY_END = "14:30" FORCE_EXIT = "14:50" # 절대 변경 불가 -TP1_PCT = 0.02 # 1차 익절 +2% → 50% 매도 -TP2_PCT = 0.03 # 2차 익절 +3% → 전량 -SL_PCT = 0.015 # 손절 -1.5% +TP1_PCT = 0.015 # 1차 익절 +1.5% → 70% 매도 +TP2_PCT = 0.025 # 2차 익절 +2.5% → 전량 +TP1_RATIO = 0.70 # TP1 시 매도 비율 +SL_PCT = 0.020 # 손절 -2.0% MAX_HOLD_MIN = 120 -TICKER_REENTRY_COOLDOWN_MIN = 30 # 동일 종목 재진입 금지 시간(분) +TICKER_REENTRY_COOLDOWN_MIN = 60 # 동일 종목 재진입 금지 시간(분) # ── 리스크 ── POS_SIZE_PCT = 0.20 diff --git a/app/main.py b/app/main.py index 021e747..97bee46 100644 --- a/app/main.py +++ b/app/main.py @@ -488,6 +488,7 @@ class StockBot: except Exception as e: logger.error(f"청산 체크 오류 {ticker}: {type(e).__name__}: {e}") + await asyncio.sleep(5) async def _do_exit(self, ticker: str, pos: dict, current: float, qty: int, reason: str): diff --git a/app/strategy/volatility_breakout.py b/app/strategy/volatility_breakout.py index e0b2fa8..1916b89 100644 --- a/app/strategy/volatility_breakout.py +++ b/app/strategy/volatility_breakout.py @@ -8,7 +8,7 @@ import logging import os from datetime import datetime from app.config import ( - STRATEGY_K, TP1_PCT, TP2_PCT, + STRATEGY_K, TP1_PCT, TP2_PCT, TP1_RATIO, ENTRY_START, ENTRY_END, AI_CONTEXT_PATH, AI_MIN_SCORE, AI_BOOST_MULTI, MIN_TRADE_AMOUNT, @@ -209,12 +209,12 @@ class VolatilityBreakout: }) return result - # 2차 익절 + # 2차 익절 — 잔여 전량 청산 if current_price >= tp2_price: result.update({ "signal": True, "reason": "TP2", - "qty" : qty - (qty // 2 if not tp1_done else 0), + "qty" : qty, "price" : tp2_price, }) return result @@ -224,7 +224,7 @@ class VolatilityBreakout: result.update({ "signal": True, "reason": "TP1", - "qty" : qty // 2, + "qty" : max(1, int(qty * TP1_RATIO)), "price" : tp1_price, }) return result