sentisense 0.49.0 → 0.50.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
@@ -657,6 +657,129 @@ interface OptionsOverview {
657
657
  /** Full ETF board size on a FREE response, mirroring what the envelope's `totalCount` does for stocks. */
658
658
  etfTotalCount?: number;
659
659
  }
660
+ /** The six dimensions the composite is blended from, by stable `key`. */
661
+ type RatingDimensionKey = "crowd" | "smart_money" | "options" | "analysts" | "fundamentals" | "earnings";
662
+ /**
663
+ * Why a stock has no grade.
664
+ *
665
+ * `stale` means a row exists but the nightly has not written recently, which is an
666
+ * operational gap rather than a coverage one. `not_rated_today` means no row and no refusal
667
+ * on record: an ETF, a ticker outside the swept universe, or one that entered coverage after
668
+ * the last run. The other two mean the run looked and declined to grade.
669
+ */
670
+ type RatingNotRatedReason = "stale" | "not_rated_today" | "insufficient_dimensions" | "insufficient_coverage_weight";
671
+ /**
672
+ * One constituent leg behind a dimension's percentile.
673
+ *
674
+ * Only the smart-money dimension carries legs today; every other dimension omits the field
675
+ * entirely, so an absent `subLegs` means "this dimension has no legs", never "the legs were
676
+ * all zero".
677
+ */
678
+ interface RatingSubLeg {
679
+ /** Stable snake_case identifier, e.g. `"inst_13f"`. */
680
+ key: string;
681
+ label: string;
682
+ /** The leg's natural-scale reading. `null` when the leg had no data. */
683
+ raw: number | null;
684
+ /** `"%"` for a percentage, `"ratio"` for a scale-free balance. */
685
+ unit: string;
686
+ }
687
+ /**
688
+ * One of the six dimensions the composite is blended from.
689
+ *
690
+ * **All six always arrive, in a fixed order, whether or not they had data.** An absent
691
+ * dimension is a full row with `present` false and a `null` percentile; the server never
692
+ * drops it, precisely so a client cannot mistake a gap for a five-dimension rating. Read
693
+ * `present` before reading `percentile`, and never substitute zero for a `null`: zero is the
694
+ * bottom of the cross-section, absence is not a position on it.
695
+ */
696
+ interface RatingDimension {
697
+ key: RatingDimensionKey;
698
+ /** Display label, owned by the API so every surface agrees on the wording. */
699
+ label: string;
700
+ /** The dimension's cross-sectional rank, 0 to 100. `null` when absent. */
701
+ percentile: number | null;
702
+ /** The natural-scale reading behind the percentile, when the dimension has one. */
703
+ raw: number | null;
704
+ /** What `raw` means and in what unit, e.g. `"Operating margin, percent"`. */
705
+ rawLabel: string | null;
706
+ /** Whether this dimension had data for this stock. */
707
+ present: boolean;
708
+ /** Constituent legs, currently smart-money only. Absent on every other dimension. */
709
+ subLegs?: RatingSubLeg[];
710
+ }
711
+ /**
712
+ * One anomaly flag evaluated alongside the rating.
713
+ *
714
+ * Flags are informational and never move the composite. A flag the run could not evaluate is
715
+ * absent from the list rather than reported inactive, so present-and-false and absent stay
716
+ * distinguishable.
717
+ */
718
+ interface RatingFlag {
719
+ /** Stable snake_case identifier, e.g. `"unusual_options_flow"`. */
720
+ key: string;
721
+ label: string;
722
+ active: boolean;
723
+ }
724
+ /** The fields both rating shapes carry, graded or not. */
725
+ interface RatingBase {
726
+ ticker: string;
727
+ /**
728
+ * The stock's knowledge base id, e.g. `"kb/company/1"`. Addresses the metrics time series
729
+ * without a second lookup.
730
+ */
731
+ kbEntityId: string;
732
+ /** The New York calendar day this answer describes, `"YYYY-MM-DD"`. */
733
+ asOf: string;
734
+ /** Always all six, in a fixed order, absent ones with `present` false. */
735
+ dimensions: RatingDimension[];
736
+ flags: RatingFlag[];
737
+ /** The standard financial disclaimer. Display it alongside the grade. */
738
+ disclaimer: string;
739
+ }
740
+ /** A stock that has a grade for `asOf`. */
741
+ interface RatedStockRating extends RatingBase {
742
+ rated: true;
743
+ /**
744
+ * `"A"`, `"B"`, `"C"`, `"D"` or `"F"`. Served as stored, never re-derived from
745
+ * `percentile`, so read it rather than computing your own bucket edges.
746
+ */
747
+ letter: string;
748
+ /** Rank of `composite` among the day's rated stocks, 0 to 100. */
749
+ percentile: number;
750
+ /** The weighted blend before ranking, in [-1, +1]. */
751
+ composite: number;
752
+ /** How many stocks were rated that day: the rank's denominator. */
753
+ ratedCount: number;
754
+ /** The weights and floors in force when the row was written, e.g. `"2026.09-v1"`. */
755
+ methodologyVersion: string;
756
+ }
757
+ /**
758
+ * A stock with no grade for `asOf`. A normal 200, not an error: ETFs and tickers outside
759
+ * the swept universe answer this way, and the composition still arrives so a card can render.
760
+ */
761
+ interface UnratedStockRating extends RatingBase {
762
+ rated: false;
763
+ /** Why there is no grade. */
764
+ reason: RatingNotRatedReason;
765
+ /** How many of the six dimensions had data. */
766
+ dimensionsPresent?: number;
767
+ /** Which dimensions had data, by `key`. */
768
+ presentDimensions: RatingDimensionKey[];
769
+ }
770
+ /**
771
+ * The SentiSense Rating for one stock: where it ranks against the day's rated set.
772
+ *
773
+ * A discriminated union on `rated`, so `if (rating.rated)` narrows to the graded fields and
774
+ * the `else` branch narrows to `reason`. Branch on that flag rather than testing a field for
775
+ * `undefined`.
776
+ *
777
+ * The rating is a *relative* research signal, informational and educational only. It ranks a
778
+ * stock against the others rated that day; it is not financial, investment or trading advice
779
+ * and it is not a recommendation about any security. Carry `disclaimer` wherever you display
780
+ * a grade. Methodology: https://sentisense.ai/methodology/#sentisense-rating
781
+ */
782
+ type StockRating = RatedStockRating | UnratedStockRating;
660
783
  type DocumentSource = "news" | "reddit" | "x" | "substack" | "youtube";
