5 Commits

Author SHA1 Message Date
Your Name
d8ac1595c1 fix(backtest): 22.8% 쓰레기스킵 → 5.2% (bt_candle_source 로더 통일)
## 근본원인
bt_candle_source._load_ticks_by_code_bulk / _ticks_for_bar_garbage 가
자체 SELECT 로 recv_ts/tick_time_raw 미포함 → bar_is_garbage 가
_lag_sec/recv_ts 없이 봉끝 폴백 → WS 봉의 76% 대량 컷.

엔진 로더(breakout_tick_loader.load_common_ticks_by_code) 는 이미
recv_ts + _lag_sec 완비였지만 두 로더가 발산 상태 → 이번에 사고 촉발.

## 수정 (C안: 로더 통일)
- _load_ticks_by_code_bulk: breakout_tick_loader._fetch_ws_ticks_day_rows
  위임. flat 리턴은 _ingest_flat_tick_rows (신설) 로 어댑팅.
  recv_ts + _lag_sec 모두 포함 → 엔진 로더와 100% 동일 SELECT/계산.
- _ticks_for_bar_garbage: 단일 종목용으로 _load_ticks_by_code_bulk
  (codes_filter=[code]) 재사용. 별도 SELECT 제거.

## 검증
Optuna scalp TPE 10 trials · 2026-09-04 · Python 엔진:
- Before: 슬롯 63671 · 쓰레기스킵 14495 (22.8%) · hole 7.4% · kis/ws pick 11%
- After:  슬롯 63671 · 쓰레기스킵  3324 ( 5.2%) · hole 3.7% · kis/ws pick 20%

실매 스모크 (scripts/test_live_execution_validation.py): 최종 통과 · 완결
로그: logs/test_live_execution_validation_20260906_201535.log

## 문서 (rust_engine_parity_port_plan.md)
- 부록 A: A6~A11 사전 정지 작업 추가 (wall-clock 정합·로더 통일·파케이·게이팅·뱃지)
- 부록 C (신설): D안 로드맵 — Rust 세션이 현재 봉만 받고 틱/호가/프로그램매매 미전달.
  Python 정합 개선을 받아도 Rust 는 여전히 데이터 절반짜리 상태. P0 최우선 6단계.

## 룰
- CRITICAL §0 (봉 freeze · OHLC 폴백 금지) 준수
- 룰 19 (근본원인 딥다이브 · 3안 선보고) — B/C/D 안 제시 후 사용자 C안 선택
- 룰 25-1 (교차검증) — 두 로더 발산 재발 방지

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 20:18:11 +09:00
Your Name
0780b2cdd0 feat: Enhance Optuna integration and logging for backtesting framework
Changes:
- Added new API endpoints for continuing and confirming Optuna jobs, allowing for better management of ongoing studies.
- Introduced detailed logging for tick feed tracking and order book processing, improving traceability of vendor performance during backtests.
- Updated database schema to include new fields for managing Optuna study results, enhancing the ability to track study progress and outcomes.
- Refactored existing functions to utilize the new logging and tracking features, ensuring consistency across the backtesting framework.

Impact:
- These enhancements improve the robustness and transparency of the Optuna backtesting process, facilitating better analysis and optimization of trading strategies.
2026-08-21 19:05:23 +09:00
Your Name
d1dc274f0e fix: 한투 호가 2키 전용, LS RAM 합집합, 분봉 쓰레기면 다음 소스 통째
메인 시세 41에 H0STASP0를 붙이는 폴백을 없앤다. MINIMAL과 무관하게
후보∪보유∪영구를 LS RAM에 붙인다. 그 분 틱이 없거나 봉끝 대비 늦으면
그 WS 봉을 버리고 2차·LS·REST 봉을 통째로 쓴다.

같은 파일에 직전 커밋 이후 쌓인 시세 폴백/ENV 키 정리도 포함된다.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 22:09:03 +09:00
Your Name
36a3e2b4a1 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 제거 븅신같은 초기설계 아예 제거
진입모드에 구멍메움
호가진입을 켜도 호가가 안들어올때 호가 안보고 그냥 사버림
2026-08-15 23:01:14 +09:00
Your Name
2c7ad867f4 거래 빠르게 안티에서 병신만든거 커서로
feat: Implement backtest source management and enhance candle data handling

Changes:
- Introduced a new function `_apply_backtest_source_env_from_request` to manage the environment variables for candle, tick, and order book sources based on incoming requests.
- Added a teardown function `_teardown_backtest_source_env` to ensure that environment variables do not persist between requests, enhancing the stability of the backtesting environment.
- Refactored existing code to utilize the new source management functions, improving code readability and maintainability.
- Added new utility functions in `bt_candle_source.py` for fetching and managing candle data, ensuring consistency with live trading data sources.

Impact:
- These changes improve the flexibility and reliability of the backtesting framework, allowing for better management of data sources and reducing the risk of cross-request contamination.
2026-08-13 16:03:40 +09:00