finance-sentiment 2.1.0 → 2.3.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.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * import { AdanosClient } from 'finance-sentiment';
9
9
  *
10
10
  * const client = new AdanosClient({ apiKey: 'adanos_api_key_here' });
11
- * const trending = await client.reddit.trending({ days: 7 });
11
+ * const trending = await client.reddit.trending({ limit: 10 });
12
12
  * ```
13
13
  */
14
14
  declare class StockSentimentError extends Error {
@@ -26,7 +26,11 @@ interface ClientOptions {
26
26
  timeout?: number;
27
27
  }
28
28
  interface TrendingOptions {
29
- /** Time period in days (1-90). Free tier limited to 30. */
29
+ /** Inclusive UTC start date (`YYYY-MM-DD`). Recommended for explicit periods. */
30
+ from?: string;
31
+ /** Inclusive UTC end date (`YYYY-MM-DD`). Recommended for explicit periods. */
32
+ to?: string;
33
+ /** Legacy period shorthand in days. Do not combine with both `from` and `to`. */
30
34
  days?: number;
31
35
  /** Max results (1-100). Default: 20. */
32
36
  limit?: number;
@@ -36,23 +40,36 @@ interface TrendingOptions {
36
40
  type?: string;
37
41
  }
38
42
  interface TrendingGroupOptions {
43
+ from?: string;
44
+ to?: string;
45
+ /** Legacy period shorthand in days. Do not combine with both `from` and `to`. */
39
46
  days?: number;
40
47
  limit?: number;
41
48
  offset?: number;
42
49
  }
43
50
  interface StockOptions {
44
- /** Time period in days (1-90). Default: 7. */
51
+ /** Inclusive UTC start date (`YYYY-MM-DD`). Recommended for explicit periods. */
52
+ from?: string;
53
+ /** Inclusive UTC end date (`YYYY-MM-DD`). Recommended for explicit periods. */
54
+ to?: string;
55
+ /** Legacy period shorthand in days. Do not combine with both `from` and `to`. */
45
56
  days?: number;
46
57
  }
47
58
  /** Alias — compare accepts the same options as a single-stock lookup. */
48
59
  type CompareOptions = StockOptions;
49
- type SearchOptions = Pick<TrendingGroupOptions, 'days' | 'limit'>;
50
- type MarketSentimentOptions = Pick<TrendingGroupOptions, 'days'>;
60
+ type SearchOptions = Pick<TrendingGroupOptions, 'from' | 'to' | 'days' | 'limit'>;
61
+ type MarketSentimentOptions = Pick<TrendingGroupOptions, 'from' | 'to' | 'days'>;
51
62
  interface RawMentionsOptions {
52
- /** Time period in days. */
63
+ /** Inclusive UTC start date (`YYYY-MM-DD`). Recommended for raw mention windows. */
64
+ from?: string;
65
+ /** Inclusive UTC end date (`YYYY-MM-DD`). Recommended for raw mention windows. */
66
+ to?: string;
67
+ /** Legacy period shorthand in days. Do not combine with both `from` and `to`. */
53
68
  days?: number;
54
69
  /** Max raw rows to return. */
55
70
  limit?: number;
71
+ /** Pagination offset. Default: 0. */
72
+ offset?: number;
56
73
  /** Include inherited Reddit thread context where supported. */
57
74
  includeInherited?: boolean;
58
75
  }
@@ -135,6 +152,9 @@ interface SchedulerStatus {
135
152
  success_rate?: number | null;
136
153
  note?: string | null;
137
154
  }
155
+ interface CryptoSchedulerStatus extends SchedulerStatus {
156
+ timed_out_scrape_threads?: number;
157
+ }
138
158
  interface HealthResponse {
139
159
  status: string;
140
160
  service?: string | null;
@@ -144,12 +164,64 @@ interface HealthResponse {
144
164
  scheduler?: SchedulerStatus | null;
145
165
  error?: string | null;
146
166
  }
167
+ interface CryptoHealthResponse {
168
+ status: string;
169
+ service?: string | null;
170
+ version?: string | null;
171
+ total_mentions?: number;
172
+ tokens_tracked?: number;
173
+ scheduler?: CryptoSchedulerStatus | null;
174
+ error?: string | null;
175
+ }
176
+ interface XSchedulerStatus {
177
+ running: boolean;
178
+ last_scrape?: string | null;
179
+ scrape_count?: number;
180
+ error_count?: number;
181
+ success_rate?: number;
182
+ note?: string | null;
183
+ }
184
+ interface XHealthResponse {
185
+ status: string;
186
+ service: string;
187
+ version: string;
188
+ total_mentions: number;
189
+ tickers_tracked: number;
190
+ scheduler?: XSchedulerStatus | null;
191
+ error?: string | null;
192
+ }
193
+ type PolymarketSchedulerStatus = XSchedulerStatus;
194
+ interface PolymarketHealthResponse {
195
+ status: string;
196
+ service: string;
197
+ version: string;
198
+ total_mentions: number;
199
+ tickers_tracked: number;
200
+ scheduler?: PolymarketSchedulerStatus | null;
201
+ error?: string | null;
202
+ }
203
+ interface RootHealthSummary {
204
+ total: number;
205
+ healthy: number;
206
+ unhealthy: number;
207
+ unhealthy_services: string[];
208
+ }
209
+ interface RootHealthResponse {
210
+ status: string;
211
+ service?: string | null;
212
+ version: string;
213
+ summary: RootHealthSummary;
214
+ services: Record<string, unknown>;
215
+ }
147
216
  interface StatsResponse {
148
217
  total_mentions: number;
149
218
  unique_tickers: number;
150
- tickers: string[];
219
+ mentions_today?: number;
220
+ unique_tickers_today?: number;
151
221
  supported_tickers: number;
152
222
  }
223
+ type RedditStatsResponse = StatsResponse;
224
+ type NewsStatsResponse = StatsResponse;
153
225
  interface StockSearchSummary {
154
226
  mentions: number;
155
227
  buzz_score: number;
@@ -445,6 +517,23 @@ interface XSearchResultItem {
445
517
  summary: XSearchSummary;
446
518
  }
447
519
  type XSearchResponse = SearchResponse<XSearchResultItem>;
520
+ interface XCompareStockItem {
521
+ ticker: string;
522
+ company_name?: string | null;
523
+ buzz_score: number;
524
+ trend?: 'rising' | 'falling' | 'stable' | null;
525
+ mentions: number;
526
+ unique_tweets: number;
527
+ sentiment_score?: number | null;
528
+ bullish_pct?: number | null;
529
+ bearish_pct?: number | null;
530
+ total_upvotes: number;
531
+ trend_history?: number[];
532
+ }
533
+ interface XCompareResponse {
534
+ period_days: number;
535
+ stocks: XCompareStockItem[];
536
+ }
448
537
  interface XTopTweet {
449
538
  text_snippet: string;
450
539
  sentiment_score?: number | null;
@@ -509,12 +598,14 @@ interface XRawMentionsResponse {
509
598
  count: number;
510
599
  results: XRawMentionItem[];
511
600
  }
601
+ type XStatsResponse = StatsResponse;
512
602
  interface PolymarketTrendingStock {
513
603
  ticker: string;
514
604
  buzz_score: number;
515
605
  trend: 'rising' | 'falling' | 'stable';
516
606
  trade_count: number;
517
607
  market_count: number;
608
+ current_market_count: number;
518
609
  unique_traders?: number | null;
519
610
  bullish_pct: number;
520
611
  bearish_pct: number;
@@ -551,6 +642,7 @@ interface PolymarketStockDetail {
551
642
  period_days?: number | null;
552
643
  trade_count?: number | null;
553
644
  market_count?: number | null;
645
+ current_market_count?: number | null;
554
646
  unique_traders?: number | null;
555
647
  sentiment_score?: number | null;
556
648
  positive_count?: number | null;
@@ -567,6 +659,7 @@ interface PolymarketTrendingGroupBase {
567
659
  trend: 'rising' | 'falling' | 'stable';
568
660
  trade_count: number;
569
661
  market_count: number;
662
+ current_market_count: number;
570
663
  unique_tickers: number;
571
664
  unique_traders?: number | null;
572
665
  sentiment_score?: number | null;
@@ -588,6 +681,7 @@ interface PolymarketCompareStockItem {
588
681
  trend?: 'rising' | 'falling' | 'stable' | null;
589
682
  trade_count: number;
590
683
  market_count: number;
684
+ current_market_count: number;
591
685
  unique_traders?: number | null;
592
686
  sentiment_score?: number | null;
593
687
  bullish_pct?: number | null;
@@ -610,6 +704,7 @@ interface PolymarketMarketSentiment {
610
704
  trend?: 'rising' | 'falling' | 'stable' | null;
611
705
  trade_count: number;
612
706
  market_count: number;
707
+ current_market_count: number;
613
708
  unique_traders: number;
614
709
  total_liquidity: number;
615
710
  active_tickers: number;
@@ -627,6 +722,7 @@ interface PolymarketSearchSummary {
627
722
  trend?: 'rising' | 'falling' | 'stable' | null;
628
723
  trade_count: number;
629
724
  market_count: number;
725
+ current_market_count: number;
630
726
  unique_traders?: number | null;
631
727
  sentiment_score?: number | null;
632
728
  bullish_pct?: number | null;
@@ -678,6 +774,14 @@ interface PolymarketRawMentionsResponse {
678
774
  count: number;
679
775
  results: PolymarketRawMentionItem[];
680
776
  }
777
+ interface PolymarketStatsResponse {
778
+ total_trades: number;
779
+ total_markets: number;
780
+ unique_tickers: number;
781
+ trades_today?: number;
782
+ unique_tickers_today?: number;
783
+ supported_tickers: number;
784
+ }
681
785
  interface CryptoTrendingToken {
682
786
  symbol: string;
683
787
  name?: string | null;
@@ -692,6 +796,24 @@ interface CryptoTrendingToken {
692
796
  total_upvotes: number;
693
797
  trend_history?: number[];
694
798
  }
799
+ interface CryptoSubredditCount {
800
+ subreddit: string;
801
+ count: number;
802
+ }
803
+ interface CryptoDailyTrendItem {
804
+ date: string;
805
+ mentions: number;
806
+ sentiment_score?: number | null;
807
+ buzz_score?: number | null;
808
+ }
809
+ interface CryptoTopMention {
810
+ text_snippet: string;
811
+ sentiment_score?: number | null;
812
+ sentiment_label?: string | null;
813
+ upvotes: number;
814
+ subreddit?: string | null;
815
+ created_utc: string;
816
+ }
695
817
  interface CryptoTokenSentiment {
696
818
  symbol: string;
697
819
  name?: string | null;
@@ -709,15 +831,28 @@ interface CryptoTokenSentiment {
709
831
  bullish_pct?: number | null;
710
832
  bearish_pct?: number | null;
711
833
  period_days?: number | null;
712
- top_subreddits?: SubredditCount[] | null;
713
- daily_trend?: DailyTrendItem[] | null;
714
- top_mentions?: TopMention[] | null;
834
+ top_subreddits?: CryptoSubredditCount[] | null;
835
+ daily_trend?: CryptoDailyTrendItem[] | null;
836
+ top_mentions?: CryptoTopMention[] | null;
837
+ }
838
+ interface CryptoSearchSummary {
839
+ mentions: number;
840
+ buzz_score: number;
841
+ trend?: 'rising' | 'falling' | 'stable' | null;
842
+ sentiment_score?: number | null;
843
+ bullish_pct?: number | null;
844
+ bearish_pct?: number | null;
845
+ unique_posts: number;
846
+ subreddit_count: number;
847
+ total_upvotes: number;
715
848
  }
716
849
  interface CryptoSearchItem {
717
850
  symbol: string;
718
851
  name: string;
719
- aliases?: string[] | null;
720
- summary: StockSearchSummary;
852
+ market_cap_rank?: number | null;
853
+ market_cap_usd?: number | null;
854
+ aliases?: string[];
855
+ summary: CryptoSearchSummary;
721
856
  }
722
857
  interface CryptoSearchResponse {
723
858
  query: string;
@@ -725,13 +860,24 @@ interface CryptoSearchResponse {
725
860
  period_days: number;
726
861
  results: CryptoSearchItem[];
727
862
  }
728
- interface CryptoCompareTokenItem extends CryptoTokenSentiment {
729
- trend_history?: number[];
730
- }
731
863
  interface CryptoCompareResponse {
732
864
  period_days: number;
733
865
  tokens: CryptoCompareTokenItem[];
734
866
  }
867
+ interface CryptoCompareTokenItem {
868
+ symbol: string;
869
+ name?: string | null;
870
+ buzz_score: number;
871
+ trend?: 'rising' | 'falling' | 'stable' | null;
872
+ mentions: number;
873
+ unique_posts: number;
874
+ subreddit_count: number;
875
+ sentiment_score?: number | null;
876
+ bullish_pct?: number | null;
877
+ bearish_pct?: number | null;
878
+ total_upvotes: number;
879
+ trend_history?: number[];
880
+ }
735
881
  interface CryptoRawMentionItem extends RedditRawMentionItem {
736
882
  }
737
883
  interface CryptoRawMentionsResponse {
@@ -747,7 +893,7 @@ interface CryptoMarketSentiment {
747
893
  unique_posts: number;
748
894
  subreddit_count: number;
749
895
  total_upvotes: number;
750
- active_tokens: number;
896
+ active_tickers: number;
751
897
  sentiment_score?: number | null;
752
898
  positive_count: number;
753
899
  negative_count: number;
@@ -755,17 +901,19 @@ interface CryptoMarketSentiment {
755
901
  bullish_pct: number;
756
902
  bearish_pct: number;
757
903
  trend_history: number[];
758
- drivers: Array<{
759
- symbol: string;
760
- buzz_score: number;
761
- sentiment_score?: number | null;
762
- mentions: number;
763
- }>;
904
+ drivers: CryptoMarketSentimentDriver[];
905
+ }
906
+ interface CryptoMarketSentimentDriver {
907
+ symbol: string;
908
+ mentions: number;
909
+ buzz_score: number;
910
+ sentiment_score?: number | null;
764
911
  }
765
912
  interface CryptoStatsResponse {
766
913
  total_mentions: number;
767
914
  unique_tokens: number;
768
- tokens: string[];
915
+ mentions_today?: number;
916
+ unique_tokens_today?: number;
769
917
  supported_tokens: number;
770
918
  }
771
919
  type QueryParams = Record<string, string | number | undefined>;
@@ -804,7 +952,7 @@ declare class RedditNamespace extends PlatformNamespace {
804
952
  /** Get the service-level Reddit market sentiment snapshot. */
805
953
  marketSentiment(options?: MarketSentimentOptions): Promise<RedditMarketSentiment>;
806
954
  /** Get Reddit stock data statistics. */
807
- stats(): Promise<StatsResponse>;
955
+ stats(): Promise<RedditStatsResponse>;
808
956
  /** Get public Reddit stock service health. */
809
957
  health(): Promise<HealthResponse>;
810
958
  }
@@ -830,7 +978,7 @@ declare class NewsNamespace extends PlatformNamespace {
830
978
  /** Get the service-level News market sentiment snapshot. */
831
979
  marketSentiment(options?: MarketSentimentOptions): Promise<NewsMarketSentiment>;
832
980
  /** Get news data statistics. */
833
- stats(): Promise<StatsResponse>;
981
+ stats(): Promise<NewsStatsResponse>;
834
982
  /** Get public news service health (no auth required on server side). */
835
983
  health(): Promise<HealthResponse>;
836
984
  }
@@ -852,13 +1000,13 @@ declare class XNamespace extends PlatformNamespace {
852
1000
  /** Search for stocks by name or ticker on X/Twitter. */
853
1001
  search(query: string, options?: SearchOptions): Promise<XSearchResponse>;
854
1002
  /** Compare multiple stocks side-by-side on X/Twitter. */
855
- compare(tickers: string[], options?: CompareOptions): Promise<CompareResponse>;
1003
+ compare(tickers: string[], options?: CompareOptions): Promise<XCompareResponse>;
856
1004
  /** Get the service-level X/Twitter market sentiment snapshot. */
857
1005
  marketSentiment(options?: MarketSentimentOptions): Promise<XMarketSentiment>;
858
1006
  /** Get X/Twitter data statistics. */
859
- stats(): Promise<StatsResponse>;
1007
+ stats(): Promise<XStatsResponse>;
860
1008
  /** Get public X/Twitter service health. */
861
- health(): Promise<HealthResponse>;
1009
+ health(): Promise<XHealthResponse>;
862
1010
  }
863
1011
  declare class PolymarketNamespace extends PlatformNamespace {
864
1012
  /** @internal */
@@ -880,9 +1028,9 @@ declare class PolymarketNamespace extends PlatformNamespace {
880
1028
  /** Get the service-level Polymarket market sentiment snapshot. */
881
1029
  marketSentiment(options?: MarketSentimentOptions): Promise<PolymarketMarketSentiment>;
882
1030
  /** Get Polymarket data statistics. */
883
- stats(): Promise<StatsResponse>;
1031
+ stats(): Promise<PolymarketStatsResponse>;
884
1032
  /** Get public Polymarket service health. */
885
- health(): Promise<HealthResponse>;
1033
+ health(): Promise<PolymarketHealthResponse>;
886
1034
  }
887
1035
  declare class RedditCryptoNamespace extends PlatformNamespace {
888
1036
  /** @internal */
@@ -902,7 +1050,7 @@ declare class RedditCryptoNamespace extends PlatformNamespace {
902
1050
  /** Get Reddit crypto data statistics. */
903
1051
  stats(): Promise<CryptoStatsResponse>;
904
1052
  /** Get public Reddit crypto service health. */
905
- health(): Promise<HealthResponse>;
1053
+ health(): Promise<CryptoHealthResponse>;
906
1054
  }
907
1055
  declare class AdanosClient {
908
1056
  readonly news: NewsNamespace;
@@ -911,6 +1059,7 @@ declare class AdanosClient {
911
1059
  readonly redditCrypto: RedditCryptoNamespace;
912
1060
  readonly x: XNamespace;
913
1061
  readonly polymarket: PolymarketNamespace;
1062
+ private readonly http;
914
1063
  /**
915
1064
  * Create a new Adanos Market Sentiment API client.
916
1065
  *
@@ -919,7 +1068,9 @@ declare class AdanosClient {
919
1068
  * @param options.timeout - Request timeout in ms. Default: 30000.
920
1069
  */
921
1070
  constructor(options: ClientOptions);
1071
+ /** Get aggregate API health across all public market sentiment services. */
1072
+ health(): Promise<RootHealthResponse>;
922
1073
  }
923
1074
  declare const StockSentimentClient: typeof AdanosClient;
924
1075
 
925
- export { AdanosClient, ApiError, type ClientOptions, type CompareOptions, type CompareResponse, type CompareStockItem, type CryptoCompareResponse, type CryptoCompareTokenItem, type CryptoMarketSentiment, type CryptoRawMentionItem, type CryptoRawMentionsResponse, type CryptoSearchItem, type CryptoSearchResponse, type CryptoStatsResponse, type CryptoTokenSentiment, type CryptoTrendingToken, type DailyTrendItem, type HealthResponse, type MarketSentimentDriver, type MarketSentimentOptions, type NewsCompareOptions, type NewsCompareResponse, type NewsCompareStockItem, type NewsMarketSentiment, NewsNamespace, type NewsRawMentionItem, type NewsRawMentionsResponse, type NewsSearchResultItem, type NewsSearchSummary, type NewsSourceCount, type NewsSourceOptions, type NewsStockOptions, type NewsStockSentiment, type NewsTopMention, type NewsTrendingCountry, type NewsTrendingGroupOptions, type NewsTrendingOptions, type NewsTrendingSector, type NewsTrendingStock, type PolymarketCompareResponse, type PolymarketCompareStockItem, type PolymarketDailyTrendItem, type PolymarketMarketSentiment, type PolymarketMarketSentimentDriver, PolymarketNamespace, type PolymarketRawMentionItem, type PolymarketRawMentionsResponse, type PolymarketSearchResponse, type PolymarketSearchResultItem, type PolymarketSearchSummary, type PolymarketStockDetail, type PolymarketTopMention, type PolymarketTrendingCountry, type PolymarketTrendingSector, type PolymarketTrendingStock, type RawMentionsOptions, RedditCryptoNamespace, type RedditMarketSentiment, RedditNamespace, type RedditRawMentionItem, type RedditRawMentionsResponse, type SchedulerStatus, type SearchOptions, type SearchResponse, type SearchResultItem, type StatsResponse, type StockExplanationResponse, type StockOptions, type StockSearchSummary, type StockSentiment, StockSentimentClient, StockSentimentError, type SubredditCount, type TopMention, type TrendingCountry, type TrendingGroupOptions, type TrendingOptions, type TrendingSector, type TrendingStock, type XDailyTrendItem, type XMarketSentiment, XNamespace, type XRawMentionItem, type XRawMentionsResponse, type XSearchResponse, type XSearchResultItem, type XSearchSummary, type XStockDetail, type XTopTweet, type XTrendingCountry, type XTrendingSector, type XTrendingStock };
1076
+ export { AdanosClient, ApiError, type ClientOptions, type CompareOptions, type CompareResponse, type CompareStockItem, type CryptoCompareResponse, type CryptoCompareTokenItem, type CryptoDailyTrendItem, type CryptoHealthResponse, type CryptoMarketSentiment, type CryptoMarketSentimentDriver, type CryptoRawMentionItem, type CryptoRawMentionsResponse, type CryptoSchedulerStatus, type CryptoSearchItem, type CryptoSearchResponse, type CryptoSearchSummary, type CryptoStatsResponse, type CryptoSubredditCount, type CryptoTokenSentiment, type CryptoTopMention, type CryptoTrendingToken, type DailyTrendItem, type HealthResponse, type MarketSentimentDriver, type MarketSentimentOptions, type NewsCompareOptions, type NewsCompareResponse, type NewsCompareStockItem, type NewsMarketSentiment, NewsNamespace, type NewsRawMentionItem, type NewsRawMentionsResponse, type NewsSearchResultItem, type NewsSearchSummary, type NewsSourceCount, type NewsSourceOptions, type NewsStatsResponse, type NewsStockOptions, type NewsStockSentiment, type NewsTopMention, type NewsTrendingCountry, type NewsTrendingGroupOptions, type NewsTrendingOptions, type NewsTrendingSector, type NewsTrendingStock, type PolymarketCompareResponse, type PolymarketCompareStockItem, type PolymarketDailyTrendItem, type PolymarketHealthResponse, type PolymarketMarketSentiment, type PolymarketMarketSentimentDriver, PolymarketNamespace, type PolymarketRawMentionItem, type PolymarketRawMentionsResponse, type PolymarketSchedulerStatus, type PolymarketSearchResponse, type PolymarketSearchResultItem, type PolymarketSearchSummary, type PolymarketStatsResponse, type PolymarketStockDetail, type PolymarketTopMention, type PolymarketTrendingCountry, type PolymarketTrendingSector, type PolymarketTrendingStock, type RawMentionsOptions, RedditCryptoNamespace, type RedditMarketSentiment, RedditNamespace, type RedditRawMentionItem, type RedditRawMentionsResponse, type RedditStatsResponse, type RootHealthResponse, type RootHealthSummary, type SchedulerStatus, type SearchOptions, type SearchResponse, type SearchResultItem, type StatsResponse, type StockExplanationResponse, type StockOptions, type StockSearchSummary, type StockSentiment, StockSentimentClient, StockSentimentError, type SubredditCount, type TopMention, type TrendingCountry, type TrendingGroupOptions, type TrendingOptions, type TrendingSector, type TrendingStock, type XCompareResponse, type XCompareStockItem, type XDailyTrendItem, type XHealthResponse, type XMarketSentiment, XNamespace, type XRawMentionItem, type XRawMentionsResponse, type XSchedulerStatus, type XSearchResponse, type XSearchResultItem, type XSearchSummary, type XStatsResponse, type XStockDetail, type XTopTweet, type XTrendingCountry, type XTrendingSector, type XTrendingStock };