Commit Graph

36 Commits

Author SHA1 Message Date
Your Name
6d2a706a48 커밋 1 — 실매 가격 TTL 구멍 (본체)
왜: 체결이 없어도 마지막가는 유지인데, TTL로 None 만들고 매도/EOD를 건너뛰어 8/5 돌파·금요일 leftover가 남음. 호가필터 TTL 구멍과 같은 병.

넣을 파일

신규: kis_trader/engine/live_sell_price.py
kis_trader/strategies/base.py (_ws_last_quote, _resolve_sell_price)
전략: momentum.py scalping.py tail_catch.py breakout.py range_break.py dart_strategy.py updow_strategy.py updown_feed.py us_momentum.py
WS: ws_manager.py kis_ws.py kiwoom_ws.py ls_ws.py kis_ws_overseas.py
kis_trader/web/live_config_schema.py (WS_PRICE_MAX_AGE_SEC 기본 0)
database.py (키 주석 + legacy/ sys.path)
kis_trader/execution/order_manager.py (잔고 있는데 40240000 ghost_purge 금지 — 같은 EOD 사고)
EOD가 min_hold에 안 막히게 손본 momentum_hts_logic.py / scalping_engine.py / tail_engine.py (이 대화에서 손본 부분만 확인 후)
문서: docs/like_mcp.md/db_erd.md code_architecture.md (가격 TTL 문구)
메시지 초안

fix: 매수·매도 현재가를 TTL로 버리지 않음 (마지막 RAM)
횡보·체결 공백을 죽은 캐시로 오인해 None 처리하면 손절·EOD가 스킵된다.
호가필터와 같이 나이는 무시하고 마지막 체결가를 유지한다. EOD는 매수가 폴백.
영향: 실매 O / 백테·옵투나 봉 경로 거의 무관 (엔진 식 변경 아님)

커밋 2 — 루트 정리 (remove/ vs legacy/)
왜: 루트 단독봇·테스트는 지울 보관함으로. 웹·알람이 아직 쓰는 모듈은 remove에 두면 나중에 폴더째 삭제 때 깨짐.

넣을 파일

이동: 미사용 → remove/legacy_root/ (래퍼, ETF/키움 옛봇, 테스트, kiwoom_rest_api 등)
이동: 사용 중 → legacy/ (holding_bot kis_holding_ver1 news_analyzer kis_long_ver1/2)
신규: kis_trader/utils/legacy_root.py legacy/README.md remove/README.md
import 경로: backtest_web.py mm_butler.py mm_remote.py updow_holding_cfg.py dbband_stock_cfg.py param_search_updow*.py dbband_param_search.py param_search_apply_snapshot.py verify_three_paths.py
docs/like_mcp.md/code_architecture.md 수동 노트
메시지 초안

chore: 미사용 루트는 remove/, 웹·알람 구모듈은 legacy/
remove는 나중에 통째 삭제 예정. holding_bot·news_analyzer·kis_long은
ensure_legacy_root로 legacy/만 본다.
빼기: scratch/set_ws_price_max_age_zero.py (일회성)
2026-08-18 00:13:17 +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
4a18ce2697 셀락은 좀 더 고민
롤업만 보강
2026-08-14 00:01:20 +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
Your Name
c6bd62a25f refactor: enhance Optuna backtesting framework, optimize orderbook filtering, and update database management utilities. 2026-08-12 10:19:19 +09:00
Your Name
cb7e5037a0 feat: Enhance trading system with new e_min_chg_pct parameter and related logic
Changes:
- Introduced the `e_min_chg_pct` parameter to define the minimum price change percentage compared to the previous day's close, enhancing the momentum trading strategy.
- Updated various functions and classes to incorporate this new parameter, ensuring it is utilized in both backtesting and live trading scenarios.
- Improved documentation and comments to clarify the purpose and usage of the new parameter across the codebase.

Impact:
- This addition allows for more precise control over trading conditions, potentially increasing the effectiveness of the momentum strategy while maintaining system integrity and performance.
2026-08-01 16:19:24 +09:00
Your Name
7050f788c5 ls kiwoom 구독 히스토리 모두 적재 2026-07-30 20:23:37 +09:00
Your Name
67eab24603 ls증권 히스토리 구독 넣음 2026-07-30 18:05:07 +09:00
Your Name
61bec4bd1d feat: Add DART strategy and related configurations
ㅇ
Changes:
- Introduced the DART strategy to the trading system, including its configuration and integration into the existing framework.
- Updated the database schema to include DART-specific tables for disclosures and watchlists.
- Enhanced the backtesting and parameter search functionalities to support the DART strategy.
- Implemented new rules for browser verification and API interactions to ensure compliance with the updated DART strategy.

