sentisense 0.73.0 → 0.75.1
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 +59 -3
- package/dist/cli.cjs +91 -6
- package/dist/index.cjs +81 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +287 -7
- package/dist/index.d.ts +287 -7
- package/dist/index.mjs +81 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ npx -y sentisense@latest health
|
|
|
67
67
|
| Command | What you get |
|
|
68
68
|
|---------|--------------|
|
|
69
69
|
| `auth [key]` | Store a key, show what is configured, or `--remove` it |
|
|
70
|
-
| `init` | A temporary key with no signup, printed as `SENTISENSE_API_KEY=...`, plus a link to keep it |
|
|
70
|
+
| `init` | A temporary key with no signup, printed as `SENTISENSE_API_KEY=...`, plus a command to try it and a link to keep it |
|
|
71
71
|
| `health` | Reachability, key validity, latency, and the resolved base URL |
|
|
72
72
|
| `quote <ticker>...` | Price, day range, 52-week range, market cap, P/E. One request per ticker; ETFs show AUM, expense ratio and NAV |
|
|
73
73
|
| `sentiment <ticker>` | SentiSense Score, tone, attention, per-source breakdown, `--days N` history |
|
|
@@ -92,10 +92,18 @@ Run `sentisense help <command>` for its flags and examples.
|
|
|
92
92
|
`init` is built for coding agents: it asks nothing and writes nothing into your project.
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
|
-
npx -y sentisense@latest init # prints SENTISENSE_API_KEY=<key
|
|
95
|
+
npx -y sentisense@latest init # prints SENTISENSE_API_KEY=<key>, a command to try, and a keep link
|
|
96
96
|
npx -y sentisense@latest init --json # the same, as JSON
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
Right after the key, `init` prints one command to run next:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx sentisense sentiment TSLA --api-key <key>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Tesla is a sample company, so the temporary key gets its full sentiment reading. `--api-key` applies to that one call, so it works before the key is stored anywhere. With `--json`, the same line is in `starterCommand`.
|
|
106
|
+
|
|
99
107
|
It prints a temporary free key as `SENTISENSE_API_KEY=<key>`. Store it the way your project already stores secrets; the SDK and every command read `SENTISENSE_API_KEY` from the environment. To keep the key, open the link it prints, sign in or create a free account, and the same key stays on your account with nothing else to change. Until it is kept, the key stops working after a few days and has request limits; the link still keeps it for about two weeks. When a key is already configured, `init` says so and makes no new one; `--new` asks for a fresh temporary key anyway. To tell machines that share a network apart, the request carries a random per-install id, stored as `install-id` in the CLI's config directory; it identifies nothing about you.
|
|
100
108
|
|
|
101
109
|
Three of these chain into each other. Start from a name, land on a person:
|
|
@@ -193,7 +201,7 @@ Affected: every method whose declared return type is `PreviewResponse<T>`. A tes
|
|
|
193
201
|
| `etfs` | `analystAggregate` `insiderAggregate` `sentimentAggregate` |
|
|
194
202
|
| `insider` | `getActivity` `getTrades` `getClusterBuys` |
|
|
195
203
|
| `insights` | `stock` `stockRange` `market` `latest` `user` |
|
|
196
|
-
| `institutional` | `getFlows` `getHolders` `getHoldersHistory` `getActivists` |
|
|
204
|
+
| `institutional` | `getFlows` `getHolders` `getHoldersHistory` `getInstitutionHistory` `getActivists` |
|
|
197
205
|
| `options` | `getOverview` |
|
|
198
206
|
| `politicians` | `getActivity` `getFilings` `getMembers` `getMember` |
|
|
199
207
|
| `stocks` | `getSentiment` `getKpis` `getOptionsSummary` `getOptionsHistory` `getOptionsIntradayHistory` |
|
|
@@ -307,6 +315,8 @@ client.institutional.getFlows("2025-02-14", { limit: 20 })
|
|
|
307
315
|
client.institutional.getHolders("AAPL", "2025-02-14")
|
|
308
316
|
client.institutional.getHolders("AAPL") // no date: the ticker's latest settled quarter
|
|
309
317
|
client.institutional.getHoldersHistory("AAPL", { quarters: 8 })
|
|
318
|
+
client.institutional.getInstitutionDetail("Berkshire-Hathaway", { limit: 10, sortBy: "estimatedFlowUsd" })
|
|
319
|
+
client.institutional.getInstitutionHistory("Renaissance-Technologies", { quarters: 8, tickers: ["NVDA"] })
|
|
310
320
|
client.institutional.getActivists("2025-02-14")
|
|
311
321
|
```
|
|
312
322
|
|
|
@@ -348,6 +358,34 @@ const detail = await client.institutional.getInstitutionDetail("1067983") as Pre
|
|
|
348
358
|
console.log(detail.data.positionsHeld); // undefined when an older response omits it
|
|
349
359
|
```
|
|
350
360
|
|
|
361
|
+
Institution detail compares each filing with the quarter before it. When `comparisonStatus` is `AVAILABLE`, the payload carries `priorTotalValueUsd` and `priorPositionsHeld`, and each holding carries `priorValueUsd`, `priorPortfolioWeight` and `estimatedFlowUsd` (dollars bought, positive, or sold, negative, estimated from two quarter-end snapshots rather than a reported trade). Every one of these is absent when it does not apply. Pass `limit` to get a sorted page of holdings, with `sortBy`, `sortDir`, `changeType` (a value or an array; `"HELD"` keeps every position still held, whatever its change), `q` and `minWeight` to sort and filter it; those only take effect together with `limit`. When a filter is set, `data.matchTotals` sums every matching holding, not just the page:
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
// The ten biggest estimated buys of the latest quarter
|
|
365
|
+
const page = await client.institutional.getInstitutionDetail("Berkshire-Hathaway", {
|
|
366
|
+
limit: 10,
|
|
367
|
+
sortBy: "estimatedFlowUsd",
|
|
368
|
+
changeType: ["NEW", "INCREASED"],
|
|
369
|
+
}) as PreviewResponse<InstitutionDetail>;
|
|
370
|
+
for (const h of page.data.holdings ?? []) console.log(h.ticker, h.estimatedFlowUsd);
|
|
371
|
+
console.log(page.data.matchTotals?.estimatedFlowUsd); // every matching holding, not only these ten
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Institution history.** `getInstitutionHistory()` returns one row per filing, newest first (`quarters` up to 40, 12 by default). Free keys see the newest four, with `totalCount` naming the window. The comparison fields (`newPositions`, `boughtUsd`, `netFlowUsd` and the rest) are absent unless that filing's `comparisonStatus` is `AVAILABLE`, never zero. Pass `tickers` (up to 100) to also get `positions`: each ticker's shares and value per filing, newest first, with filings where the institution did not hold it left out. Free keys receive `positions` only for the institution's ten largest holdings. `priceEffectUsd` is the remainder after `netFlowUsd`, mostly price moves; it also absorbs rounding, the different price bases of exits and trades, and positions whose change could not be restated:
|
|
375
|
+
|
|
376
|
+
```typescript
|
|
377
|
+
const { data } = await client.institutional.getInstitutionHistory("Renaissance-Technologies", {
|
|
378
|
+
quarters: 8,
|
|
379
|
+
tickers: ["NVDA", "META"],
|
|
380
|
+
});
|
|
381
|
+
for (const q of data.quarters) {
|
|
382
|
+
console.log(q.label, q.totalValueUsd, q.netFlowUsd, q.priceEffectUsd);
|
|
383
|
+
}
|
|
384
|
+
for (const point of data.positions?.NVDA ?? []) {
|
|
385
|
+
console.log(point.reportDate, point.shares, point.valueUsd);
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
351
389
|
**Paging the holder list.** A widely held ticker returns thousands of rows: a megacap quarter is roughly 6,000 holders and 1.5 MB on the wire. Pass `limit` unless you really want the whole list; omitting the options object sends the original unbounded request, so existing code keeps working.
|
|
352
390
|
|
|
353
391
|
| Option | Values |
|
|
@@ -645,6 +683,24 @@ const symbol = hits.find((hit) => hit.ticker)?.ticker; // "TSLA"
|
|
|
645
683
|
|
|
646
684
|
An empty array is the normal answer for a query that matches nothing, so branch on `length` rather than catching.
|
|
647
685
|
|
|
686
|
+
### Trackers
|
|
687
|
+
|
|
688
|
+
Every tracker returns the same snapshot envelope, so one renderer per `viewType` covers them all. `trackers.list()` says which trackers exist and, on those that have them, the `filters` each accepts (`{ key, values }`, with `values` the complete list).
|
|
689
|
+
|
|
690
|
+
```typescript
|
|
691
|
+
const { trackers } = await client.trackers.list();
|
|
692
|
+
const heatmap = await client.trackers.get("market-heatmap", { scope: "nasdaq100" });
|
|
693
|
+
|
|
694
|
+
// Narrow a tracker that lists filters, as an object or the wire string "state:TX".
|
|
695
|
+
const tx = await client.trackers.get("data-center-moratoriums", { filter: { state: "TX" } });
|
|
696
|
+
console.log(tx.totalCount, "Texas records");
|
|
697
|
+
for (const row of tx.data.rows ?? []) {
|
|
698
|
+
console.log(row.rowId, row.name, row.ticker, row.endsDate, row.statesNamed);
|
|
699
|
+
}
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
Rows carry `ticker`, `url`, `endsDate` (ISO date) and `statesNamed` when a row has them, and absent otherwise. Other named cells, such as the `market-heatmap` columns, are on the row too (`row.marketCap`, typed `unknown`). Combine filters with commas: `{ state: "TX", category: "local" }` sends `filter=state:TX,category:local`. An unknown filter key or value throws `APIError` with `status: 400` and `code: "invalid_filter"`, the same way a bad `scope` throws `code: "invalid_scope"`, so a call never comes back unfiltered by accident.
|
|
703
|
+
|
|
648
704
|
### Screener
|
|
649
705
|
|
|
650
706
|
Filter the tracked universe on the SentiSense Score, attention, analyst consensus, technicals, price and end-of-day options readings in one query. Screening on analyst ratings alone is something a dozen free tools do; screening on analyst ratings *where the Score disagrees* is not.
|
package/dist/cli.cjs
CHANGED
|
@@ -1432,7 +1432,7 @@ var flowsCommand = {
|
|
|
1432
1432
|
};
|
|
1433
1433
|
|
|
1434
1434
|
// src/version.ts
|
|
1435
|
-
var VERSION = "0.
|
|
1435
|
+
var VERSION = "0.75.1";
|
|
1436
1436
|
|
|
1437
1437
|
// src/resources/analyst.ts
|
|
1438
1438
|
var Analyst = class {
|
|
@@ -2226,10 +2226,71 @@ var Institutional = class {
|
|
|
2226
2226
|
* The signature remains unknown for compatibility. Opt in to the exported
|
|
2227
2227
|
* PreviewResponse<InstitutionDetail> type to read data.positionsHeld, the full
|
|
2228
2228
|
* portfolio count excluding SOLD_OUT rows, even on a truncated holdings list.
|
|
2229
|
+
*
|
|
2230
|
+
* When the filing compares with the preceding quarter (`comparisonStatus` is `AVAILABLE`),
|
|
2231
|
+
* the payload also carries `priorTotalValueUsd` and `priorPositionsHeld`, and each holding
|
|
2232
|
+
* carries `priorValueUsd`, `priorPortfolioWeight` and `estimatedFlowUsd` (an estimate from
|
|
2233
|
+
* two quarter-end snapshots, not a reported trade). Each is absent when it does not apply.
|
|
2234
|
+
*
|
|
2235
|
+
* `options.limit` returns a sorted page of holdings and adds `returnedCount` and `offset` to
|
|
2236
|
+
* `data` and `totalCount` to the envelope; `sortBy`, `sortDir`, `changeType`, `q` and
|
|
2237
|
+
* `minWeight` only take effect together with it (PRO only). `changeType` also accepts `"HELD"`,
|
|
2238
|
+
* every position still held whatever its change; values combine as a union. With a filter set, `data.matchTotals`
|
|
2239
|
+
* sums every matching holding, not just the page. Calling without `options` is unchanged.
|
|
2240
|
+
*
|
|
2241
|
+
* @example
|
|
2242
|
+
* const page = await client.institutional.getInstitutionDetail("Berkshire-Hathaway", {
|
|
2243
|
+
* limit: 10,
|
|
2244
|
+
* sortBy: "estimatedFlowUsd",
|
|
2245
|
+
* changeType: ["NEW", "INCREASED"],
|
|
2246
|
+
* }) as PreviewResponse<InstitutionDetail>;
|
|
2229
2247
|
*/
|
|
2230
|
-
async getInstitutionDetail(slugOrCik) {
|
|
2248
|
+
async getInstitutionDetail(slugOrCik, options) {
|
|
2249
|
+
const { changeType, ...rest } = options ?? {};
|
|
2231
2250
|
return this.client.get(
|
|
2232
|
-
`/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}
|
|
2251
|
+
`/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}`,
|
|
2252
|
+
{
|
|
2253
|
+
...rest,
|
|
2254
|
+
changeType: typeof changeType === "string" ? changeType : changeType?.join(",") || void 0
|
|
2255
|
+
}
|
|
2256
|
+
);
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Get an institution's 13F book filing by filing, newest first.
|
|
2260
|
+
*
|
|
2261
|
+
* Returns the preview envelope wrapping an {@link InstitutionHistory}, so the rows are two
|
|
2262
|
+
* levels down: `(await getInstitutionHistory(s)).data.quarters`. Each row carries the
|
|
2263
|
+
* filing's reported value, positions held and top-10 concentration, and, when it compares
|
|
2264
|
+
* with the quarter before (`comparisonStatus: "AVAILABLE"`), the position counts and the
|
|
2265
|
+
* estimated dollars bought, trimmed and exited. Those comparison fields are absent
|
|
2266
|
+
* otherwise, never zero. The flows are estimates from two quarter-end snapshots, not
|
|
2267
|
+
* reported cash flow. A 13F covers long US-listed equity only.
|
|
2268
|
+
*
|
|
2269
|
+
* Pass `tickers` to also get `data.positions`: each ticker maps to its shares and value per
|
|
2270
|
+
* filing, newest first. A filing in which the institution did not hold the ticker is absent
|
|
2271
|
+
* from its list. Free keys receive positions only for the institution's ten largest
|
|
2272
|
+
* holdings; other tickers are left out.
|
|
2273
|
+
*
|
|
2274
|
+
* Free keys receive the newest four filings with `isPreview: true` and `totalCount` holding
|
|
2275
|
+
* the number of filings in the requested window. The first request for a large multi-filer
|
|
2276
|
+
* institution can take a few seconds; when too many such computations run at once the API
|
|
2277
|
+
* answers 503 with a `Retry-After` header.
|
|
2278
|
+
*
|
|
2279
|
+
* @example
|
|
2280
|
+
* const { data } = await client.institutional.getInstitutionHistory("Renaissance-Technologies", {
|
|
2281
|
+
* quarters: 8,
|
|
2282
|
+
* tickers: ["NVDA", "META"],
|
|
2283
|
+
* });
|
|
2284
|
+
* for (const q of data.quarters) console.log(q.label, q.totalValueUsd, q.netFlowUsd);
|
|
2285
|
+
*/
|
|
2286
|
+
async getInstitutionHistory(slugOrCik, options) {
|
|
2287
|
+
const { tickers, ...rest } = options ?? {};
|
|
2288
|
+
return this.client.get(
|
|
2289
|
+
`/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}/history`,
|
|
2290
|
+
{
|
|
2291
|
+
...rest,
|
|
2292
|
+
tickers: typeof tickers === "string" ? tickers : tickers?.join(",") || void 0
|
|
2293
|
+
}
|
|
2233
2294
|
);
|
|
2234
2295
|
}
|
|
2235
2296
|
};
|
|
@@ -2818,13 +2879,27 @@ var Trackers = class {
|
|
|
2818
2879
|
* in your renderer.
|
|
2819
2880
|
*
|
|
2820
2881
|
* @param trackerId slug from {@link list}, e.g. `"institution-concentration"`.
|
|
2821
|
-
* @param params provider-specific query params
|
|
2822
|
-
*
|
|
2882
|
+
* @param params provider-specific query params, e.g. `{ scope: "nasdaq100" }` for
|
|
2883
|
+
* `market-heatmap`, or `{ filter: { state: "TX" } }` for a tracker that lists
|
|
2884
|
+
* `filters`. A bad `filter` throws `APIError` with `code: "invalid_filter"`.
|
|
2823
2885
|
*/
|
|
2824
2886
|
async get(trackerId, params) {
|
|
2825
|
-
return this.client.get(`/api/v1/trackers/${trackerId}`, params);
|
|
2887
|
+
return this.client.get(`/api/v1/trackers/${trackerId}`, serializeTrackerParams(params));
|
|
2826
2888
|
}
|
|
2827
2889
|
};
|
|
2890
|
+
function serializeTrackerFilter(filter) {
|
|
2891
|
+
if (typeof filter === "string") return filter;
|
|
2892
|
+
return Object.entries(filter).map(([key, value]) => `${key}:${value}`).join(",");
|
|
2893
|
+
}
|
|
2894
|
+
function serializeTrackerParams(params) {
|
|
2895
|
+
if (!params) return void 0;
|
|
2896
|
+
const out = {};
|
|
2897
|
+
for (const [key, value] of Object.entries(params)) {
|
|
2898
|
+
if (value === void 0 || value === null) continue;
|
|
2899
|
+
out[key] = key === "filter" ? serializeTrackerFilter(value) : value;
|
|
2900
|
+
}
|
|
2901
|
+
return out;
|
|
2902
|
+
}
|
|
2828
2903
|
|
|
2829
2904
|
// src/client.ts
|
|
2830
2905
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|
|
@@ -3361,6 +3436,10 @@ var PROVISION_PATH = "/api/v1/keys/provision";
|
|
|
3361
3436
|
var CLIENT_ID_HEADER = "X-SentiSense-Client-Id";
|
|
3362
3437
|
var LLMS_URL = "https://sentisense.ai/llms.txt";
|
|
3363
3438
|
var SKILL_URL = "https://sentisense.ai/skill.md";
|
|
3439
|
+
var STARTER_ARGS = "sentiment TSLA";
|
|
3440
|
+
function starterCommand(apiKey) {
|
|
3441
|
+
return `npx sentisense ${STARTER_ARGS} --api-key ${apiKey}`;
|
|
3442
|
+
}
|
|
3364
3443
|
var SOURCE_TEXT = {
|
|
3365
3444
|
config: 'your own key saved with "sentisense auth"',
|
|
3366
3445
|
flag: "the key passed with --api-key",
|
|
@@ -3432,6 +3511,7 @@ var initCommand = {
|
|
|
3432
3511
|
"it prints SENTISENSE_API_KEY=<key> and a keep link. Store the key the way the project",
|
|
3433
3512
|
"already stores secrets (an environment variable, a .env file kept out of git, a secret",
|
|
3434
3513
|
"manager). The SDK and every sentisense command read SENTISENSE_API_KEY from the environment.",
|
|
3514
|
+
"After the key it prints one command to try next (Tesla's sentiment, a sample company).",
|
|
3435
3515
|
"The key is temporary until kept: open the link, sign in or create a free account, and the",
|
|
3436
3516
|
"same key stays on your account. Until then it stops working after a few days and has request",
|
|
3437
3517
|
"limits; the link keeps it for about two weeks, even after it stops working.",
|
|
@@ -3465,6 +3545,7 @@ var initCommand = {
|
|
|
3465
3545
|
}
|
|
3466
3546
|
const minted = await mintKey(context);
|
|
3467
3547
|
const keepWindow = minted.keepUntil ? `; it works until ${formatUtc(minted.keepUntil)}, even after the key stops` : "";
|
|
3548
|
+
const starter = starterCommand(minted.apiKey);
|
|
3468
3549
|
return {
|
|
3469
3550
|
json: {
|
|
3470
3551
|
apiKey: minted.apiKey,
|
|
@@ -3474,6 +3555,7 @@ var initCommand = {
|
|
|
3474
3555
|
keepUntil: minted.keepUntil ?? null,
|
|
3475
3556
|
keepUrl: minted.keepUrl,
|
|
3476
3557
|
limits: minted.limits ?? null,
|
|
3558
|
+
starterCommand: starter,
|
|
3477
3559
|
docs: { llms: LLMS_URL, skill: SKILL_URL }
|
|
3478
3560
|
},
|
|
3479
3561
|
doc: doc(
|
|
@@ -3484,6 +3566,9 @@ var initCommand = {
|
|
|
3484
3566
|
text: `A temporary key, working until ${formatUtc(minted.expiresAt)} unless kept. Set it as the ${ENV_VAR} environment variable wherever this project keeps its secrets; the SDK and the sentisense commands read it from there.`
|
|
3485
3567
|
},
|
|
3486
3568
|
{ kind: "blank" },
|
|
3569
|
+
{ kind: "text", text: "Run this next. Tesla is a sample company, so this key gets its full sentiment reading:" },
|
|
3570
|
+
{ kind: "text", text: starter, tone: "accent" },
|
|
3571
|
+
{ kind: "blank" },
|
|
3487
3572
|
{
|
|
3488
3573
|
kind: "text",
|
|
3489
3574
|
text: "Keep this key: open this link and sign in (or create a free account), and the same key stays on your account for good. Nothing else changes."
|
package/dist/index.cjs
CHANGED
|
@@ -874,10 +874,71 @@ var Institutional = class {
|
|
|
874
874
|
* The signature remains unknown for compatibility. Opt in to the exported
|
|
875
875
|
* PreviewResponse<InstitutionDetail> type to read data.positionsHeld, the full
|
|
876
876
|
* portfolio count excluding SOLD_OUT rows, even on a truncated holdings list.
|
|
877
|
+
*
|
|
878
|
+
* When the filing compares with the preceding quarter (`comparisonStatus` is `AVAILABLE`),
|
|
879
|
+
* the payload also carries `priorTotalValueUsd` and `priorPositionsHeld`, and each holding
|
|
880
|
+
* carries `priorValueUsd`, `priorPortfolioWeight` and `estimatedFlowUsd` (an estimate from
|
|
881
|
+
* two quarter-end snapshots, not a reported trade). Each is absent when it does not apply.
|
|
882
|
+
*
|
|
883
|
+
* `options.limit` returns a sorted page of holdings and adds `returnedCount` and `offset` to
|
|
884
|
+
* `data` and `totalCount` to the envelope; `sortBy`, `sortDir`, `changeType`, `q` and
|
|
885
|
+
* `minWeight` only take effect together with it (PRO only). `changeType` also accepts `"HELD"`,
|
|
886
|
+
* every position still held whatever its change; values combine as a union. With a filter set, `data.matchTotals`
|
|
887
|
+
* sums every matching holding, not just the page. Calling without `options` is unchanged.
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* const page = await client.institutional.getInstitutionDetail("Berkshire-Hathaway", {
|
|
891
|
+
* limit: 10,
|
|
892
|
+
* sortBy: "estimatedFlowUsd",
|
|
893
|
+
* changeType: ["NEW", "INCREASED"],
|
|
894
|
+
* }) as PreviewResponse<InstitutionDetail>;
|
|
895
|
+
*/
|
|
896
|
+
async getInstitutionDetail(slugOrCik, options) {
|
|
897
|
+
const { changeType, ...rest } = options ?? {};
|
|
898
|
+
return this.client.get(
|
|
899
|
+
`/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}`,
|
|
900
|
+
{
|
|
901
|
+
...rest,
|
|
902
|
+
changeType: typeof changeType === "string" ? changeType : changeType?.join(",") || void 0
|
|
903
|
+
}
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Get an institution's 13F book filing by filing, newest first.
|
|
908
|
+
*
|
|
909
|
+
* Returns the preview envelope wrapping an {@link InstitutionHistory}, so the rows are two
|
|
910
|
+
* levels down: `(await getInstitutionHistory(s)).data.quarters`. Each row carries the
|
|
911
|
+
* filing's reported value, positions held and top-10 concentration, and, when it compares
|
|
912
|
+
* with the quarter before (`comparisonStatus: "AVAILABLE"`), the position counts and the
|
|
913
|
+
* estimated dollars bought, trimmed and exited. Those comparison fields are absent
|
|
914
|
+
* otherwise, never zero. The flows are estimates from two quarter-end snapshots, not
|
|
915
|
+
* reported cash flow. A 13F covers long US-listed equity only.
|
|
916
|
+
*
|
|
917
|
+
* Pass `tickers` to also get `data.positions`: each ticker maps to its shares and value per
|
|
918
|
+
* filing, newest first. A filing in which the institution did not hold the ticker is absent
|
|
919
|
+
* from its list. Free keys receive positions only for the institution's ten largest
|
|
920
|
+
* holdings; other tickers are left out.
|
|
921
|
+
*
|
|
922
|
+
* Free keys receive the newest four filings with `isPreview: true` and `totalCount` holding
|
|
923
|
+
* the number of filings in the requested window. The first request for a large multi-filer
|
|
924
|
+
* institution can take a few seconds; when too many such computations run at once the API
|
|
925
|
+
* answers 503 with a `Retry-After` header.
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* const { data } = await client.institutional.getInstitutionHistory("Renaissance-Technologies", {
|
|
929
|
+
* quarters: 8,
|
|
930
|
+
* tickers: ["NVDA", "META"],
|
|
931
|
+
* });
|
|
932
|
+
* for (const q of data.quarters) console.log(q.label, q.totalValueUsd, q.netFlowUsd);
|
|
877
933
|
*/
|
|
878
|
-
async
|
|
934
|
+
async getInstitutionHistory(slugOrCik, options) {
|
|
935
|
+
const { tickers, ...rest } = options ?? {};
|
|
879
936
|
return this.client.get(
|
|
880
|
-
`/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}
|
|
937
|
+
`/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}/history`,
|
|
938
|
+
{
|
|
939
|
+
...rest,
|
|
940
|
+
tickers: typeof tickers === "string" ? tickers : tickers?.join(",") || void 0
|
|
941
|
+
}
|
|
881
942
|
);
|
|
882
943
|
}
|
|
883
944
|
};
|
|
@@ -1466,16 +1527,30 @@ var Trackers = class {
|
|
|
1466
1527
|
* in your renderer.
|
|
1467
1528
|
*
|
|
1468
1529
|
* @param trackerId slug from {@link list}, e.g. `"institution-concentration"`.
|
|
1469
|
-
* @param params provider-specific query params
|
|
1470
|
-
*
|
|
1530
|
+
* @param params provider-specific query params, e.g. `{ scope: "nasdaq100" }` for
|
|
1531
|
+
* `market-heatmap`, or `{ filter: { state: "TX" } }` for a tracker that lists
|
|
1532
|
+
* `filters`. A bad `filter` throws `APIError` with `code: "invalid_filter"`.
|
|
1471
1533
|
*/
|
|
1472
1534
|
async get(trackerId, params) {
|
|
1473
|
-
return this.client.get(`/api/v1/trackers/${trackerId}`, params);
|
|
1535
|
+
return this.client.get(`/api/v1/trackers/${trackerId}`, serializeTrackerParams(params));
|
|
1474
1536
|
}
|
|
1475
1537
|
};
|
|
1538
|
+
function serializeTrackerFilter(filter) {
|
|
1539
|
+
if (typeof filter === "string") return filter;
|
|
1540
|
+
return Object.entries(filter).map(([key, value]) => `${key}:${value}`).join(",");
|
|
1541
|
+
}
|
|
1542
|
+
function serializeTrackerParams(params) {
|
|
1543
|
+
if (!params) return void 0;
|
|
1544
|
+
const out = {};
|
|
1545
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1546
|
+
if (value === void 0 || value === null) continue;
|
|
1547
|
+
out[key] = key === "filter" ? serializeTrackerFilter(value) : value;
|
|
1548
|
+
}
|
|
1549
|
+
return out;
|
|
1550
|
+
}
|
|
1476
1551
|
|
|
1477
1552
|
// src/version.ts
|
|
1478
|
-
var VERSION = "0.
|
|
1553
|
+
var VERSION = "0.75.1";
|
|
1479
1554
|
|
|
1480
1555
|
// src/client.ts
|
|
1481
1556
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|