This commit is contained in:
lunaticbum 2026-03-26 11:22:07 +09:00
parent dc18d5baaf
commit b289b4d9a0
2 changed files with 101 additions and 90 deletions

View File

@ -0,0 +1,13 @@
분석용 llm
https://huggingface.co/MLP-KTLim/llama-3-Korean-Bllossom-8B-gguf-Q4_K_M
llama-3-Korean-Bllossom-8B-Q4_K_M.gguf
뉴스용 임베디드 llm
https://huggingface.co/Jackrong/Qwen3.5-27B-Claude-4.6-Opus-Reasoning-Distilled
bge-m3-q4_k_m.gguf

View File

@ -118,102 +118,100 @@ fun main() = application {
) )
if (isWindowOpen) { if (isWindowOpen) {
Window(onCloseRequest = { isWindowOpen = false }, title = "KIS AI 자동매매", state = windowState) { Window(onCloseRequest = { isWindowOpen = false }, title = "KIS AI 자동매매", state = windowState) {
var currentScreen by remember { mutableStateOf(AppScreen.Settings) } var currentScreen by remember { mutableStateOf(AppScreen.Settings) }
var isLoaded by remember { mutableStateOf(false) } var isLoaded by remember { mutableStateOf(false) }
val scope = rememberCoroutineScope() // 1. 앱 시작 시 DB에서 마지막 설정 로드 (KisSession에 주입)
LaunchedEffect(Unit) {
// 1. 앱 시작 시 DB에서 마지막 설정 로드 (KisSession에 주입) DatabaseFactory.init()
LaunchedEffect(Unit) { transaction {
DatabaseFactory.init() ConfigTable.selectAll().lastOrNull()?.let {
transaction { KisSession.config = AppConfig(
ConfigTable.selectAll().lastOrNull()?.let { realAppKey = it[ConfigTable.realAppKey],
KisSession.config = AppConfig( realSecretKey = it[ConfigTable.realSecretKey],
realAppKey = it[ConfigTable.realAppKey], realAccountNo = it[ConfigTable.realAccountNo],
realSecretKey = it[ConfigTable.realSecretKey], vtsAppKey = it[ConfigTable.vtsAppKey],
realAccountNo = it[ConfigTable.realAccountNo], vtsSecretKey = it[ConfigTable.vtsSecretKey],
vtsAppKey = it[ConfigTable.vtsAppKey], vtsAccountNo = it[ConfigTable.vtsAccountNo],
vtsSecretKey = it[ConfigTable.vtsSecretKey], nAppKey = it[ConfigTable.nAppKey],
vtsAccountNo = it[ConfigTable.vtsAccountNo], nSecretKey = it[ConfigTable.nSecretKey],
nAppKey = it[ConfigTable.nAppKey], dAppKey = it[ConfigTable.dAppKey],
nSecretKey = it[ConfigTable.nSecretKey], isSimulation = it[ConfigTable.isSimulation],
dAppKey = it[ConfigTable.dAppKey], htsId = it[ConfigTable.htsId],
isSimulation = it[ConfigTable.isSimulation], modelPath = it[ConfigTable.modelPath],
htsId = it[ConfigTable.htsId], embedModelPath = it[ConfigTable.embedModelPath],
modelPath = it[ConfigTable.modelPath], FEES_AND_TAXRATE = it[ConfigTable.fees_and_taxrate],
embedModelPath = it[ConfigTable.embedModelPath], MINIMUM_NET_PROFIT = it[ConfigTable.minimum_net_profit],
FEES_AND_TAXRATE = it[ConfigTable.fees_and_taxrate], BUY_WEIGHT = it[ConfigTable.buy_weight],
MINIMUM_NET_PROFIT = it[ConfigTable.minimum_net_profit], MAX_BUDGET = it[ConfigTable.max_budget],
BUY_WEIGHT = it[ConfigTable.buy_weight], MAX_PRICE = it[ConfigTable.max_price],
MAX_BUDGET = it[ConfigTable.max_budget], MIN_PRICE = it[ConfigTable.min_price],
MAX_PRICE = it[ConfigTable.max_price], MIN_PURCHASE_SCORE = it[ConfigTable.min_purchase_score],
MIN_PRICE = it[ConfigTable.min_price], SELL_PROFIT = it[ConfigTable.sell_profit],
MIN_PURCHASE_SCORE = it[ConfigTable.min_purchase_score], GRADE_5_BUY = it[grade_5_buy],
SELL_PROFIT = it[ConfigTable.sell_profit], GRADE_5_PROFIT = it[grade_5_profit],
GRADE_5_BUY = it[grade_5_buy], GRADE_4_BUY = it[grade_4_buy],
GRADE_5_PROFIT = it[grade_5_profit], GRADE_4_PROFIT = it[grade_4_profit],
GRADE_4_BUY = it[grade_4_buy], GRADE_3_BUY = it[grade_3_buy],
GRADE_4_PROFIT = it[grade_4_profit], GRADE_3_PROFIT = it[grade_3_profit],
GRADE_3_BUY = it[grade_3_buy], GRADE_2_BUY = it[grade_2_buy],
GRADE_3_PROFIT = it[grade_3_profit], GRADE_2_PROFIT = it[grade_2_profit],
GRADE_2_BUY = it[grade_2_buy], GRADE_1_BUY = it[grade_1_buy],
GRADE_2_PROFIT = it[grade_2_profit], GRADE_1_PROFIT = it[grade_1_profit],
GRADE_1_BUY = it[grade_1_buy], MAX_COUNT = it[max_count],
GRADE_1_PROFIT = it[grade_1_profit], )
MAX_COUNT = it[max_count], }
)
} }
isLoaded = true
} }
isLoaded = true if (!isLoaded) {
// 로딩 중 표시
} CircularProgressIndicator()
} else {
if (!isLoaded) { when (currentScreen) {
// 로딩 중 표시 AppScreen.Settings -> {
CircularProgressIndicator() AutoTradingManager.onMarketClosed = {
} else { println("프로그램 초기화 실행됨")
when (currentScreen) { currentScreen = AppScreen.Settings
AppScreen.Settings -> { isWindowOpen = false
AutoTradingManager.onMarketClosed = {
println("프로그램 초기화 실행됨")
currentScreen = AppScreen.Settings
isWindowOpen = false
}
SettingsScreen(
onAuthSuccess = {
// 2. 설정 및 인증 완료 시점의 처리
val config = KisSession.config
AutoTradingManager.isSystemReadyToday = true
AutoTradingManager.isSystemCleanedUpToday = false
CoroutineScope(Dispatchers.Default).launch {
AutoTradingManager.startAutoDiscoveryLoop()
KisWebSocketManager.onExecutionReceived = AutoTradingManager.onExecutionReceived
KisWebSocketManager.connect()
}
if (config.modelPath.isNotEmpty()) {
LlamaServerManager.startServer(binPath, config.modelPath,port = 8080)
}
if (config.embedModelPath.isNotEmpty()) {
LlamaServerManager.startServer(binPath, config.embedModelPath, port = 8081)
}
// 대시보드로 화면 전환
currentScreen = AppScreen.TradingDecision
} }
) SettingsScreen(
} onAuthSuccess = {
AppScreen.Dashboard -> {
DashboardScreen() // 2. 설정 및 인증 완료 시점의 처리
} val config = KisSession.config
AppScreen.TradingDecision -> { AutoTradingManager.isSystemReadyToday = true
TradingDecisionLog() AutoTradingManager.isSystemCleanedUpToday = false
CoroutineScope(Dispatchers.Default).launch {
AutoTradingManager.startAutoDiscoveryLoop()
KisWebSocketManager.onExecutionReceived = AutoTradingManager.onExecutionReceived
KisWebSocketManager.connect()
}
if (config.modelPath.isNotEmpty()) {
LlamaServerManager.startServer(binPath, config.modelPath,port = 8080)
}
if (config.embedModelPath.isNotEmpty()) {
LlamaServerManager.startServer(binPath, config.embedModelPath, port = 8081)
}
// 대시보드로 화면 전환
currentScreen = AppScreen.TradingDecision
}
)
}
AppScreen.Dashboard -> {
DashboardScreen()
}
AppScreen.TradingDecision -> {
TradingDecisionLog()
}
} }
} }
} }
} }
}
} }