sentisense 0.49.0 → 0.51.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,188 @@ 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
+ * A risk condition evaluated against a rated stock. An active one deducts points from the
673
+ * score, up to 12 apiece; `percentile` itself is never touched by them.
674
+ */
675
+ type RiskCondition = "thin_coverage" | "weak_dimension" | "unprofitable" | "no_fundamentals" | "high_leverage" | "unseasoned_listing" | "small_market_cap" | "thin_liquidity" | "extended_price" | "insider_selling" | "institutional_outflow";
676
+ /**
677
+ * One graded deduction applied to a rated stock's score.
678
+ *
679
+ * A condition is graded rather than binary, so `points` is the share of the 12-point
680
+ * maximum this one actually cost. Only active conditions appear, and `penaltyPoints` is
681
+ * the sum of these.
682
+ */
683
+ interface RiskAdjustment {
684
+ /** Which condition, by the same key `riskConditions` reports. */
685
+ condition: RiskCondition;
686
+ /** Points deducted, to one decimal, up to 12 for a single condition. */
687
+ points: number;
688
+ }
689
+ /**
690
+ * One constituent leg behind a dimension's percentile.
691
+ *
692
+ * Only the smart-money dimension carries legs today; every other dimension omits the field
693
+ * entirely, so an absent `subLegs` means "this dimension has no legs", never "the legs were
694
+ * all zero".
695
+ */
696
+ interface RatingSubLeg {
697
+ /** Stable snake_case identifier, e.g. `"inst_13f"`. */
698
+ key: string;
699
+ label: string;
700
+ /** The leg's natural-scale reading. `null` when the leg had no data. */
701
+ raw: number | null;
702
+ /** `"%"` for a percentage, `"ratio"` for a scale-free balance. */
703
+ unit: string;
704
+ }
705
+ /**
706
+ * One of the six dimensions the composite is blended from.
707
+ *
708
+ * **All six always arrive, in a fixed order, whether or not they had data.** An absent
709
+ * dimension is a full row with `present` false and a `null` percentile; the server never
710
+ * drops it, precisely so a client cannot mistake a gap for a five-dimension rating. Read
711
+ * `present` before reading `percentile`, and never substitute zero for a `null`: zero is the
712
+ * bottom of the cross-section, absence is not a position on it.
713
+ */
714
+ interface RatingDimension {
715
+ key: RatingDimensionKey;
716
+ /** Display label, owned by the API so every surface agrees on the wording. */
717
+ label: string;
718
+ /** The dimension's cross-sectional rank, 0 to 100. `null` when absent. */
719
+ percentile: number | null;
720
+ /** The natural-scale reading behind the percentile, when the dimension has one. */
721
+ raw: number | null;
722
+ /** What `raw` means and in what unit, e.g. `"Operating margin, percent"`. */
723
+ rawLabel: string | null;
724
+ /** Whether this dimension had data for this stock. */
725
+ present: boolean;
726
+ /** Constituent legs, currently smart-money only. Absent on every other dimension. */
727
+ subLegs?: RatingSubLeg[];
728
+ }
729
+ /**
730
+ * One anomaly flag evaluated alongside the rating.
731
+ *
732
+ * Flags are informational and never move the composite. A flag the run could not evaluate is
733
+ * absent from the list rather than reported inactive, so present-and-false and absent stay
734
+ * distinguishable.
735
+ */
736
+ interface RatingFlag {
737
+ /** Stable snake_case identifier, e.g. `"unusual_options_flow"`. */
738
+ key: string;
739
+ label: string;
740
+ active: boolean;
741
+ }
742
+ /** The fields both rating shapes carry, graded or not. */
743
+ interface RatingBase {
744
+ ticker: string;
745
+ /**
746
+ * The stock's knowledge base id, e.g. `"kb/company/1"`. Addresses the metrics time series
747
+ * without a second lookup.
748
+ */
749
+ kbEntityId: string;
750
+ /** The New York calendar day this answer describes, `"YYYY-MM-DD"`. */
751
+ asOf: string;
752
+ /** Always all six, in a fixed order, absent ones with `present` false. */
753
+ dimensions: RatingDimension[];
754
+ flags: RatingFlag[];
755
+ /** The standard financial disclaimer. Display it alongside the grade. */
756
+ disclaimer: string;
757
+ }
758
+ /**
759
+ * A stock that has a grade for `asOf`.
760
+ *
761
+ * `score`, `bucketLetter`, `riskConditions`, `riskAdjustments` and `penaltyPoints` arrive
762
+ * from the next API deploy onward and are optional here because a response served before
763
+ * then omits them.
764
+ */
765
+ interface StockRating extends RatingBase {
766
+ rated: true;
767
+ /**
768
+ * The headline number, 0 to 100 with one decimal, and the number `letter` is the band
769
+ * of: `score = percentile - sum(riskAdjustments.map((a) => a.points))`, floored at 10
770
+ * when fewer than five dimensions are available and at 0 otherwise. Absent on a
771
+ * response served before this field shipped.
772
+ */
773
+ score?: number;
774
+ /**
775
+ * `"A"`, `"B"`, `"C"`, `"D"` or `"F"`: the band `score` falls in, at edges 90, 70, 30
776
+ * and 10. Served as stored, so read it rather than deriving your own edges. Deriving
777
+ * it from `percentile` disagrees with the API for every stock carrying a risk
778
+ * condition.
779
+ */
780
+ letter: string;
781
+ /**
782
+ * The band `percentile` alone would fall in, so a difference from `letter` is exactly
783
+ * what the risk conditions cost. Absent on a response served before this field
784
+ * shipped.
785
+ */
786
+ bucketLetter?: string;
787
+ /**
788
+ * Rank of `composite` among the day's rated stocks, 0 to 100. This stays the true rank
789
+ * of the blended signals: the risk conditions are subtracted from `score`, never here.
790
+ */
791
+ percentile: number;
792
+ /** The weighted blend before ranking, in [-1, +1]. */
793
+ composite: number;
794
+ /**
795
+ * Which risk conditions were active. An empty array means none were, and the field is
796
+ * absent on a response served before it shipped.
797
+ */
798
+ riskConditions?: RiskCondition[];
799
+ /**
800
+ * The same conditions with the points each one actually cost, since a condition is
801
+ * graded rather than binary and can cost anything up to 12. Absent on a response
802
+ * served before this field shipped.
803
+ */
804
+ riskAdjustments?: RiskAdjustment[];
805
+ /**
806
+ * The sum of `riskAdjustments` points, to one decimal: how far `score` sits below
807
+ * `percentile` before the floor applies. Absent on a response served before this field
808
+ * shipped.
809
+ */
810
+ penaltyPoints?: number;
811
+ /** How many stocks were rated that day: the rank's denominator. */
812
+ ratedCount: number;
813
+ /** The weights and floors in force when the row was written, e.g. `"2026.09-v1"`. */
814
+ methodologyVersion: string;
815
+ }
816
+ /**
817
+ * A stock with no grade for `asOf`. A normal 200, not an error: ETFs and tickers outside
818
+ * the swept universe answer this way, and the composition still arrives so a card can render.
819
+ */
820
+ interface StockNotRated extends RatingBase {
821
+ rated: false;
822
+ /** Why there is no grade. */
823
+ reason: RatingNotRatedReason;
824
+ /** How many of the six dimensions had data. */
825
+ dimensionsPresent?: number;
826
+ /** Which dimensions had data, by `key`. */
827
+ presentDimensions: RatingDimensionKey[];
828
+ }
829
+ /**
830
+ * The SentiSense Rating for one stock: where it ranks against the day's rated set.
831
+ *
832
+ * A discriminated union on `rated`, so `if (rating.rated)` narrows to the graded fields and
833
+ * the `else` branch narrows to `reason`. Branch on that flag rather than testing a field for
834
+ * `undefined`.
835
+ *
836
+ * The rating is a *relative* research signal, informational and educational only. It ranks a
837
+ * stock against the others rated that day; it is not financial, investment or trading advice
838
+ * and it is not a recommendation about any security. Carry `disclaimer` wherever you display
839
+ * a grade. Methodology: https://sentisense.ai/methodology/#sentisense-rating
840
+ */
841
+ type StockRatingResponse = StockRating | StockNotRated;
660
842
  type DocumentSource = "news" | "reddit" | "x" | "substack" | "youtube";
