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) {
Window(onCloseRequest = { isWindowOpen = false }, title = "KIS AI 자동매매", state = windowState) {
var currentScreen by remember { mutableStateOf(AppScreen.Settings) }
var isLoaded by remember { mutableStateOf(false) }
val scope = rememberCoroutineScope()
// 1. 앱 시작 시 DB에서 마지막 설정 로드 (KisSession에 주입)
LaunchedEffect(Unit) {
DatabaseFactory.init()
transaction {
ConfigTable.selectAll().lastOrNull()?.let {
KisSession.config = AppConfig(
realAppKey = it[ConfigTable.realAppKey],
realSecretKey = it[ConfigTable.realSecretKey],
realAccountNo = it[ConfigTable.realAccountNo],
vtsAppKey = it[ConfigTable.vtsAppKey],
vtsSecretKey = it[ConfigTable.vtsSecretKey],
vtsAccountNo = it[ConfigTable.vtsAccountNo],
nAppKey = it[ConfigTable.nAppKey],
nSecretKey = it[ConfigTable.nSecretKey],
dAppKey = it[ConfigTable.dAppKey],
isSimulation = it[ConfigTable.isSimulation],
htsId = it[ConfigTable.htsId],
modelPath = it[ConfigTable.modelPath],
embedModelPath = it[ConfigTable.embedModelPath],
FEES_AND_TAXRATE = it[ConfigTable.fees_and_taxrate],
MINIMUM_NET_PROFIT = it[ConfigTable.minimum_net_profit],
BUY_WEIGHT = it[ConfigTable.buy_weight],
MAX_BUDGET = it[ConfigTable.max_budget],
MAX_PRICE = it[ConfigTable.max_price],
MIN_PRICE = it[ConfigTable.min_price],
MIN_PURCHASE_SCORE = it[ConfigTable.min_purchase_score],
SELL_PROFIT = it[ConfigTable.sell_profit],
GRADE_5_BUY = it[grade_5_buy],
GRADE_5_PROFIT = it[grade_5_profit],
GRADE_4_BUY = it[grade_4_buy],
GRADE_4_PROFIT = it[grade_4_profit],
GRADE_3_BUY = it[grade_3_buy],
GRADE_3_PROFIT = it[grade_3_profit],
GRADE_2_BUY = it[grade_2_buy],
GRADE_2_PROFIT = it[grade_2_profit],
GRADE_1_BUY = it[grade_1_buy],
GRADE_1_PROFIT = it[grade_1_profit],
MAX_COUNT = it[max_count],
)
Window(onCloseRequest = { isWindowOpen = false }, title = "KIS AI 자동매매", state = windowState) {
var currentScreen by remember { mutableStateOf(AppScreen.Settings) }
var isLoaded by remember { mutableStateOf(false) }
// 1. 앱 시작 시 DB에서 마지막 설정 로드 (KisSession에 주입)
LaunchedEffect(Unit) {
DatabaseFactory.init()
transaction {
ConfigTable.selectAll().lastOrNull()?.let {
KisSession.config = AppConfig(
realAppKey = it[ConfigTable.realAppKey],
realSecretKey = it[ConfigTable.realSecretKey],
realAccountNo = it[ConfigTable.realAccountNo],
vtsAppKey = it[ConfigTable.vtsAppKey],
vtsSecretKey = it[ConfigTable.vtsSecretKey],
vtsAccountNo = it[ConfigTable.vtsAccountNo],
nAppKey = it[ConfigTable.nAppKey],
nSecretKey = it[ConfigTable.nSecretKey],
dAppKey = it[ConfigTable.dAppKey],
isSimulation = it[ConfigTable.isSimulation],
htsId = it[ConfigTable.htsId],
modelPath = it[ConfigTable.modelPath],
embedModelPath = it[ConfigTable.embedModelPath],
FEES_AND_TAXRATE = it[ConfigTable.fees_and_taxrate],
MINIMUM_NET_PROFIT = it[ConfigTable.minimum_net_profit],
BUY_WEIGHT = it[ConfigTable.buy_weight],
MAX_BUDGET = it[ConfigTable.max_budget],
MAX_PRICE = it[ConfigTable.max_price],
MIN_PRICE = it[ConfigTable.min_price],
MIN_PURCHASE_SCORE = it[ConfigTable.min_purchase_score],
SELL_PROFIT = it[ConfigTable.sell_profit],
GRADE_5_BUY = it[grade_5_buy],
GRADE_5_PROFIT = it[grade_5_profit],
GRADE_4_BUY = it[grade_4_buy],
GRADE_4_PROFIT = it[grade_4_profit],
GRADE_3_BUY = it[grade_3_buy],
GRADE_3_PROFIT = it[grade_3_profit],
GRADE_2_BUY = it[grade_2_buy],
GRADE_2_PROFIT = it[grade_2_profit],
GRADE_1_BUY = it[grade_1_buy],
GRADE_1_PROFIT = it[grade_1_profit],
MAX_COUNT = it[max_count],
)
}
}
isLoaded = true
}
isLoaded = true
}
if (!isLoaded) {
// 로딩 중 표시
CircularProgressIndicator()
} else {
when (currentScreen) {
AppScreen.Settings -> {
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
if (!isLoaded) {
// 로딩 중 표시
CircularProgressIndicator()
} else {
when (currentScreen) {
AppScreen.Settings -> {
AutoTradingManager.onMarketClosed = {
println("프로그램 초기화 실행됨")
currentScreen = AppScreen.Settings
isWindowOpen = false
}
)
}
AppScreen.Dashboard -> {
DashboardScreen()
}
AppScreen.TradingDecision -> {
TradingDecisionLog()
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
}
)
}
AppScreen.Dashboard -> {
DashboardScreen()
}
AppScreen.TradingDecision -> {
TradingDecisionLog()
}
}
}
}
}
}
}