fix: use actual held quantity for SELL orders instead of hardcoded 1 (#164) #167

Closed
agentson wants to merge 1 commits from feature/issue-164-sell-quantity-fix into main

1 Commits

Author SHA1 Message Date
agentson
1adb85926d fix: use actual held quantity for SELL orders instead of hardcoded 1 (#164)
Some checks failed
CI / test (pull_request) Has been cancelled
_determine_order_quantity()에서 SELL 시 항상 1을 반환하던 버그 수정.
DB에서 실제 보유 수량을 조회해 전량 청산이 가능하도록 변경.

- _determine_order_quantity에 open_position 파라미터 추가
- SELL 시 open_position["quantity"] 반환, 포지션 없으면 0 반환
- trading_cycle 및 run_daily_session 호출 지점 모두 수정
- _determine_order_quantity 임포트 및 유닛 테스트 클래스 추가 (6개)
- SELL 실제 수량 사용 통합 테스트 추가 (quantity=5 검증)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 03:03:50 +09:00