From f40856c25a0af01430388e6e6c0de068ac4a721d Mon Sep 17 00:00:00 2001 From: jongjae Date: Fri, 22 May 2026 18:09:48 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=84=EB=9E=B5=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=20=EC=A1=B0=EC=A0=95=20=E2=80=94=20SL=20?= =?UTF-8?q?=EC=99=84=ED=99=94=C2=B7TP=20=EA=B5=AC=EA=B0=84=20=EC=B6=95?= =?UTF-8?q?=EC=86=8C=C2=B7=EC=9E=AC=EC=A7=84=EC=9E=85=20=EC=BF=A8=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=20=EC=97=B0=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SL: -1.5% → -2.0% (개장 노이즈 손절 방지) - TP1: +2.0% → +1.5%, 매도 비율 50% → 70% (확정 빈도 향상) - TP2: +3.0% → +2.5% (달성률 개선) - 재진입 쿨다운: 30분 → 60분 (동일 종목 반복 손절 차단) - main.py: 청산 체크 오류 시 5초 대기 추가 (API 과부하 방지) - volatility_breakout.py: TP2 qty 버그 수정 (tp1_done=False 시 전량 청산) Co-Authored-By: Claude Sonnet 4.6 --- app/config.py | 9 +++++---- app/main.py | 1 + app/strategy/volatility_breakout.py | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) 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