sentisense 0.8.0 → 0.11.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.cjs +171 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +271 -3
- package/dist/index.d.ts +271 -3
- package/dist/index.mjs +171 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,14 +10,42 @@ interface StockPrice {
|
|
|
10
10
|
change: number;
|
|
11
11
|
changePercent: number;
|
|
12
12
|
previousClose: number;
|
|
13
|
+
/** Unix timestamp in milliseconds of the price quote. */
|
|
13
14
|
timestamp: number;
|
|
14
15
|
}
|
|
16
|
+
/** Aggregate quote snapshot from GET /api/v1/stocks/{ticker}/quote. */
|
|
17
|
+
interface StockQuote {
|
|
18
|
+
ticker: string;
|
|
19
|
+
currentPrice: number | null;
|
|
20
|
+
change: number | null;
|
|
21
|
+
changePercent: number | null;
|
|
22
|
+
volume: number | null;
|
|
23
|
+
open: number | null;
|
|
24
|
+
dayHigh: number | null;
|
|
25
|
+
dayLow: number | null;
|
|
26
|
+
previousClose: number | null;
|
|
27
|
+
week52High: number | null;
|
|
28
|
+
week52Low: number | null;
|
|
29
|
+
marketCap: number | null;
|
|
30
|
+
peRatio: number | null;
|
|
31
|
+
epsTTM: number | null;
|
|
32
|
+
dividendYield: number | null;
|
|
33
|
+
timestamp: number | null;
|
|
34
|
+
extendedHours: boolean | null;
|
|
35
|
+
}
|
|
15
36
|
interface StockDetail {
|
|
16
37
|
ticker: string;
|
|
17
38
|
name: string;
|
|
18
39
|
kbEntityId?: string;
|
|
19
40
|
urlSlug?: string;
|
|
20
41
|
}
|
|
42
|
+
interface SimilarStock {
|
|
43
|
+
symbol: string;
|
|
44
|
+
name: string;
|
|
45
|
+
kbEntityId?: string;
|
|
46
|
+
price: number | null;
|
|
47
|
+
changePercent: number | null;
|
|
48
|
+
}
|
|
21
49
|
interface StockImage {
|
|
22
50
|
iconUrl: string | null;
|
|
23
51
|
logoUrl: string | null;
|
|
@@ -136,6 +164,7 @@ interface StoryCluster {
|
|
|
136
164
|
title: string;
|
|
137
165
|
clusterSize: number;
|
|
138
166
|
averageSentiment: number;
|
|
167
|
+
/** Unix timestamp in seconds. */
|
|
139
168
|
createdAt: number;
|
|
140
169
|
}
|
|
141
170
|
interface Story {
|
|
@@ -144,6 +173,7 @@ interface Story {
|
|
|
144
173
|
tickers: string[];
|
|
145
174
|
primaryEntityNames: string[];
|
|
146
175
|
impactScore: number;
|
|
176
|
+
/** Unix timestamp in seconds when the story first broke. */
|
|
147
177
|
brokeAt: number;
|
|
148
178
|
}
|
|
149
179
|
interface GetByTickerOptions {
|
|
@@ -202,6 +232,16 @@ interface InstitutionalFlow {
|
|
|
202
232
|
hedgeFundNetChange: number;
|
|
203
233
|
activistActivity: boolean;
|
|
204
234
|
reportDate: string;
|
|
235
|
+
/**
|
|
236
|
+
* Quarterly average closing price used to weight the dollar flow.
|
|
237
|
+
* Null when no price is cached for this (quarter, ticker) yet.
|
|
238
|
+
*/
|
|
239
|
+
avgClosePrice?: number | null;
|
|
240
|
+
/**
|
|
241
|
+
* Dollar-weighted net flow: `netSharesChange × avgClosePrice`. 0 when
|
|
242
|
+
* `avgClosePrice` is missing — fall back to displaying `netSharesChange`.
|
|
243
|
+
*/
|
|
244
|
+
dollarFlowUsd: number;
|
|
205
245
|
}
|
|
206
246
|
interface Holder {
|
|
207
247
|
filerCik: string;
|
|
@@ -350,6 +390,7 @@ interface MetricDistributionOptions {
|
|
|
350
390
|
}
|
|
351
391
|
/** A single data point returned by the v2 time-series metrics endpoint. */
|
|
352
392
|
interface ServingMetric {
|
|
393
|
+
/** Unix timestamp in seconds. */
|
|
353
394
|
timestamp: number;
|
|
354
395
|
value: number;
|
|
355
396
|
[key: string]: unknown;
|
|
@@ -444,12 +485,157 @@ interface GetInsightsOptions {
|
|
|
444
485
|
/** Filter by insight type (e.g., `"insider_buy_signal"`). */
|
|
445
486
|
insightType?: string;
|
|
446
487
|
}
|
|
488
|
+
/** One period value in a KPI time series. */
|
|
489
|
+
interface KpiDataPoint {
|
|
490
|
+
/** e.g. "Q2 FY2026" */
|
|
491
|
+
period: string;
|
|
492
|
+
/** ISO date, e.g. "2025-12-27" */
|
|
493
|
+
date: string;
|
|
494
|
+
value: number;
|
|
495
|
+
/** Preliminary flag; often null. */
|
|
496
|
+
isEstimate?: boolean | null;
|
|
497
|
+
}
|
|
498
|
+
/** A single KPI time series for a company. */
|
|
499
|
+
interface KpiSeries {
|
|
500
|
+
/** Stable per-ticker identifier, e.g. "iphone_revenue". */
|
|
501
|
+
id: string;
|
|
502
|
+
/** Human-readable name, e.g. "iPhone Revenue". */
|
|
503
|
+
name: string;
|
|
504
|
+
/** Logical category, e.g. "product_revenue", "segment_revenue". */
|
|
505
|
+
category: string;
|
|
506
|
+
/** Unit of measurement, e.g. "USD". */
|
|
507
|
+
unit: string;
|
|
508
|
+
/** Display hint, e.g. "currency_abbreviated". */
|
|
509
|
+
displayFormat: string;
|
|
510
|
+
/** Default chart type, e.g. "bar" or "line". */
|
|
511
|
+
chartType: string;
|
|
512
|
+
/** Time-series data points. */
|
|
513
|
+
values: KpiDataPoint[];
|
|
514
|
+
/** Citation for the source filing. */
|
|
515
|
+
sourceRef?: string;
|
|
516
|
+
/** Set when the company has stopped reporting this metric. */
|
|
517
|
+
discontinued?: boolean;
|
|
518
|
+
/** Optional human-readable note about discontinuation. */
|
|
519
|
+
discontinuedNote?: string;
|
|
520
|
+
}
|
|
521
|
+
/** Full KPI payload for a company. Returned by `client.stocks.getKpis`. */
|
|
522
|
+
interface CompanyKpisData {
|
|
523
|
+
ticker: string;
|
|
524
|
+
companyName: string;
|
|
525
|
+
cik?: string;
|
|
526
|
+
lastUpdated: string;
|
|
527
|
+
kpis: KpiSeries[];
|
|
528
|
+
}
|
|
529
|
+
/** Lightweight coverage entry. Returned by `client.stocks.listKpiCoverage`. */
|
|
530
|
+
interface KpiCoverageEntry {
|
|
531
|
+
ticker: string;
|
|
532
|
+
companyName: string;
|
|
533
|
+
lastUpdated: string;
|
|
534
|
+
kpiCount: number;
|
|
535
|
+
}
|
|
536
|
+
/** Coverage listing envelope: count + list of covered tickers. */
|
|
537
|
+
interface KpiCoverageResponse {
|
|
538
|
+
count: number;
|
|
539
|
+
tickers: KpiCoverageEntry[];
|
|
540
|
+
}
|
|
541
|
+
/** Lightweight KPI metadata tuple. Returned by `client.stocks.getKpiTypes`. */
|
|
542
|
+
interface KpiTypeEntry {
|
|
543
|
+
id: string;
|
|
544
|
+
name: string;
|
|
545
|
+
category: string;
|
|
546
|
+
chartType: string;
|
|
547
|
+
}
|
|
447
548
|
interface KBEntity {
|
|
448
549
|
entityId: string;
|
|
449
550
|
name: string;
|
|
450
551
|
[key: string]: unknown;
|
|
451
552
|
}
|
|
452
553
|
|
|
554
|
+
interface AnalystConsensus {
|
|
555
|
+
ticker: string;
|
|
556
|
+
currentPrice: number | null;
|
|
557
|
+
targetLow: number | null;
|
|
558
|
+
targetMean: number | null;
|
|
559
|
+
targetHigh: number | null;
|
|
560
|
+
targetMedian: number | null;
|
|
561
|
+
numberOfAnalysts: number;
|
|
562
|
+
upsidePercent: number | null;
|
|
563
|
+
consensusLabel: string | null;
|
|
564
|
+
recommendationMean: number | null;
|
|
565
|
+
/** PRO-only; zero in the free preview. */
|
|
566
|
+
strongBuy: number;
|
|
567
|
+
/** PRO-only; zero in the free preview. */
|
|
568
|
+
buy: number;
|
|
569
|
+
/** PRO-only; zero in the free preview. */
|
|
570
|
+
hold: number;
|
|
571
|
+
/** PRO-only; zero in the free preview. */
|
|
572
|
+
sell: number;
|
|
573
|
+
/** PRO-only; zero in the free preview. */
|
|
574
|
+
strongSell: number;
|
|
575
|
+
updatedAt: string | null;
|
|
576
|
+
}
|
|
577
|
+
interface AnalystAction {
|
|
578
|
+
ticker: string;
|
|
579
|
+
actionDate: string;
|
|
580
|
+
firm: string;
|
|
581
|
+
/** UPGRADE, DOWNGRADE, INITIATE, REITERATE, OTHER */
|
|
582
|
+
actionType: string;
|
|
583
|
+
fromGrade: string | null;
|
|
584
|
+
toGrade: string | null;
|
|
585
|
+
}
|
|
586
|
+
interface AnalystEstimate {
|
|
587
|
+
/** Fiscal period descriptor (provider-specific shape). */
|
|
588
|
+
[key: string]: unknown;
|
|
589
|
+
}
|
|
590
|
+
interface AnalystEarningsSurprise {
|
|
591
|
+
/** Past report descriptor (provider-specific shape). */
|
|
592
|
+
[key: string]: unknown;
|
|
593
|
+
}
|
|
594
|
+
interface AnalystEstimatesResponse {
|
|
595
|
+
estimates: AnalystEstimate[];
|
|
596
|
+
surprises: AnalystEarningsSurprise[];
|
|
597
|
+
}
|
|
598
|
+
interface GetAnalystActionsOptions {
|
|
599
|
+
/** Days of history to return. Default 90. */
|
|
600
|
+
lookbackDays?: number;
|
|
601
|
+
}
|
|
602
|
+
interface GetAnalystMarketActivityOptions {
|
|
603
|
+
/** Days of history to return. Default 30. */
|
|
604
|
+
lookbackDays?: number;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Wall Street analyst coverage: aggregate price targets, recommendation distribution,
|
|
608
|
+
* recent upgrade/downgrade actions, and forward EPS estimates with earnings surprise history.
|
|
609
|
+
*
|
|
610
|
+
* Free users receive the price target band (low/mean/high + analyst count + consensus label)
|
|
611
|
+
* in full -- it powers the public projection cone. The buy/hold/sell distribution counts
|
|
612
|
+
* and full action/estimate history are PRO-only.
|
|
613
|
+
*/
|
|
614
|
+
declare class Analyst {
|
|
615
|
+
private client;
|
|
616
|
+
constructor(client: APIClient);
|
|
617
|
+
/**
|
|
618
|
+
* Get the aggregate Wall Street consensus for a ticker. Returns 404 if no
|
|
619
|
+
* coverage exists.
|
|
620
|
+
*/
|
|
621
|
+
consensus(ticker: string): Promise<PreviewResponse<AnalystConsensus>>;
|
|
622
|
+
/**
|
|
623
|
+
* Get recent analyst upgrade/downgrade actions for a ticker, newest first.
|
|
624
|
+
* Free users receive the 3 most recent.
|
|
625
|
+
*/
|
|
626
|
+
actions(ticker: string, options?: GetAnalystActionsOptions): Promise<PreviewResponse<AnalystAction[]>>;
|
|
627
|
+
/**
|
|
628
|
+
* Get forward EPS estimates and earnings surprise history for a ticker.
|
|
629
|
+
* Free users receive 1 estimate (current quarter) plus the 2 most recent surprises.
|
|
630
|
+
*/
|
|
631
|
+
estimates(ticker: string): Promise<PreviewResponse<AnalystEstimatesResponse>>;
|
|
632
|
+
/**
|
|
633
|
+
* Get market-wide recent analyst actions across all covered tickers, newest first.
|
|
634
|
+
* Free users receive the 5 most recent.
|
|
635
|
+
*/
|
|
636
|
+
marketActivity(options?: GetAnalystMarketActivityOptions): Promise<PreviewResponse<AnalystAction[]>>;
|
|
637
|
+
}
|
|
638
|
+
|
|
453
639
|
declare class Documents {
|
|
454
640
|
private client;
|
|
455
641
|
constructor(client: APIClient);
|
|
@@ -569,6 +755,20 @@ declare class Politicians {
|
|
|
569
755
|
getMember(slug: string): Promise<PreviewResponse<PoliticianDetail>>;
|
|
570
756
|
}
|
|
571
757
|
|
|
758
|
+
interface GetStockInsightsRangeOptions {
|
|
759
|
+
startDate: string;
|
|
760
|
+
endDate: string;
|
|
761
|
+
urgency?: "low" | "medium" | "high";
|
|
762
|
+
insightType?: string;
|
|
763
|
+
}
|
|
764
|
+
interface GetLatestInsightsOptions {
|
|
765
|
+
limit?: number;
|
|
766
|
+
urgency?: "low" | "medium" | "high";
|
|
767
|
+
}
|
|
768
|
+
interface GetUserInsightsOptions {
|
|
769
|
+
limit?: number;
|
|
770
|
+
category?: string;
|
|
771
|
+
}
|
|
572
772
|
declare class Insights {
|
|
573
773
|
private client;
|
|
574
774
|
constructor(client: APIClient);
|
|
@@ -581,6 +781,13 @@ declare class Insights {
|
|
|
581
781
|
* (type, urgency, timestamp) showing what additional signals exist.
|
|
582
782
|
*/
|
|
583
783
|
stock(ticker: string, options?: GetInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
|
|
784
|
+
/**
|
|
785
|
+
* Get AI insights for a stock within a date range.
|
|
786
|
+
*
|
|
787
|
+
* Free users receive the top 3; PRO users receive the full list.
|
|
788
|
+
* The server returns 400 if `startDate` is after `endDate`.
|
|
789
|
+
*/
|
|
790
|
+
stockRange(ticker: string, options: GetStockInsightsRangeOptions): Promise<Insight[] | InsightPreviewResponse>;
|
|
584
791
|
/**
|
|
585
792
|
* Get AI-generated market-level insights, sorted by urgency then confidence.
|
|
586
793
|
*
|
|
@@ -589,6 +796,19 @@ declare class Insights {
|
|
|
589
796
|
* the top 5 insights in full, and a `locked` array with metadata-only entries.
|
|
590
797
|
*/
|
|
591
798
|
market(): Promise<Insight[] | InsightPreviewResponse>;
|
|
799
|
+
/**
|
|
800
|
+
* Get the latest AI insights across all tracked stocks, newest first.
|
|
801
|
+
*
|
|
802
|
+
* Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
|
|
803
|
+
*/
|
|
804
|
+
latest(options?: GetLatestInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
|
|
805
|
+
/**
|
|
806
|
+
* Get personalized insights for the authenticated user.
|
|
807
|
+
*
|
|
808
|
+
* Biased toward the user's watchlist and portfolio when available; falls back
|
|
809
|
+
* to market-level insights otherwise. API key authentication required.
|
|
810
|
+
*/
|
|
811
|
+
user(options?: GetUserInsightsOptions): Promise<Insight[] | InsightPreviewResponse>;
|
|
592
812
|
/**
|
|
593
813
|
* Get available insight types for a specific stock.
|
|
594
814
|
* No authentication required.
|
|
@@ -609,6 +829,15 @@ declare class Institutional {
|
|
|
609
829
|
getHolders(ticker: string, reportDate: string): Promise<Holder[]>;
|
|
610
830
|
/** Get activist investor positions (NEW or INCREASED). */
|
|
611
831
|
getActivists(reportDate: string): Promise<Holder[]>;
|
|
832
|
+
/**
|
|
833
|
+
* Get the full profile, summary stats, and current-quarter holdings for a
|
|
834
|
+
* specific institutional filer.
|
|
835
|
+
*
|
|
836
|
+
* Resolved by URL slug (e.g. `Berkshire-Hathaway`) or numeric SEC CIK.
|
|
837
|
+
* Free users receive the profile and top 10 holdings; PRO users receive the
|
|
838
|
+
* full holdings array. Returns 404 if the slug or CIK is unknown.
|
|
839
|
+
*/
|
|
840
|
+
getInstitutionDetail(slugOrCik: string): Promise<unknown>;
|
|
612
841
|
}
|
|
613
842
|
|
|
614
843
|
declare class KB {
|
|
@@ -649,6 +878,12 @@ declare class Stocks {
|
|
|
649
878
|
listPopularDetailed(): Promise<StockDetail[]>;
|
|
650
879
|
/** Get real-time price for a single ticker. */
|
|
651
880
|
getPrice(ticker: string): Promise<StockPrice>;
|
|
881
|
+
/**
|
|
882
|
+
* Get aggregate quote snapshot: live price, today OHLC, 52-week range,
|
|
883
|
+
* market cap, P/E, EPS TTM, and dividend yield in a single call.
|
|
884
|
+
* All fields except `ticker` may be null when upstream data is unavailable.
|
|
885
|
+
*/
|
|
886
|
+
getQuote(ticker: string): Promise<StockQuote>;
|
|
652
887
|
/** Get real-time prices for multiple tickers. */
|
|
653
888
|
getPrices(tickers: string[]): Promise<StockPrice[]>;
|
|
654
889
|
/** Get batch company logo URLs. */
|
|
@@ -656,7 +891,7 @@ declare class Stocks {
|
|
|
656
891
|
/** Get company profiles with branding, market cap, sector. */
|
|
657
892
|
getDescriptions(tickers: string[], options?: GetDescriptionsOptions): Promise<Record<string, StockProfile>>;
|
|
658
893
|
/** Get peer/similar stocks. */
|
|
659
|
-
getSimilar(ticker: string, options?: GetSimilarOptions): Promise<
|
|
894
|
+
getSimilar(ticker: string, options?: GetSimilarOptions): Promise<SimilarStock[]>;
|
|
660
895
|
/** Get company profile (CEO, sector, industry, market data). */
|
|
661
896
|
getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile>;
|
|
662
897
|
/** Get related KB entities (people, products, partners). */
|
|
@@ -685,11 +920,41 @@ declare class Stocks {
|
|
|
685
920
|
getFloat(ticker: string): Promise<FloatInfo>;
|
|
686
921
|
/** Get short volume trading data. */
|
|
687
922
|
getShortVolume(ticker: string): Promise<ShortVolume>;
|
|
923
|
+
/**
|
|
924
|
+
* Get company-specific KPI time-series for a ticker. Returns curated GAAP and
|
|
925
|
+
* non-GAAP metrics from earnings filings (e.g. iPhone unit sales, Tesla deliveries,
|
|
926
|
+
* AWS revenue).
|
|
927
|
+
*
|
|
928
|
+
* Free users receive metadata only with an empty `kpis` list; PRO users receive
|
|
929
|
+
* the full series. Returns 404 for tickers that do not yet have curated coverage.
|
|
930
|
+
*
|
|
931
|
+
* Coverage today: near-complete for the S&P 500 plus extended universe
|
|
932
|
+
* (~500 tickers). Use `listKpiCoverage()` to enumerate.
|
|
933
|
+
*/
|
|
934
|
+
getKpis(ticker: string): Promise<PreviewResponse<CompanyKpisData>>;
|
|
935
|
+
/**
|
|
936
|
+
* List every ticker with curated KPI coverage. Returns `{count, tickers: [...]}`
|
|
937
|
+
* with lightweight metadata (ticker, companyName, lastUpdated, kpiCount).
|
|
938
|
+
* Sorted alphabetically by ticker.
|
|
939
|
+
*
|
|
940
|
+
* Auth: API key required, but the call does NOT consume your monthly quota
|
|
941
|
+
* (rate-limit-per-minute still applies). [COMP-421]
|
|
942
|
+
*/
|
|
943
|
+
listKpiCoverage(): Promise<KpiCoverageResponse>;
|
|
944
|
+
/**
|
|
945
|
+
* List the KPI metadata tuples available for a ticker — `id, name, category,
|
|
946
|
+
* chartType` — without paying the cost of the full series payload. Mirrors
|
|
947
|
+
* the `/api/v1/insights/stock/{ticker}/types` precedent.
|
|
948
|
+
*
|
|
949
|
+
* Auth: API key required, no quota cost. 404 if the ticker has no curated KPIs.
|
|
950
|
+
*/
|
|
951
|
+
getKpiTypes(ticker: string): Promise<KpiTypeEntry[]>;
|
|
688
952
|
}
|
|
689
953
|
|
|
690
954
|
/** @internal HTTP interface exposed to resource classes. */
|
|
691
955
|
interface APIClient {
|
|
692
956
|
get<T = unknown>(path: string, params?: object): Promise<T>;
|
|
957
|
+
post<T = unknown>(path: string, body: unknown): Promise<T>;
|
|
693
958
|
}
|
|
694
959
|
declare class SentiSense implements APIClient {
|
|
695
960
|
private baseUrl;
|
|
@@ -702,6 +967,7 @@ declare class SentiSense implements APIClient {
|
|
|
702
967
|
readonly insider: Insider;
|
|
703
968
|
readonly politicians: Politicians;
|
|
704
969
|
readonly insights: Insights;
|
|
970
|
+
readonly analyst: Analyst;
|
|
705
971
|
readonly entityMetrics: EntityMetrics;
|
|
706
972
|
readonly marketMood: MarketMoodResource;
|
|
707
973
|
readonly marketSummary: MarketSummaryResource;
|
|
@@ -709,6 +975,8 @@ declare class SentiSense implements APIClient {
|
|
|
709
975
|
constructor(options?: SentiSenseOptions);
|
|
710
976
|
/** @internal */
|
|
711
977
|
get<T = unknown>(path: string, params?: object): Promise<T>;
|
|
978
|
+
/** @internal */
|
|
979
|
+
post<T = unknown>(path: string, body: unknown): Promise<T>;
|
|
712
980
|
private buildUrl;
|
|
713
981
|
private handleErrorResponse;
|
|
714
982
|
}
|
|
@@ -732,6 +1000,6 @@ declare class APIError extends SentiSenseError {
|
|
|
732
1000
|
constructor(message: string, status: number, code?: string);
|
|
733
1001
|
}
|
|
734
1002
|
|
|
735
|
-
declare const VERSION = "0.
|
|
1003
|
+
declare const VERSION = "0.11.0";
|
|
736
1004
|
|
|
737
|
-
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CongressTrade, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetInsiderOptions, type GetInsightsOptions, type GetPoliticiansOptions, type Holder, type InsiderActivityResponse, type InsiderActivitySummary, type InsiderTrade, type Insight, type InsightPreviewResponse, type InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, 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 StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, VERSION, SentiSense as default };
|
|
1005
|
+
export { type AISummary, APIError, type AnalystAction, type AnalystConsensus, type AnalystEarningsSurprise, type AnalystEstimate, type AnalystEstimatesResponse, AuthenticationError, type ChartData, type ChartDataPoint, type ClusterBuy, type CompanyKpisData, type CongressTrade, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type GetAnalystActionsOptions, type GetAnalystMarketActivityOptions, 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 InstitutionalFlow, type InstitutionalFlowsResponse, type KBEntity, type KpiCoverageEntry, type KpiCoverageResponse, type KpiDataPoint, type KpiSeries, type KpiTypeEntry, 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, VERSION, SentiSense as default };
|
package/dist/index.mjs
CHANGED
|
@@ -33,6 +33,48 @@ var APIError = class extends SentiSenseError {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
// src/resources/analyst.ts
|
|
37
|
+
var Analyst = class {
|
|
38
|
+
constructor(client) {
|
|
39
|
+
this.client = client;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the aggregate Wall Street consensus for a ticker. Returns 404 if no
|
|
43
|
+
* coverage exists.
|
|
44
|
+
*/
|
|
45
|
+
async consensus(ticker) {
|
|
46
|
+
return this.client.get(
|
|
47
|
+
`/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/consensus`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get recent analyst upgrade/downgrade actions for a ticker, newest first.
|
|
52
|
+
* Free users receive the 3 most recent.
|
|
53
|
+
*/
|
|
54
|
+
async actions(ticker, options) {
|
|
55
|
+
return this.client.get(
|
|
56
|
+
`/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/actions`,
|
|
57
|
+
options
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get forward EPS estimates and earnings surprise history for a ticker.
|
|
62
|
+
* Free users receive 1 estimate (current quarter) plus the 2 most recent surprises.
|
|
63
|
+
*/
|
|
64
|
+
async estimates(ticker) {
|
|
65
|
+
return this.client.get(
|
|
66
|
+
`/api/v1/analyst/${encodeURIComponent(ticker.toUpperCase())}/estimates`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get market-wide recent analyst actions across all covered tickers, newest first.
|
|
71
|
+
* Free users receive the 5 most recent.
|
|
72
|
+
*/
|
|
73
|
+
async marketActivity(options) {
|
|
74
|
+
return this.client.get("/api/v1/analyst/activity", options);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
36
78
|
// src/resources/documents.ts
|
|
37
79
|
var Documents = class {
|
|
38
80
|
constructor(client) {
|
|
@@ -277,6 +319,18 @@ var Insights = class {
|
|
|
277
319
|
options
|
|
278
320
|
);
|
|
279
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Get AI insights for a stock within a date range.
|
|
324
|
+
*
|
|
325
|
+
* Free users receive the top 3; PRO users receive the full list.
|
|
326
|
+
* The server returns 400 if `startDate` is after `endDate`.
|
|
327
|
+
*/
|
|
328
|
+
async stockRange(ticker, options) {
|
|
329
|
+
return this.client.get(
|
|
330
|
+
`/api/v1/insights/stock/${encodeURIComponent(ticker.toUpperCase())}/range`,
|
|
331
|
+
options
|
|
332
|
+
);
|
|
333
|
+
}
|
|
280
334
|
/**
|
|
281
335
|
* Get AI-generated market-level insights, sorted by urgency then confidence.
|
|
282
336
|
*
|
|
@@ -287,6 +341,23 @@ var Insights = class {
|
|
|
287
341
|
async market() {
|
|
288
342
|
return this.client.get("/api/v1/insights/market");
|
|
289
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Get the latest AI insights across all tracked stocks, newest first.
|
|
346
|
+
*
|
|
347
|
+
* Free users receive the top 5; PRO users receive up to `limit` (clamped to 1-200).
|
|
348
|
+
*/
|
|
349
|
+
async latest(options) {
|
|
350
|
+
return this.client.get("/api/v1/insights/latest", options);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Get personalized insights for the authenticated user.
|
|
354
|
+
*
|
|
355
|
+
* Biased toward the user's watchlist and portfolio when available; falls back
|
|
356
|
+
* to market-level insights otherwise. API key authentication required.
|
|
357
|
+
*/
|
|
358
|
+
async user(options) {
|
|
359
|
+
return this.client.get("/api/v1/insights/user", options);
|
|
360
|
+
}
|
|
290
361
|
/**
|
|
291
362
|
* Get available insight types for a specific stock.
|
|
292
363
|
* No authentication required.
|
|
@@ -327,6 +398,19 @@ var Institutional = class {
|
|
|
327
398
|
async getActivists(reportDate) {
|
|
328
399
|
return this.client.get("/api/v1/institutional/activist", { reportDate });
|
|
329
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* Get the full profile, summary stats, and current-quarter holdings for a
|
|
403
|
+
* specific institutional filer.
|
|
404
|
+
*
|
|
405
|
+
* Resolved by URL slug (e.g. `Berkshire-Hathaway`) or numeric SEC CIK.
|
|
406
|
+
* Free users receive the profile and top 10 holdings; PRO users receive the
|
|
407
|
+
* full holdings array. Returns 404 if the slug or CIK is unknown.
|
|
408
|
+
*/
|
|
409
|
+
async getInstitutionDetail(slugOrCik) {
|
|
410
|
+
return this.client.get(
|
|
411
|
+
`/api/v1/institutional/institution/${encodeURIComponent(slugOrCik)}`
|
|
412
|
+
);
|
|
413
|
+
}
|
|
330
414
|
};
|
|
331
415
|
|
|
332
416
|
// src/resources/kb.ts
|
|
@@ -395,6 +479,14 @@ var Stocks = class {
|
|
|
395
479
|
async getPrice(ticker) {
|
|
396
480
|
return this.client.get("/api/v1/stocks/price", { ticker });
|
|
397
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* Get aggregate quote snapshot: live price, today OHLC, 52-week range,
|
|
484
|
+
* market cap, P/E, EPS TTM, and dividend yield in a single call.
|
|
485
|
+
* All fields except `ticker` may be null when upstream data is unavailable.
|
|
486
|
+
*/
|
|
487
|
+
async getQuote(ticker) {
|
|
488
|
+
return this.client.get(`/api/v1/stocks/${encodeURIComponent(ticker)}/quote`);
|
|
489
|
+
}
|
|
398
490
|
/** Get real-time prices for multiple tickers. */
|
|
399
491
|
async getPrices(tickers) {
|
|
400
492
|
return this.client.get("/api/v1/stocks/prices", {
|
|
@@ -478,10 +570,49 @@ var Stocks = class {
|
|
|
478
570
|
async getShortVolume(ticker) {
|
|
479
571
|
return this.client.get("/api/v1/stocks/short-volume", { ticker });
|
|
480
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Get company-specific KPI time-series for a ticker. Returns curated GAAP and
|
|
575
|
+
* non-GAAP metrics from earnings filings (e.g. iPhone unit sales, Tesla deliveries,
|
|
576
|
+
* AWS revenue).
|
|
577
|
+
*
|
|
578
|
+
* Free users receive metadata only with an empty `kpis` list; PRO users receive
|
|
579
|
+
* the full series. Returns 404 for tickers that do not yet have curated coverage.
|
|
580
|
+
*
|
|
581
|
+
* Coverage today: near-complete for the S&P 500 plus extended universe
|
|
582
|
+
* (~500 tickers). Use `listKpiCoverage()` to enumerate.
|
|
583
|
+
*/
|
|
584
|
+
async getKpis(ticker) {
|
|
585
|
+
return this.client.get(
|
|
586
|
+
`/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis`
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* List every ticker with curated KPI coverage. Returns `{count, tickers: [...]}`
|
|
591
|
+
* with lightweight metadata (ticker, companyName, lastUpdated, kpiCount).
|
|
592
|
+
* Sorted alphabetically by ticker.
|
|
593
|
+
*
|
|
594
|
+
* Auth: API key required, but the call does NOT consume your monthly quota
|
|
595
|
+
* (rate-limit-per-minute still applies). [COMP-421]
|
|
596
|
+
*/
|
|
597
|
+
async listKpiCoverage() {
|
|
598
|
+
return this.client.get("/api/v1/stocks/with-kpis");
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* List the KPI metadata tuples available for a ticker — `id, name, category,
|
|
602
|
+
* chartType` — without paying the cost of the full series payload. Mirrors
|
|
603
|
+
* the `/api/v1/insights/stock/{ticker}/types` precedent.
|
|
604
|
+
*
|
|
605
|
+
* Auth: API key required, no quota cost. 404 if the ticker has no curated KPIs.
|
|
606
|
+
*/
|
|
607
|
+
async getKpiTypes(ticker) {
|
|
608
|
+
return this.client.get(
|
|
609
|
+
`/api/v1/stocks/${encodeURIComponent(ticker.toUpperCase())}/kpis/types`
|
|
610
|
+
);
|
|
611
|
+
}
|
|
481
612
|
};
|
|
482
613
|
|
|
483
614
|
// src/version.ts
|
|
484
|
-
var VERSION = "0.
|
|
615
|
+
var VERSION = "0.11.0";
|
|
485
616
|
|
|
486
617
|
// src/client.ts
|
|
487
618
|
var DEFAULT_BASE_URL = "https://app.sentisense.ai";
|
|
@@ -504,6 +635,7 @@ var SentiSense = class {
|
|
|
504
635
|
this.insider = new Insider(this);
|
|
505
636
|
this.politicians = new Politicians(this);
|
|
506
637
|
this.insights = new Insights(this);
|
|
638
|
+
this.analyst = new Analyst(this);
|
|
507
639
|
this.entityMetrics = new EntityMetrics(this);
|
|
508
640
|
this.marketMood = new MarketMoodResource(this);
|
|
509
641
|
this.marketSummary = new MarketSummaryResource(this);
|
|
@@ -567,6 +699,44 @@ var SentiSense = class {
|
|
|
567
699
|
}
|
|
568
700
|
throw new SentiSenseError("All retries exhausted");
|
|
569
701
|
}
|
|
702
|
+
/** @internal */
|
|
703
|
+
async post(path, body) {
|
|
704
|
+
const url = this.buildUrl(path);
|
|
705
|
+
const headers = {
|
|
706
|
+
"Accept": "application/json",
|
|
707
|
+
"Content-Type": "application/json"
|
|
708
|
+
};
|
|
709
|
+
if (this.apiKey) {
|
|
710
|
+
headers["X-SentiSense-API-Key"] = this.apiKey;
|
|
711
|
+
}
|
|
712
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
713
|
+
headers["User-Agent"] = `sentisense-node/${VERSION}`;
|
|
714
|
+
}
|
|
715
|
+
const controller = new AbortController();
|
|
716
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
717
|
+
try {
|
|
718
|
+
const response = await fetch(url, {
|
|
719
|
+
method: "POST",
|
|
720
|
+
headers,
|
|
721
|
+
body: JSON.stringify(body),
|
|
722
|
+
signal: controller.signal
|
|
723
|
+
});
|
|
724
|
+
if (!response.ok) {
|
|
725
|
+
await this.handleErrorResponse(response);
|
|
726
|
+
}
|
|
727
|
+
return await response.json();
|
|
728
|
+
} catch (error) {
|
|
729
|
+
if (error instanceof SentiSenseError) throw error;
|
|
730
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
731
|
+
throw new SentiSenseError(`Request timed out after ${this.timeout}ms`);
|
|
732
|
+
}
|
|
733
|
+
throw new SentiSenseError(
|
|
734
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
735
|
+
);
|
|
736
|
+
} finally {
|
|
737
|
+
clearTimeout(timer);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
570
740
|
buildUrl(path, params) {
|
|
571
741
|
const url = new URL(path, this.baseUrl);
|
|
572
742
|
if (params) {
|