Files
auto-stock/backend/tests/test_entry_throughput_config.py
shuim 9774c1249b fix: 진입이 최소주문금액에 막혀 거래가 안 나던 문제 — 15만원으로 하향 + 종목당 4%
로그 집계(2026-09-23): 진입 차단 141건이 min_amount_guard. 최소 주문금액 50만원이
종목당 예산(총자산 982만×6%≈59만)과 거의 같아, 신뢰도·현금 보정으로 20~30만원이 되면
전부 탈락했다(기아 230,800원·엘앤에프 217,000원 등).
- MIN_BUY_AMOUNT_KRW 500,000 → 150,000
- MAX_POSITION_SIZE 0.06 → 0.04 (종목당 금액을 낮추고 동시 보유 종목 수를 늘려 표본 확보)
- AI 분석 매수 추천 금액의 신뢰도 하한 0.5 → 0.8 (과도 축소 방지)
- 설정 관계를 테스트로 고정(최소주문 ≤ 종목당 예산의 50%, 스윙 상한 내 10종목 이상)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-23 14:40:18 +09:00

28 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""진입이 차단되지 않도록 하는 설정 관계 검증.
2026-09-23: 최소 주문금액(50만)이 종목당 예산(총자산×6%≈59만)과 거의 같아,
신뢰도·현금 보정으로 조금만 깎여도 전부 탈락했다(하루 141건 min_amount_guard).
"""
import pytest
from app.core.config import settings
def test_min_buy_amount_is_well_below_position_budget():
"""1,000만원 계좌 기준 종목당 예산의 절반 이하여야 보정 후에도 주문이 살아남는다."""
budget = 10_000_000 * settings.MAX_POSITION_SIZE
assert settings.MIN_BUY_AMOUNT_KRW <= budget * 0.5, (
f"최소주문 {settings.MIN_BUY_AMOUNT_KRW:,.0f} vs 종목당 예산 {budget:,.0f}"
)
def test_position_size_allows_enough_concurrent_holdings():
"""스윙 자본 상한 안에서 최소 10종목은 동시 보유할 수 있어야 표본이 쌓인다."""
swing_cap = getattr(settings, "SWING_MAX_CAPITAL_RATIO", 1.0)
assert swing_cap / settings.MAX_POSITION_SIZE >= 10
def test_values_are_intended():
assert settings.MAX_POSITION_SIZE == 0.04
assert settings.MIN_BUY_AMOUNT_KRW == 150_000