661
843
  /** Per-entity sentiment classification with resolved entity details. */
662
844
  interface SentimentEntry {
@@ -1375,7 +1557,12 @@ interface PreviewResponse<T> {
1375
1557
  data: T;
1376
1558
  }
1377
1559
  /** Supported metric types for the v2 Serving Metrics API. */
1378
- type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
1560
+ type MetricType = "mentions" | "sentiment" | "sentisense_score"
1561
+ /**
1562
+ * The SentiSense Rating score, 0 to 100. Time series only: it has no source
1563
+ * breakdown, so `getDistribution` answers with an empty distribution for it.
1564
+ */
1565
+ | "sentisense_rating" | "social_dominance" | "creators";
1379
1566
  /** Options for `EntityMetrics.getMetrics()`. */
1380
1567
  interface MetricsOptions {
1381
1568
  /** Metric to retrieve. Defaults to `"sentiment"`. */
@@ -2179,6 +2366,23 @@ interface AnalystCoverageFirm {
2179
2366
  latestNote: AnalystNote | null;
2180
2367
  firmRating: AnalystFirmRating | null;
2181
2368
  }
2369
+ /**
2370
+ * Covering firms counted by the tier of their current rating. Counted over the whole
2371
+ * book before the free truncation, so `buy + hold + sell + unrated === total` and a free
2372
+ * key reads the same numbers as a PRO one.
2373
+ */
2374
+ interface AnalystRatingBuckets {
2375
+ /** Buy-tier grades: Buy, Overweight, Outperform, Strong Buy, Sector Outperform. */
2376
+ buy: number;
2377
+ /** Hold-tier grades: Hold, Neutral, Equal-Weight, Market Perform. */
2378
+ hold: number;
2379
+ /** Sell-tier grades. */
2380
+ sell: number;
2381
+ /** No current rating on record (a price-target-only desk), or a grade we do not recognise. */
2382
+ unrated: number;
2383
+ /** Every covering firm. Equals `firmCount`. */
2384
+ total: number;
2385
+ }
2182
2386
  interface AnalystCoverage {
2183
2387
  ticker: string;
2184
2388
  /** Window actually applied after clamping, in days. */
@@ -2192,6 +2396,12 @@ interface AnalystCoverage {
2192
2396
  * target are `firmCount - ratingOnlyFirmCount`.
2193
2397
  */
2194
2398
  ratingOnlyFirmCount: number;
2399
+ /**
2400
+ * The same firms split by the tier of their current rating. A different population from
2401
+ * `strongBuy`..`strongSell` on the consensus endpoint, which report the provider's
2402
+ * analyst survey rather than the firms in this book, so do not reconcile the two.
2403
+ */
2404
+ ratingBuckets?: AnalystRatingBuckets;
2195
2405
  namedAnalystCount: number;
2196
2406
  noteCount: number;
2197
2407
  /** Notes that name an individual. */
@@ -3195,6 +3405,47 @@ declare class Stocks {
3195
3405
  * years, so it can answer with nearly the same series as `"2y"`.
3196
3406
  */
3197
3407
  getOptionsHistory(ticker: string, options?: GetOptionsHistoryOptions): Promise<PreviewResponse<OptionsHistory>>;
3408
+ /**
3409
+ * Get the SentiSense Rating for one stock: where it ranks against the other stocks rated
3410
+ * that day, and the six dimensions the rank is blended from.
3411
+ *
3412
+ * The Rating is a *relative*, automatically generated research signal, for informational
3413
+ * and educational purposes only. It ranks a stock against its cross-section; it is not
3414
+ * financial, investment or trading advice and it is not a recommendation about any
3415
+ * security. `disclaimer` carries the wording to display alongside a grade. Methodology:
3416
+ * https://sentisense.ai/methodology/#sentisense-rating
3417
+ *
3418
+ * **A discriminated union on `rated`.** `if (rating.rated)` narrows to `score`,
3419
+ * `letter`, `percentile`, `composite`, `ratedCount` and `methodologyVersion`; the
3420
+ * `else` branch narrows to `reason`, `dimensionsPresent` and `presentDimensions`.
3421
+ * Branch on the flag rather than testing a field for `undefined`.
3422
+ *
3423
+ * **Having no grade is a normal 200, not a 404.** ETFs and tickers outside the swept
3424
+ * universe answer with `rated` false, and the composition still arrives so a card can
3425
+ * render. Only a ticker that resolves to nothing we track rejects with
3426
+ * {@link NotFoundError}; a request with no usable key rejects with
3427
+ * {@link AuthenticationError}.
3428
+ *
3429
+ * `dimensions` always holds all six rows in a fixed order, including the ones with no
3430
+ * data, which arrive with `present` false and a `null` percentile. Read `present` first
3431
+ * and never read a missing percentile as zero.
3432
+ *
3433
+ * **`score` and `percentile` are different numbers.** `percentile` is the rank of the
3434
+ * blended signals against the day's rated set, and
3435
+ * `score = percentile - sum(riskAdjustments.map((a) => a.points))`, floored at 10 when
3436
+ * fewer than five dimensions are available and at 0 otherwise. `letter` is the band
3437
+ * `score` falls in, at edges 90, 70, 30 and 10, while `bucketLetter` is the band the
3438
+ * percentile alone would fall in, so a difference between the two letters is exactly
3439
+ * what the conditions cost. `riskConditions` names the active ones, `riskAdjustments`
3440
+ * gives the points each cost (graded, up to 12 apiece), and `penaltyPoints` is their
3441
+ * sum. `letter` is served as stored, so read it instead of computing your own bucket
3442
+ * edges. The five fields arrive from the next API deploy onward and are optional, so a
3443
+ * response served before then still parses.
3444
+ *
3445
+ * For the daily history of a stock's score, ask `client.entityMetrics.getMetrics` for
3446
+ * the `sentisense_rating` metric.
3447
+ */
3448
+ getRating(ticker: string): Promise<StockRatingResponse>;
3198
3449
  }
3199
3450
 
3200
3451
  /**
@@ -3351,6 +3602,6 @@ declare class APIError extends SentiSenseError {
3351
3602
  constructor(message: string, status: number, code?: string);
3352
3603
  }
3353
3604
 
3354
- declare const VERSION = "0.49.0";
3605
+ declare const VERSION = "0.51.0";
3355
3606
 
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 };
3607
+ 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 RatingBase, type RatingDimension, type RatingDimensionKey, type RatingFlag, type RatingNotRatedReason, type RatingSubLeg, type RecentEarningsEntry, type RiskAdjustment, type RiskCondition, 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 StockNotRated, type StockPrice, type StockProfile, type StockQuote, type StockRating, type StockRatingResponse, 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 };
package/dist/index.d.ts CHANGED
@@ -657,6 +657,188 @@ 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
+ * A risk condition evaluated against a rated stock. An active one deducts points from the
673
+ * score, up to 12 apiece; `percentile` itself is never touched by them.
674
+ */
675
+ type RiskCondition = "thin_coverage" | "weak_dimension" | "unprofitable" | "no_fundamentals" | "high_leverage" | "unseasoned_listing" | "small_market_cap" | "thin_liquidity" | "extended_price" | "insider_selling" | "institutional_outflow";
676
+ /**
677
+ * One graded deduction applied to a rated stock's score.
678
+ *
679
+ * A condition is graded rather than binary, so `points` is the share of the 12-point
680
+ * maximum this one actually cost. Only active conditions appear, and `penaltyPoints` is
681
+ * the sum of these.
682
+ */
683
+ interface RiskAdjustment {
684
+ /** Which condition, by the same key `riskConditions` reports. */
685
+ condition: RiskCondition;
686
+ /** Points deducted, to one decimal, up to 12 for a single condition. */
687
+ points: number;
688
+ }
689
+ /**
690
+ * One constituent leg behind a dimension's percentile.
691
+ *
692
+ * Only the smart-money dimension carries legs today; every other dimension omits the field
693
+ * entirely, so an absent `subLegs` means "this dimension has no legs", never "the legs were
694
+ * all zero".
695
+ */
696
+ interface RatingSubLeg {
697
+ /** Stable snake_case identifier, e.g. `"inst_13f"`. */
698
+ key: string;
699
+ label: string;
700
+ /** The leg's natural-scale reading. `null` when the leg had no data. */
701
+ raw: number | null;
702
+ /** `"%"` for a percentage, `"ratio"` for a scale-free balance. */
703
+ unit: string;
704
+ }
705
+ /**
706
+ * One of the six dimensions the composite is blended from.
707
+ *
708
+ * **All six always arrive, in a fixed order, whether or not they had data.** An absent
709
+ * dimension is a full row with `present` false and a `null` percentile; the server never
710
+ * drops it, precisely so a client cannot mistake a gap for a five-dimension rating. Read
711
+ * `present` before reading `percentile`, and never substitute zero for a `null`: zero is the
712
+ * bottom of the cross-section, absence is not a position on it.
713
+ */
714
+ interface RatingDimension {
715
+ key: RatingDimensionKey;
716
+ /** Display label, owned by the API so every surface agrees on the wording. */
717
+ label: string;
718
+ /** The dimension's cross-sectional rank, 0 to 100. `null` when absent. */
719
+ percentile: number | null;
720
+ /** The natural-scale reading behind the percentile, when the dimension has one. */
721
+ raw: number | null;
722
+ /** What `raw` means and in what unit, e.g. `"Operating margin, percent"`. */
723
+ rawLabel: string | null;
724
+ /** Whether this dimension had data for this stock. */
725
+ present: boolean;
726
+ /** Constituent legs, currently smart-money only. Absent on every other dimension. */
727
+ subLegs?: RatingSubLeg[];
728
+ }
729
+ /**
730
+ * One anomaly flag evaluated alongside the rating.
731
+ *
732
+ * Flags are informational and never move the composite. A flag the run could not evaluate is
733
+ * absent from the list rather than reported inactive, so present-and-false and absent stay
734
+ * distinguishable.
735
+ */
736
+ interface RatingFlag {
737
+ /** Stable snake_case identifier, e.g. `"unusual_options_flow"`. */
738
+ key: string;
739
+ label: string;
740
+ active: boolean;
741
+ }
742
+ /** The fields both rating shapes carry, graded or not. */
743
+ interface RatingBase {
744
+ ticker: string;
745
+ /**
746
+ * The stock's knowledge base id, e.g. `"kb/company/1"`. Addresses the metrics time series
747
+ * without a second lookup.
748
+ */
749
+ kbEntityId: string;
750
+ /** The New York calendar day this answer describes, `"YYYY-MM-DD"`. */
751
+ asOf: string;
752
+ /** Always all six, in a fixed order, absent ones with `present` false. */
753
+ dimensions: RatingDimension[];
754
+ flags: RatingFlag[];
755
+ /** The standard financial disclaimer. Display it alongside the grade. */
756
+ disclaimer: string;
757
+ }
758
+ /**
759
+ * A stock that has a grade for `asOf`.
760
+ *
761
+ * `score`, `bucketLetter`, `riskConditions`, `riskAdjustments` and `penaltyPoints` arrive
762
+ * from the next API deploy onward and are optional here because a response served before
763
+ * then omits them.
764
+ */
765
+ interface StockRating extends RatingBase {
766
+ rated: true;
767
+ /**
768
+ * The headline number, 0 to 100 with one decimal, and the number `letter` is the band
769
+ * of: `score = percentile - sum(riskAdjustments.map((a) => a.points))`, floored at 10
770
+ * when fewer than five dimensions are available and at 0 otherwise. Absent on a
771
+ * response served before this field shipped.
772
+ */
773
+ score?: number;
774
+ /**
775
+ * `"A"`, `"B"`, `"C"`, `"D"` or `"F"`: the band `score` falls in, at edges 90, 70, 30
776
+ * and 10. Served as stored, so read it rather than deriving your own edges. Deriving
777
+ * it from `percentile` disagrees with the API for every stock carrying a risk
778
+ * condition.
779
+ */
780
+ letter: string;
781
+ /**
782
+ * The band `percentile` alone would fall in, so a difference from `letter` is exactly
783
+ * what the risk conditions cost. Absent on a response served before this field
784
+ * shipped.
785
+ */
786
+ bucketLetter?: string;
787
+ /**
788
+ * Rank of `composite` among the day's rated stocks, 0 to 100. This stays the true rank
789
+ * of the blended signals: the risk conditions are subtracted from `score`, never here.
790
+ */
791
+ percentile: number;
792
+ /** The weighted blend before ranking, in [-1, +1]. */
793
+ composite: number;
794
+ /**
795
+ * Which risk conditions were active. An empty array means none were, and the field is
796
+ * absent on a response served before it shipped.
797
+ */
798
+ riskConditions?: RiskCondition[];
799
+ /**
800
+ * The same conditions with the points each one actually cost, since a condition is
801
+ * graded rather than binary and can cost anything up to 12. Absent on a response
802
+ * served before this field shipped.
803
+ */
804
+ riskAdjustments?: RiskAdjustment[];
805
+ /**
806
+ * The sum of `riskAdjustments` points, to one decimal: how far `score` sits below
807
+ * `percentile` before the floor applies. Absent on a response served before this field
808
+ * shipped.
809
+ */
810
+ penaltyPoints?: number;
811
+ /** How many stocks were rated that day: the rank's denominator. */
812
+ ratedCount: number;
813
+ /** The weights and floors in force when the row was written, e.g. `"2026.09-v1"`. */
814
+ methodologyVersion: string;
815
+ }
816
+ /**
817
+ * A stock with no grade for `asOf`. A normal 200, not an error: ETFs and tickers outside
818
+ * the swept universe answer this way, and the composition still arrives so a card can render.
819
+ */
820
+ interface StockNotRated extends RatingBase {
821
+ rated: false;
822
+ /** Why there is no grade. */
823
+ reason: RatingNotRatedReason;
824
+ /** How many of the six dimensions had data. */
825
+ dimensionsPresent?: number;
826
+ /** Which dimensions had data, by `key`. */
827
+ presentDimensions: RatingDimensionKey[];
828
+ }
829
+ /**
830
+ * The SentiSense Rating for one stock: where it ranks against the day's rated set.
831
+ *
832
+ * A discriminated union on `rated`, so `if (rating.rated)` narrows to the graded fields and
833
+ * the `else` branch narrows to `reason`. Branch on that flag rather than testing a field for
834
+ * `undefined`.
835
+ *
836
+ * The rating is a *relative* research signal, informational and educational only. It ranks a
837
+ * stock against the others rated that day; it is not financial, investment or trading advice
838
+ * and it is not a recommendation about any security. Carry `disclaimer` wherever you display
839
+ * a grade. Methodology: https://sentisense.ai/methodology/#sentisense-rating
840
+ */
841
+ type StockRatingResponse = StockRating | StockNotRated;
660
842
  type DocumentSource = "news" | "reddit" | "x" | "substack" | "youtube";
661
843
  /** Per-entity sentiment classification with resolved entity details. */
662
844
  interface SentimentEntry {
@@ -1375,7 +1557,12 @@ interface PreviewResponse<T> {
1375
1557
  data: T;
1376
1558
  }
1377
1559
  /** Supported metric types for the v2 Serving Metrics API. */
1378
- type MetricType = "mentions" | "sentiment" | "sentisense_score" | "social_dominance" | "creators";
1560
+ type MetricType = "mentions" | "sentiment" | "sentisense_score"
1561
+ /**
1562
+ * The SentiSense Rating score, 0 to 100. Time series only: it has no source
1563
+ * breakdown, so `getDistribution` answers with an empty distribution for it.
1564
+ */
1565
+ | "sentisense_rating" | "social_dominance" | "creators";
1379
1566
  /** Options for `EntityMetrics.getMetrics()`. */
1380
1567
  interface MetricsOptions {
1381
1568
  /** Metric to retrieve. Defaults to `"sentiment"`. */
@@ -2179,6 +2366,23 @@ interface AnalystCoverageFirm {
2179
2366
  latestNote: AnalystNote | null;
2180
2367
  firmRating: AnalystFirmRating | null;
2181
2368
  }
2369
+ /**
2370
+ * Covering firms counted by the tier of their current rating. Counted over the whole
2371
+ * book before the free truncation, so `buy + hold + sell + unrated === total` and a free
2372
+ * key reads the same numbers as a PRO one.
2373
+ */
2374
+ interface AnalystRatingBuckets {
2375
+ /** Buy-tier grades: Buy, Overweight, Outperform, Strong Buy, Sector Outperform. */
2376
+ buy: number;
2377
+ /** Hold-tier grades: Hold, Neutral, Equal-Weight, Market Perform. */
2378
+ hold: number;
2379
+ /** Sell-tier grades. */
2380
+ sell: number;
2381
+ /** No current rating on record (a price-target-only desk), or a grade we do not recognise. */
2382
+ unrated: number;
2383
+ /** Every covering firm. Equals `firmCount`. */
2384
+ total: number;
2385
+ }
2182
2386
  interface AnalystCoverage {
2183
2387
  ticker: string;
2184
2388
  /** Window actually applied after clamping, in days. */
@@ -2192,6 +2396,12 @@ interface AnalystCoverage {
2192
2396
  * target are `firmCount - ratingOnlyFirmCount`.
2193
2397
  */
2194
2398
  ratingOnlyFirmCount: number;
2399
+ /**
2400
+ * The same firms split by the tier of their current rating. A different population from
2401
+ * `strongBuy`..`strongSell` on the consensus endpoint, which report the provider's
2402
+ * analyst survey rather than the firms in this book, so do not reconcile the two.
2403
+ */
2404
+ ratingBuckets?: AnalystRatingBuckets;
2195
2405
  namedAnalystCount: number;
2196
2406
  noteCount: number;
2197
2407
  /** Notes that name an individual. */
@@ -3195,6 +3405,47 @@ declare class Stocks {
3195
3405
  * years, so it can answer with nearly the same series as `"2y"`.
3196
3406
  */
3197
3407
  getOptionsHistory(ticker: string, options?: GetOptionsHistoryOptions): Promise<PreviewResponse<OptionsHistory>>;
3408
+ /**
3409
+ * Get the SentiSense Rating for one stock: where it ranks against the other stocks rated
3410
+ * that day, and the six dimensions the rank is blended from.
3411
+ *
3412
+ * The Rating is a *relative*, automatically generated research signal, for informational
3413
+ * and educational purposes only. It ranks a stock against its cross-section; it is not
3414
+ * financial, investment or trading advice and it is not a recommendation about any
3415
+ * security. `disclaimer` carries the wording to display alongside a grade. Methodology:
3416
+ * https://sentisense.ai/methodology/#sentisense-rating
3417
+ *
3418
+ * **A discriminated union on `rated`.** `if (rating.rated)` narrows to `score`,
3419
+ * `letter`, `percentile`, `composite`, `ratedCount` and `methodologyVersion`; the
3420
+ * `else` branch narrows to `reason`, `dimensionsPresent` and `presentDimensions`.
3421
+ * Branch on the flag rather than testing a field for `undefined`.
3422
+ *
3423
+ * **Having no grade is a normal 200, not a 404.** ETFs and tickers outside the swept
3424
+ * universe answer with `rated` false, and the composition still arrives so a card can
3425
+ * render. Only a ticker that resolves to nothing we track rejects with
3426
+ * {@link NotFoundError}; a request with no usable key rejects with
3427
+ * {@link AuthenticationError}.
3428
+ *
3429
+ * `dimensions` always holds all six rows in a fixed order, including the ones with no
3430
+ * data, which arrive with `present` false and a `null` percentile. Read `present` first
3431
+ * and never read a missing percentile as zero.
3432
+ *
3433
+ * **`score` and `percentile` are different numbers.** `percentile` is the rank of the
3434
+ * blended signals against the day's rated set, and
3435
+ * `score = percentile - sum(riskAdjustments.map((a) => a.points))`, floored at 10 when
3436
+ * fewer than five dimensions are available and at 0 otherwise. `letter` is the band
3437
+ * `score` falls in, at edges 90, 70, 30 and 10, while `bucketLetter` is the band the
3438
+ * percentile alone would fall in, so a difference between the two letters is exactly
3439
+ * what the conditions cost. `riskConditions` names the active ones, `riskAdjustments`
3440
+ * gives the points each cost (graded, up to 12 apiece), and `penaltyPoints` is their
3441
+ * sum. `letter` is served as stored, so read it instead of computing your own bucket
3442
+ * edges. The five fields arrive from the next API deploy onward and are optional, so a
3443
+ * response served before then still parses.
3444
+ *
3445
+ * For the daily history of a stock's score, ask `client.entityMetrics.getMetrics` for
3446
+ * the `sentisense_rating` metric.
3447
+ */
3448
+ getRating(ticker: string): Promise<StockRatingResponse>;
3198
3449
  }
3199
3450
 
3200
3451
  /**
@@ -3351,6 +3602,6 @@ declare class APIError extends SentiSenseError {
3351
3602
  constructor(message: string, status: number, code?: string);
3352
3603
  }
3353
3604
 
3354
- declare const VERSION = "0.49.0";
3605
+ declare const VERSION = "0.51.0";
3355
3606
 
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 };
3607
+ 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 RatingBase, type RatingDimension, type RatingDimensionKey, type RatingFlag, type RatingNotRatedReason, type RatingSubLeg, type RecentEarningsEntry, type RiskAdjustment, type RiskCondition, 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 StockNotRated, type StockPrice, type StockProfile, type StockQuote, type StockRating, type StockRatingResponse, 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 };