추세검색 설정 추가
This commit is contained in:
@@ -37,6 +37,14 @@ import type { ChartLegendVisibility } from '../types/chartLegend';
|
||||
import { DEFAULT_MAIN_CHART_STYLE } from '../utils/storage';
|
||||
import { DEFAULT_SYNC, type SyncOptions } from '../utils/layoutTypes';
|
||||
import { DEFAULT_DISPLAY_TIMEZONE, normalizeTimezone, setDisplayTimezone } from '../utils/timezone';
|
||||
import {
|
||||
clampVirtualTargetMax,
|
||||
DEFAULT_VIRTUAL_TARGET_MAX,
|
||||
} from '../utils/virtualTargetLimits';
|
||||
import {
|
||||
resolveTrendSearchAppSettings,
|
||||
type TrendSearchAppSettings,
|
||||
} from '../utils/trendSearchAppSettings';
|
||||
|
||||
// 전역 캐시 — 여러 컴포넌트에서 공유하여 중복 요청 방지
|
||||
let _cache: AppSettingsDto | null = null;
|
||||
@@ -96,6 +104,7 @@ export function resolveAppDefaults(s: AppSettingsDto) {
|
||||
paperMinOrderKrw: s.paperMinOrderKrw ?? 5000,
|
||||
paperAutoTradeEnabled: s.paperAutoTradeEnabled ?? false,
|
||||
paperAutoTradeBudgetPct: s.paperAutoTradeBudgetPct ?? 95,
|
||||
virtualTargetMaxCount: clampVirtualTargetMax(s.virtualTargetMaxCount ?? DEFAULT_VIRTUAL_TARGET_MAX),
|
||||
tradingMode: s.tradingMode ?? 'PAPER',
|
||||
liveAutoTradeEnabled: s.liveAutoTradeEnabled ?? false,
|
||||
hasUpbitKeys: s.hasUpbitKeys ?? false,
|
||||
@@ -104,6 +113,9 @@ export function resolveAppDefaults(s: AppSettingsDto) {
|
||||
liveAutoTradeBudgetPct: s.liveAutoTradeBudgetPct ?? 95,
|
||||
fcmPushEnabled: s.fcmPushEnabled ?? false,
|
||||
displayTimezone: normalizeTimezone(s.displayTimezone ?? DEFAULT_DISPLAY_TIMEZONE),
|
||||
trendSearchSettings: resolveTrendSearchAppSettings(
|
||||
s.trendSearchSettings as Partial<TrendSearchAppSettings> | null | undefined,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -158,3 +170,9 @@ export function useAppSettings(sessionKey = 0) {
|
||||
|
||||
return { settings, defaults, isLoaded, save };
|
||||
}
|
||||
|
||||
/** 앱 설정 캐시 기준 투자대상 최대 개수 (훅 외부·추가 API 등) */
|
||||
export function getVirtualTargetMaxCount(): number {
|
||||
const n = _cache?.virtualTargetMaxCount;
|
||||
return clampVirtualTargetMax(n ?? DEFAULT_VIRTUAL_TARGET_MAX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user