fix: 해외잔고 ord_psbl_qty 우선 적용 및 ghost position SELL 반복 방지 (#235) #236
Reference in New Issue
Block a user
Delete Branch "feature/issue-235-overseas-balance-ord-psbl-qty"
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
Closes #235
근본 원인
모의투자 잔고내역이 없습니다오류가 반복된 두 가지 원인:필드 오류 (주요 원인)
_extract_held_codes_from_balance/_extract_held_qty_from_balance가 해외 잔고에서ovrs_cblc_qty(총 보유수량)를 사용ord_psbl_qty(주문가능수량)ovrs_cblc_qty=289456이지만ord_psbl_qty=0→ 실제 매도 불가한데 startup sync가 포지션으로 기록하고 SELL 반복 시도Ghost position 무한 반복
변경 내용
src/main.pyovrs_cblc_qty→ord_psbl_qty우선 (fallback 유지), ghost-close 처리 추가tests/test_main.pyord_psbl_qty=0인 종목 제외 확인 4개 테스트, ghost-close 2개 테스트 추가효과
Test plan
TestExtractHeldQtyFromBalance—ord_psbl_qty=0시 qty=0 반환TestExtractHeldCodesFromBalance—ord_psbl_qty=0인 종목 제외TestOverseasGhostPositionClose— ghost-close 로그 확인 / 일반 오류는 ghost-close 미실행🤖 Generated with Claude Code