...
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package ui
|
||||
|
||||
|
||||
import AutoTradeItem
|
||||
import TradingDecision
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
@@ -14,7 +12,6 @@ import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
@@ -25,7 +22,6 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import model.ConfigIndex
|
||||
import model.KisSession
|
||||
import service.TechnicalAnalyzer
|
||||
|
||||
@Composable
|
||||
fun TradingDecisionLog() {
|
||||
@@ -45,7 +41,13 @@ fun TradingDecisionLog() {
|
||||
Text("${log.time} - ${log.stockName}", fontWeight = FontWeight.Bold)
|
||||
Text(
|
||||
text = log.decision,
|
||||
color = if (log.decision == "BUY") Color.Red else Color.Gray,
|
||||
color = when (log.decision) {
|
||||
"BUY" -> Color.Red
|
||||
"SETTING" -> Color(0xFFFFA500) // 주황색
|
||||
"SELL" -> Color(0xFF800080) // 보라색
|
||||
"HOLD" -> Color.Gray // HOLD는 그레이
|
||||
else -> Color.Gray // 그 외 기본값 그레이
|
||||
},
|
||||
fontWeight = FontWeight.ExtraBold
|
||||
)
|
||||
}
|
||||
@@ -63,6 +65,7 @@ fun TradingDecisionLog() {
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier.fillMaxWidth().fillMaxHeight().background(Color.White)
|
||||
) {
|
||||
var firstSet = mutableSetOf<ConfigIndex>()
|
||||
item(span = { GridItemSpan(maxLineSpan) }) { // 2열을 모두 차지함
|
||||
Text(
|
||||
"💰 거래 기본 설정",
|
||||
@@ -92,9 +95,16 @@ fun TradingDecisionLog() {
|
||||
// 저장 로직을 공통 함수로 분리
|
||||
val saveAction = {
|
||||
var newValue = localText.toDoubleOrNull() ?: 0.0
|
||||
var oldValue = KisSession.config.getValues(configKey)
|
||||
if (configKey.label.contains("PROFIT")) {
|
||||
newValue = newValue / KisSession.config.getValues(ConfigIndex.PROFIT_INDEX)
|
||||
}
|
||||
if (firstSet.contains(configKey)) {
|
||||
TradingLogStore.addSettingLog(configKey.label,oldValue.toString(),newValue.toString(),"💾 저장됨: ${configKey.label} = $newValue")
|
||||
} else {
|
||||
firstSet.add(configKey)
|
||||
}
|
||||
|
||||
KisSession.config.setValues(configKey, newValue)
|
||||
DatabaseFactory.saveConfig(KisSession.config)
|
||||
println("💾 저장됨: ${configKey.label} = $newValue")
|
||||
@@ -173,11 +183,16 @@ fun TradingDecisionLog() {
|
||||
}
|
||||
|
||||
val saveAction = {
|
||||
var oldValue = KisSession.config.getValues(configKey)
|
||||
var newValue = localText.toDoubleOrNull() ?: 0.0
|
||||
//
|
||||
KisSession.config.setValues(configKey, newValue)
|
||||
DatabaseFactory.saveConfig(KisSession.config)
|
||||
println("💾 저장됨: ${configKey.label} = $newValue")
|
||||
if (firstSet.contains(configKey)) {
|
||||
TradingLogStore.addSettingLog(configKey.label,oldValue.toString(),newValue.toString(),"💾 저장됨: ${configKey.label} = $newValue")
|
||||
} else {
|
||||
firstSet.add(configKey)
|
||||
}
|
||||
labelText = if (configKey.name.contains("PROFIT")) {
|
||||
getRemaining(configKey.label,common) + ": 기준율(${KisSession.config.getValues(ConfigIndex.PROFIT_INDEX)}) * 성향별 비율(${KisSession.config.getValues(configKey)}) + 세금제비용(${KisSession.config.getValues(
|
||||
ConfigIndex.TAX_INDEX)}) = ${(localText.toDouble() * KisSession.config.getValues(ConfigIndex.PROFIT_INDEX)) + KisSession.config.getValues(
|
||||
|
||||
Reference in New Issue
Block a user