전략평가 화면 수정
This commit is contained in:
@@ -1472,18 +1472,41 @@ export async function fetchLiveConditionStatus(
|
||||
strategyId: number,
|
||||
barTimeSec?: number | null,
|
||||
indicatorParams?: Record<string, Record<string, unknown>> | null,
|
||||
chartBars?: Array<{
|
||||
time: number;
|
||||
open: number;
|
||||
high: number;
|
||||
low: number;
|
||||
close: number;
|
||||
volume: number;
|
||||
}> | null,
|
||||
chartTimeframe?: string | null,
|
||||
): Promise<LiveConditionStatusDto | null> {
|
||||
if (indicatorParams && Object.keys(indicatorParams).length > 0) {
|
||||
const normalizedBarTime = barTimeSec != null && Number.isFinite(barTimeSec)
|
||||
? Math.floor(barTimeSec)
|
||||
: null;
|
||||
const useChartBars = chartBars != null && chartBars.length > 0 && chartTimeframe;
|
||||
|
||||
if (useChartBars || (indicatorParams && Object.keys(indicatorParams).length > 0)) {
|
||||
return request<LiveConditionStatusDto>('/strategy/live-conditions/evaluate', {
|
||||
method: 'POST',
|
||||
cache: 'no-store',
|
||||
body: JSON.stringify({
|
||||
market,
|
||||
strategyId,
|
||||
barTimeSec: barTimeSec != null && Number.isFinite(barTimeSec)
|
||||
? Math.floor(barTimeSec)
|
||||
: null,
|
||||
indicatorParams,
|
||||
barTimeSec: normalizedBarTime,
|
||||
indicatorParams: indicatorParams ?? undefined,
|
||||
bars: useChartBars
|
||||
? chartBars.map(b => ({
|
||||
time: b.time,
|
||||
open: b.open,
|
||||
high: b.high,
|
||||
low: b.low,
|
||||
close: b.close,
|
||||
volume: b.volume,
|
||||
}))
|
||||
: undefined,
|
||||
timeframe: useChartBars ? chartTimeframe : undefined,
|
||||
}),
|
||||
});
|
||||
}
|
||||
@@ -1491,8 +1514,8 @@ export async function fetchLiveConditionStatus(
|
||||
market,
|
||||
strategyId: String(strategyId),
|
||||
});
|
||||
if (barTimeSec != null && Number.isFinite(barTimeSec)) {
|
||||
params.set('barTimeSec', String(Math.floor(barTimeSec)));
|
||||
if (normalizedBarTime != null) {
|
||||
params.set('barTimeSec', String(normalizedBarTime));
|
||||
}
|
||||
return request<LiveConditionStatusDto>(`/strategy/live-conditions?${params}`, {
|
||||
cache: 'no-store',
|
||||
|
||||
Reference in New Issue
Block a user