This commit is contained in:
2026-04-02 11:16:53 +09:00
parent 6e7f485988
commit 921e6c7caf
2 changed files with 52 additions and 63 deletions
+8 -52
View File
@@ -256,14 +256,14 @@ object RagService {
result(finalDecision, true)
} else {
println("✋ [$stockName] 기술 점수 미달로 분석 중단")
println("✋ [$stockName] 기술 점수 미달로 분석 중단 ${scores.toString()}")
TradingLogStore.addAnalyzer(stockName, stockCode, "기술 점수 미달로 분석 중단")
tradingDecision.confidence = 1.0
result(tradingDecision, false)
}
} else {
println("🚨 [$stockName] 재무 안전벨트 미달")
TradingLogStore.addAnalyzer(stockName, stockCode, "재무 안전벨트 미달로 분석 중단")
println("🚨 [$stockName] ${FinancialAnalyzer.getInvestmentStatus(financialStmt)} 재무 안전벨트 미달")
TradingLogStore.addAnalyzer(stockName, stockCode, "재무 안전벨트 미달로 분석 중단 ${FinancialAnalyzer.getInvestmentStatus(financialStmt)}")
tradingDecision.confidence = 1.0
result(tradingDecision, false)
}
@@ -290,53 +290,6 @@ object RagService {
return result.matches().isNotEmpty()
}
/**
* 질문과 가장 유사한 정보를 H2에서 검색하여 AI 답변을 생성합니다.
*/
// fun askWithContext(question: String,
// corpInfo: String,
// financialData: String,
// days : List<CandleData>,
// weeks : List<CandleData>,
// monthly : List<CandleData>): String {
// val questionEmbedding = embeddingModel.embed(question).content()
// val searchResult = embeddingStore.search(
// EmbeddingSearchRequest.builder()
// .queryEmbedding(questionEmbedding)
// .maxResults(5)
// .build()
// )
// val newsContext = searchResult.matches().joinToString("\n") { it.embedded().text() }
//
// // 2. 종합 분석 프롬프트 구성
// val finalPrompt = """
// <|begin_of_text|><|start_header_id|>system<|end_header_id|>
// 당신은 뉴스(심리), 재무(본질), 차트(추세)를 통합 분석하는 'AI 수석 애널리스트'입니다.
// 제공된 데이터를 바탕으로 아래 형식을 엄격히 지켜 분석 리포트를 작성하세요.
//
// [데이터 세트]
// 1. 기업 기본 정보: $corpInfo
// 2. 재무 성장성: $financialData
// 3. 기술적 추세: ${monthly}, ${weeks}, ${days}
// 4. 최신 이슈(뉴스): $newsContext
//
// [분석 요청 사항]
// 1. **업계 상황**: 해당 종목이 속한 업종의 현재 전체적인 흐름을 먼저 정리하세요.
// 2. **종목 이슈 분석**: 뉴스에서 포착된 핵심 키워드와 시장의 반응을 요약하세요.
// 3. **장기/단기 전략**:
// - 장기(재무/월봉 기반): 추천 혹은 비추천 사유
// - 단기(뉴스/일봉 기반): 추천 혹은 비추천 사유
// 4. **최종 결론**: '매수/관망/매도' 의견과 그에 따른 근거를 단호하게 제시하세요.
// <|eot_id|>
// <|start_header_id|>user<|end_header_id|>
// 질문: $question
// <|eot_id|><|start_header_id|>assistant<|end_header_id|>
// """.trimIndent()
//
// val response = chatModel.chat(UserMessage.from(finalPrompt))
//// println(response)
// return response.aiMessage().text()
// }
private fun LLM_API_URL() = "http://127.0.0.1:$LLM_PORT/v1/chat/completions"
private suspend fun callLlamaWithSchema(prompt: String): String {
@@ -409,9 +362,9 @@ object RagService {
// 2. 뉴스 유무에 따른 동적 데이터 섹션 구성
val newsDataSection = if (validNews != null) {
"3. News Context: $validNews"
"4. News Context: $validNews"
} else {
"3. News Context: No significant news available. Rely on financials."
"4. News Context: No significant news available. Rely on financials."
}
@@ -426,9 +379,12 @@ Your goal is to provide a final trading decision based on STRICT data analysis.
2. Financials: Operating Profit ${if(financialStmt.isOperatingProfitPositive) "PROFIT" else "LOSS"} (Growth: ${"%.2f".format(financialStmt.operatingProfitGrowth)}%), ROE: ${"%.2f".format(financialStmt.roe)}%, Debt: ${"%.2f".format(financialStmt.debtRatio)}%
3. Technical Analysis Summary: ${tempDecision.techSummary ?: "No technical summary available."}
$newsDataSection
# Step-by-Step Analysis Logic
1. Financial Review: First, evaluate the 'Financials' section for long-term stability.