@discomedia/utils 1.0.41 → 1.0.43
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 +32 -29
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +32 -29
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +58 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +58 -61
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +7 -7
- package/dist/test.js +58 -61
- package/dist/test.js.map +1 -1
- package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
- package/dist/types/types/alpaca-types.d.ts +1 -1
- 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/types/alpaca-types.d.ts +1 -1
- package/dist/types-frontend/types/alpaca-types.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.43",
|
|
7
7
|
"author": "Disco Media",
|
|
8
8
|
"description": "Utility functions used in Disco Media apps",
|
|
9
9
|
"always-build-npm": true,
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"dotenv": "^17.2.3",
|
|
36
|
-
"openai": "^6.
|
|
37
|
-
"p-limit": "^7.
|
|
36
|
+
"openai": "^6.7.0",
|
|
37
|
+
"p-limit": "^7.2.0",
|
|
38
38
|
"tslib": "^2.8.1",
|
|
39
39
|
"ws": "^8.18.3"
|
|
40
40
|
},
|
|
41
41
|
"license": "ISC",
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
43
|
+
"@rollup/plugin-commonjs": "^28.0.9",
|
|
44
44
|
"@rollup/plugin-json": "^6.1.0",
|
|
45
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
46
|
-
"@rollup/plugin-typescript": "^12.
|
|
45
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
46
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
47
47
|
"@types/ws": "^8.18.1",
|
|
48
48
|
"lightweight-charts": "^5.0.9",
|
|
49
|
-
"rollup": "^4.52.
|
|
49
|
+
"rollup": "^4.52.5",
|
|
50
50
|
"typescript": "^5.9.3"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/dist/test.js
CHANGED
|
@@ -532,8 +532,8 @@ function pLimit(concurrency) {
|
|
|
532
532
|
},
|
|
533
533
|
},
|
|
534
534
|
map: {
|
|
535
|
-
async value(
|
|
536
|
-
const promises =
|
|
535
|
+
async value(iterable, function_) {
|
|
536
|
+
const promises = Array.from(iterable, (value, index) => this(function_, value, index));
|
|
537
537
|
return Promise.all(promises);
|
|
538
538
|
},
|
|
539
539
|
},
|
|
@@ -799,7 +799,7 @@ const safeJSON = (text) => {
|
|
|
799
799
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
800
800
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
801
801
|
|
|
802
|
-
const VERSION = '6.
|
|
802
|
+
const VERSION = '6.7.0'; // x-release-please-version
|
|
803
803
|
|
|
804
804
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
805
805
|
const isRunningInBrowser = () => {
|
|
@@ -4354,19 +4354,6 @@ class ChatKit extends APIResource {
|
|
|
4354
4354
|
this.sessions = new Sessions(this._client);
|
|
4355
4355
|
this.threads = new Threads$1(this._client);
|
|
4356
4356
|
}
|
|
4357
|
-
/**
|
|
4358
|
-
* Upload a ChatKit file
|
|
4359
|
-
*
|
|
4360
|
-
* @example
|
|
4361
|
-
* ```ts
|
|
4362
|
-
* const response = await client.beta.chatkit.uploadFile({
|
|
4363
|
-
* file: fs.createReadStream('path/to/file'),
|
|
4364
|
-
* });
|
|
4365
|
-
* ```
|
|
4366
|
-
*/
|
|
4367
|
-
uploadFile(body, options) {
|
|
4368
|
-
return this._client.post('/chatkit/files', maybeMultipartFormRequestOptions({ body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]) }, this._client));
|
|
4369
|
-
}
|
|
4370
4357
|
}
|
|
4371
4358
|
ChatKit.Sessions = Sessions;
|
|
4372
4359
|
ChatKit.Threads = Threads$1;
|
|
@@ -5654,20 +5641,19 @@ let Files$1 = class Files extends APIResource {
|
|
|
5654
5641
|
* up to 512 MB, and the size of all files uploaded by one organization can be up
|
|
5655
5642
|
* to 1 TB.
|
|
5656
5643
|
*
|
|
5657
|
-
* The Assistants API supports files up to 2 million tokens and of specific file
|
|
5658
|
-
*
|
|
5659
|
-
*
|
|
5660
|
-
* details.
|
|
5661
|
-
*
|
|
5662
|
-
*
|
|
5663
|
-
*
|
|
5664
|
-
*
|
|
5665
|
-
*
|
|
5666
|
-
*
|
|
5667
|
-
*
|
|
5668
|
-
*
|
|
5669
|
-
*
|
|
5670
|
-
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
5644
|
+
* - The Assistants API supports files up to 2 million tokens and of specific file
|
|
5645
|
+
* types. See the
|
|
5646
|
+
* [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools)
|
|
5647
|
+
* for details.
|
|
5648
|
+
* - The Fine-tuning API only supports `.jsonl` files. The input also has certain
|
|
5649
|
+
* required formats for fine-tuning
|
|
5650
|
+
* [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input)
|
|
5651
|
+
* or
|
|
5652
|
+
* [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
|
|
5653
|
+
* models.
|
|
5654
|
+
* - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
|
|
5655
|
+
* also has a specific required
|
|
5656
|
+
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
5671
5657
|
*
|
|
5672
5658
|
* Please [contact us](https://help.openai.com/) if you need to increase these
|
|
5673
5659
|
* storage limits.
|
|
@@ -5688,7 +5674,7 @@ let Files$1 = class Files extends APIResource {
|
|
|
5688
5674
|
return this._client.getAPIList('/files', (CursorPage), { query, ...options });
|
|
5689
5675
|
}
|
|
5690
5676
|
/**
|
|
5691
|
-
* Delete a file.
|
|
5677
|
+
* Delete a file and remove it from all vector stores.
|
|
5692
5678
|
*/
|
|
5693
5679
|
delete(fileID, options) {
|
|
5694
5680
|
return this._client.delete(path `/files/${fileID}`, options);
|
|
@@ -6570,11 +6556,27 @@ class InputItems extends APIResource {
|
|
|
6570
6556
|
}
|
|
6571
6557
|
}
|
|
6572
6558
|
|
|
6559
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6560
|
+
class InputTokens extends APIResource {
|
|
6561
|
+
/**
|
|
6562
|
+
* Get input token counts
|
|
6563
|
+
*
|
|
6564
|
+
* @example
|
|
6565
|
+
* ```ts
|
|
6566
|
+
* const response = await client.responses.inputTokens.count();
|
|
6567
|
+
* ```
|
|
6568
|
+
*/
|
|
6569
|
+
count(body = {}, options) {
|
|
6570
|
+
return this._client.post('/responses/input_tokens', { body, ...options });
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6573
6574
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6574
6575
|
class Responses extends APIResource {
|
|
6575
6576
|
constructor() {
|
|
6576
6577
|
super(...arguments);
|
|
6577
6578
|
this.inputItems = new InputItems(this._client);
|
|
6579
|
+
this.inputTokens = new InputTokens(this._client);
|
|
6578
6580
|
}
|
|
6579
6581
|
create(body, options) {
|
|
6580
6582
|
return this._client.post('/responses', { body, ...options, stream: body.stream ?? false })._thenUnwrap((rsp) => {
|
|
@@ -6640,6 +6642,7 @@ class Responses extends APIResource {
|
|
|
6640
6642
|
}
|
|
6641
6643
|
}
|
|
6642
6644
|
Responses.InputItems = InputItems;
|
|
6645
|
+
Responses.InputTokens = InputTokens;
|
|
6643
6646
|
|
|
6644
6647
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6645
6648
|
class Parts extends APIResource {
|
|
@@ -13225,7 +13228,11 @@ function requireConfig () {
|
|
|
13225
13228
|
|
|
13226
13229
|
requireConfig();
|
|
13227
13230
|
|
|
13231
|
+
const DEBUG_LOGGING = process.env['DEBUG'] === 'true' || false;
|
|
13228
13232
|
const log = (message, options = { type: 'info' }) => {
|
|
13233
|
+
if (!DEBUG_LOGGING && options.type === 'debug') {
|
|
13234
|
+
return;
|
|
13235
|
+
}
|
|
13229
13236
|
log$1(message, { ...options, source: 'AlpacaMarketDataAPI' });
|
|
13230
13237
|
};
|
|
13231
13238
|
// Default settings for market data API
|
|
@@ -13315,7 +13322,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13315
13322
|
this.optionWs = ws;
|
|
13316
13323
|
}
|
|
13317
13324
|
ws.on('open', () => {
|
|
13318
|
-
log(`${streamType} stream connected
|
|
13325
|
+
log(`${streamType} stream connected`);
|
|
13319
13326
|
const authMessage = {
|
|
13320
13327
|
action: 'auth',
|
|
13321
13328
|
key: process.env.ALPACA_API_KEY,
|
|
@@ -13328,7 +13335,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13328
13335
|
const messages = JSON.parse(data.toString());
|
|
13329
13336
|
for (const message of messages) {
|
|
13330
13337
|
if (message.T === 'success' && message.msg === 'authenticated') {
|
|
13331
|
-
log(`${streamType} stream authenticated
|
|
13338
|
+
log(`${streamType} stream authenticated`);
|
|
13332
13339
|
this.sendSubscription(streamType);
|
|
13333
13340
|
}
|
|
13334
13341
|
else if (message.T === 'error') {
|
|
@@ -13478,9 +13485,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13478
13485
|
symbols.forEach((symbol) => {
|
|
13479
13486
|
allBars[symbol] = [];
|
|
13480
13487
|
});
|
|
13481
|
-
log(`Starting historical bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})
|
|
13482
|
-
type: 'info',
|
|
13483
|
-
});
|
|
13488
|
+
log(`Starting historical bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
13484
13489
|
while (hasMorePages) {
|
|
13485
13490
|
pageCount++;
|
|
13486
13491
|
const requestParams = {
|
|
@@ -13525,7 +13530,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13525
13530
|
const dateRangeStr = earliestTimestamp && latestTimestamp
|
|
13526
13531
|
? `${new Date(earliestTimestamp).toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${new Date(latestTimestamp).toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
13527
13532
|
: 'unknown range';
|
|
13528
|
-
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}
|
|
13533
|
+
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, { type: 'debug' });
|
|
13529
13534
|
// Prevent infinite loops
|
|
13530
13535
|
if (pageCount > 1000) {
|
|
13531
13536
|
log(`Stopping pagination after ${pageCount} pages to prevent infinite loop`, { type: 'warn' });
|
|
@@ -13536,7 +13541,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13536
13541
|
const symbolsJoined = Object.entries(allBars)
|
|
13537
13542
|
.map(([symbol, bars]) => `${symbol}: ${bars.length}`)
|
|
13538
13543
|
.join(', ');
|
|
13539
|
-
log(`
|
|
13544
|
+
log(`Bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages for ${symbolsJoined.length} symbols'}`);
|
|
13540
13545
|
return {
|
|
13541
13546
|
bars: allBars,
|
|
13542
13547
|
next_page_token: null, // Always null since we fetch all pages
|
|
@@ -13817,9 +13822,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13817
13822
|
symbols.forEach((symbol) => {
|
|
13818
13823
|
allBars[symbol] = [];
|
|
13819
13824
|
});
|
|
13820
|
-
log(`Starting historical options bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})
|
|
13821
|
-
type: 'info',
|
|
13822
|
-
});
|
|
13825
|
+
log(`Starting historical options bars fetch for ${symbolsStr.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
13823
13826
|
while (hasMorePages) {
|
|
13824
13827
|
pageCount++;
|
|
13825
13828
|
const requestParams = {
|
|
@@ -13859,7 +13862,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13859
13862
|
? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
13860
13863
|
: 'unknown range';
|
|
13861
13864
|
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} option bars (total: ${totalBarsCount.toLocaleString()}) for ${symbolsStr}, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
|
|
13862
|
-
type: '
|
|
13865
|
+
type: 'debug',
|
|
13863
13866
|
});
|
|
13864
13867
|
// Prevent infinite loops
|
|
13865
13868
|
if (pageCount > 1000) {
|
|
@@ -13871,9 +13874,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13871
13874
|
const symbolCounts = Object.entries(allBars)
|
|
13872
13875
|
.map(([symbol, bars]) => `${symbol}: ${bars.length}`)
|
|
13873
13876
|
.join(', ');
|
|
13874
|
-
log(`
|
|
13875
|
-
type: 'info',
|
|
13876
|
-
});
|
|
13877
|
+
log(`Options bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages (${symbolCounts})`);
|
|
13877
13878
|
return {
|
|
13878
13879
|
bars: allBars,
|
|
13879
13880
|
next_page_token: undefined, // Always undefined since we fetch all pages
|
|
@@ -13899,9 +13900,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13899
13900
|
symbols.forEach((symbol) => {
|
|
13900
13901
|
allTrades[symbol] = [];
|
|
13901
13902
|
});
|
|
13902
|
-
log(`Starting historical options trades fetch for ${symbolsStr.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})
|
|
13903
|
-
type: 'info',
|
|
13904
|
-
});
|
|
13903
|
+
log(`Starting historical options trades fetch for ${symbolsStr.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
13905
13904
|
while (hasMorePages) {
|
|
13906
13905
|
pageCount++;
|
|
13907
13906
|
const requestParams = {
|
|
@@ -13941,7 +13940,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13941
13940
|
? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
13942
13941
|
: 'unknown range';
|
|
13943
13942
|
log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} option trades (total: ${totalTradesCount.toLocaleString()}) for ${symbolsStr.length} symbols, date range: ${dateRangeStr}${hasMorePages ? ', more pages available' : ', complete'}`, {
|
|
13944
|
-
type: '
|
|
13943
|
+
type: 'debug',
|
|
13945
13944
|
});
|
|
13946
13945
|
// Prevent infinite loops
|
|
13947
13946
|
if (pageCount > 1000) {
|
|
@@ -13953,9 +13952,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
13953
13952
|
const symbolCounts = Object.entries(allTrades)
|
|
13954
13953
|
.map(([symbol, trades]) => `${symbol}: ${trades.length}`)
|
|
13955
13954
|
.join(', ');
|
|
13956
|
-
log(`
|
|
13957
|
-
type: 'info',
|
|
13958
|
-
});
|
|
13955
|
+
log(`Options trades fetch complete: ${totalTradesCount.toLocaleString()} total trades across ${pageCount} pages (${symbolCounts})`);
|
|
13959
13956
|
return {
|
|
13960
13957
|
trades: allTrades,
|
|
13961
13958
|
next_page_token: undefined, // Always undefined since we fetch all pages
|
|
@@ -14163,7 +14160,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
14163
14160
|
symbols.forEach((symbol) => {
|
|
14164
14161
|
allBars[symbol] = [];
|
|
14165
14162
|
});
|
|
14166
|
-
log(`Starting crypto historical bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})
|
|
14163
|
+
log(`Starting crypto historical bars fetch for ${symbols.length} symbols (${params.timeframe}, ${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
14167
14164
|
while (hasMorePages) {
|
|
14168
14165
|
pageCount++;
|
|
14169
14166
|
const requestParams = {
|
|
@@ -14187,14 +14184,14 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
14187
14184
|
totalBarsCount += pageBarsCount;
|
|
14188
14185
|
pageToken = response.next_page_token || null;
|
|
14189
14186
|
hasMorePages = !!pageToken;
|
|
14190
|
-
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} crypto bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols${hasMorePages ? ', more pages available' : ', complete'}
|
|
14187
|
+
log(`Page ${pageCount}: Fetched ${pageBarsCount.toLocaleString()} crypto bars (total: ${totalBarsCount.toLocaleString()}) for ${symbols.length} symbols${hasMorePages ? ', more pages available' : ', complete'}`, { type: 'debug' });
|
|
14191
14188
|
// Prevent infinite loops
|
|
14192
14189
|
if (pageCount > 1000) {
|
|
14193
14190
|
log(`Stopping crypto bars pagination after ${pageCount} pages to prevent infinite loop`, { type: 'warn' });
|
|
14194
14191
|
break;
|
|
14195
14192
|
}
|
|
14196
14193
|
}
|
|
14197
|
-
log(`Crypto historical bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages
|
|
14194
|
+
log(`Crypto historical bars fetch complete: ${totalBarsCount.toLocaleString()} total bars across ${pageCount} pages`);
|
|
14198
14195
|
return {
|
|
14199
14196
|
bars: allBars,
|
|
14200
14197
|
next_page_token: null, // Always null since we fetch all pages
|
|
@@ -14226,7 +14223,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
14226
14223
|
symbols.forEach((symbol) => {
|
|
14227
14224
|
allQuotes[symbol] = [];
|
|
14228
14225
|
});
|
|
14229
|
-
log(`Starting crypto historical quotes fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})
|
|
14226
|
+
log(`Starting crypto historical quotes fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
14230
14227
|
while (hasMorePages) {
|
|
14231
14228
|
pageCount++;
|
|
14232
14229
|
const requestParams = {
|
|
@@ -14250,14 +14247,14 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
14250
14247
|
totalQuotesCount += pageQuotesCount;
|
|
14251
14248
|
pageToken = response.next_page_token || null;
|
|
14252
14249
|
hasMorePages = !!pageToken;
|
|
14253
|
-
log(`Page ${pageCount}: Fetched ${pageQuotesCount.toLocaleString()} crypto quotes (total: ${totalQuotesCount.toLocaleString()}) for ${symbols.length} symbols${hasMorePages ? ', more pages available' : ', complete'}
|
|
14250
|
+
log(`Page ${pageCount}: Fetched ${pageQuotesCount.toLocaleString()} crypto quotes (total: ${totalQuotesCount.toLocaleString()}) for ${symbols.length} symbols${hasMorePages ? ', more pages available' : ', complete'}`, { type: 'debug' });
|
|
14254
14251
|
// Prevent infinite loops
|
|
14255
14252
|
if (pageCount > 1000) {
|
|
14256
14253
|
log(`Stopping crypto quotes pagination after ${pageCount} pages to prevent infinite loop`, { type: 'warn' });
|
|
14257
14254
|
break;
|
|
14258
14255
|
}
|
|
14259
14256
|
}
|
|
14260
|
-
log(`Crypto historical quotes fetch complete: ${totalQuotesCount.toLocaleString()} total quotes across ${pageCount} pages
|
|
14257
|
+
log(`Crypto historical quotes fetch complete: ${totalQuotesCount.toLocaleString()} total quotes across ${pageCount} pages`);
|
|
14261
14258
|
return {
|
|
14262
14259
|
quotes: allQuotes,
|
|
14263
14260
|
next_page_token: null, // Always null since we fetch all pages
|
|
@@ -14293,7 +14290,7 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
14293
14290
|
symbols.forEach((symbol) => {
|
|
14294
14291
|
allTrades[symbol] = [];
|
|
14295
14292
|
});
|
|
14296
|
-
log(`Starting crypto historical trades fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})
|
|
14293
|
+
log(`Starting crypto historical trades fetch for ${symbols.length} symbols (${params.start || 'no start'} to ${params.end || 'no end'})`);
|
|
14297
14294
|
while (hasMorePages) {
|
|
14298
14295
|
pageCount++;
|
|
14299
14296
|
const requestParams = {
|
|
@@ -14317,14 +14314,14 @@ class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
14317
14314
|
totalTradesCount += pageTradesCount;
|
|
14318
14315
|
pageToken = response.next_page_token || null;
|
|
14319
14316
|
hasMorePages = !!pageToken;
|
|
14320
|
-
log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} crypto trades (total: ${totalTradesCount.toLocaleString()}) for ${symbols.length} symbols${hasMorePages ? ', more pages available' : ', complete'}
|
|
14317
|
+
log(`Page ${pageCount}: Fetched ${pageTradesCount.toLocaleString()} crypto trades (total: ${totalTradesCount.toLocaleString()}) for ${symbols.length} symbols${hasMorePages ? ', more pages available' : ', complete'}`, { type: 'debug' });
|
|
14321
14318
|
// Prevent infinite loops
|
|
14322
14319
|
if (pageCount > 1000) {
|
|
14323
14320
|
log(`Stopping crypto trades pagination after ${pageCount} pages to prevent infinite loop`, { type: 'warn' });
|
|
14324
14321
|
break;
|
|
14325
14322
|
}
|
|
14326
14323
|
}
|
|
14327
|
-
log(`Crypto historical trades fetch complete: ${totalTradesCount.toLocaleString()} total trades across ${pageCount} pages
|
|
14324
|
+
log(`Crypto historical trades fetch complete: ${totalTradesCount.toLocaleString()} total trades across ${pageCount} pages`);
|
|
14328
14325
|
return {
|
|
14329
14326
|
trades: allTrades,
|
|
14330
14327
|
next_page_token: null, // Always null since we fetch all pages
|