fix: reconcile KIS exchange rejections
This commit is contained in:
@@ -461,7 +461,7 @@ get_current_price(symbol: str, market: str = "J") -> Optional[Decimal]
|
||||
- `filled` :: 전량 체결 → `pending_buy→holding` / `pending_sell→inactive` + 원장 1건.
|
||||
- `cancelled`(체결 0 외부 취소) :: `is_terminal_reject` → 롤백(`pending_sell→holding` / `pending_buy→inactive`), `clear_dispatch` → 자동 재매도 가능.
|
||||
- `partially_filled` + `cancelled=True`(부분 체결 후 외부 취소) :: `is_partial_cancel` → 체결분 원장 1회 기록 + 슬롯 qty 차감(매도: 잔여 held / 매수: 체결분만) + `holding` 복귀. 매도는 cost basis(`avg_price`) 유지.
|
||||
- KIS 매핑: `inquire-daily-ccld` 응답 row 의 `cncl_yn="Y"` 를 취소로 해석한다(미지/부재 값은 보수적으로 비취소 처리, stale 워치독이 backstop).
|
||||
- KIS 매핑: `inquire-daily-ccld` 응답 row 의 `cncl_yn="Y"` 를 취소로 해석한다(미지/부재 값은 보수적으로 비취소 처리, stale 워치독이 backstop). 체결수량이 0이고 `rjct_qty >= ord_qty > 0`이면 브로커 접수 뒤 거래소 전량거부로 해석해 `rejected`로 종료한다. `rjct_qty` 일부만으로는 미체결 잔여 상태를 추정하지 않는다.
|
||||
|
||||
## Interface: `MessagingTransport` (Protocol, BAT-007)
|
||||
|
||||
|
||||
@@ -219,6 +219,7 @@ Loki LogQL:
|
||||
| 매도 미발생 + WARN `sell dispatch skipped` | 브로커 잔고 0(divergence) | reconcile(운영자) — 미러 fallback 없음(설계) |
|
||||
| `RpcTimeoutError` | 데몬 미기동/소비 스레드 크래시 | `/tmp/trex-core.log` traceback 확인 |
|
||||
| 미체결 `pending_*` 고착 | 취소 감지 누락/timeout 미설정/fill_price_unresolvable | `trex-core cancel <slot_id>` 백스톱; pending stale WARN + `fill_price_unresolvable` WARN 확인(§5) |
|
||||
| KIS 접수 뒤 전량 거부인데 `pending_buy` 유지 | 일별 주문조회에서 `tot_ccld_qty=0`, `rjct_qty=ord_qty` 확인 | Core가 `rejected`로 롤백하는지 `event=order_reject`와 슬롯 `inactive`를 확인. 재주문 전 브로커 잔고·미체결을 먼저 대조 |
|
||||
| `avg_price_backfill` WARN | KIS avg_price 순간 레이스(None/0 반환) | 슬롯 평단·원장 price는 지정가로 보정됨 — §5 점검 절차 참고 |
|
||||
|
||||
### DB 직접 조회
|
||||
|
||||
Reference in New Issue
Block a user