Skip to content

Commit 744755f

Browse files
authored
fix(energy-complex): suppress EIA price cards when live tape covers same commodity (koala73#2009)
EIA wtiPrice/brentPrice are weekly survey data (can be a week stale) while the live tape shows real-time Yahoo Finance futures for CL=F and BZ=F. Showing both together produced two different prices for WTI and Brent with no context, confusing users. When the live tape has live data for CL=F or BZ=F, hide the corresponding EIA price card. EIA production and inventory metrics (the unique value of that data source) are always shown.
1 parent ab53df8 commit 744755f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/components/EnergyComplexPanel.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ export class EnergyComplexPanel extends Panel {
3535
}
3636

3737
private render(): void {
38+
// Suppress EIA price cards when live tape already covers the same commodity
39+
// to avoid showing two different prices for the same product (EIA is weekly/stale).
40+
const tapeCoveredSymbols = new Set(this.tape.filter(d => d.price !== null).map(d => d.symbol));
41+
const wtiInTape = tapeCoveredSymbols.has('CL=F');
42+
const brentInTape = tapeCoveredSymbols.has('BZ=F');
43+
3844
const metrics = [
39-
this.analytics?.wtiPrice,
40-
this.analytics?.brentPrice,
45+
wtiInTape ? null : this.analytics?.wtiPrice,
46+
brentInTape ? null : this.analytics?.brentPrice,
4147
this.analytics?.usProduction,
4248
this.analytics?.usInventory,
4349
].filter(Boolean);

0 commit comments

Comments
 (0)