@discomedia/utils 1.0.22 → 1.0.24
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-frontend.cjs +10 -14
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +10 -14
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +10 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10 -14
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +6 -14
- package/dist/test.js.map +1 -1
- package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
- package/dist/types/alpaca-trading-api.d.ts +4 -9
- package/dist/types/alpaca-trading-api.d.ts.map +1 -1
- package/dist/types/types/alpaca-types.d.ts +2 -8
- package/dist/types/types/alpaca-types.d.ts.map +1 -1
- package/dist/types-frontend/alpaca-market-data-api.d.ts.map +1 -1
- package/dist/types-frontend/alpaca-trading-api.d.ts +4 -9
- package/dist/types-frontend/alpaca-trading-api.d.ts.map +1 -1
- package/dist/types-frontend/types/alpaca-types.d.ts +2 -8
- package/dist/types-frontend/types/alpaca-types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2368,7 +2368,7 @@ const safeJSON = (text) => {
|
|
|
2368
2368
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2369
2369
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2370
2370
|
|
|
2371
|
-
const VERSION = '5.
|
|
2371
|
+
const VERSION = '5.12.0'; // x-release-please-version
|
|
2372
2372
|
|
|
2373
2373
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2374
2374
|
const isRunningInBrowser = () => {
|
|
@@ -3223,11 +3223,7 @@ class Stream {
|
|
|
3223
3223
|
done = true;
|
|
3224
3224
|
continue;
|
|
3225
3225
|
}
|
|
3226
|
-
if (sse.event === null ||
|
|
3227
|
-
sse.event.startsWith('response.') ||
|
|
3228
|
-
sse.event.startsWith('image_edit.') ||
|
|
3229
|
-
sse.event.startsWith('image_generation.') ||
|
|
3230
|
-
sse.event.startsWith('transcript.')) {
|
|
3226
|
+
if (sse.event === null || !sse.event.startsWith('thread.')) {
|
|
3231
3227
|
let data;
|
|
3232
3228
|
try {
|
|
3233
3229
|
data = JSON.parse(sse.data);
|
|
@@ -16307,11 +16303,9 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
16307
16303
|
hasMorePages = !!pageToken;
|
|
16308
16304
|
// Enhanced logging with date range and progress info
|
|
16309
16305
|
const dateRangeStr = earliestTimestamp && latestTimestamp
|
|
16310
|
-
? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
16306
|
+
? `${new Date(earliestTimestamp).toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${new Date(latestTimestamp).toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
16311
16307
|
: 'unknown range';
|
|
16312
|
-
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} bars (total: ${totalBarsCount.toLocaleString()}) for ${
|
|
16313
|
-
type: 'info',
|
|
16314
|
-
});
|
|
16308
|
+
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`);
|
|
16315
16309
|
// Prevent infinite loops
|
|
16316
16310
|
if (pageCount > 1000) {
|
|
16317
16311
|
log(`Stopping pagination after ${pageCount} pages to prevent infinite loop`, { type: 'warn' });
|
|
@@ -16319,12 +16313,10 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
16319
16313
|
}
|
|
16320
16314
|
}
|
|
16321
16315
|
// Final summary
|
|
16322
|
-
const
|
|
16316
|
+
const symbolsJoined = Object.entries(allBars)
|
|
16323
16317
|
.map(([symbol, bars]) => `${symbol}: ${bars.length}`)
|
|
16324
16318
|
.join(', ');
|
|
16325
|
-
log(`Historical bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages
|
|
16326
|
-
type: 'info',
|
|
16327
|
-
});
|
|
16319
|
+
log(`Historical bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbolsJoined.length} symbols'}`);
|
|
16328
16320
|
return {
|
|
16329
16321
|
bars: allBars,
|
|
16330
16322
|
next_page_token: null, // Always null since we fetch all pages
|
|
@@ -17623,6 +17615,10 @@ class AlpacaTradingAPI {
|
|
|
17623
17615
|
queryParams.append('period', params.period);
|
|
17624
17616
|
if (params.extended_hours !== undefined)
|
|
17625
17617
|
queryParams.append('extended_hours', params.extended_hours.toString());
|
|
17618
|
+
if (params.start)
|
|
17619
|
+
queryParams.append('start', params.start);
|
|
17620
|
+
if (params.end)
|
|
17621
|
+
queryParams.append('end', params.end);
|
|
17626
17622
|
if (params.date_end)
|
|
17627
17623
|
queryParams.append('date_end', params.date_end);
|
|
17628
17624
|
const response = await this.makeRequest(`/account/portfolio/history?${queryParams.toString()}`);
|