수정사항

This commit is contained in:
2026-02-22 23:13:45 +09:00
parent e794267b96
commit d49c6209cb
3 changed files with 66 additions and 29 deletions

View File

@@ -381,6 +381,46 @@ def calculate_position_size(
return result
def calculate_position_size_v2(
total_assets: float,
available_cash: float,
current_strategy_allocation: float,
regime: MarketRegime,
rsi: Optional[float] = None,
adx: Optional[float] = None,
max_per_position: float = 0.04,
max_strategy_capital_bull: float = 0.70,
max_strategy_capital_bear: float = 0.30,
) -> float:
"""CLAUDE.md 섹션 6.1 + RSI/ADX 동적 포지션 사이징
calculate_position_size 기반으로 RSI·ADX 보정 추가:
- RSI ≤ 20: ×1.2 (깊은 과매도 = 더 유리한 진입)
- RSI ≤ 25: ×1.1
- ADX > 30: ×0.8 (강추세 중 평균회귀 위험 = 포지션 축소)
보정 후에도 종목당 4% 상한 재적용 (CLAUDE.md 절대 룰)
"""
base = calculate_position_size(
total_assets, available_cash, current_strategy_allocation,
regime, max_per_position, max_strategy_capital_bull, max_strategy_capital_bear,
)
if base <= 0:
return 0.0
mult = 1.0
if rsi is not None:
if rsi <= 20:
mult *= 1.2
elif rsi <= 25:
mult *= 1.1
if adx is not None and adx > 30:
mult *= 0.8
max_allowed = total_assets * max_per_position
return min(base * mult, max_allowed, available_cash)
def check_h1_breakout_with_ma5(
h1_closes: List[float],
h1_current_close: float,