aiden-shared-calculations-unified 1.0.89 → 1.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -87,9 +87,9 @@ class CorePriceMetrics {
|
|
|
87
87
|
|
|
88
88
|
process(context) {
|
|
89
89
|
const { mappings, prices, date } = context;
|
|
90
|
-
|
|
90
|
+
// FIX 1: Use the correct property name 'instrumentToSector'
|
|
91
|
+
const { instrumentToTicker, instrumentToSector } = mappings;
|
|
91
92
|
|
|
92
|
-
// Uses history from context
|
|
93
93
|
const priceData = prices?.history;
|
|
94
94
|
const todayDateStr = date.today;
|
|
95
95
|
|
|
@@ -101,7 +101,8 @@ class CorePriceMetrics {
|
|
|
101
101
|
const by_instrument = {};
|
|
102
102
|
const tickerToInstrument = {};
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
// FIX 2: Iterate over Object.values() since priceData is a map, not an array
|
|
105
|
+
for (const p of Object.values(priceData)) {
|
|
105
106
|
const ticker = instrumentToTicker[p.instrumentId];
|
|
106
107
|
if (!ticker) continue;
|
|
107
108
|
tickerToInstrument[ticker] = p.instrumentId;
|
|
@@ -125,7 +126,9 @@ class CorePriceMetrics {
|
|
|
125
126
|
const sectorAggs = {};
|
|
126
127
|
for (const ticker in by_instrument) {
|
|
127
128
|
const instId = tickerToInstrument[ticker];
|
|
128
|
-
|
|
129
|
+
// FIX 1 (Usage): Use the corrected variable name
|
|
130
|
+
const sector = instrumentToSector[instId] || "Unknown";
|
|
131
|
+
|
|
129
132
|
if (!sectorAggs[sector]) sectorAggs[sector] = { metrics: {}, counts: {} };
|
|
130
133
|
|
|
131
134
|
const data = by_instrument[ticker];
|