sentisense 0.27.0 → 0.29.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/dist/index.d.mts CHANGED
@@ -117,10 +117,38 @@ interface Fundamentals {
117
117
  timeframe: string;
118
118
  [key: string]: unknown;
119
119
  }
120
+ /**
121
+ * Trailing-twelve-month snapshot from `stocks.getCurrentFundamentals()`: TTM ratios,
122
+ * a different shape from the per-period statement data in {@link Fundamentals}.
123
+ */
124
+ interface TtmFundamentals {
125
+ ticker: string;
126
+ currentPrice?: number;
127
+ peTTM?: number | null;
128
+ psTTM?: number | null;
129
+ epsTTM?: number | null;
130
+ revenueTTM?: number | null;
131
+ quartersIncluded?: number;
132
+ /** False when there is not enough filed history to compute the TTM figures. */
133
+ available?: boolean;
134
+ /** Populated when `available` is false, explaining why. */
135
+ reason?: string | null;
136
+ [key: string]: unknown;
137
+ }
120
138
  interface FundamentalsPeriod {
121
139
  fiscalPeriod: string;
122
140
  fiscalYear: number;
123
141
  }
142
+ /**
143
+ * What `stocks.getFundamentalsPeriods()` returns: the periods are in `periods`, not at
144
+ * the top level.
145
+ */
146
+ interface FundamentalsPeriodsResponse {
147
+ ticker: string;
148
+ periods: FundamentalsPeriod[];
149
+ /** Populated when no periods are available, explaining why. */
150
+ reason?: string | null;
151
+ }
124
152
  interface ShortInterest {
125
153
  ticker: string;
126
154
  [key: string]: unknown;
@@ -187,6 +215,23 @@ interface Document {
187
215
  reliability: number;
188
216
  sentiment: SentimentEntry[];
189
217
  }
218
+ /**
219
+ * What the document-metrics endpoints return: `documents.getByTicker()`,
220
+ * `getByTickerRange()`, `getByEntity()`, `search()` and `getBySource()` all resolve to
221
+ * this. The rows are in `documents`, and this is NOT the {@link PreviewResponse}
222
+ * envelope: there is no `isPreview` or `data`.
223
+ */
224
+ interface DocumentSearchResponse {
225
+ documents: Document[];
226
+ /** Total matching documents before any limit was applied. */
227
+ totalCount: number;
228
+ /** Ticker the query resolved to, or `null` when the query was not ticker-scoped. */
229
+ searchTicker: string | null;
230
+ /** Source filter applied, or `"ALL"` when unfiltered. */
231
+ source: string;
232
+ startDate: string;
233
+ endDate: string;
234
+ }
190
235
  /** Story cluster with title, sentiment, and metrics. */
191
236
  interface StoryCluster {
192
237
  id: string;
@@ -299,10 +344,53 @@ interface Holder {
299
344
  sharesChange: number;
300
345
  sharesChangePct: number;
301
346
  }
302
- interface InstitutionalFlowsResponse {
347
+ /**
348
+ * Institutional ownership for one ticker: the `data` payload of
349
+ * `institutional.getHolders()`, which returns `PreviewResponse<TickerHolders>`. The
350
+ * holder rows are in `holders`, so read them as `result.data.holders` (two levels down),
351
+ * alongside ticker-level totals like `holderCount`.
352
+ */
353
+ interface TickerHolders {
354
+ ticker: string;
355
+ companyName: string;
356
+ reportDate: string;
357
+ totalInstitutionalShares: number;
358
+ totalInstitutionalValue: number;
359
+ holderCount: number;
360
+ holders: Holder[];
361
+ }
362
+ /**
363
+ * The flows payload inside the response envelope: `institutional.getFlows()` returns
364
+ * `PreviewResponse<InstitutionalFlows>`, so read the flows as `result.data.inflows`.
365
+ */
366
+ interface InstitutionalFlows {
303
367
  inflows: InstitutionalFlow[];
304
368
  outflows: InstitutionalFlow[];
369
+ /**
370
+ * Quarter these flows are for (ISO date). Populated when `reportDate` is omitted from
371
+ * the request so the caller knows which quarter the server defaulted to.
372
+ */
373
+ reportDate?: string;
374
+ /**
375
+ * True when `reportDate` is a still-open 13F filing window (within 45 days of quarter
376
+ * end), so only early filers are represented and the flows are partial.
377
+ */
378
+ isPending?: boolean;
379
+ /** Distinct 13F filers represented in this quarter. Present only when `isPending`. */
380
+ filerCount?: number;
381
+ /**
382
+ * Distinct filers in the latest fully-filed quarter, as a coverage baseline for a
383
+ * pending quarter (e.g. `filerCount` 578 of `baselineFilerCount` 8789). Present only
384
+ * when `isPending`.
385
+ */
386
+ baselineFilerCount?: number;
305
387
  }
388
+ /**
389
+ * @deprecated Names the INNER flows payload, but `getFlows()` returns the envelope
390
+ * {@link PreviewResponse}<{@link InstitutionalFlows}>. Kept as an alias of the inner
391
+ * shape so an existing import still resolves; will be removed in a future release.
392
+ */
393
+ type InstitutionalFlowsResponse = InstitutionalFlows;
306
394
  interface GetFlowsOptions {
307
395
  limit?: number;
308
396
  }
@@ -627,9 +715,9 @@ interface MarketMood {
627
715
  }
628
716
  /** AI-generated market summary with headline and analysis. */
629
717
  interface MarketSummary {
630
- /** Total mentions across all stocks. */
718
+ /** Not populated by the API (always empty); retained for backward compatibility. */
631
719
  totalMentions: number;
632
- /** Most active stock tickers by mention volume. */
720
+ /** Not populated by the API (always empty); retained for backward compatibility. */
633
721
  topActiveStocks: string[];
634
722
  /** Timestamp when this data was last updated (epoch milliseconds). */
635
723
  lastUpdated: number;
@@ -663,7 +751,11 @@ interface LockedInsight {
663
751
  urgency: string;
664
752
  generatedAt: number;
665
753
  }
666
- /** Preview response returned to free/unauthenticated users on insights endpoints. */
754
+ /**
755
+ * @deprecated The insights endpoints return `PreviewResponse<Insight[]>`, not this shape.
756
+ * No endpoint emits `insights` or `locked`. Kept only so an existing import resolves;
757
+ * will be removed in a future release.
758
+ */
667
759
  interface InsightPreviewResponse {
668
760
  isPreview: true;
669
761
  previewReason: "PRO_REQUIRED";
@@ -1002,16 +1094,16 @@ declare class Calendar {
1002
1094
  declare class Documents {
1003
1095
  private client;
1004
1096
  constructor(client: APIClient);
1005
- /** Get document metrics for a stock. */
1006
- getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]>;
1007
- /** Get document metrics for a stock within a date range. */
1008
- getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]>;
1009
- /** Get document metrics for a KB entity. */
1010
- getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]>;
1011
- /** Smart search with natural language query parsing. */
1012
- search(query: string, options?: SearchDocumentsOptions): Promise<Document[]>;
1013
- /** Get latest document metrics from a source type. */
1014
- getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]>;
1097
+ /** Get document metrics for a stock. The rows are in `documents`. */
1098
+ getByTicker(ticker: string, options?: GetByTickerOptions): Promise<DocumentSearchResponse>;
1099
+ /** Get document metrics for a stock within a date range. The rows are in `documents`. */
1100
+ getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<DocumentSearchResponse>;
1101
+ /** Get document metrics for a KB entity. The rows are in `documents`. */
1102
+ getByEntity(entityId: string, options?: GetByEntityOptions): Promise<DocumentSearchResponse>;
1103
+ /** Smart search with natural language query parsing. The rows are in `documents`. */
1104
+ search(query: string, options?: SearchDocumentsOptions): Promise<DocumentSearchResponse>;
1105
+ /** Get latest document metrics from a source type. The rows are in `documents`. */
1106
+ getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<DocumentSearchResponse>;
1015
1107
  /** Get AI-curated news story clusters. */
1016
1108
  getStories(options?: GetStoriesOptions): Promise<Story[]>;
1017
1109
  /** Get full story detail by cluster ID. */
@@ -1304,40 +1396,42 @@ declare class Insights {
1304
1396
  /**
1305
1397
  * Get AI-generated insights for a specific stock, sorted by urgency then confidence.
1306
1398
  *
1307
- * PRO users receive a flat array of Insight objects.
1308
- * Free/unauthenticated users receive a preview with `isPreview: true`,
1309
- * the top 3 insights in full, and a `locked` array with metadata-only entries
1310
- * (type, urgency, timestamp) showing what additional signals exist.
1399
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1400
+ * full list with `isPreview: false`; free callers get the top 3 with `isPreview: true`
1401
+ * and `totalCount` carrying the untruncated size.
1311
1402
  */
1312
- stock(ticker: string, options?: GetInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1403
+ stock(ticker: string, options?: GetInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1313
1404
  /**
1314
1405
  * Get AI insights for a stock within a date range.
1315
1406
  *
1316
- * Free users receive the top 3; PRO users receive the full list.
1317
- * The server returns 400 if `startDate` is after `endDate`.
1407
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1408
+ * the top 3, PRO callers the full list. The server returns 400 if `startDate` is
1409
+ * after `endDate`.
1318
1410
  */
1319
- stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<Insight[] | InsightPreviewResponse>;
1411
+ stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<PreviewResponse<Insight[]>>;
1320
1412
  /**
1321
1413
  * Get AI-generated market-level insights, sorted by urgency then confidence.
1322
1414
  *
1323
- * PRO users receive a flat array of Insight objects.
1324
- * Free/unauthenticated users receive a preview with `isPreview: true`,
1325
- * the top 5 insights in full, and a `locked` array with metadata-only entries.
1415
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1416
+ * full list with `isPreview: false`; free callers get the top 5 with `isPreview: true`
1417
+ * and `totalCount` carrying the untruncated size.
1326
1418
  */
1327
- market(): Promise<Insight[] | InsightPreviewResponse>;
1419
+ market(): Promise<PreviewResponse<Insight[]>>;
1328
1420
  /**
1329
1421
  * Get the latest AI insights across all tracked stocks, newest first.
1330
1422
  *
1331
- * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
1423
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1424
+ * the top 5, PRO callers up to `limit` (clamped to 1-200).
1332
1425
  */
1333
- latest(options?: GetLatestInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1426
+ latest(options?: GetLatestInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1334
1427
  /**
1335
1428
  * Get personalized insights for the authenticated user.
1336
1429
  *
1337
1430
  * Biased toward the user's watchlist and portfolio when available; falls back
1338
1431
  * to market-level insights otherwise. API key authentication required.
1432
+ * Returns the preview envelope: read the insights as `.data`.
1339
1433
  */
1340
- user(options?: GetUserInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1434
+ user(options?: GetUserInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1341
1435
  /**
1342
1436
  * Get available insight types for a specific stock.
1343
1437
  * No authentication required.
@@ -1352,12 +1446,32 @@ declare class Institutional {
1352
1446
  constructor(client: APIClient);
1353
1447
  /** Get available 13F reporting quarters. */
1354
1448
  getQuarters(): Promise<Quarter[]>;
1355
- /** Get aggregate institutional activity per ticker for a quarter. */
1356
- getFlows(reportDate: string, options?: GetFlowsOptions): Promise<InstitutionalFlowsResponse>;
1357
- /** Get institutional holders for a specific stock. */
1358
- getHolders(ticker: string, reportDate: string): Promise<Holder[]>;
1359
- /** Get activist investor positions (NEW or INCREASED). */
1360
- getActivists(reportDate: string): Promise<Holder[]>;
1449
+ /**
1450
+ * Get aggregate institutional activity per ticker for a quarter.
1451
+ *
1452
+ * `reportDate` is optional: omit it to get the latest available quarter, which may be
1453
+ * a still-open one holding only early filers. The response then carries `reportDate`
1454
+ * plus `isPending` and filer coverage counts so a partial quarter is clearly labeled.
1455
+ *
1456
+ * Returns the preview envelope, so the flows are one level down:
1457
+ * `const { data } = await client.institutional.getFlows(); data.inflows`.
1458
+ */
1459
+ getFlows(reportDate?: string, options?: GetFlowsOptions): Promise<PreviewResponse<InstitutionalFlows>>;
1460
+ /**
1461
+ * Get institutional holders for a specific stock.
1462
+ *
1463
+ * Returns the preview envelope wrapping a {@link TickerHolders} object, so the rows
1464
+ * are two levels down: `(await getHolders(t, d)).data.holders`, alongside ticker-level
1465
+ * totals like `holderCount`. Free callers get a truncated `holders` array with
1466
+ * `isPreview: true`.
1467
+ */
1468
+ getHolders(ticker: string, reportDate: string): Promise<PreviewResponse<TickerHolders>>;
1469
+ /**
1470
+ * Get activist investor positions (NEW or INCREASED).
1471
+ *
1472
+ * Returns the preview envelope, so read the rows as `.data`.
1473
+ */
1474
+ getActivists(reportDate: string): Promise<PreviewResponse<Holder[]>>;
1361
1475
  /**
1362
1476
  * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
1363
1477
  * so you can find what to query without knowing slugs upfront.
@@ -1453,10 +1567,13 @@ declare class Stocks {
1453
1567
  getMarketStatus(): Promise<MarketStatus>;
1454
1568
  /** Get financial statement data. */
1455
1569
  getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals>;
1456
- /** Get available fiscal periods. */
1457
- getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]>;
1458
- /** Get most recent fundamentals snapshot. */
1459
- getCurrentFundamentals(ticker: string): Promise<Fundamentals>;
1570
+ /** Get available fiscal periods. The periods are in `periods`. */
1571
+ getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriodsResponse>;
1572
+ /**
1573
+ * Get the trailing-twelve-month fundamentals snapshot: TTM ratios, a different
1574
+ * shape from the per-period statement data `getFundamentals()` returns.
1575
+ */
1576
+ getCurrentFundamentals(ticker: string): Promise<TtmFundamentals>;
1460
1577
  /** Get historical revenue data. */
1461
1578
  getHistoricalRevenue(ticker: string): Promise<unknown>;
1462
1579
  /** Get short interest metrics (FINRA). */
@@ -1580,6 +1697,6 @@ declare class APIError extends SentiSenseError {
1580
1697
  constructor(message: string, status: number, code?: string);
1581
1698
  }
1582
1699
 
1583
- declare const VERSION = "0.27.0";
1700
+ declare const VERSION = "0.29.0";
1584
1701
 
1585
- export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionList, type InstitutionListResponse, type InstitutionSummary, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type ListInstitutionsOptions, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, type TrackerEvent, type TrackerGeoEntry, type TrackerHeadlineMetric, type TrackerListResponse, type TrackerListing, type TrackerMetricValue, type TrackerSignal, type TrackerSnapshot, type TrackerSnapshotResponse, type TrackerSourceRef, type TrackerTableRow, type TrackerTimeSeriesPoint, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
1702
+ export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSearchResponse, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type FundamentalsPeriodsResponse, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionList, type InstitutionListResponse, type InstitutionSummary, type InstitutionalFlow, type InstitutionalFlows, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type ListInstitutionsOptions, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, type TickerHolders, type TrackerEvent, type TrackerGeoEntry, type TrackerHeadlineMetric, type TrackerListResponse, type TrackerListing, type TrackerMetricValue, type TrackerSignal, type TrackerSnapshot, type TrackerSnapshotResponse, type TrackerSourceRef, type TrackerTableRow, type TrackerTimeSeriesPoint, type TtmFundamentals, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
package/dist/index.d.ts CHANGED
@@ -117,10 +117,38 @@ interface Fundamentals {
117
117
  timeframe: string;
118
118
  [key: string]: unknown;
119
119
  }
120
+ /**
121
+ * Trailing-twelve-month snapshot from `stocks.getCurrentFundamentals()`: TTM ratios,
122
+ * a different shape from the per-period statement data in {@link Fundamentals}.
123
+ */
124
+ interface TtmFundamentals {
125
+ ticker: string;
126
+ currentPrice?: number;
127
+ peTTM?: number | null;
128
+ psTTM?: number | null;
129
+ epsTTM?: number | null;
130
+ revenueTTM?: number | null;
131
+ quartersIncluded?: number;
132
+ /** False when there is not enough filed history to compute the TTM figures. */
133
+ available?: boolean;
134
+ /** Populated when `available` is false, explaining why. */
135
+ reason?: string | null;
136
+ [key: string]: unknown;
137
+ }
120
138
  interface FundamentalsPeriod {
121
139
  fiscalPeriod: string;
122
140
  fiscalYear: number;
123
141
  }
142
+ /**
143
+ * What `stocks.getFundamentalsPeriods()` returns: the periods are in `periods`, not at
144
+ * the top level.
145
+ */
146
+ interface FundamentalsPeriodsResponse {
147
+ ticker: string;
148
+ periods: FundamentalsPeriod[];
149
+ /** Populated when no periods are available, explaining why. */
150
+ reason?: string | null;
151
+ }
124
152
  interface ShortInterest {
125
153
  ticker: string;
126
154
  [key: string]: unknown;
@@ -187,6 +215,23 @@ interface Document {
187
215
  reliability: number;
188
216
  sentiment: SentimentEntry[];
189
217
  }
218
+ /**
219
+ * What the document-metrics endpoints return: `documents.getByTicker()`,
220
+ * `getByTickerRange()`, `getByEntity()`, `search()` and `getBySource()` all resolve to
221
+ * this. The rows are in `documents`, and this is NOT the {@link PreviewResponse}
222
+ * envelope: there is no `isPreview` or `data`.
223
+ */
224
+ interface DocumentSearchResponse {
225
+ documents: Document[];
226
+ /** Total matching documents before any limit was applied. */
227
+ totalCount: number;
228
+ /** Ticker the query resolved to, or `null` when the query was not ticker-scoped. */
229
+ searchTicker: string | null;
230
+ /** Source filter applied, or `"ALL"` when unfiltered. */
231
+ source: string;
232
+ startDate: string;
233
+ endDate: string;
234
+ }
190
235
  /** Story cluster with title, sentiment, and metrics. */
191
236
  interface StoryCluster {
192
237
  id: string;
@@ -299,10 +344,53 @@ interface Holder {
299
344
  sharesChange: number;
300
345
  sharesChangePct: number;
301
346
  }
302
- interface InstitutionalFlowsResponse {
347
+ /**
348
+ * Institutional ownership for one ticker: the `data` payload of
349
+ * `institutional.getHolders()`, which returns `PreviewResponse<TickerHolders>`. The
350
+ * holder rows are in `holders`, so read them as `result.data.holders` (two levels down),
351
+ * alongside ticker-level totals like `holderCount`.
352
+ */
353
+ interface TickerHolders {
354
+ ticker: string;
355
+ companyName: string;
356
+ reportDate: string;
357
+ totalInstitutionalShares: number;
358
+ totalInstitutionalValue: number;
359
+ holderCount: number;
360
+ holders: Holder[];
361
+ }
362
+ /**
363
+ * The flows payload inside the response envelope: `institutional.getFlows()` returns
364
+ * `PreviewResponse<InstitutionalFlows>`, so read the flows as `result.data.inflows`.
365
+ */
366
+ interface InstitutionalFlows {
303
367
  inflows: InstitutionalFlow[];
304
368
  outflows: InstitutionalFlow[];
369
+ /**
370
+ * Quarter these flows are for (ISO date). Populated when `reportDate` is omitted from
371
+ * the request so the caller knows which quarter the server defaulted to.
372
+ */
373
+ reportDate?: string;
374
+ /**
375
+ * True when `reportDate` is a still-open 13F filing window (within 45 days of quarter
376
+ * end), so only early filers are represented and the flows are partial.
377
+ */
378
+ isPending?: boolean;
379
+ /** Distinct 13F filers represented in this quarter. Present only when `isPending`. */
380
+ filerCount?: number;
381
+ /**
382
+ * Distinct filers in the latest fully-filed quarter, as a coverage baseline for a
383
+ * pending quarter (e.g. `filerCount` 578 of `baselineFilerCount` 8789). Present only
384
+ * when `isPending`.
385
+ */
386
+ baselineFilerCount?: number;
305
387
  }
388
+ /**
389
+ * @deprecated Names the INNER flows payload, but `getFlows()` returns the envelope
390
+ * {@link PreviewResponse}<{@link InstitutionalFlows}>. Kept as an alias of the inner
391
+ * shape so an existing import still resolves; will be removed in a future release.
392
+ */
393
+ type InstitutionalFlowsResponse = InstitutionalFlows;
306
394
  interface GetFlowsOptions {
307
395
  limit?: number;
308
396
  }
@@ -627,9 +715,9 @@ interface MarketMood {
627
715
  }
628
716
  /** AI-generated market summary with headline and analysis. */
629
717
  interface MarketSummary {
630
- /** Total mentions across all stocks. */
718
+ /** Not populated by the API (always empty); retained for backward compatibility. */
631
719
  totalMentions: number;
632
- /** Most active stock tickers by mention volume. */
720
+ /** Not populated by the API (always empty); retained for backward compatibility. */
633
721
  topActiveStocks: string[];
634
722
  /** Timestamp when this data was last updated (epoch milliseconds). */
635
723
  lastUpdated: number;
@@ -663,7 +751,11 @@ interface LockedInsight {
663
751
  urgency: string;
664
752
  generatedAt: number;
665
753
  }
666
- /** Preview response returned to free/unauthenticated users on insights endpoints. */
754
+ /**
755
+ * @deprecated The insights endpoints return `PreviewResponse<Insight[]>`, not this shape.
756
+ * No endpoint emits `insights` or `locked`. Kept only so an existing import resolves;
757
+ * will be removed in a future release.
758
+ */
667
759
  interface InsightPreviewResponse {
668
760
  isPreview: true;
669
761
  previewReason: "PRO_REQUIRED";
@@ -1002,16 +1094,16 @@ declare class Calendar {
1002
1094
  declare class Documents {
1003
1095
  private client;
1004
1096
  constructor(client: APIClient);
1005
- /** Get document metrics for a stock. */
1006
- getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]>;
1007
- /** Get document metrics for a stock within a date range. */
1008
- getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]>;
1009
- /** Get document metrics for a KB entity. */
1010
- getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]>;
1011
- /** Smart search with natural language query parsing. */
1012
- search(query: string, options?: SearchDocumentsOptions): Promise<Document[]>;
1013
- /** Get latest document metrics from a source type. */
1014
- getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]>;
1097
+ /** Get document metrics for a stock. The rows are in `documents`. */
1098
+ getByTicker(ticker: string, options?: GetByTickerOptions): Promise<DocumentSearchResponse>;
1099
+ /** Get document metrics for a stock within a date range. The rows are in `documents`. */
1100
+ getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<DocumentSearchResponse>;
1101
+ /** Get document metrics for a KB entity. The rows are in `documents`. */
1102
+ getByEntity(entityId: string, options?: GetByEntityOptions): Promise<DocumentSearchResponse>;
1103
+ /** Smart search with natural language query parsing. The rows are in `documents`. */
1104
+ search(query: string, options?: SearchDocumentsOptions): Promise<DocumentSearchResponse>;
1105
+ /** Get latest document metrics from a source type. The rows are in `documents`. */
1106
+ getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<DocumentSearchResponse>;
1015
1107
  /** Get AI-curated news story clusters. */
1016
1108
  getStories(options?: GetStoriesOptions): Promise<Story[]>;
1017
1109
  /** Get full story detail by cluster ID. */
@@ -1304,40 +1396,42 @@ declare class Insights {
1304
1396
  /**
1305
1397
  * Get AI-generated insights for a specific stock, sorted by urgency then confidence.
1306
1398
  *
1307
- * PRO users receive a flat array of Insight objects.
1308
- * Free/unauthenticated users receive a preview with `isPreview: true`,
1309
- * the top 3 insights in full, and a `locked` array with metadata-only entries
1310
- * (type, urgency, timestamp) showing what additional signals exist.
1399
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1400
+ * full list with `isPreview: false`; free callers get the top 3 with `isPreview: true`
1401
+ * and `totalCount` carrying the untruncated size.
1311
1402
  */
1312
- stock(ticker: string, options?: GetInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1403
+ stock(ticker: string, options?: GetInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1313
1404
  /**
1314
1405
  * Get AI insights for a stock within a date range.
1315
1406
  *
1316
- * Free users receive the top 3; PRO users receive the full list.
1317
- * The server returns 400 if `startDate` is after `endDate`.
1407
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1408
+ * the top 3, PRO callers the full list. The server returns 400 if `startDate` is
1409
+ * after `endDate`.
1318
1410
  */
1319
- stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<Insight[] | InsightPreviewResponse>;
1411
+ stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<PreviewResponse<Insight[]>>;
1320
1412
  /**
1321
1413
  * Get AI-generated market-level insights, sorted by urgency then confidence.
1322
1414
  *
1323
- * PRO users receive a flat array of Insight objects.
1324
- * Free/unauthenticated users receive a preview with `isPreview: true`,
1325
- * the top 5 insights in full, and a `locked` array with metadata-only entries.
1415
+ * Returns the preview envelope: read the insights as `.data`. PRO callers get the
1416
+ * full list with `isPreview: false`; free callers get the top 5 with `isPreview: true`
1417
+ * and `totalCount` carrying the untruncated size.
1326
1418
  */
1327
- market(): Promise<Insight[] | InsightPreviewResponse>;
1419
+ market(): Promise<PreviewResponse<Insight[]>>;
1328
1420
  /**
1329
1421
  * Get the latest AI insights across all tracked stocks, newest first.
1330
1422
  *
1331
- * Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
1423
+ * Returns the preview envelope: read the insights as `.data`. Free callers receive
1424
+ * the top 5, PRO callers up to `limit` (clamped to 1-200).
1332
1425
  */
1333
- latest(options?: GetLatestInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1426
+ latest(options?: GetLatestInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1334
1427
  /**
1335
1428
  * Get personalized insights for the authenticated user.
1336
1429
  *
1337
1430
  * Biased toward the user's watchlist and portfolio when available; falls back
1338
1431
  * to market-level insights otherwise. API key authentication required.
1432
+ * Returns the preview envelope: read the insights as `.data`.
1339
1433
  */
1340
- user(options?: GetUserInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
1434
+ user(options?: GetUserInsightsOptions): Promise<PreviewResponse<Insight[]>>;
1341
1435
  /**
1342
1436
  * Get available insight types for a specific stock.
1343
1437
  * No authentication required.
@@ -1352,12 +1446,32 @@ declare class Institutional {
1352
1446
  constructor(client: APIClient);
1353
1447
  /** Get available 13F reporting quarters. */
1354
1448
  getQuarters(): Promise<Quarter[]>;
1355
- /** Get aggregate institutional activity per ticker for a quarter. */
1356
- getFlows(reportDate: string, options?: GetFlowsOptions): Promise<InstitutionalFlowsResponse>;
1357
- /** Get institutional holders for a specific stock. */
1358
- getHolders(ticker: string, reportDate: string): Promise<Holder[]>;
1359
- /** Get activist investor positions (NEW or INCREASED). */
1360
- getActivists(reportDate: string): Promise<Holder[]>;
1449
+ /**
1450
+ * Get aggregate institutional activity per ticker for a quarter.
1451
+ *
1452
+ * `reportDate` is optional: omit it to get the latest available quarter, which may be
1453
+ * a still-open one holding only early filers. The response then carries `reportDate`
1454
+ * plus `isPending` and filer coverage counts so a partial quarter is clearly labeled.
1455
+ *
1456
+ * Returns the preview envelope, so the flows are one level down:
1457
+ * `const { data } = await client.institutional.getFlows(); data.inflows`.
1458
+ */
1459
+ getFlows(reportDate?: string, options?: GetFlowsOptions): Promise<PreviewResponse<InstitutionalFlows>>;
1460
+ /**
1461
+ * Get institutional holders for a specific stock.
1462
+ *
1463
+ * Returns the preview envelope wrapping a {@link TickerHolders} object, so the rows
1464
+ * are two levels down: `(await getHolders(t, d)).data.holders`, alongside ticker-level
1465
+ * totals like `holderCount`. Free callers get a truncated `holders` array with
1466
+ * `isPreview: true`.
1467
+ */
1468
+ getHolders(ticker: string, reportDate: string): Promise<PreviewResponse<TickerHolders>>;
1469
+ /**
1470
+ * Get activist investor positions (NEW or INCREASED).
1471
+ *
1472
+ * Returns the preview envelope, so read the rows as `.data`.
1473
+ */
1474
+ getActivists(reportDate: string): Promise<PreviewResponse<Holder[]>>;
1361
1475
  /**
1362
1476
  * Discover institutions: a paginated, AUM-ranked list of filers (slug + metadata)
1363
1477
  * so you can find what to query without knowing slugs upfront.
@@ -1453,10 +1567,13 @@ declare class Stocks {
1453
1567
  getMarketStatus(): Promise<MarketStatus>;
1454
1568
  /** Get financial statement data. */
1455
1569
  getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals>;
1456
- /** Get available fiscal periods. */
1457
- getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]>;
1458
- /** Get most recent fundamentals snapshot. */
1459
- getCurrentFundamentals(ticker: string): Promise<Fundamentals>;
1570
+ /** Get available fiscal periods. The periods are in `periods`. */
1571
+ getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriodsResponse>;
1572
+ /**
1573
+ * Get the trailing-twelve-month fundamentals snapshot: TTM ratios, a different
1574
+ * shape from the per-period statement data `getFundamentals()` returns.
1575
+ */
1576
+ getCurrentFundamentals(ticker: string): Promise<TtmFundamentals>;
1460
1577
  /** Get historical revenue data. */
1461
1578
  getHistoricalRevenue(ticker: string): Promise<unknown>;
1462
1579
  /** Get short interest metrics (FINRA). */
@@ -1580,6 +1697,6 @@ declare class APIError extends SentiSenseError {
1580
1697
  constructor(message: string, status: number, code?: string);
1581
1698
  }
1582
1699
 
1583
- declare const VERSION = "0.27.0";
1700
+ declare const VERSION = "0.29.0";
1584
1701
 
1585
- export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionList, type InstitutionListResponse, type InstitutionSummary, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type ListInstitutionsOptions, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, type TrackerEvent, type TrackerGeoEntry, type TrackerHeadlineMetric, type TrackerListResponse, type TrackerListing, type TrackerMetricValue, type TrackerSignal, type TrackerSnapshot, type TrackerSnapshotResponse, type TrackerSourceRef, type TrackerTableRow, type TrackerTimeSeriesPoint, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
1702
+ export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSearchResponse, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfSentimentAggregate, type EtfSentimentReading, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type FundamentalsPeriodsResponse, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEtfInsiderAggregateOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetPoliticiansOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionList, type InstitutionListResponse, type InstitutionSummary, type InstitutionalFlow, type InstitutionalFlows, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, type ListInstitutionsOptions, type LockedInsight, type MarketMood, type MarketStatus, type MarketSummary, type MentionCount, type MentionData, type MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type PoliticianDetail, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type Story, type StoryCluster, type TickerHolders, type TrackerEvent, type TrackerGeoEntry, type TrackerHeadlineMetric, type TrackerListResponse, type TrackerListing, type TrackerMetricValue, type TrackerSignal, type TrackerSnapshot, type TrackerSnapshotResponse, type TrackerSourceRef, type TrackerTableRow, type TrackerTimeSeriesPoint, type TtmFundamentals, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };