sentisense 0.63.1 → 0.66.0
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/README.md +54 -7
- package/dist/cli.cjs +336 -18
- package/dist/index.cjs +37 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +216 -11
- package/dist/index.d.ts +216 -11
- package/dist/index.mjs +37 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1242,7 +1242,9 @@ var Stocks = class {
|
|
|
1242
1242
|
*
|
|
1243
1243
|
* Tiering: a PRO key always receives the full dossier. A FREE key receives it for the first
|
|
1244
1244
|
* ten calls each calendar month and a headline-only preview after that, with `isPreview`
|
|
1245
|
-
* true; calls that return a null `data` never spend that allowance.
|
|
1245
|
+
* true; calls that return a null `data` never spend that allowance. The headline preview has
|
|
1246
|
+
* no nested objects: its readings arrive flat as `data.ivRank1y`, `data.atmIv`,
|
|
1247
|
+
* `data.expectedMove1d`, `data.pcVol`, `data.pcVolPctl1y` and `data.maxPain`.
|
|
1246
1248
|
*/
|
|
1247
1249
|
async getOptionsSummary(ticker) {
|
|
1248
1250
|
return this.client.get(
|
|
@@ -1272,6 +1274,33 @@ var Stocks = class {
|
|
|
1272
1274
|
options
|
|
1273
1275
|
);
|
|
1274
1276
|
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Get one stock's or ETF's intraday options series for one session: its numbers at every
|
|
1279
|
+
* 15-minute cycle of the intraday board, oldest cycle first.
|
|
1280
|
+
*
|
|
1281
|
+
* Use it to test an intraday signal against what the board actually showed at each point in
|
|
1282
|
+
* the day, then compare it with the session's end-of-day row from
|
|
1283
|
+
* {@link Stocks.getOptionsHistory}. Each point carries call and put volume so far, the
|
|
1284
|
+
* put/call ratio, the unusual-contract count, the percentile of the largest qualifying
|
|
1285
|
+
* contract against the ticker's own year, and the ATM implied volatility. It never carries a
|
|
1286
|
+
* contract symbol, strike, price, premium, open interest or print size.
|
|
1287
|
+
*
|
|
1288
|
+
* **PRO only.** A FREE key receives the standard preview: `isPreview` true, `previewReason`
|
|
1289
|
+
* `"PRO_REQUIRED"`, an `upgrade` hint, and `data: null`.
|
|
1290
|
+
*
|
|
1291
|
+
* **No data is an empty `series`, not a null payload.** A weekend, a holiday, a session from
|
|
1292
|
+
* before the history was kept, a ticker outside the board and an unknown symbol all answer
|
|
1293
|
+
* with `data.series` empty. `data.missingCycles` lists cycles whose stored point could not be
|
|
1294
|
+
* read, which are unknown rather than absent. A malformed or future `session` rejects with
|
|
1295
|
+
* an `APIError` (status 400, code `invalid_session`). A 503 means the stored series could
|
|
1296
|
+
* not be read; it is retried like any other 503 and never answered with a partial series.
|
|
1297
|
+
*/
|
|
1298
|
+
async getOptionsIntradayHistory(ticker, options) {
|
|
1299
|
+
return this.client.get(
|
|
1300
|
+
`/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/options/intraday-history`,
|
|
1301
|
+
options
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1275
1304
|
/**
|
|
1276
1305
|
* Get the SentiSense Rating for one stock: where it ranks against the other stocks rated
|
|
1277
1306
|
* that day, and the six dimensions the rank is blended from.
|
|
@@ -1394,7 +1423,7 @@ var Trackers = class {
|
|
|
1394
1423
|
};
|
|
1395
1424
|
|
|
1396
1425
|
// src/version.ts
|
|
1397
|
-
var VERSION = "0.
|
|
1426
|
+
var VERSION = "0.66.0";
|
|
1398
1427
|
|
|
1399
1428
|
// src/client.ts
|
|
1400
1429
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|
|
@@ -1406,11 +1435,11 @@ var DEEP_HISTORY_FALLBACK_WAIT_S = 3;
|
|
|
1406
1435
|
var MAX_DEEP_HISTORY_WAIT_S = 30;
|
|
1407
1436
|
var MAX_RATE_LIMIT_WAIT_S = 120;
|
|
1408
1437
|
var RATE_LIMIT_FALLBACK_WAIT_S = 60;
|
|
1409
|
-
var
|
|
1410
|
-
async function
|
|
1438
|
+
var NON_RETRYABLE_429_CODES = /* @__PURE__ */ new Set(["quota_exceeded", "key_limit_reached"]);
|
|
1439
|
+
async function isAllowanceExhausted(response) {
|
|
1411
1440
|
try {
|
|
1412
1441
|
const body = await response.clone().json();
|
|
1413
|
-
return body?.error ===
|
|
1442
|
+
return typeof body?.error === "string" && NON_RETRYABLE_429_CODES.has(body.error);
|
|
1414
1443
|
} catch {
|
|
1415
1444
|
return false;
|
|
1416
1445
|
}
|
|
@@ -1500,7 +1529,7 @@ var SentiSense = class {
|
|
|
1500
1529
|
);
|
|
1501
1530
|
}
|
|
1502
1531
|
if (!response.ok) {
|
|
1503
|
-
if (response.status === 429 && await
|
|
1532
|
+
if (response.status === 429 && await isAllowanceExhausted(response)) {
|
|
1504
1533
|
await this.handleErrorResponse(response);
|
|
1505
1534
|
}
|
|
1506
1535
|
const isRetryable = response.status === 429 || response.status >= 500;
|
|
@@ -1549,9 +1578,10 @@ var SentiSense = class {
|
|
|
1549
1578
|
throw new SentiSenseError("All retries exhausted");
|
|
1550
1579
|
}
|
|
1551
1580
|
/** @internal */
|
|
1552
|
-
async post(path, body) {
|
|
1581
|
+
async post(path, body, extraHeaders) {
|
|
1553
1582
|
const url = this.buildUrl(path);
|
|
1554
1583
|
const headers = {
|
|
1584
|
+
...extraHeaders,
|
|
1555
1585
|
"Accept": "application/json",
|
|
1556
1586
|
"Content-Type": "application/json"
|
|
1557
1587
|
};
|