배치 수정
This commit is contained in:
@@ -286,10 +286,16 @@ const Dashboard = () => {
|
||||
const liveProfitLoss = liveValue - totalInvestment
|
||||
const liveProfitLossRate = totalInvestment > 0 ? (liveProfitLoss / totalInvestment) * 100 : 0
|
||||
|
||||
// 총 자산 = 예수금(KIS 기준) + 주식 평가금액(live)
|
||||
// KIS API total_assets가 있으면 그 예수금 부분만 분리해서 live 주식값 합산
|
||||
const availableCash = portfolioSummary.available_cash || 0
|
||||
const liveTotal = availableCash + liveValue
|
||||
// 총 자산 = KIS tot_evlu_amt(공식 총평가금액) 기준 + 실시간 주식평가 변동분 반영
|
||||
// KIS tot_evlu_amt는 D+2 정산 등을 포함한 정확한 값이므로 base로 사용하고
|
||||
// 주식 평가분만 live 가격으로 보정 (stock_value_from_api = scts_evlu_amt)
|
||||
const backendStockValue = portfolioSummary.stock_value_from_api || 0
|
||||
const liveTotal = (portfolioSummary.total_assets || 0) + (liveValue - backendStockValue)
|
||||
|
||||
// 금일 손익도 live 주식 변동분 반영
|
||||
const bfdyTotal = portfolioSummary.bfdy_total_assets || 0
|
||||
const liveTodayPL = bfdyTotal > 0 ? liveTotal - bfdyTotal : (portfolioSummary.today_profit_loss || 0)
|
||||
const liveTodayPLRate = bfdyTotal > 0 ? (liveTodayPL / bfdyTotal) * 100 : (portfolioSummary.today_profit_loss_rate || 0)
|
||||
|
||||
return {
|
||||
...portfolioSummary,
|
||||
@@ -298,6 +304,8 @@ const Dashboard = () => {
|
||||
total_profit_loss: liveProfitLoss,
|
||||
total_profit_loss_rate: liveProfitLossRate,
|
||||
total_assets: liveTotal,
|
||||
today_profit_loss: liveTodayPL,
|
||||
today_profit_loss_rate: liveTodayPLRate,
|
||||
}
|
||||
}, [portfolioSummary, portfolio, livePrices])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user