40 lines
1.6 KiB
Kotlin
40 lines
1.6 KiB
Kotlin
//package service
|
|
//
|
|
//import kotlinx.coroutines.async
|
|
//import kotlinx.coroutines.coroutineScope
|
|
//import model.CandleData
|
|
//import model.RealTimeTrade
|
|
//import network.NewsService
|
|
//
|
|
//object StockAnalysisManager {
|
|
// var days : List<CandleData> = emptyList()
|
|
// var weeks : List<CandleData> = emptyList()
|
|
// var monthly : List<CandleData> = emptyList()
|
|
// var mins : List<CandleData> = emptyList()
|
|
//
|
|
// suspend fun analyzeStockWithMultiData(stockCode : String, stockName: String, result : (String)-> Unit) {
|
|
// coroutineScope {
|
|
// println("🔍 [1/3] '${stockName}' 실시간 뉴스 수집 및 학습 시작...")
|
|
//
|
|
// val corpInfoDeferred = async { NewsService.fetchCorpInfo(stockCode) }
|
|
// val financialDataDeferred = async { NewsService.fetchFinancialGrowth(stockCode) }
|
|
//
|
|
// val corpInfo = corpInfoDeferred.await()
|
|
// val financialData = financialDataDeferred.await()
|
|
//
|
|
// NewsService.fetchAndIngestNews("$stockName 주가 전망")
|
|
//
|
|
// println("🧠 [2/3] 관련 컨텍스트 추출 중...")
|
|
//
|
|
// // 2. 방금 저장된 뉴스를 포함하여 DB에서 관련성 높은 정보 추출
|
|
// val question = "$stockCode 종목의 현재 주가 흐름과 뉴스, 재무 실적을 바탕으로 종합 투자 전략을 세워줘."
|
|
// val context = RagService.askWithContext(question,corpInfo,financialData,days,weeks,monthly)
|
|
//
|
|
// println("🤖 [3/3] AI 분석 생성 중 (Chat 서버 8080)...")
|
|
//
|
|
// // 3. 최종 분석 결과 반환
|
|
// result.invoke(context)
|
|
// }
|
|
// }
|
|
//
|
|
//} |