aiden-shared-calculations-unified 1.0.50 → 1.0.52

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.
@@ -39,7 +39,13 @@ class DailyBoughtVsSoldCount {
39
39
  }
40
40
 
41
41
  getResult() {
42
- // Return the final aggregated counts
42
+ // --- ADD THIS CHECK ---
43
+ if (!this.processedDay) {
44
+ console.warn('[DailyBoughtVsSoldCount] getResult called but process never ran (missing insights). Returning null for backfill.');
45
+ return null;
46
+ }
47
+ // --- END ADD ---
48
+
43
49
  return {
44
50
  total_positions_bought_delta: this.totalBought,
45
51
  total_positions_sold_delta: this.totalSold
@@ -33,10 +33,16 @@ class DailyBuySellSentimentCount {
33
33
  }
34
34
 
35
35
  getResult() {
36
- // Return the final rounded sums
36
+ // --- ADD THIS CHECK ---
37
+ if (!this.processedDay) {
38
+ console.warn('[DailyBuySellSentimentCount] getResult called but process never ran (missing insights). Returning null for backfill.');
39
+ return null;
40
+ }
41
+ // --- END ADD ---
42
+
37
43
  return {
38
44
  total_buy_positions: Math.round(this.totalBuyPositions),
39
- total_sell_positions: Math.round(this.totalSellPositions) // 'sell' are shorts
45
+ total_sell_positions: Math.round(this.totalSellPositions)
40
46
  };
41
47
  }
42
48
 
@@ -42,7 +42,13 @@ class DailyOwnershipDelta {
42
42
  }
43
43
 
44
44
  getResult() {
45
- // Return the final calculated delta for each ticker
45
+ // --- ADD THIS CHECK ---
46
+ if (!this.processedDay) {
47
+ console.warn('[DailyOwnershipDelta] getResult called but process never ran (missing insights). Returning null for backfill.');
48
+ return null;
49
+ }
50
+ // --- END ADD ---
51
+
46
52
  return this.deltaByTicker;
47
53
  }
48
54
 
@@ -25,7 +25,13 @@ class DailyTotalPositionsHeld {
25
25
  }
26
26
 
27
27
  getResult() {
28
- // Return the final sum
28
+ // --- ADD THIS CHECK ---
29
+ if (!this.processedDay) {
30
+ console.warn('[DailyTotalPositionsHeld] getResult called but process never ran (missing insights). Returning null for backfill.');
31
+ return null;
32
+ }
33
+ // --- END ADD ---
34
+
29
35
  return {
30
36
  total_positions_held: this.totalPositions
31
37
  };
@@ -105,7 +105,7 @@ class UserProfitabilityTracker {
105
105
 
106
106
  const shardKey = `user_profitability_shard_${shardIndex}`;
107
107
  if (!results[shardKey]) results[shardKey] = {};
108
- results[shardKey][userId] = userHistory.slice(-7);
108
+ results[shardKey][userId] = { history: userHistory.slice(-7) };
109
109
  }
110
110
 
111
111
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiden-shared-calculations-unified",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "description": "Shared calculation modules for the BullTrackers Computation System.",
5
5
  "main": "index.js",
6
6
  "files": [