Impact:
- These additions expand the trading capabilities of the system, allowing for more comprehensive analysis and execution of DART-related strategies, while maintaining system integrity and performance.
2026-07-21 07:50:24 +09:00
Your Name
74db49149f style: Replace stars with circles in output
Co-authored-by: aider (gemini/gemini-2.5-flash) <aider@aider.chat>
2026-07-17 02:31:02 +09:00
Your Name
853d040a1b docs: Add troubleshooting guide for 'journalctl: not found' error
Co-authored-by: aider (gemini/gemini-2.5-flash) <aider@aider.chat>
2026-07-17 02:18:13 +09:00
Your Name
dae66d505d feat: Reverse star printing order
Co-authored-by: aider (gemini/gemini-2.5-flash) <aider@aider.chat>
2026-07-17 01:49:19 +09:00
Your Name
c307f2d405 feat: Add star.py to print increasing star patterns
Co-authored-by: aider (gemini/gemini-2.5-flash) <aider@aider.chat>
2026-07-17 01:42:03 +09:00
Your Name
9ca2b569d9 feat: Create test.txt file
Co-authored-by: aider (gemini/gemini-2.5-flash) <aider@aider.chat>
2026-07-17 01:31:20 +09:00
Your Name
fc27e726f9 feat: 새로운 안전 규칙 및 최적화 적용을 통한 트레이딩 시스템 개선
변경 사항 (Changes):

구문 오류(Syntax error) 및 토큰 낭비를 방지하기 위해 에이전트 쉘(Agent shell)과 파이썬 코드 스니펫에 다수의 신규 안전 규칙(Safety rules)을 추가함.

스키마 검증 및 적절한 SQL 포맷팅을 보장하기 위해 임시(Ad-hoc) 데이터베이스 쿼리 작성 가이드라인을 도입함.

코드 수정 후 UI 기능이 정상 작동하는지 확인하기 위해, 백테스트 웹 서비스 재시작 및 브라우저 검증에 대한 새로운 규칙을 구현함.

시스템 전반의 무결성(Integrity)을 유지하기 위해 실전 매매(Live trading), 웹 백테스팅, 파라미터 탐색(Parameter searches) 간의 일관성 검사(Consistency checks) 체계를 확립함.

기대 효과 (Impact):

이러한 개선 사항들은 트레이딩 시스템의 견고성(Robustness)과 신뢰성을 향상시키며, 에러 발생을 최소화하고 다양한 시스템 컴포넌트 간의 원활한 상호작용을 보장함.
2026-07-17 01:09:09 +09:00
a4626e0351 fix: Update imports and enhance error handling in momentum engine and tick replay
Changes:
- Replaced the import of `get_env_int` with `get_env_from_db` in `momentum_engine.py` to improve environment variable retrieval.
- Modified error handling in `momentum_tick_replay.py` to ensure `TickColumnView` is only referenced if successfully imported, enhancing robustness.

Impact:
- These updates streamline the import process and improve the stability of the momentum trading logic by ensuring that the code handles import errors gracefully.
2026-07-06 21:43:00 +09:00
618041909b 옵투나 공유메모리로로 2026-07-06 21:14:50 +09:00
ad0ad308d1 fix: Refactor imports and remove unused ATR calculation
Changes:
- Updated import paths for `compute_atr_series` and `is_strategy_eod_bar` to reflect new module structure.
- Removed the unused `compute_atr_series` function from `tail_engine.py`, streamlining the codebase.

Impact:
- These changes enhance code organization and maintainability by ensuring that only necessary components are imported and utilized, while also eliminating redundant code.
2026-07-06 20:27:39 +09:00
844d32f39c chore: clean snapshot for kis_trader repo 2026-07-06 19:25:19 +09:00
78edb75e01 feat: Add new files and enhance backtesting functionality
Changes:
- Introduced new files for strategy definitions and study names.
- Enhanced `backtest_web.py` with functions to handle integer display prices and trade data formatting.
- Updated backtesting logic to incorporate end-of-day (EOD) parameters for breakout and momentum strategies.
- Added EOD configuration options in the database and parameter search files.

Impact:
- These changes improve the modularity and usability of the backtesting framework, allowing for better integration of EOD strategies and clearer trade data presentation.
2026-07-06 19:11:34 +09:00
336d637b72 feat(param-search): Add new evaluation functions for breakout, momentum, and tail parameter combinations
Changes:
- Added `apply_params_to_db` function to streamline parameter application to the database.
- Introduced `evaluate_breakout_param_combo`, `evaluate_momentum_param_combo`, and `evaluate_tail_param_combo` functions to enhance the evaluation of parameter combinations for respective strategies.
- Updated `requirements.txt` to include `optuna==4.2.1` for improved optimization capabilities.

