가상수정2
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
} from '../utils/backendApi';
|
||||
import { formatIndicatorDisplayLabel } from '../utils/indicatorRegistry';
|
||||
import {
|
||||
coerceFiniteNumber,
|
||||
extractVirtualConditions,
|
||||
type VirtualConditionRow,
|
||||
} from '../utils/virtualStrategyConditions';
|
||||
@@ -42,13 +43,13 @@ function liveRowToVirtual(r: LiveConditionRowDto): VirtualConditionRow & { curre
|
||||
displayName: formatIndicatorDisplayLabel(r.indicatorType),
|
||||
conditionType: r.conditionType,
|
||||
conditionLabel: r.conditionLabel,
|
||||
targetValue: r.targetValue,
|
||||
targetValue: coerceFiniteNumber(r.targetValue),
|
||||
timeframe: r.timeframe,
|
||||
side: r.side,
|
||||
plotKey,
|
||||
satisfied: r.satisfied,
|
||||
thresholdLabel: r.thresholdLabel,
|
||||
currentValue: r.currentValue,
|
||||
currentValue: coerceFiniteNumber(r.currentValue),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -76,8 +77,8 @@ function mergeRows(
|
||||
...row,
|
||||
satisfied: liveRow.satisfied,
|
||||
thresholdLabel: liveRow.thresholdLabel,
|
||||
currentValue: liveRow.currentValue,
|
||||
targetValue: liveRow.targetValue ?? row.targetValue,
|
||||
currentValue: coerceFiniteNumber(liveRow.currentValue),
|
||||
targetValue: coerceFiniteNumber(liveRow.targetValue) ?? row.targetValue,
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -102,7 +103,12 @@ async function buildSnapshot(
|
||||
};
|
||||
}
|
||||
|
||||
const status = await fetchLiveConditionStatus(market, strategyId);
|
||||
let status: Awaited<ReturnType<typeof fetchLiveConditionStatus>> = null;
|
||||
try {
|
||||
status = await fetchLiveConditionStatus(market, strategyId);
|
||||
} catch {
|
||||
status = null;
|
||||
}
|
||||
if (!status || status.market !== market || status.strategyId !== strategyId) {
|
||||
if (baseRows.length === 0) return null;
|
||||
return {
|
||||
@@ -121,7 +127,7 @@ async function buildSnapshot(
|
||||
timeframe: status.timeframe || [...new Set(baseRows.map(r => r.timeframe))].join(', '),
|
||||
rows: mergeRows(baseRows, status.rows),
|
||||
updatedAt: status.updatedAt || Date.now(),
|
||||
matchRate: status.matchRate,
|
||||
matchRate: coerceFiniteNumber(status.matchRate) ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user