661
784
  /** Per-entity sentiment classification with resolved entity details. */
662
785
  interface SentimentEntry {
@@ -1375,7 +1498,12 @@ interface PreviewResponse<T> {
1375
1498
  data: T;
1376
1499
  }
1377
1500
  /** Supported metric types for the v2 Serving Metrics API. */
1378
- type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
1501
+ type MetricType = "mentions" | "sentiment" | "sentisense_score"
1502
+ /**
1503
+ * The SentiSense Rating percentile, 0 to 100. Time series only: it has no source
1504
+ * breakdown, so `getDistribution` answers with an empty distribution for it.
1505
+ */
1506
+ | "sentisense_rating" | "social_dominance" | "creators";
1379
1507
  /** Options for `EntityMetrics.getMetrics()`. */
1380
1508
  interface MetricsOptions {
1381
1509
  /** Metric to retrieve. Defaults to `"sentiment"`. */
@@ -2179,6 +2307,23 @@ interface AnalystCoverageFirm {
2179
2307
  latestNote: AnalystNote | null;
2180
2308
  firmRating: AnalystFirmRating | null;
2181
2309
  }
2310
+ /**
2311
+ * Covering firms counted by the tier of their current rating. Counted over the whole
2312
+ * book before the free truncation, so `buy + hold + sell + unrated === total` and a free
2313
+ * key reads the same numbers as a PRO one.
2314
+ */
2315
+ interface AnalystRatingBuckets {
2316
+ /** Buy-tier grades: Buy, Overweight, Outperform, Strong Buy, Sector Outperform. */
2317
+ buy: number;
2318
+ /** Hold-tier grades: Hold, Neutral, Equal-Weight, Market Perform. */
2319
+ hold: number;
2320
+ /** Sell-tier grades. */
2321
+ sell: number;
2322
+ /** No current rating on record (a price-target-only desk), or a grade we do not recognise. */
2323
+ unrated: number;
2324
+ /** Every covering firm. Equals `firmCount`. */
2325
+ total: number;
2326
+ }
2182
2327
  interface AnalystCoverage {
2183
2328
  ticker: string;
2184
2329
  /** Window actually applied after clamping, in days. */
@@ -2192,6 +2337,12 @@ interface AnalystCoverage {
2192
2337
  * target are `firmCount - ratingOnlyFirmCount`.
2193
2338
  */
2194
2339
  ratingOnlyFirmCount: number;
2340
+ /**
2341
+ * The same firms split by the tier of their current rating. A different population from
2342
+ * `strongBuy`..`strongSell` on the consensus endpoint, which report the provider's
2343
+ * analyst survey rather than the firms in this book, so do not reconcile the two.
2344
+ */
2345
+ ratingBuckets?: AnalystRatingBuckets;
2195
2346
  namedAnalystCount: number;
2196
2347
  noteCount: number;
2197
2348
  /** Notes that name an individual. */
@@ -3195,6 +3346,36 @@ declare class Stocks {
3195
3346
  * years, so it can answer with nearly the same series as `"2y"`.
3196
3347
  */
3197
3348
  getOptionsHistory(ticker: string, options?: GetOptionsHistoryOptions): Promise<PreviewResponse<OptionsHistory>>;
3349
+ /**
3350
+ * Get the SentiSense Rating for one stock: where it ranks against the other stocks rated
3351
+ * that day, and the six dimensions the rank is blended from.
3352
+ *
3353
+ * The Rating is a *relative*, automatically generated research signal, for informational
3354
+ * and educational purposes only. It ranks a stock against its cross-section; it is not
3355
+ * financial, investment or trading advice and it is not a recommendation about any
3356
+ * security. `disclaimer` carries the wording to display alongside a grade. Methodology:
3357
+ * https://sentisense.ai/methodology/#sentisense-rating
3358
+ *
3359
+ * **A discriminated union on `rated`.** `if (rating.rated)` narrows to `letter`,
3360
+ * `percentile`, `composite`, `ratedCount` and `methodologyVersion`; the `else` branch
3361
+ * narrows to `reason`, `dimensionsPresent` and `presentDimensions`. Branch on the flag
3362
+ * rather than testing a field for `undefined`.
3363
+ *
3364
+ * **Having no grade is a normal 200, not a 404.** ETFs and tickers outside the swept
3365
+ * universe answer with `rated` false, and the composition still arrives so a card can
3366
+ * render. Only a ticker that resolves to nothing we track rejects with
3367
+ * {@link NotFoundError}; a request with no usable key rejects with
3368
+ * {@link AuthenticationError}.
3369
+ *
3370
+ * `dimensions` always holds all six rows in a fixed order, including the ones with no
3371
+ * data, which arrive with `present` false and a `null` percentile. Read `present` first
3372
+ * and never read a missing percentile as zero. `letter` is served as stored rather than
3373
+ * derived from `percentile`, so read it instead of computing your own bucket edges.
3374
+ *
3375
+ * For the daily history of a stock's percentile, ask `client.entityMetrics.getMetrics`
3376
+ * for the `sentisense_rating` metric.
3377
+ */
3378
+ getRating(ticker: string): Promise<StockRating>;
3198
3379
  }
3199
3380
 
3200
3381
  /**
@@ -3351,6 +3532,6 @@ declare class APIError extends SentiSenseError {
3351
3532
  constructor(message: string, status: number, code?: string);
3352
3533
  }
3353
3534
 
3354
- declare const VERSION = "0.49.0";
3535
+ declare const VERSION = "0.50.0";
3355
3536
 
3356
- export { type AISummary, APIError, type AnalystAction, type AnalystCall, type AnalystConsensus, type AnalystCoverage, type AnalystCoverageAnalyst, type AnalystCoverageBookEntry, type AnalystCoverageFirm, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AnalystFirmRating, type AnalystFirmTenure, type AnalystNote, type AnalystProfile, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, DeepHistoryUnavailableError, type Document, type DocumentSearchResponse, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EarningsKpiHighlight, type EarningsQuarter, type EarningsSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfScreenerExecuteResponse, type EtfScreenerRow, type EtfSentimentAggregate, type EtfSentimentReading, type FeaturedScreen, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type FundamentalsPeriodsResponse, type GetAnalystActionsOptions, type GetAnalystCallsOptions, type GetAnalystCoverageOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEarningsSummariesOptions, type GetEtfInsiderAggregateOptions, type GetHoldersOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetOptionsHistoryOptions, type GetPoliticianActivityOptions, type GetPoliticianDirectoryOptions, type GetPoliticianMemberOptions, type GetPoliticiansOptions, type GetRecentEarningsOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type HolderNotableChanges, type IndexConstituent, type IndexHistoryPoint, type IndexHistoryResponse, type IndexListResponse, type IndexListing, type IndexSnapshot, 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 MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type OptionsAggregate, type OptionsContext, type OptionsHistory, type OptionsHistoryWindow, type OptionsOiWalls, type OptionsOverview, type OptionsOverviewRow, type OptionsSummary, type OptionsUnusualContract, type OptionsWall, type PoliticianDetail, type PoliticianDirectory, type PoliticianDirectoryEntry, type PoliticianDirectoryResponse, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, type RecentEarningsEntry, type ScreenerExecuteOptions, type ScreenerExecuteResponse, type ScreenerFieldCatalog, type ScreenerFieldDescriptor, type ScreenerFieldOption, type ScreenerFilter, type ScreenerPlan, type ScreenerRow, type ScreenerScreensResponse, type ScreenerSort, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type StockSocialDominance, 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 };
3537
+ export { type AISummary, APIError, type AnalystAction, type AnalystCall, type AnalystConsensus, type AnalystCoverage, type AnalystCoverageAnalyst, type AnalystCoverageBookEntry, type AnalystCoverageFirm, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AnalystFirmRating, type AnalystFirmTenure, type AnalystNote, type AnalystProfile, type AnalystRatingBuckets, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, DeepHistoryUnavailableError, type Document, type DocumentSearchResponse, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EarningsKpiHighlight, type EarningsQuarter, type EarningsSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfScreenerExecuteResponse, type EtfScreenerRow, type EtfSentimentAggregate, type EtfSentimentReading, type FeaturedScreen, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type FundamentalsPeriodsResponse, type GetAnalystActionsOptions, type GetAnalystCallsOptions, type GetAnalystCoverageOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEarningsSummariesOptions, type GetEtfInsiderAggregateOptions, type GetHoldersOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetOptionsHistoryOptions, type GetPoliticianActivityOptions, type GetPoliticianDirectoryOptions, type GetPoliticianMemberOptions, type GetPoliticiansOptions, type GetRecentEarningsOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type HolderNotableChanges, type IndexConstituent, type IndexHistoryPoint, type IndexHistoryResponse, type IndexListResponse, type IndexListing, type IndexSnapshot, 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 MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type OptionsAggregate, type OptionsContext, type OptionsHistory, type OptionsHistoryWindow, type OptionsOiWalls, type OptionsOverview, type OptionsOverviewRow, type OptionsSummary, type OptionsUnusualContract, type OptionsWall, type PoliticianDetail, type PoliticianDirectory, type PoliticianDirectoryEntry, type PoliticianDirectoryResponse, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, type RatedStockRating, type RatingBase, type RatingDimension, type RatingDimensionKey, type RatingFlag, type RatingNotRatedReason, type RatingSubLeg, type RecentEarningsEntry, type ScreenerExecuteOptions, type ScreenerExecuteResponse, type ScreenerFieldCatalog, type ScreenerFieldDescriptor, type ScreenerFieldOption, type ScreenerFilter, type ScreenerPlan, type ScreenerRow, type ScreenerScreensResponse, type ScreenerSort, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type StockRating, type StockSocialDominance, 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, type UnratedStockRating, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
package/dist/index.d.ts CHANGED
@@ -657,6 +657,129 @@ interface OptionsOverview {
657
657
  /** Full ETF board size on a FREE response, mirroring what the envelope's `totalCount` does for stocks. */
658
658
  etfTotalCount?: number;
659
659
  }
660
+ /** The six dimensions the composite is blended from, by stable `key`. */
661
+ type RatingDimensionKey = "crowd" | "smart_money" | "options" | "analysts" | "fundamentals" | "earnings";
662
+ /**
663
+ * Why a stock has no grade.
664
+ *
665
+ * `stale` means a row exists but the nightly has not written recently, which is an
666
+ * operational gap rather than a coverage one. `not_rated_today` means no row and no refusal
667
+ * on record: an ETF, a ticker outside the swept universe, or one that entered coverage after
668
+ * the last run. The other two mean the run looked and declined to grade.
669
+ */
670
+ type RatingNotRatedReason = "stale" | "not_rated_today" | "insufficient_dimensions" | "insufficient_coverage_weight";
671
+ /**
672
+ * One constituent leg behind a dimension's percentile.
673
+ *
674
+ * Only the smart-money dimension carries legs today; every other dimension omits the field
675
+ * entirely, so an absent `subLegs` means "this dimension has no legs", never "the legs were
676
+ * all zero".
677
+ */
678
+ interface RatingSubLeg {
679
+ /** Stable snake_case identifier, e.g. `"inst_13f"`. */
680
+ key: string;
681
+ label: string;
682
+ /** The leg's natural-scale reading. `null` when the leg had no data. */
683
+ raw: number | null;
684
+ /** `"%"` for a percentage, `"ratio"` for a scale-free balance. */
685
+ unit: string;
686
+ }
687
+ /**
688
+ * One of the six dimensions the composite is blended from.
689
+ *
690
+ * **All six always arrive, in a fixed order, whether or not they had data.** An absent
691
+ * dimension is a full row with `present` false and a `null` percentile; the server never
692
+ * drops it, precisely so a client cannot mistake a gap for a five-dimension rating. Read
693
+ * `present` before reading `percentile`, and never substitute zero for a `null`: zero is the
694
+ * bottom of the cross-section, absence is not a position on it.
695
+ */
696
+ interface RatingDimension {
697
+ key: RatingDimensionKey;
698
+ /** Display label, owned by the API so every surface agrees on the wording. */
699
+ label: string;
700
+ /** The dimension's cross-sectional rank, 0 to 100. `null` when absent. */
701
+ percentile: number | null;
702
+ /** The natural-scale reading behind the percentile, when the dimension has one. */
703
+ raw: number | null;
704
+ /** What `raw` means and in what unit, e.g. `"Operating margin, percent"`. */
705
+ rawLabel: string | null;
706
+ /** Whether this dimension had data for this stock. */
707
+ present: boolean;
708
+ /** Constituent legs, currently smart-money only. Absent on every other dimension. */
709
+ subLegs?: RatingSubLeg[];
710
+ }
711
+ /**
712
+ * One anomaly flag evaluated alongside the rating.
713
+ *
714
+ * Flags are informational and never move the composite. A flag the run could not evaluate is
715
+ * absent from the list rather than reported inactive, so present-and-false and absent stay
716
+ * distinguishable.
717
+ */
718
+ interface RatingFlag {
719
+ /** Stable snake_case identifier, e.g. `"unusual_options_flow"`. */
720
+ key: string;
721
+ label: string;
722
+ active: boolean;
723
+ }
724
+ /** The fields both rating shapes carry, graded or not. */
725
+ interface RatingBase {
726
+ ticker: string;
727
+ /**
728
+ * The stock's knowledge base id, e.g. `"kb/company/1"`. Addresses the metrics time series
729
+ * without a second lookup.
730
+ */
731
+ kbEntityId: string;
732
+ /** The New York calendar day this answer describes, `"YYYY-MM-DD"`. */
733
+ asOf: string;
734
+ /** Always all six, in a fixed order, absent ones with `present` false. */
735
+ dimensions: RatingDimension[];
736
+ flags: RatingFlag[];
737
+ /** The standard financial disclaimer. Display it alongside the grade. */
738
+ disclaimer: string;
739
+ }
740
+ /** A stock that has a grade for `asOf`. */
741
+ interface RatedStockRating extends RatingBase {
742
+ rated: true;
743
+ /**
744
+ * `"A"`, `"B"`, `"C"`, `"D"` or `"F"`. Served as stored, never re-derived from
745
+ * `percentile`, so read it rather than computing your own bucket edges.
746
+ */
747
+ letter: string;
748
+ /** Rank of `composite` among the day's rated stocks, 0 to 100. */
749
+ percentile: number;
750
+ /** The weighted blend before ranking, in [-1, +1]. */
751
+ composite: number;
752
+ /** How many stocks were rated that day: the rank's denominator. */
753
+ ratedCount: number;
754
+ /** The weights and floors in force when the row was written, e.g. `"2026.09-v1"`. */
755
+ methodologyVersion: string;
756
+ }
757
+ /**
758
+ * A stock with no grade for `asOf`. A normal 200, not an error: ETFs and tickers outside
759
+ * the swept universe answer this way, and the composition still arrives so a card can render.
760
+ */
761
+ interface UnratedStockRating extends RatingBase {
762
+ rated: false;
763
+ /** Why there is no grade. */
764
+ reason: RatingNotRatedReason;
765
+ /** How many of the six dimensions had data. */
766
+ dimensionsPresent?: number;
767
+ /** Which dimensions had data, by `key`. */
768
+ presentDimensions: RatingDimensionKey[];
769
+ }
770
+ /**
771
+ * The SentiSense Rating for one stock: where it ranks against the day's rated set.
772
+ *
773
+ * A discriminated union on `rated`, so `if (rating.rated)` narrows to the graded fields and
774
+ * the `else` branch narrows to `reason`. Branch on that flag rather than testing a field for
775
+ * `undefined`.
776
+ *
777
+ * The rating is a *relative* research signal, informational and educational only. It ranks a
778
+ * stock against the others rated that day; it is not financial, investment or trading advice
779
+ * and it is not a recommendation about any security. Carry `disclaimer` wherever you display
780
+ * a grade. Methodology: https://sentisense.ai/methodology/#sentisense-rating
781
+ */
782
+ type StockRating = RatedStockRating | UnratedStockRating;
660
783
  type DocumentSource = "news" | "reddit" | "x" | "substack" | "youtube";
661
784
  /** Per-entity sentiment classification with resolved entity details. */
662
785
  interface SentimentEntry {
@@ -1375,7 +1498,12 @@ interface PreviewResponse<T> {
1375
1498
  data: T;
1376
1499
  }
1377
1500
  /** Supported metric types for the v2 Serving Metrics API. */
1378
- type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
1501
+ type MetricType = "mentions" | "sentiment" | "sentisense_score"
1502
+ /**
1503
+ * The SentiSense Rating percentile, 0 to 100. Time series only: it has no source
1504
+ * breakdown, so `getDistribution` answers with an empty distribution for it.
1505
+ */
1506
+ | "sentisense_rating" | "social_dominance" | "creators";
1379
1507
  /** Options for `EntityMetrics.getMetrics()`. */
1380
1508
  interface MetricsOptions {
1381
1509
  /** Metric to retrieve. Defaults to `"sentiment"`. */
@@ -2179,6 +2307,23 @@ interface AnalystCoverageFirm {
2179
2307
  latestNote: AnalystNote | null;
2180
2308
  firmRating: AnalystFirmRating | null;
2181
2309
  }
2310
+ /**
2311
+ * Covering firms counted by the tier of their current rating. Counted over the whole
2312
+ * book before the free truncation, so `buy + hold + sell + unrated === total` and a free
2313
+ * key reads the same numbers as a PRO one.
2314
+ */
2315
+ interface AnalystRatingBuckets {
2316
+ /** Buy-tier grades: Buy, Overweight, Outperform, Strong Buy, Sector Outperform. */
2317
+ buy: number;
2318
+ /** Hold-tier grades: Hold, Neutral, Equal-Weight, Market Perform. */
2319
+ hold: number;
2320
+ /** Sell-tier grades. */
2321
+ sell: number;
2322
+ /** No current rating on record (a price-target-only desk), or a grade we do not recognise. */
2323
+ unrated: number;
2324
+ /** Every covering firm. Equals `firmCount`. */
2325
+ total: number;
2326
+ }
2182
2327
  interface AnalystCoverage {
2183
2328
  ticker: string;
2184
2329
  /** Window actually applied after clamping, in days. */
@@ -2192,6 +2337,12 @@ interface AnalystCoverage {
2192
2337
  * target are `firmCount - ratingOnlyFirmCount`.
2193
2338
  */
2194
2339
  ratingOnlyFirmCount: number;
2340
+ /**
2341
+ * The same firms split by the tier of their current rating. A different population from
2342
+ * `strongBuy`..`strongSell` on the consensus endpoint, which report the provider's
2343
+ * analyst survey rather than the firms in this book, so do not reconcile the two.
2344
+ */
2345
+ ratingBuckets?: AnalystRatingBuckets;
2195
2346
  namedAnalystCount: number;
2196
2347
  noteCount: number;
2197
2348
  /** Notes that name an individual. */
@@ -3195,6 +3346,36 @@ declare class Stocks {
3195
3346
  * years, so it can answer with nearly the same series as `"2y"`.
3196
3347
  */
3197
3348
  getOptionsHistory(ticker: string, options?: GetOptionsHistoryOptions): Promise<PreviewResponse<OptionsHistory>>;
3349
+ /**
3350
+ * Get the SentiSense Rating for one stock: where it ranks against the other stocks rated
3351
+ * that day, and the six dimensions the rank is blended from.
3352
+ *
3353
+ * The Rating is a *relative*, automatically generated research signal, for informational
3354
+ * and educational purposes only. It ranks a stock against its cross-section; it is not
3355
+ * financial, investment or trading advice and it is not a recommendation about any
3356
+ * security. `disclaimer` carries the wording to display alongside a grade. Methodology:
3357
+ * https://sentisense.ai/methodology/#sentisense-rating
3358
+ *
3359
+ * **A discriminated union on `rated`.** `if (rating.rated)` narrows to `letter`,
3360
+ * `percentile`, `composite`, `ratedCount` and `methodologyVersion`; the `else` branch
3361
+ * narrows to `reason`, `dimensionsPresent` and `presentDimensions`. Branch on the flag
3362
+ * rather than testing a field for `undefined`.
3363
+ *
3364
+ * **Having no grade is a normal 200, not a 404.** ETFs and tickers outside the swept
3365
+ * universe answer with `rated` false, and the composition still arrives so a card can
3366
+ * render. Only a ticker that resolves to nothing we track rejects with
3367
+ * {@link NotFoundError}; a request with no usable key rejects with
3368
+ * {@link AuthenticationError}.
3369
+ *
3370
+ * `dimensions` always holds all six rows in a fixed order, including the ones with no
3371
+ * data, which arrive with `present` false and a `null` percentile. Read `present` first
3372
+ * and never read a missing percentile as zero. `letter` is served as stored rather than
3373
+ * derived from `percentile`, so read it instead of computing your own bucket edges.
3374
+ *
3375
+ * For the daily history of a stock's percentile, ask `client.entityMetrics.getMetrics`
3376
+ * for the `sentisense_rating` metric.
3377
+ */
3378
+ getRating(ticker: string): Promise<StockRating>;
3198
3379
  }
3199
3380
 
3200
3381
  /**
@@ -3351,6 +3532,6 @@ declare class APIError extends SentiSenseError {
3351
3532
  constructor(message: string, status: number, code?: string);
3352
3533
  }
3353
3534
 
3354
- declare const VERSION = "0.49.0";
3535
+ declare const VERSION = "0.50.0";
3355
3536
 
3356
- export { type AISummary, APIError, type AnalystAction, type AnalystCall, type AnalystConsensus, type AnalystCoverage, type AnalystCoverageAnalyst, type AnalystCoverageBookEntry, type AnalystCoverageFirm, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AnalystFirmRating, type AnalystFirmTenure, type AnalystNote, type AnalystProfile, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, DeepHistoryUnavailableError, type Document, type DocumentSearchResponse, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EarningsKpiHighlight, type EarningsQuarter, type EarningsSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfScreenerExecuteResponse, type EtfScreenerRow, type EtfSentimentAggregate, type EtfSentimentReading, type FeaturedScreen, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type FundamentalsPeriodsResponse, type GetAnalystActionsOptions, type GetAnalystCallsOptions, type GetAnalystCoverageOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEarningsSummariesOptions, type GetEtfInsiderAggregateOptions, type GetHoldersOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetOptionsHistoryOptions, type GetPoliticianActivityOptions, type GetPoliticianDirectoryOptions, type GetPoliticianMemberOptions, type GetPoliticiansOptions, type GetRecentEarningsOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type HolderNotableChanges, type IndexConstituent, type IndexHistoryPoint, type IndexHistoryResponse, type IndexListResponse, type IndexListing, type IndexSnapshot, 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 MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type OptionsAggregate, type OptionsContext, type OptionsHistory, type OptionsHistoryWindow, type OptionsOiWalls, type OptionsOverview, type OptionsOverviewRow, type OptionsSummary, type OptionsUnusualContract, type OptionsWall, type PoliticianDetail, type PoliticianDirectory, type PoliticianDirectoryEntry, type PoliticianDirectoryResponse, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, type RecentEarningsEntry, type ScreenerExecuteOptions, type ScreenerExecuteResponse, type ScreenerFieldCatalog, type ScreenerFieldDescriptor, type ScreenerFieldOption, type ScreenerFilter, type ScreenerPlan, type ScreenerRow, type ScreenerScreensResponse, type ScreenerSort, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type StockSocialDominance, 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 };
3537
+ export { type AISummary, APIError, type AnalystAction, type AnalystCall, type AnalystConsensus, type AnalystCoverage, type AnalystCoverageAnalyst, type AnalystCoverageBookEntry, type AnalystCoverageFirm, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, type AnalystFirmRating, type AnalystFirmTenure, type AnalystNote, type AnalystProfile, type AnalystRatingBuckets, type AssetMetadata, AuthenticationError, type CalendarMeta, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, DeepHistoryUnavailableError, type Document, type DocumentSearchResponse, type DocumentSource, type EarningsCalendarResponse, type EarningsEvent, type EarningsKpiHighlight, type EarningsQuarter, type EarningsSource, type EtfAggregateCoverage, type EtfAnalystAggregate, type EtfAnalystContributor, type EtfHolding, type EtfHoldings, type EtfInfo, type EtfInsiderAggregate, type EtfInsiderContributor, type EtfScreenerExecuteResponse, type EtfScreenerRow, type EtfSentimentAggregate, type EtfSentimentReading, type FeaturedScreen, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type FundamentalsPeriodsResponse, type GetAnalystActionsOptions, type GetAnalystCallsOptions, type GetAnalystCoverageOptions, type GetAnalystMarketActivityOptions, type GetEarningsCalendarOptions, type GetEarningsSummariesOptions, type GetEtfInsiderAggregateOptions, type GetHoldersOptions, type GetInsiderOptions, type GetInsightsOptions, type GetLatestInsightsOptions, type GetOptionsHistoryOptions, type GetPoliticianActivityOptions, type GetPoliticianDirectoryOptions, type GetPoliticianMemberOptions, type GetPoliticiansOptions, type GetRecentEarningsOptions, type GetStockInsightsRangeOptions, type GetUserInsightsOptions, type Holder, type HolderNotableChanges, type IndexConstituent, type IndexHistoryPoint, type IndexHistoryResponse, type IndexListResponse, type IndexListing, type IndexSnapshot, 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 MetricDistribution, type MetricDistributionOptions, type MetricType, type MetricsBreakdown, type MetricsOptions, NotFoundError, type OptionsAggregate, type OptionsContext, type OptionsHistory, type OptionsHistoryWindow, type OptionsOiWalls, type OptionsOverview, type OptionsOverviewRow, type OptionsSummary, type OptionsUnusualContract, type OptionsWall, type PoliticianDetail, type PoliticianDirectory, type PoliticianDirectoryEntry, type PoliticianDirectoryResponse, type PoliticianSummary, type PreviewResponse, type Quarter, RateLimitError, type RatedStockRating, type RatingBase, type RatingDimension, type RatingDimensionKey, type RatingFlag, type RatingNotRatedReason, type RatingSubLeg, type RecentEarningsEntry, type ScreenerExecuteOptions, type ScreenerExecuteResponse, type ScreenerFieldCatalog, type ScreenerFieldDescriptor, type ScreenerFieldOption, type ScreenerFilter, type ScreenerPlan, type ScreenerRow, type ScreenerScreensResponse, type ScreenerSort, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentEntry, type ServingMetric, type ShortInterest, type ShortVolume, type SimilarStock, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type StockQuote, type StockRating, type StockSocialDominance, 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, type UnratedStockRating, VERSION, type WeightedConsensus, type WeightedNetFlow, SentiSense as default };
package/dist/index.mjs CHANGED
@@ -1070,6 +1070,38 @@ var Stocks = class {
1070
1070
  options
1071
1071
  );
1072
1072
  }
1073
+ /**
1074
+ * Get the SentiSense Rating for one stock: where it ranks against the other stocks rated
1075
+ * that day, and the six dimensions the rank is blended from.
1076
+ *
1077
+ * The Rating is a *relative*, automatically generated research signal, for informational
1078
+ * and educational purposes only. It ranks a stock against its cross-section; it is not
1079
+ * financial, investment or trading advice and it is not a recommendation about any
1080
+ * security. `disclaimer` carries the wording to display alongside a grade. Methodology:
1081
+ * https://sentisense.ai/methodology/#sentisense-rating
1082
+ *
1083
+ * **A discriminated union on `rated`.** `if (rating.rated)` narrows to `letter`,
1084
+ * `percentile`, `composite`, `ratedCount` and `methodologyVersion`; the `else` branch
1085
+ * narrows to `reason`, `dimensionsPresent` and `presentDimensions`. Branch on the flag
1086
+ * rather than testing a field for `undefined`.
1087
+ *
1088
+ * **Having no grade is a normal 200, not a 404.** ETFs and tickers outside the swept
1089
+ * universe answer with `rated` false, and the composition still arrives so a card can
1090
+ * render. Only a ticker that resolves to nothing we track rejects with
1091
+ * {@link NotFoundError}; a request with no usable key rejects with
1092
+ * {@link AuthenticationError}.
1093
+ *
1094
+ * `dimensions` always holds all six rows in a fixed order, including the ones with no
1095
+ * data, which arrive with `present` false and a `null` percentile. Read `present` first
1096
+ * and never read a missing percentile as zero. `letter` is served as stored rather than
1097
+ * derived from `percentile`, so read it instead of computing your own bucket edges.
1098
+ *
1099
+ * For the daily history of a stock's percentile, ask `client.entityMetrics.getMetrics`
1100
+ * for the `sentisense_rating` metric.
1101
+ */
1102
+ async getRating(ticker) {
1103
+ return this.client.get(`/api/v1/rating/${encodeURIComponent(ticker.toUpperCase())}`);
1104
+ }
1073
1105
  };
1074
1106
 
1075
1107
  // src/resources/indexes.ts
@@ -1149,7 +1181,7 @@ var Trackers = class {
1149
1181
  };
1150
1182
 
1151
1183
  // src/version.ts
1152
- var VERSION = "0.49.0";
1184
+ var VERSION = "0.50.0";
1153
1185
 
1154
1186
  // src/client.ts
1155
1187
  var DEFAULT_BASE_URL = "https://app.sentisense.ai";