Reference in New Issue
Block a user
Delete Branch "feature/issue-164-165-broker-api-holdings"
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?
배경
PR #167, #168에서 DB 기반으로 SELL 수량과 보유 종목을 조회했으나, 유저 피드백에 따라 재검토.
문제: DB의
quantity필드는 주문 수량이지 체결 수량이 아님.해결책
브로커 잔고 API (
get_balance()output1)를 source of truth로 사용.trading_cycle은 이미 각 종목마다get_balance()를 호출하고 있으므로 추가 API 호출 없음.변경 내용
_extract_held_qty_from_balance()신규_determine_order_quantity()수정_extract_held_codes_from_balance()신규실시간 루프 보유 종목 병합
테스트
TestExtractHeldQtyFromBalance— 7개 (국내/해외/fallback/미보유/케이스 무관)TestExtractHeldCodesFromBalance— 4개 (qty>0 포함, qty=0 제외 등)TestDetermineOrderQuantity— 5개 (SELL qty, BUY sizing)test_sell_order_uses_broker_balance_qty_not_db— DB 10주 vs 브로커 5주 → 5주 사용 검증Closes #164
Closes #165
Supersedes #167, #168 (closed)
🤖 Generated with Claude Code