@discomedia/utils 1.0.43 → 1.0.44

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.
package/dist/index.mjs CHANGED
@@ -16957,7 +16957,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16957
16957
  */
16958
16958
  async getHistoricalBars(params) {
16959
16959
  const symbols = params.symbols;
16960
- const symbolsStr = symbols.join(',');
16960
+ symbols.join(',');
16961
16961
  let allBars = {};
16962
16962
  let pageToken = null;
16963
16963
  let hasMorePages = true;
@@ -16968,7 +16968,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16968
16968
  symbols.forEach((symbol) => {
16969
16969
  allBars[symbol] = [];
16970
16970
  });
16971
- log(`Starting historical bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
16971
+ log(`Starting historical bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
16972
16972
  while (hasMorePages) {
16973
16973
  pageCount++;
16974
16974
  const requestParams = {
@@ -16979,7 +16979,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
16979
16979
  };
16980
16980
  const response = await this.makeRequest('/stocks/bars', 'GET', requestParams);
16981
16981
  if (!response.bars) {
16982
- log(`No bars data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
16982
+ log(`No bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
16983
16983
  break;
16984
16984
  }
16985
16985
  // Track currency from first response
@@ -17021,10 +17021,10 @@ class AlpacaMarketDataAPI extends EventEmitter {
17021
17021
  }
17022
17022
  }
17023
17023
  // Final summary
17024
- const symbolsJoined = Object.entries(allBars)
17024
+ const symbolCounts = Object.entries(allBars)
17025
17025
  .map(([symbol, bars]) => `${symbol}: ${bars.length}`)
17026
17026
  .join(', ');
17027
- log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbolsJoined.length} symbols'}`);
17027
+ log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbols.length} symbols (${symbolCounts})`);
17028
17028
  return {
17029
17029
  bars: allBars,
17030
17030
  next_page_token: null, // Always null since we fetch all pages
@@ -17295,7 +17295,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17295
17295
  */
17296
17296
  async getHistoricalOptionsBars(params) {
17297
17297
  const symbols = params.symbols;
17298
- const symbolsStr = symbols.join(',');
17298
+ symbols.join(',');
17299
17299
  let allBars = {};
17300
17300
  let pageToken = null;
17301
17301
  let hasMorePages = true;
@@ -17305,7 +17305,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17305
17305
  symbols.forEach((symbol) => {
17306
17306
  allBars[symbol] = [];
17307
17307
  });
17308
- log(`Starting historical options bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
17308
+ log(`Starting historical options bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
17309
17309
  while (hasMorePages) {
17310
17310
  pageCount++;
17311
17311
  const requestParams = {
@@ -17314,7 +17314,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17314
17314
  };
17315
17315
  const response = await this.makeRequest('/options/bars', 'GET', requestParams, 'v1beta1');
17316
17316
  if (!response.bars) {
17317
- log(`No options bars data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
17317
+ log(`No options bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
17318
17318
  break;
17319
17319
  }
17320
17320
  // Combine bars for each symbol
@@ -17344,7 +17344,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17344
17344
  const dateRangeStr = earliestTimestamp && latestTimestamp
17345
17345
  ? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
17346
17346
  : 'unknown range';
17347
- log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbolsStr}, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17347
+ log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17348
17348
  type: 'debug',
17349
17349
  });
17350
17350
  // Prevent infinite loops
@@ -17373,7 +17373,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17373
17373
  */
17374
17374
  async getHistoricalOptionsTrades(params) {
17375
17375
  const symbols = params.symbols;
17376
- const symbolsStr = symbols.join(',');
17376
+ symbols.join(',');
17377
17377
  let allTrades = {};
17378
17378
  let pageToken = null;
17379
17379
  let hasMorePages = true;
@@ -17383,7 +17383,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17383
17383
  symbols.forEach((symbol) => {
17384
17384
  allTrades[symbol] = [];
17385
17385
  });
17386
- log(`Starting historical options trades fetch for ${symbolsStr.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
17386
+ log(`Starting historical options trades fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
17387
17387
  while (hasMorePages) {
17388
17388
  pageCount++;
17389
17389
  const requestParams = {
@@ -17392,7 +17392,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17392
17392
  };
17393
17393
  const response = await this.makeRequest('/options/trades', 'GET', requestParams, 'v1beta1');
17394
17394
  if (!response.trades) {
17395
- log(`No options trades data found in response for ${symbolsStr.length} symbols`, { type: 'warn' });
17395
+ log(`No options trades data found in response for ${symbols.length} symbols`, { type: 'warn' });
17396
17396
  break;
17397
17397
  }
17398
17398
  // Combine trades for each symbol
@@ -17422,7 +17422,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
17422
17422
  const dateRangeStr = earliestTimestamp && latestTimestamp
17423
17423
  ? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
17424
17424
  : 'unknown range';
17425
- log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbolsStr.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17425
+ log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
17426
17426
  type: 'debug',
17427
17427
  });
17428
17428
  // Prevent infinite loops