feat: Enhance trading system with new permanent subscription features and order book management
Changes: - Added a new API endpoint for managing permanent subscriptions, allowing users to enable or disable subscriptions dynamically. - Implemented a function to fill candle data from Kiwoom, ensuring that only relevant data is inserted into the database. - Introduced a mechanism to handle master subscription states, improving the management of subscription statuses. - Updated the database schema to include new fields for managing subscription states and order book filtering. Impact: - These enhancements improve the flexibility and reliability of the trading system, allowing for better management of subscriptions and order book data, while reducing the risk of data inconsistencies. 히스토리 align 제거 븅신같은 초기설계 아예 제거 진입모드에 구멍메움 호가진입을 켜도 호가가 안들어올때 호가 안보고 그냥 사버림
This commit is contained in:
26
docs/정합성.md
26
docs/정합성.md
@@ -29,6 +29,30 @@
|
||||
→ 파람을 실시간 피드로 바꾸라는 뜻이 **아님**.
|
||||
→ 고칠 코드 = **존재 시 UPDATE 금지**뿐. 파람/아침용 봉 소스를 둘로 나누지 않음.
|
||||
|
||||
### 0.2 증권사별 저장 · 읽기 (2026-08-14)
|
||||
|
||||
`ws_candles.source` = 증권사(`kiwoom`|`kis`), `channel` = `ws`|`rest`|`rollup`.
|
||||
UNIQUE = `(code, timeframe, candle_time, source, channel)`.
|
||||
|
||||
| 쓰기 | 규칙 |
|
||||
|------|------|
|
||||
| 키움/KIS WS 틱 분봉 | `source=증권사, channel=ws` |
|
||||
| 갭보정 | **항상 키움 ka10080** → `source=kiwoom, channel=rest`. KIS REST 페이지 갭보정 **사용 금지** |
|
||||
| 1M→nM 롤업 | `source=kiwoom, channel=rollup` |
|
||||
| 영구구독 KR | LS WS → `ls_ws_candles` 만. **`ws_candles`에 넣지 않음**. 자동 갭보정 제외. 탭 「확정봉 가져오기」=키움 REST → `ls_ws_candles` INSERT IGNORE |
|
||||
|
||||
읽기(실매 RAM = Optuna `bt_candle_source`): 틱 메인 WS 한 칸, 없으면 `kiwoom+rest`, 그다음 롤업.
|
||||
`CANDLE_SOURCE=kis` 여도 구멍은 키움 REST. 키움 REST로 KIS WS 행을 덮지 않음.
|
||||
|
||||
영구구독 마스터 `PERMANENT_SUBSCRIBE_ENABLED`(기본 true): OFF면 행 유지, KR LS / US 해외 WS 구독만 안 함.
|
||||
|
||||
### 0.3 호가필터 구멍 ≠ 봉 ±1 (혼동 금지)
|
||||
|
||||
봉 정합(본 문서)과 **별개**. 진입 호가필터가 저장 TTL로 `None`이 되면 필터 ON인데 통과한다.
|
||||
고치는 키: `WS_ORDERBOOK_FILTER_MAX_AGE_SEC`(기본 0=마지막 RAM). 저장은 `WS_ORDERBOOK_TICK_MAX_AGE_SEC`.
|
||||
사진 한 장도 없으면 `WS_ORDERBOOK_FILTER_REJECT_IF_EMPTY`(기본 true)로 안 삼.
|
||||
상세 `docs/호가.md`. ±1봉 보정으로 맞추지 말 것.
|
||||
|
||||
---
|
||||
|
||||
## 1. 잠긴 매매 규칙 (변경 금지)
|
||||
@@ -37,7 +61,7 @@
|
||||
|------|------|
|
||||
| 신호 봉 | **T−1 확정봉** (`live_backtest_align=True`) |
|
||||
| 진입 봉 | **T 확정봉** |
|
||||
| 유니버스 | 초 단위 `event_time` — 분 슬롯 ±1 해킹 금지 |
|
||||
| 유니버스 | 실매=키움 RAM 푸시/팝. 백테=`target_candidates_history` 완성 스냅샷 재생 (`event_time` 마이크로초). 분 슬롯 ±1 해킹 금지 |
|
||||
| HTS | SCAN 후보 참고. `*_SKIP_HTS_SCAN_DUPES` 기본 **false** 유지 |
|
||||
| 차트봉 | 매매·백테·Optuna 경로에 사용하지 않음 (`ws_candles` + `ws_ticks`) |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user