알림목록 종목별 정렬시 시간별로 정렬되도록 수정
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
toUpbitMarket,
|
||||
} from '../../utils/backtestUiUtils';
|
||||
import { getKoreanName } from '../../utils/marketNameCache';
|
||||
import { compareMarketSymbol, compareTimeAsc } from '../../utils/tradeListSort';
|
||||
|
||||
export type ExecutionListTab = 'backtest' | 'live';
|
||||
export type BacktestListSort = 'strategy' | 'symbol' | 'return';
|
||||
@@ -58,7 +59,13 @@ export default function BacktestExecutionList({
|
||||
const sortedBacktests = useMemo(() => {
|
||||
const list = [...backtestRecords];
|
||||
if (sort === 'strategy') list.sort((a, b) => (a.strategyName ?? '').localeCompare(b.strategyName ?? ''));
|
||||
else if (sort === 'symbol') list.sort((a, b) => a.symbol.localeCompare(b.symbol));
|
||||
else if (sort === 'symbol') {
|
||||
list.sort((a, b) => {
|
||||
const bySymbol = compareMarketSymbol(a.symbol, b.symbol);
|
||||
if (bySymbol !== 0) return bySymbol;
|
||||
return compareTimeAsc(a.createdAt, b.createdAt);
|
||||
});
|
||||
}
|
||||
else list.sort((a, b) => (b.totalReturn ?? 0) - (a.totalReturn ?? 0));
|
||||
return list;
|
||||
}, [backtestRecords, sort]);
|
||||
@@ -117,7 +124,13 @@ export default function BacktestExecutionList({
|
||||
<p className="btd-sidebar-hint">가상투자 화면에서 자동·수동<br />매매를 실행하세요.</p>
|
||||
</div>
|
||||
) : (
|
||||
liveItems.map(item => {
|
||||
[...liveItems]
|
||||
.sort((a, b) => {
|
||||
const bySymbol = compareMarketSymbol(a.symbol, b.symbol);
|
||||
if (bySymbol !== 0) return bySymbol;
|
||||
return compareTimeAsc(a.createdAt, b.createdAt);
|
||||
})
|
||||
.map(item => {
|
||||
const positive = item.totalReturnPct >= 0;
|
||||
const active = selectedLiveId === item.id;
|
||||
const market = toUpbitMarket(item.symbol);
|
||||
|
||||
Reference in New Issue
Block a user