aiden-shared-calculations-unified 1.0.154 → 1.0.156

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.
@@ -5,7 +5,7 @@ class AumLeaderboard {
5
5
  static getMetadata() {
6
6
  return {
7
7
  type: 'meta',
8
- category: 'analytics',
8
+ category: 'popular-investor',
9
9
  rootDataDependencies: ['rankings'],
10
10
  mandatoryRoots: ['rankings'],
11
11
  schedule: { type: 'DAILY' }
@@ -6,7 +6,7 @@ class GlobalAumPerAsset30D {
6
6
  static getMetadata() {
7
7
  return {
8
8
  type: 'meta',
9
- category: 'analytics',
9
+ category: 'popular-investor',
10
10
  rootDataDependencies: [],
11
11
  schedule: { type: 'DAILY' }
12
12
  };
@@ -40,7 +40,6 @@ class GlobalAumPerAsset30D {
40
40
  // Result: { AAPL: 5000000, TSLA: ... }
41
41
  this.results = globalTotals;
42
42
 
43
- // Return for potential debugging or further chaining
44
43
  return this.results;
45
44
  }
46
45
 
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * @fileoverview Calculates the $ AUM allocated to each asset for a single PI.
3
- * Includes a lookback mechanism: If AUM is missing today, it checks the last 7 days of rankings.
3
+ * Includes a lookback mechanism: If AUM is missing today, it checks the last 30 days of rankings.
4
4
  */
5
5
  class PIDailyAssetAUM {
6
6
  static getMetadata() {
7
7
  return {
8
8
  type: 'standard',
9
- category: 'analytics',
9
+ category: 'popular-investor',
10
10
  userType: 'POPULAR_INVESTOR', // Ensures we only run for PIs
11
11
 
12
12
  // 1. Core Data
@@ -14,9 +14,9 @@ class PIDailyAssetAUM {
14
14
  mandatoryRoots: ['portfolio'], // Rankings are mandatory but handled via lookback if missing today
15
15
 
16
16
  // 2. Rankings Lookback Series
17
- // This requests the last 7 days of rankings to be available in context.seriesData.root.rankings
17
+ // This requests the last 30 days of rankings to be available in context.seriesData.root.rankings
18
18
  rootDataSeries: {
19
- rankings: 7
19
+ rankings: 30
20
20
  }
21
21
  };
22
22
  }
@@ -45,8 +45,6 @@ class PIDailyAssetAUM {
45
45
 
46
46
  if (historicalAum > 0) {
47
47
  piAum = historicalAum;
48
- // Optional: Log that we used historical data
49
- // context.logger.log('INFO', `Using historical AUM for ${userId} from ${dateKey}: $${piAum}`);
50
48
  break;
51
49
  }
52
50
  }
@@ -66,10 +64,9 @@ class PIDailyAssetAUM {
66
64
  const ticker = context.mappings.instrumentToTicker[instId] || `ID:${instId}`;
67
65
 
68
66
  // Get Weight (%)
69
- const pct = extract.getPositionWeight(pos); // Uses Invested or Amount based on schema
67
+ const pct = extract.getPositionWeight(pos);
70
68
 
71
69
  // Calculate $ Value: AUM * (Weight / 100)
72
- // Note: Ensure pct is treated as percentage (e.g. 5.5 = 5.5%)
73
70
  if (pct > 0) {
74
71
  const usdValue = piAum * (pct / 100);
75
72
 
@@ -79,10 +76,10 @@ class PIDailyAssetAUM {
79
76
  });
80
77
 
81
78
  // --- STEP C: Output Results ---
82
- // Format: { [UserId]: { Ticker: $Amount } }
83
- this.results = {
84
- [userId]: allocationMap
85
- };
79
+ // CRITICAL FIX: Accumulate results, do not overwrite 'this.results'
80
+ if (!this.results) this.results = {};
81
+
82
+ this.results[userId] = allocationMap;
86
83
 
87
84
  return this.results;
88
85
  }
@@ -5,7 +5,7 @@ class RiskLeaderboard {
5
5
  static getMetadata() {
6
6
  return {
7
7
  type: 'meta',
8
- category: 'analytics',
8
+ category: 'popular-investor',
9
9
  rootDataDependencies: ['rankings'],
10
10
  mandatoryRoots: ['rankings'],
11
11
  schedule: { type: 'DAILY' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiden-shared-calculations-unified",
3
- "version": "1.0.154",
3
+ "version": "1.0.156",
4
4
  "description": "Shared calculation modules for the BullTrackers Computation System.",
5
5
  "main": "index.js",
6
6
  "files": [