.
This commit is contained in:
@@ -141,6 +141,58 @@ const TradeModal: React.FC<TradeModalProps> = ({ 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<TradeModalProps> = ({ stock, type: initialType, onClo
|
||||
|
||||
<div className="p-4 bg-slate-900/5 rounded-2xl border border-slate-100 text-center">
|
||||
<p className="text-[12px] font-black text-slate-600 leading-tight">
|
||||
<span className={`${isBuyMode ? 'text-rose-500' : 'text-blue-600'}`}>{finalQuantity}주</span>를 {isBuyMode ? '매수' : '매도'}합니다.
|
||||
{summaryMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user