bulltrackers-module 1.0.185 → 1.0.186

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.
@@ -25,9 +25,18 @@ async function runComputationPass(config, dependencies, computationManifest) {
25
25
 
26
26
  logger.log('INFO', `🚀 Starting PASS ${passToRun} (Targeting /computation_status/{YYYY-MM-DD})...`);
27
27
 
28
- const earliestDates = await getEarliestDataDates(config, dependencies); // Now not hardcoded.
28
+ // Hardcoded earliest dates
29
+ const earliestDates = {
30
+ portfolio: new Date('2025-09-25T00:00:00Z'),
31
+ history: new Date('2025-11-05T00:00:00Z'),
32
+ social: new Date('2025-10-30T00:00:00Z'),
33
+ insights: new Date('2025-08-26T00:00:00Z'),
34
+ price: new Date('2025-08-01T00:00:00Z') // A few weeks before insights (earliest other data)
35
+
36
+ };
29
37
  earliestDates.absoluteEarliest = Object.values(earliestDates).reduce((a,b) => a < b ? a : b);
30
38
 
39
+
31
40
  const passes = groupByPass(computationManifest);
32
41
  const calcsInThisPass = passes[passToRun] || [];
33
42
 
@@ -37,7 +37,7 @@ function checkRootDependencies(calcManifest, rootDataStatus) {
37
37
  * Checks for the availability of all required root data for a specific date.
38
38
  */
39
39
  async function checkRootDataAvailability(dateStr, config, dependencies, earliestDates) {
40
- const { logger, db } = dependencies;
40
+ const { logger } = dependencies;
41
41
  const dateToProcess = new Date(dateStr + 'T00:00:00Z');
42
42
  let portfolioRefs = [], historyRefs = [];
43
43
  let hasPortfolio = false, hasInsights = false, hasSocial = false, hasHistory = false, hasPrices = false;
@@ -50,8 +50,8 @@ async function checkRootDataAvailability(dateStr, config, dependencies, earliest
50
50
  if (dateToProcess >= earliestDates.social) tasks.push(loadDailySocialPostInsights(config, dependencies, dateStr).then(r => { socialData = r; hasSocial = !!r; }));
51
51
  if (dateToProcess >= earliestDates.history) tasks.push(getHistoryPartRefs(config, dependencies, dateStr).then(r => { historyRefs = r; hasHistory = !!r.length; }));
52
52
 
53
- // NEW: Check if price data exists (proper validation)
54
- if (dateToProcess >= (earliestDates.price || earliestDates.absoluteEarliest)) {
53
+ // NEW: Check if price data exists - simple validation
54
+ if (dateToProcess >= earliestDates.price) {
55
55
  tasks.push(checkPriceDataAvailability(config, dependencies).then(r => { hasPrices = r; }));
56
56
  }
57
57
 
@@ -74,14 +74,14 @@ async function checkRootDataAvailability(dateStr, config, dependencies, earliest
74
74
  }
75
75
 
76
76
  /**
77
- * NEW HELPER: Check if price data collection has any data
77
+ * NEW HELPER: Simple check if price collection has any data
78
78
  */
79
79
  async function checkPriceDataAvailability(config, dependencies) {
80
80
  const { db, logger } = dependencies;
81
81
  const collection = config.priceCollection || 'asset_prices';
82
82
 
83
83
  try {
84
- // Check if the collection has at least one shard document
84
+ // Just check if the collection has at least one document
85
85
  const snapshot = await db.collection(collection).limit(1).get();
86
86
 
87
87
  if (snapshot.empty) {
@@ -89,16 +89,6 @@ async function checkPriceDataAvailability(config, dependencies) {
89
89
  return false;
90
90
  }
91
91
 
92
- // Check if the first shard actually has price data
93
- const firstDoc = snapshot.docs[0];
94
- const data = firstDoc.data();
95
-
96
- if (!data || Object.keys(data).length === 0) {
97
- logger.log('WARN', `[checkPriceData] Price shard exists but is empty`);
98
- return false;
99
- }
100
-
101
- logger.log('TRACE', `[checkPriceData] Price data available in ${collection}`);
102
92
  return true;
103
93
 
104
94
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.185",
3
+ "version": "1.0.186",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [