@discomedia/utils 1.0.42 → 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-frontend.cjs +31 -15
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +31 -15
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +44 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +44 -28
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +342 -64
- package/dist/test.js.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/types/alpaca-types.d.ts +1 -1
- package/dist/types-frontend/types/alpaca-types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2451,7 +2451,7 @@ const safeJSON = (text) => {
|
|
|
2451
2451
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2452
2452
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2453
2453
|
|
|
2454
|
-
const VERSION = '6.
|
|
2454
|
+
const VERSION = '6.7.0'; // x-release-please-version
|
|
2455
2455
|
|
|
2456
2456
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2457
2457
|
const isRunningInBrowser = () => {
|
|
@@ -7293,20 +7293,19 @@ let Files$1 = class Files extends APIResource {
|
|
|
7293
7293
|
* up to 512 MB, and the size of all files uploaded by one organization can be up
|
|
7294
7294
|
* to 1 TB.
|
|
7295
7295
|
*
|
|
7296
|
-
* The Assistants API supports files up to 2 million tokens and of specific file
|
|
7297
|
-
*
|
|
7298
|
-
*
|
|
7299
|
-
* details.
|
|
7300
|
-
*
|
|
7301
|
-
*
|
|
7302
|
-
*
|
|
7303
|
-
*
|
|
7304
|
-
*
|
|
7305
|
-
*
|
|
7306
|
-
*
|
|
7307
|
-
*
|
|
7308
|
-
*
|
|
7309
|
-
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
7296
|
+
* - The Assistants API supports files up to 2 million tokens and of specific file
|
|
7297
|
+
* types. See the
|
|
7298
|
+
* [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools)
|
|
7299
|
+
* for details.
|
|
7300
|
+
* - The Fine-tuning API only supports `.jsonl` files. The input also has certain
|
|
7301
|
+
* required formats for fine-tuning
|
|
7302
|
+
* [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input)
|
|
7303
|
+
* or
|
|
7304
|
+
* [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
|
|
7305
|
+
* models.
|
|
7306
|
+
* - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
|
|
7307
|
+
* also has a specific required
|
|
7308
|
+
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
7310
7309
|
*
|
|
7311
7310
|
* Please [contact us](https://help.openai.com/) if you need to increase these
|
|
7312
7311
|
* storage limits.
|
|
@@ -8209,11 +8208,27 @@ class InputItems extends APIResource {
|
|
|
8209
8208
|
}
|
|
8210
8209
|
}
|
|
8211
8210
|
|
|
8211
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8212
|
+
class InputTokens extends APIResource {
|
|
8213
|
+
/**
|
|
8214
|
+
* Get input token counts
|
|
8215
|
+
*
|
|
8216
|
+
* @example
|
|
8217
|
+
* ```ts
|
|
8218
|
+
* const response = await client.responses.inputTokens.count();
|
|
8219
|
+
* ```
|
|
8220
|
+
*/
|
|
8221
|
+
count(body = {}, options) {
|
|
8222
|
+
return this._client.post('/responses/input_tokens', { body, ...options });
|
|
8223
|
+
}
|
|
8224
|
+
}
|
|
8225
|
+
|
|
8212
8226
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8213
8227
|
class Responses extends APIResource {
|
|
8214
8228
|
constructor() {
|
|
8215
8229
|
super(...arguments);
|
|
8216
8230
|
this.inputItems = new InputItems(this._client);
|
|
8231
|
+
this.inputTokens = new InputTokens(this._client);
|
|
8217
8232
|
}
|
|
8218
8233
|
create(body, options) {
|
|
8219
8234
|
return this._client.post('/responses', { body, ...options, stream: body.stream ?? false })._thenUnwrap((rsp) => {
|
|
@@ -8279,6 +8294,7 @@ class Responses extends APIResource {
|
|
|
8279
8294
|
}
|
|
8280
8295
|
}
|
|
8281
8296
|
Responses.InputItems = InputItems;
|
|
8297
|
+
Responses.InputTokens = InputTokens;
|
|
8282
8298
|
|
|
8283
8299
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8284
8300
|
class Parts extends APIResource {
|
|
@@ -16943,7 +16959,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
16943
16959
|
*/
|
|
16944
16960
|
async getHistoricalBars(params) {
|
|
16945
16961
|
const symbols = params.symbols;
|
|
16946
|
-
|
|
16962
|
+
symbols.join(',');
|
|
16947
16963
|
let allBars = {};
|
|
16948
16964
|
let pageToken = null;
|
|
16949
16965
|
let hasMorePages = true;
|
|
@@ -16954,7 +16970,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
16954
16970
|
symbols.forEach((symbol) => {
|
|
16955
16971
|
allBars[symbol] = [];
|
|
16956
16972
|
});
|
|
16957
|
-
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'})`);
|
|
16958
16974
|
while (hasMorePages) {
|
|
16959
16975
|
pageCount++;
|
|
16960
16976
|
const requestParams = {
|
|
@@ -16965,7 +16981,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
16965
16981
|
};
|
|
16966
16982
|
const response = await this.makeRequest('/stocks/bars', 'GET', requestParams);
|
|
16967
16983
|
if (!response.bars) {
|
|
16968
|
-
log(`No bars data found in response for ${
|
|
16984
|
+
log(`No bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
|
|
16969
16985
|
break;
|
|
16970
16986
|
}
|
|
16971
16987
|
// Track currency from first response
|
|
@@ -17007,10 +17023,10 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17007
17023
|
}
|
|
17008
17024
|
}
|
|
17009
17025
|
// Final summary
|
|
17010
|
-
const
|
|
17026
|
+
const symbolCounts = Object.entries(allBars)
|
|
17011
17027
|
.map(([symbol, bars]) => `${symbol}: ${bars.length}`)
|
|
17012
17028
|
.join(', ');
|
|
17013
|
-
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})`);
|
|
17014
17030
|
return {
|
|
17015
17031
|
bars: allBars,
|
|
17016
17032
|
next_page_token: null, // Always null since we fetch all pages
|
|
@@ -17281,7 +17297,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17281
17297
|
*/
|
|
17282
17298
|
async getHistoricalOptionsBars(params) {
|
|
17283
17299
|
const symbols = params.symbols;
|
|
17284
|
-
|
|
17300
|
+
symbols.join(',');
|
|
17285
17301
|
let allBars = {};
|
|
17286
17302
|
let pageToken = null;
|
|
17287
17303
|
let hasMorePages = true;
|
|
@@ -17291,7 +17307,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17291
17307
|
symbols.forEach((symbol) => {
|
|
17292
17308
|
allBars[symbol] = [];
|
|
17293
17309
|
});
|
|
17294
|
-
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'})`);
|
|
17295
17311
|
while (hasMorePages) {
|
|
17296
17312
|
pageCount++;
|
|
17297
17313
|
const requestParams = {
|
|
@@ -17300,7 +17316,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17300
17316
|
};
|
|
17301
17317
|
const response = await this.makeRequest('/options/bars', 'GET', requestParams, 'v1beta1');
|
|
17302
17318
|
if (!response.bars) {
|
|
17303
|
-
log(`No options bars data found in response for ${
|
|
17319
|
+
log(`No options bars data found in response for ${symbols.length} symbols`, { type: 'warn' });
|
|
17304
17320
|
break;
|
|
17305
17321
|
}
|
|
17306
17322
|
// Combine bars for each symbol
|
|
@@ -17330,7 +17346,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17330
17346
|
const dateRangeStr = earliestTimestamp && latestTimestamp
|
|
17331
17347
|
? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
17332
17348
|
: 'unknown range';
|
|
17333
|
-
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'}`, {
|
|
17334
17350
|
type: 'debug',
|
|
17335
17351
|
});
|
|
17336
17352
|
// Prevent infinite loops
|
|
@@ -17359,7 +17375,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17359
17375
|
*/
|
|
17360
17376
|
async getHistoricalOptionsTrades(params) {
|
|
17361
17377
|
const symbols = params.symbols;
|
|
17362
|
-
|
|
17378
|
+
symbols.join(',');
|
|
17363
17379
|
let allTrades = {};
|
|
17364
17380
|
let pageToken = null;
|
|
17365
17381
|
let hasMorePages = true;
|
|
@@ -17369,7 +17385,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17369
17385
|
symbols.forEach((symbol) => {
|
|
17370
17386
|
allTrades[symbol] = [];
|
|
17371
17387
|
});
|
|
17372
|
-
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'})`);
|
|
17373
17389
|
while (hasMorePages) {
|
|
17374
17390
|
pageCount++;
|
|
17375
17391
|
const requestParams = {
|
|
@@ -17378,7 +17394,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17378
17394
|
};
|
|
17379
17395
|
const response = await this.makeRequest('/options/trades', 'GET', requestParams, 'v1beta1');
|
|
17380
17396
|
if (!response.trades) {
|
|
17381
|
-
log(`No options trades data found in response for ${
|
|
17397
|
+
log(`No options trades data found in response for ${symbols.length} symbols`, { type: 'warn' });
|
|
17382
17398
|
break;
|
|
17383
17399
|
}
|
|
17384
17400
|
// Combine trades for each symbol
|
|
@@ -17408,7 +17424,7 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
|
|
|
17408
17424
|
const dateRangeStr = earliestTimestamp && latestTimestamp
|
|
17409
17425
|
? `${earliestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })} to ${latestTimestamp.toLocaleDateString('en-US', { timeZone: 'America/New_York' })}`
|
|
17410
17426
|
: 'unknown range';
|
|
17411
|
-
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'}`, {
|
|
17412
17428
|
type: 'debug',
|
|
17413
17429
|
});
|
|
17414
17430
|
// Prevent infinite loops
|