Reference in New Issue
Block a user
Delete Branch "feature/issue-251-252-trading-cycle-guards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
모니터링 중 발견된 두 버그를 수정합니다.
current_price=0시 stop-loss/take-profit 오발동 → HOLD가 잘못 SELL로 전환round(x, 4)→ KIS1$이상 소수점 2자리까지만 가능거절Root Cause & Fix
Fix 1: stop-loss 가드 (
src/main.py)현재가 API가 0.0을 반환하면
loss_pct = (0 - entry) / entry = -100%→ stop-loss 오발동.이로 인해
overseas_price=0→ORD_DVSN="01"(시장가)→주문구분 입력오류연쇄 발생.Fix 2: 해외 주문 가격 소수점 (
src/main.py)KIS API는 $1 이상 종목에 소수점 2자리 제한. 페니스탁(< $1)은 4자리 유지.
Test plan
test_stop_loss_not_triggered_when_current_price_is_zero— current_price=0일 때 SELL 주문 없음test_overseas_buy_price_rounded_to_2_decimals_for_dollar_plus_stock— $50 주식 → 2자리test_overseas_penny_stock_price_keeps_4_decimals— $0.57 주식 → 4자리Closes #251
Closes #252
🤖 Generated with Claude Code