feat: 해외주식 지정가 버퍼 최적화 BUY +0.2% / SELL -0.2% (#211) #230

Merged
jihoson merged 1 commits from feature/issue-211-overseas-limit-price-policy into main 2026-02-23 17:47:34 +09:00
Collaborator

Summary

  • BUY 지정가 버퍼: current_price × 1.005current_price × 1.002 (+0.5% → +0.2%)
  • SELL 지정가 버퍼: current_pricecurrent_price × 0.998 (±0% → -0.2%)
  • VTS(paper)와 live 동일 정책 적용

변경 이유

BUY 버퍼 축소 (0.5% → 0.2%)

기존 0.5% 버퍼는 VTS 제약("KIS VTS only accepts limit orders") 때문에 설정된 값이었음. 연구에 따르면:

  • 대형주(AAPL, MSFT 등) +0.1-0.2% 버퍼로도 90%+ 체결률 달성
  • 0.5% 버퍼는 $5,000 주문 기준 약 $25 과다 지불 → 연간 누적 손실
  • KIS 시장가 주문은 상한가 기준 수량 계산 버그로 인해 예수금 60-80%만 사용되므로 지정가 유지

SELL 버퍼 추가 (-0.2%)

기존에는 current_price를 그대로 지정가로 사용했으나 문제가 있음:

last_price = $100.00
현재 bid    = $99.90   ← 시장이 조금이라도 내려가면

SELL limit $100.00 → 체결 안 됨!

-0.2% 적용 시 bid가 last_price 아래인 구간에서도 체결 보장.

테스트

  • test_overseas_buy_order_uses_limit_price: 1.005 → 1.002 업데이트 (회귀 테스트)
  • test_overseas_sell_order_uses_limit_price_below_current: 신규 추가
  • 832 tests passed

관련 이슈

## Summary - BUY 지정가 버퍼: `current_price × 1.005` → `current_price × 1.002` (+0.5% → +0.2%) - SELL 지정가 버퍼: `current_price` → `current_price × 0.998` (±0% → -0.2%) - VTS(paper)와 live 동일 정책 적용 ## 변경 이유 ### BUY 버퍼 축소 (0.5% → 0.2%) 기존 0.5% 버퍼는 VTS 제약("KIS VTS only accepts limit orders") 때문에 설정된 값이었음. 연구에 따르면: - 대형주(AAPL, MSFT 등) +0.1-0.2% 버퍼로도 90%+ 체결률 달성 - 0.5% 버퍼는 $5,000 주문 기준 약 $25 과다 지불 → 연간 누적 손실 - KIS 시장가 주문은 상한가 기준 수량 계산 버그로 인해 예수금 60-80%만 사용되므로 지정가 유지 ### SELL 버퍼 추가 (-0.2%) 기존에는 `current_price`를 그대로 지정가로 사용했으나 문제가 있음: ``` last_price = $100.00 현재 bid = $99.90 ← 시장이 조금이라도 내려가면 SELL limit $100.00 → 체결 안 됨! ``` `-0.2%` 적용 시 bid가 last_price 아래인 구간에서도 체결 보장. ## 테스트 - `test_overseas_buy_order_uses_limit_price`: 1.005 → 1.002 업데이트 (회귀 테스트) - `test_overseas_sell_order_uses_limit_price_below_current`: 신규 추가 - 832 tests passed ## 관련 이슈 - Closes #211 - 미체결 주문 처리 (취소/재시도) → #229 별도 이슈로 등록
agentson added 1 commit 2026-02-23 17:25:37 +09:00
feat: 해외주식 지정가 버퍼 최적화 BUY +0.2% / SELL -0.2% (#211)
Some checks failed
CI / test (pull_request) Has been cancelled
2e27000760
기존 정책(BUY +0.5%, SELL 현재가)의 두 가지 문제를 해결:
- BUY 0.5% 버퍼는 대형주에서 불필요한 과다 지불 유발 ($50K 규모에서 연간 수십 달러 손실)
- SELL 현재가 지정가는 가격이 소폭 하락 시 미체결 위험 (bid < last_price 구간)

변경:
- BUY: current_price * 1.005 → current_price * 1.002 (+0.2%)
  대형주 기준 90%+ 체결률 유지하면서 과다 지불 최소화
- SELL: current_price → current_price * 0.998 (-0.2%)
  bid가 last_price 아래일 때도 체결 보장
- VTS(paper)와 live 동일 정책 적용 — 더 현실적인 시뮬레이션
- KIS 시장가 주문은 상한가 기준 수량 계산 버그로 사용 안 함(유지)

테스트:
- test_overseas_buy_order_uses_limit_price: 1.005 → 1.002 업데이트
- test_overseas_sell_order_uses_limit_price_below_current: 신규 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jihoson merged commit 1a1fe7e637 into main 2026-02-23 17:47:34 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#230