레디스 및 구조 수정중

This commit is contained in:
2026-02-25 16:56:34 +09:00
parent 89f54bae55
commit ec02f27200
10 changed files with 428 additions and 131 deletions

View File

@@ -7,12 +7,20 @@ RSI + 볼린저 밴드 평균회귀 전략 (CLAUDE.md 섹션 7.1-7.5)
① R:R 개선: 손절 -8%→-6%, 1차 익절 RSI 45~50→55~65, 트레일링 스탑 도입
② 진입 기회 확대: BULL RSI ≤25 → ≤30 (2배 증가)
③ 동적 포지션 사이징: RSI/ADX 기반 4~8% 다이나믉 비중
[.env 설정]
MEAN_REVERSION_RSI_THRESHOLD
MEAN_REVERSION_MULTIPLIER_STRONG
MEAN_REVERSION_MULTIPLIER_NORMAL
MEAN_REVERSION_MULTIPLIER_WEAK
"""
import logging
from typing import Optional, Dict, List, Tuple
from dataclasses import dataclass
from enum import Enum
from app.core.config import settings
logger = logging.getLogger(__name__)
@@ -208,7 +216,7 @@ def check_buy_signal(
return None
if regime == MarketRegime.BULL:
rsi_ok = rsi <= 30 # ← 25 → 30으로 완화: 진입 기회 ~2배 증가
rsi_ok = rsi <= settings.MEAN_REVERSION_RSI_THRESHOLD # ← 30 (또는 .env 설정값)
vol_ok = current_volume >= avg_volume_20d * 2 # 거래량 20일평균 200% 이상
if rsi_ok or (vol_ok and rsi <= 50): # vol_ok 단독 시 RSI 50 상한 (과열 진입 차단)
bb_low_minus = bb_lower * 0.97 # -3%
@@ -357,13 +365,13 @@ def calculate_position_size(
# RSI 기반 동적 변수 스케일링
if rsi is not None:
if rsi <= 20:
multiplier = 1.50 # 군도 과매도 → 6%
multiplier = settings.MEAN_REVERSION_MULTIPLIER_STRONG # 강한 과매도 신호
elif rsi <= 25:
multiplier = 1.25 # 강한 신호 → 5%
multiplier = settings.MEAN_REVERSION_MULTIPLIER_NORMAL # 강한 신호
else:
multiplier = 1.00 # 표준 → 4%
multiplier = settings.MEAN_REVERSION_MULTIPLIER_WEAK # 표준 신호
else:
multiplier = 1.00
multiplier = settings.MEAN_REVERSION_MULTIPLIER_WEAK
# ADX < 15: 특돉한 회황장 → +0.25× 비중 보너스 (최대 2.0× = 8%)
if adx is not None and adx < 15: