Files
atrade/src/main/kotlin/model/TradeModels.kt
T

113 lines
3.4 KiB
Kotlin
Raw Normal View History

2026-01-10 18:16:50 +09:00
package model
2026-04-16 15:48:23 +09:00
import analyzer.ScalpingSignalModel
import analyzer.TechnicalAnalyzer
2026-01-10 18:16:50 +09:00
import kotlinx.serialization.Serializable
2026-04-16 15:48:23 +09:00
import service.InvestmentGrade
2026-01-10 18:16:50 +09:00
@Serializable
data class RealTimeTrade(
2026-02-12 15:31:34 +09:00
val code: String,
2026-01-10 18:16:50 +09:00
val time: String, // 체결 시간 (HH:mm:ss)
val price: String, // 체결가
val change: String, // 전일 대비 (대비 기호 포함)
val volume: String, // 체결량
val type: TradeType // 매수체결(빨강) / 매도체결(파랑)
)
2026-04-16 15:48:23 +09:00
enum class TradeType { BUY, SELL, NEUTRAL }
@Serializable
class TradingDecision {
var corpName : String = ""
var stockName : String = ""
var ultraShortScore: Double = 0.0 // 초단기 (분봉/에너지)
var shortTermScore: Double = 0.0 // 단기 (일봉/뉴스)
var midTermScore: Double = 0.0 // 중기 (주봉/재무)
var longTermScore: Double = 0.0
// [추가] 화면 전환용 종목명
var currentPrice: Double = 0.0
var stockCode: String = ""
var decision: String? = null
var reason: String? = null
var confidence: Double = 0.0
var newsScore : Double = 0.0
var systemScore : Double = 0.0
var financialScore : Double = 0.0
var technicalScore : Double = 0.0
var investmentGrade : InvestmentGrade? = null
var techSummary : String? = null
var newsContext : String? = null
var financialData : String? = null
var analyzer : TechnicalAnalyzer? = null
var signalModel : ScalpingSignalModel? = null
2026-06-19 14:31:33 +09:00
var maxRealisticProfitRate :Double = 0.0
var reboundDaysDaily: Double = 0.0 // 일봉 기준 평균 반등 소요일
2026-09-15 14:26:53 +09:00
var isWatering: Boolean = false
2026-06-19 14:31:33 +09:00
var reboundWeeksWeekly: Double = 0.0 // 주봉 기준 평균 반등 소요주
var isReboundApproaching: Boolean = false // 반등 주기에 근접했는지 여부
var reboundGuideMessage: String = "반등 주기 데이터 없음" // UI나 로그에 노출할 가이드 메시지
2026-04-16 15:48:23 +09:00
fun shortPossible() =
listOf<Double>(ultraShortScore,
shortTermScore).average()
fun profitPossible() =
listOf<Double>(ultraShortScore,
shortTermScore,
midTermScore,
longTermScore).average()
fun safePossible() =
listOf<Double>(
midTermScore,
longTermScore).average()
2026-06-19 14:31:33 +09:00
fun summary(
targetProfitRate: Double) : String{
2026-04-16 15:48:23 +09:00
return """
$corpName[$stockName]
수익실현 가능성 : ${profitPossible()}
investmentGrade:${investmentGrade!!.name}
ultraShortScore :$ultraShortScore
shortTermScore :$shortTermScore
midTermScore :$midTermScore
longTermScore :$longTermScore
systemScore :$systemScore
technicalScore: $technicalScore
financialScore: $financialScore
newsScore: $newsScore
decision: $decision
reason: $reason
2026-06-19 14:31:33 +09:00
예측가능 수익율 : ${maxRealisticProfitRate}
반등 주기 가이드: ${analyzer?.generateMTFReboundGuide(targetProfitRate)}
2026-04-16 15:48:23 +09:00
""".trimIndent()
}
override fun toString(): String {
return """
$corpName($stockName)
수익실현 가능성 : ${profitPossible()}
ultraShortScore :$ultraShortScore
shortTermScore :$shortTermScore
midTermScore :$midTermScore
longTermScore :$longTermScore
decision: $decision
investmentGrade:${investmentGrade!!.name}
reason: $reason
confidence: $confidence
기술 분석: $techSummary
뉴스 점수: $newsScore
2026-06-19 14:31:33 +09:00
반등 주기 가이드: $reboundGuideMessage
2026-04-16 15:48:23 +09:00
""".trimIndent()
}
}
//재무재표: $financialData
//뉴스: $newsContext