Files
kis_bot/remove/legacy_root/sample_python/search_window.py
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

131 lines
4.3 KiB
Python

from PySide2 import QtCore, QtWidgets
from PySide2.QtUiTools import QUiLoader
# from PySide2.QtWidgets import QTableWidgetItem, QFileDialog
from PySide2.QtWidgets import *
from PySide2.QtWidgets import QDialog
from PySide2.QtCore import QEvent, QObject, SIGNAL,QFile
from PySide2.QtWidgets import (QApplication, QWidget, QMessageBox)
import sys
# from .ui.ui_test import Ui_Test
# from ui.ui_test import Ui_Test
# from ui.ui_second_window import Ui_Second_Window
from tr.tr_0424 import Tr_0424
from tr.tr_1857 import Tr_1857
import win32com.client #이베스트 관련
import pythoncom #이베스트 관련
import os
from ui.ui_search_window import Ui_Form
# app=QApplication(sys.argv)
class MyEventFilter(QObject):
def eventFilter(self, watched, event):
if event.type() == QEvent.Close:
#print("Event filter: Window is being closed.")
# Add your custom logic here if needed
pass
return super().eventFilter(watched, event)
loader=QUiLoader()
#QWidget
class Search_window(QWidget,Ui_Form):
def __init__(self):
super().__init__()
# self=loader.load('./ui/search-window.ui',None)
self.setupUi(self)
# loader = QUiLoader()
# ui_file = QFile('./ui/search-window.ui')
# ui_file.open(QFile.ReadOnly)
# self = loader.load(ui_file)
# ui_file.close()
# event_filter = MyEventFilter()
# self.installEventFilter(event_filter)
#print('자기소개 SEARCH_WINDOW: ',dir(self))
# uic.loadUi('./ui/search-window.ui', self)
self.setWindowTitle("종목 검색")
self.tr_1857=win32com.client.DispatchWithEvents("XA_DataSet.XAQuery",Tr_1857)
self.tr_1857.init_callbacks(self.set_value_on_table,self.insert_row_on_stocks_table)
# self.balance_table.setItem(0,1,QTableWidgetItem(str(1)))
# self.balance_stocks_table.setColumnWidth(7,130)
# self.balance_table.setItem(0,0,QTableWidgetItem(str(2)))
self.file_select_button.clicked.connect(self.selectFile)
# self.end_btn.clicked.connect(self.handle_close_event)
# self.destroyed.connect(self.handle_close_event)
self.closeEvent=self.handle_close_event
# self.installEventFilter(self)
#print('init search window')
# def __init__(self, parent=None):
# super().__init__(parent)
# # Load the UI file
# loader = QUiLoader()
# ui_file = QFile('./ui/search-window.ui') # Replace with your UI file path
# ui_file.open(QFile.ReadOnly)
# self = loader.load(ui_file)
# ui_file.close()
# # Set up the UI and connections
# self.setCentralWidget(self)
# self.setWindowTitle("Search Window")
# # Connect the close event to a custom handler
# self.closeEvent = self.handle_close_event
def closeEvent(self, event) -> None:
#print('a')
self.tr_1857.manually_stop()
return super().closeEvent(event)
def handle_close_event(self, event):
# Perform desired action when the window is closed
self.tr_1857.manually_stop()
#print("Search window closed!")
self.close()
# super().closeEvent(event)
def showMe(self):
self.show()
# app.exec_()
# def closeEvent(self, event):
# #print('IM CLOSING!!!@!')
# super().closeEvent(event)
def selectFile(self):
the_path=os.environ.get('ROOT_FILE_PATH')+"\\ACF"
fname = QFileDialog.getOpenFileName(
parent=self,
caption='ACF 파일 선택',
dir=the_path)
#print('the_acf: ',fname[0])
self.tr_1857.go_search(fname[0])
def set_value_on_table(self,column_num,row_num,value):
# #print('set_value_on_table: ',column_num)
# #print('set_value_on_table2: ',value)
self.search_stocks_table.setItem(row_num,column_num,QTableWidgetItem(str(value)))
def insert_row_on_stocks_table(self):
rowPosition=self.search_stocks_table.rowCount()
# #print('테이블 개수: ',rowPosition)
self.search_stocks_table.insertRow(rowPosition)
return rowPosition