diff --git a/backend/src/domain/candle-predict/index.ts b/backend/src/domain/candle-predict/index.ts index 24bcbf7a..722d1dd5 100644 --- a/backend/src/domain/candle-predict/index.ts +++ b/backend/src/domain/candle-predict/index.ts @@ -571,6 +571,14 @@ export async function updateAdminConfig(body: Record) { : undefined, }); + // Global enable toggles should win over stale per-interval "on/off" overrides. + if ( + typeof body.tieToleranceMinEnabled === 'boolean' || + typeof body.tieToleranceMaxEnabled === 'boolean' + ) { + await repo.clearIntervalNeutralityEnabledOverrides(); + } + if (config.redis.enabled) { const activeIntervals = await loadResolvedIntervals(updated, true); await Promise.all( diff --git a/backend/src/repositories/candlePredictRepository.ts b/backend/src/repositories/candlePredictRepository.ts index 27587103..2ca38e2d 100644 --- a/backend/src/repositories/candlePredictRepository.ts +++ b/backend/src/repositories/candlePredictRepository.ts @@ -208,6 +208,19 @@ export async function updateConfig(update: ConfigUpdate): Promise { + await query( + `UPDATE candle_predict_intervals + SET tie_tolerance_min_enabled = NULL, + tie_tolerance_max_enabled = NULL, + updated_at = NOW()` + ); +} + export async function getRoundByOpenMs( openMs: number, intervalMinutes: number diff --git a/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx b/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx index b518beb4..e1d294f8 100644 --- a/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx +++ b/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx @@ -18,10 +18,12 @@ export function AdminPoolInsights({ config, interval, round }: Props) { const parts: string[] = []; const tieTolerancePercent = interval.tieTolerancePercent ?? config.tieTolerancePercent ?? 0; const tieToleranceMaxPercent = interval.tieToleranceMaxPercent ?? config.tieToleranceMaxPercent ?? 100; + // Prefer resolved interval flags (same as settlement). Do not default to "on" + // when the global catalog explicitly disabled the rules. const tieToleranceMinEnabled = - interval.tieToleranceMinEnabled ?? config.tieToleranceMinEnabled ?? true; + interval.tieToleranceMinEnabled ?? config.tieToleranceMinEnabled ?? false; const tieToleranceMaxEnabled = - interval.tieToleranceMaxEnabled ?? config.tieToleranceMaxEnabled ?? true; + interval.tieToleranceMaxEnabled ?? config.tieToleranceMaxEnabled ?? false; if (tieToleranceMinEnabled) { parts.push(t('candlePredict.adminInsights.neutralMin', { percent: tieTolerancePercent })); @@ -31,7 +33,9 @@ export function AdminPoolInsights({ config, interval, round }: Props) { } const neutralityRulesSummary = - parts.length > 0 ? parts.join(' · ') : t('candlePredict.adminInsights.neutralNone'); + parts.length > 0 + ? `${parts.join(' · ')}. ${t('candlePredict.adminInsights.neutralBehavior')}` + : t('candlePredict.adminInsights.neutralNone'); const poolWinnerLabel = config.poolWinnerRule === 'majority' @@ -48,7 +52,7 @@ export function AdminPoolInsights({ config, interval, round }: Props) { - {neutralityRulesSummary}. {t('candlePredict.adminInsights.neutralBehavior')} + {neutralityRulesSummary} {t('candlePredict.adminInsights.footer')}