커스텀 수정

This commit is contained in:
Macbook
2026-06-03 02:43:13 +09:00
parent 8cba6a612a
commit 656248a72f
6 changed files with 124 additions and 30 deletions
+38 -1
View File
@@ -1,4 +1,41 @@
import type { Timeframe } from '../types';
import type { ChartType, Timeframe } from '../types';
export function toUpbitMarket(symbol: string): string {
return symbol.startsWith('KRW-') ? symbol : `KRW-${symbol}`;
}
const TIMEFRAME_KO: Record<Timeframe, string> = {
'1m': '1분',
'3m': '3분',
'5m': '5분',
'10m': '10분',
'15m': '15분',
'30m': '30분',
'1h': '1시간',
'4h': '4시간',
'1D': '1일',
'1W': '1주',
'1M': '1월',
};
/** 차트·목록용 시간봉 한글 라벨 */
export function formatTimeframeKo(raw: string | undefined): string {
const tf = normalizeChartTimeframe(raw);
return TIMEFRAME_KO[tf] ?? tf;
}
const CHART_TYPE_KO: Record<ChartType, string> = {
candlestick: '캔들스틱',
bar: '바',
line: '라인',
area: '영역',
baseline: '기준선',
};
export function formatChartTypeKo(type: ChartType | string | undefined): string {
if (!type) return '캔들스틱';
return CHART_TYPE_KO[type as ChartType] ?? String(type);
}
export function normalizeChartTimeframe(raw: string | undefined): Timeframe {
const t = (raw ?? '1h').trim();