From c1c52ff95c054b8b697e77f74c6069b6161fabb8 Mon Sep 17 00:00:00 2001 From: mooncitydev Date: Fri, 24 Apr 2026 05:10:17 +0900 Subject: [PATCH 1/2] fix opinion child markets volume24h by distributing parent volume evenly Made-with: Cursor --- core/src/exchanges/opinion/normalizer.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/exchanges/opinion/normalizer.ts b/core/src/exchanges/opinion/normalizer.ts index b272146b..122219ff 100644 --- a/core/src/exchanges/opinion/normalizer.ts +++ b/core/src/exchanges/opinion/normalizer.ts @@ -57,8 +57,11 @@ export class OpinionNormalizer implements IExchangeNormalizer 0 ? parentVolume24h / children.length : 0; + for (const child of children) { - const market = this.normalizeChildMarket(child, raw); + const market = this.normalizeChildMarket(child, raw, perChildVolume24h); if (market) results.push(market); } @@ -267,6 +270,7 @@ export class OpinionNormalizer implements IExchangeNormalizer Date: Fri, 24 Apr 2026 19:28:40 +0300 Subject: [PATCH 2/2] fix: distribute volume24h proportionally by child volume instead of evenly --- core/src/exchanges/opinion/normalizer.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/exchanges/opinion/normalizer.ts b/core/src/exchanges/opinion/normalizer.ts index 122219ff..ea2374d7 100644 --- a/core/src/exchanges/opinion/normalizer.ts +++ b/core/src/exchanges/opinion/normalizer.ts @@ -58,10 +58,14 @@ export class OpinionNormalizer implements IExchangeNormalizer 0 ? parentVolume24h / children.length : 0; + const totalChildVolume = children.reduce((sum, c) => sum + parseNumStr(c.volume), 0); for (const child of children) { - const market = this.normalizeChildMarket(child, raw, perChildVolume24h); + const childVolume = parseNumStr(child.volume); + const childVolume24h = totalChildVolume > 0 + ? (childVolume / totalChildVolume) * parentVolume24h + : 0; + const market = this.normalizeChildMarket(child, raw, childVolume24h); if (market) results.push(market); }