From f25b6f538f6098496928275e06ab5a8c67dcba3c Mon Sep 17 00:00:00 2001 From: LGram16 Date: Sat, 31 Jan 2026 23:46:19 +0900 Subject: [PATCH] . --- components/TradeModal.tsx | 54 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/components/TradeModal.tsx b/components/TradeModal.tsx index 9cf3647..7eef3b9 100644 --- a/components/TradeModal.tsx +++ b/components/TradeModal.tsx @@ -141,6 +141,58 @@ const TradeModal: React.FC = ({ stock, type: initialType, onClo return quantity; }, [isBuyMode, quantityMode, quantity, quantityRatio, holding, buyingPower, stock.price]); + const summaryMessage = useMemo(() => { + const action = isBuyMode ? '매수' : '매도'; + const quantityText = quantityMode === 'RATIO' + ? `${finalQuantity}주(${isBuyMode ? '예수금' : '보유수량'}대비 ${quantityRatio}%)` + : `${finalQuantity}주`; + + const priceMethodMap = { + CURRENT: '현재가', + MARKET: '시장가', + HIGH: '고가', + LOW: '저가' + }; + + const tickText = tickOffset === 0 ? '+0틱' : (tickOffset > 0 ? `+${tickOffset}틱` : `${tickOffset}틱`); + const priceText = priceMethod === 'MARKET' ? '시장가' : `${priceMethodMap[priceMethod]}${tickText}`; + + if (!monitoringEnabled) { + return `${priceText}로 ${quantityText}를 ${action}합니다.`; + } + + let strategyDesc = ''; + if (activeStrategy === 'TRAILING_STOP') { + const triggerTypeMap = { + CURRENT: '현재가', + HIGH: '고가', + LOW: '저가', + VOLUME: '거래량' + }; + const triggerLabel = triggerTypeMap[triggerType]; + const josa = triggerType === 'VOLUME' ? '이' : '가'; + const triggerDesc = triggerEnabled + ? `${triggerLabel}${josa} ${triggerValue.toLocaleString()}${triggerType === 'VOLUME' ? '주' : currencySymbol} ${monCondition === 'ABOVE' ? '이상' : '이하'} 도달 후` + : '현재 시점부터'; + + const tsUnitText = tsUnit === 'PERCENT' ? '%' : tsUnit === 'TICK' ? '틱' : currencySymbol; + const turnAction = isBuyMode ? '반등' : '하락'; + strategyDesc = `${triggerDesc} ${tsValue}${tsUnitText} ${turnAction} 시`; + } else if (activeStrategy === 'PROFIT') { + const unitLabel = monTargetUnit === 'PRICE' ? '현재가' : monTargetUnit === 'PERCENT' ? '수익률(%)' : '수익금액'; + const unit = monTargetUnit === 'PERCENT' ? '%' : currencySymbol; + strategyDesc = `(이익실현) ${unitLabel} ${profitValue.toLocaleString()}${unit} 이상 도달 시`; + } else if (activeStrategy === 'LOSS') { + const unitLabel = monTargetUnit === 'PRICE' ? '현재가' : monTargetUnit === 'PERCENT' ? '수익률(%)' : '수익금액'; + const unit = monTargetUnit === 'PERCENT' ? '%' : currencySymbol; + strategyDesc = `(손절제한) ${unitLabel} ${lossValue.toLocaleString()}${unit} 이하 도달 시`; + } else { + strategyDesc = '조건 만족 시'; + } + + return `${strategyDesc} (${priceText})으로 ${quantityText}를 ${action}합니다.`; + }, [isBuyMode, monitoringEnabled, activeStrategy, triggerEnabled, triggerType, triggerValue, monCondition, tsValue, tsUnit, priceMethod, tickOffset, finalQuantity, quantityMode, quantityRatio, profitValue, lossValue, monTargetUnit, currencySymbol]); + const handleExecute = () => { if (monitoringEnabled) { let finalExpiry = new Date(); @@ -470,7 +522,7 @@ const TradeModal: React.FC = ({ stock, type: initialType, onClo

- {finalQuantity}주를 {isBuyMode ? '매수' : '매도'}합니다. + {summaryMessage}