@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.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/dist/test.js +311 -49
- package/dist/test.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -16959,7 +16959,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
16959
16959
|
*/
|
|
16960
16960
|
async getHistoricalBars(params) {
|
|
16961
16961
|
const symbols = params.symbols;
|
|
16962
|
-
|
|
16962
|
+
symbols.join(',');
|
|
16963
16963
|
let allBars = {};
|
|
16964
16964
|
let pageToken = null;
|
|
16965
16965
|
let hasMorePages = true;
|
|
@@ -16970,7 +16970,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
16970
16970
|
symbols.forEach((symbol) => {
|
|
16971
16971
|
allBars[symbol] = [];
|
|
16972
16972
|
});
|
|
16973
|
-
log(`Starting historical bars fetch for ${
|
|
16973
|
+
log(`Starting historical bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
16974
16974
|
while (hasMorePages) {
|
|
16975
16975
|
pageCount++;
|
|
16976
16976
|
const requestParams = {
|
|
@@ -16981,7 +16981,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
16981
16981
|
};
|
|
16982
16982
|
const response = await this.makeRequest('/stocks/bars', 'GET', requestParams);
|
|
16983
16983
|
if (!response.bars) {
|
|
16984
|
-
log(`No bars data found in response for ${
|
|
16984
|
+
log(`No bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
|
|
16985
16985
|
break;
|
|
16986
16986
|
}
|
|
16987
16987
|
// Track currency from first response
|
|
@@ -17023,10 +17023,10 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17023
17023
|
}
|
|
17024
17024
|
}
|
|
17025
17025
|
// Final summary
|
|
17026
|
-
const
|
|
17026
|
+
const symbolCounts = Object.entries(allBars)
|
|
17027
17027
|
.map(([symbol, bars]) => `${symbol}: ${bars.length}`)
|
|
17028
17028
|
.join(', ');
|
|
17029
|
-
log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${
|
|
17029
|
+
log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbols.length} symbols (${symbolCounts})`);
|
|
17030
17030
|
return {
|
|
17031
17031
|
bars: allBars,
|
|
17032
17032
|
next_page_token: null, // Always null since we fetch all pages
|
|
@@ -17297,7 +17297,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17297
17297
|
*/
|
|
17298
17298
|
async getHistoricalOptionsBars(params) {
|
|
17299
17299
|
const symbols = params.symbols;
|
|
17300
|
-
|
|
17300
|
+
symbols.join(',');
|
|
17301
17301
|
let allBars = {};
|
|
17302
17302
|
let pageToken = null;
|
|
17303
17303
|
let hasMorePages = true;
|
|
@@ -17307,7 +17307,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17307
17307
|
symbols.forEach((symbol) => {
|
|
17308
17308
|
allBars[symbol] = [];
|
|
17309
17309
|
});
|
|
17310
|
-
log(`Starting historical options bars fetch for ${
|
|
17310
|
+
log(`Starting historical options bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
17311
17311
|
while (hasMorePages) {
|
|
17312
17312
|
pageCount++;
|
|
17313
17313
|
const requestParams = {
|
|
@@ -17316,7 +17316,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17316
17316
|
};
|
|
17317
17317
|
const response = await this.makeRequest('/options/bars', 'GET', requestParams, 'v1beta1');
|
|
17318
17318
|
if (!response.bars) {
|
|
17319
|
-
log(`No options bars data found in response for ${
|
|
17319
|
+
log(`No options bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
|
|
17320
17320
|
break;
|
|
17321
17321
|
}
|
|
17322
17322
|
// Combine bars for each symbol
|
|
@@ -17346,7 +17346,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17346
17346
|
const dateRangeStr = earliestTimestamp && latestTimestamp
|
|
17347
17347
|
? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
17348
17348
|
: 'unknown range';
|
|
17349
|
-
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${
|
|
17349
|
+
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
|
|
17350
17350
|
type: 'debug',
|
|
17351
17351
|
});
|
|
17352
17352
|
// Prevent infinite loops
|
|
@@ -17375,7 +17375,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17375
17375
|
*/
|
|
17376
17376
|
async getHistoricalOptionsTrades(params) {
|
|
17377
17377
|
const symbols = params.symbols;
|
|
17378
|
-
|
|
17378
|
+
symbols.join(',');
|
|
17379
17379
|
let allTrades = {};
|
|
17380
17380
|
let pageToken = null;
|
|
17381
17381
|
let hasMorePages = true;
|
|
@@ -17385,7 +17385,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17385
17385
|
symbols.forEach((symbol) => {
|
|
17386
17386
|
allTrades[symbol] = [];
|
|
17387
17387
|
});
|
|
17388
|
-
log(`Starting historical options trades fetch for ${
|
|
17388
|
+
log(`Starting historical options trades fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
17389
17389
|
while (hasMorePages) {
|
|
17390
17390
|
pageCount++;
|
|
17391
17391
|
const requestParams = {
|
|
@@ -17394,7 +17394,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17394
17394
|
};
|
|
17395
17395
|
const response = await this.makeRequest('/options/trades', 'GET', requestParams, 'v1beta1');
|
|
17396
17396
|
if (!response.trades) {
|
|
17397
|
-
log(`No options trades data found in response for ${
|
|
17397
|
+
log(`No options trades data found in response for ${symbols.length} symbols`, { type: 'warn' });
|
|
17398
17398
|
break;
|
|
17399
17399
|
}
|
|
17400
17400
|
// Combine trades for each symbol
|
|
@@ -17424,7 +17424,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17424
17424
|
const dateRangeStr = earliestTimestamp && latestTimestamp
|
|
17425
17425
|
? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
17426
17426
|
: 'unknown range';
|
|
17427
|
-
log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${
|
|
17427
|
+
log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
|
|
17428
17428
|
type: 'debug',
|
|
17429
17429
|
});
|
|
17430
17430
|
// Prevent infinite loops
|