Impact:
- These additions improve the modularity and efficiency of parameter evaluations across different trading strategies, facilitating better optimization and backtesting processes.
2026-07-06 02:18:14 +09:00
94a7608f6f Pin Python dependencies for Win11 param search setup 2026-07-06 01:37:46 +09:00
61c72a8a4c feat(tests): 신규 키움 웹소켓 조건검색 및 실시간 조건검색 테스트 추가
변경 사항
----
- _test_kiwoom_condition_list.py: 키움 웹소켓 조건검색 '목록조회' 기능을 단독으로 테스트하는 스크립트 추가
- _test_kiwoom_condition_realtime.py: 'momentum' 조건식을 실시간으로 등록하고 초기 매칭 종목 리스트 및 실시간 편입/이탈을 수신하는 테스트 스크립트 추가
- _verify_columnar_bitid.py, _verify_shared_e2e_breakout.py, _verify_shared_e2e.py: 공유 메모리 및 dict 간의 데이터 일관성을 검증하는 테스트 추가

영향
----
- 신규 테스트 스크립트 추가로 키움 웹소켓 API의 기능 검증 및 안정성을 높임
- 기존 기능에 대한 영향 없음

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 01:27:00 +09:00
d8ba01afa4 옵투나 하기전 고도화 완료 테스트 전 2026-07-06 01:25:38 +09:00
2cb95fc694 feat(ws-validation): 키움 WS 시세는 KIS_MOCK 무관 항상 실키/실전 강제 (KIWOOM_WS_FORCE_REAL)
배경
----
- 모의 도메인(mockapi.kiwoom.com)은 장외 데이터 미제공 + 실시간 표본 빈약 → 시세 비교/마이그레이션 가치 없음
- 사용자 운영 정책: 키움은 실전 도메인에서 시간외 단일가까지 데이터 푸시 → 부하 회피용으로 매매 외 호출만 정지 토글

변경
----
- database.py: ENV_CONFIG_KEYS 에 KIWOOM_WS_FORCE_REAL 추가 (기본 true)
- kis_trader/main.py _start_ws_validator: 토글 true 면 _REAL 컬럼에서 직접 로드 + is_mock=False 강제, false 면 기존 _get_kiwoom_creds() 자동 분기 (디버그)
- test_kiwoom_ws.py: load_kiwoom_creds(force_real=True) 기본, --mock-auto 플래그로 디버그 토글

영향
----
- 매매(KIS) 100% 무영향 — 검증/테스트 채널만 실전 시세 도메인 강제
- KIS_MOCK=true 라도 시세 비교는 진짜 가격으로 진행 가능

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-05 21:39:34 +09:00
3fa9eb9bf7 feat(ws): 키움 WS 시세 마이그레이션 검증 인프라
KIS WS(41 한도) → 키움 WS(100 한도) 본격 전환 전, 두 소스를 동시 운영해
가격 일치성을 데이터로 검증하기 위한 인프라.

신규
- kiwoom_ws.py: 키움 WS 클라이언트 (KIS WS 와 동일 get_price 인터페이스, 메모리 dict 캐시)
- kis_trader/network/ws_validator.py: 5초마다 KIS↔키움 가격 비교, ws_price_validation 테이블에 1행 INSERT, |diff|≥WARN_PCT 시 WARN 로그
- test_kiwoom_ws.py: 키움 WS 단독 동작 확인 스크립트 (토큰/LOGIN/REG/시세)

수정
- database.py: ws_price_validation 테이블 + ENV 키 (WS_PROVIDER, WS_VALIDATION_INTERVAL_SEC, WS_VALIDATION_DIFF_WARN_PCT) + insert_ws_price_validation/get_ws_validation_stats 헬퍼
- kis_trader/main.py: WS_PROVIDER=kis_with_validation 시 키움 WS + Validator 백그라운드 기동, 종료 시 정리

운영 영향: 0. 매매·시세 의사결정은 항상 KIS WS만 사용. 키움 WS는 백그라운드 비교 기록만.
적용: DB env_config 에 WS_PROVIDER=kis_with_validation INSERT 후 봇 재시작.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-05 21:28:22 +09:00
f61c471aac 브랜치 분리 방식: A / B / C
A 선택 시 커밋 메시지: 위 초안 OK / 수정 / 직접 작성
작업 시점: 지금 / 운영 데이터 1~2일 쌓고 / 주말
2026-05-05 21:04:17 +09:00
c2b2b711e0 커서가 망쳐놓은 듯 2026-03-17 12:33:30 +09:00
6fc179f598 database 2026-03-13 04:28:31 +09:00
f62b2ed237 오픈라우터 하기전전 2026-03-11 15:25:32 +09:00
bc6fc1706f 오픈라우터 하기전 2026-03-11 15:23:01 +09:00
41a1a0fc4b 소켓하기전 마지막 버전전 2026-02-28 21:31:11 +09:00
168e7d016e 늘림목까지 완성성 2026-02-22 21:42:41 +09:00
6a9fef7be8 매매테스트 시작작 2026-02-22 18:27:30 +09:00
b827f03d56 source push 2026-02-22 18:05:14 +09:00
899a3c6543 first commit 2026-02-22 18:00:33 +09:00