finance-sentiment 2.2.0 → 2.3.1

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/README.md CHANGED
@@ -35,8 +35,8 @@ import { AdanosClient } from "finance-sentiment";
35
35
 
36
36
  const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
37
37
 
38
- const trending = await client.reddit.trending({ days: 7, limit: 10 });
39
- const tsla = await client.reddit.stock("TSLA", { days: 14 });
38
+ const trending = await client.reddit.trending({ limit: 10 });
39
+ const tsla = await client.reddit.stock("TSLA");
40
40
  const explanation = await client.reddit.explain("TSLA");
41
41
  const health = await client.health();
42
42
 
@@ -76,14 +76,14 @@ import { AdanosClient } from "finance-sentiment";
76
76
 
77
77
  const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
78
78
 
79
- const trending = await client.reddit.trending({ days: 7, limit: 10 });
80
- const sectors = await client.reddit.trendingSectors({ days: 7, limit: 10 });
81
- const countries = await client.reddit.trendingCountries({ days: 7, limit: 10 });
82
- const tsla = await client.reddit.stock("TSLA", { days: 14 });
79
+ const trending = await client.reddit.trending({ limit: 10 });
80
+ const sectors = await client.reddit.trendingSectors({ limit: 10 });
81
+ const countries = await client.reddit.trendingCountries({ limit: 10 });
82
+ const tsla = await client.reddit.stock("TSLA");
83
83
  const explanation = await client.reddit.explain("TSLA");
84
- const results = await client.reddit.search("Tesla", { days: 7, limit: 10 });
85
- const comparison = await client.reddit.compare(["TSLA", "AAPL", "MSFT"], { days: 7 });
86
- const market = await client.reddit.marketSentiment({ days: 7 });
84
+ const results = await client.reddit.search("Tesla", { limit: 10 });
85
+ const comparison = await client.reddit.compare(["TSLA", "AAPL", "MSFT"]);
86
+ const market = await client.reddit.marketSentiment();
87
87
  ```
88
88
 
89
89
  ### News
@@ -93,14 +93,14 @@ import { AdanosClient } from "finance-sentiment";
93
93
 
94
94
  const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
95
95
 
96
- const trending = await client.news.trending({ days: 7, source: "reuters" });
97
- const sectors = await client.news.trendingSectors({ days: 7, source: "reuters" });
98
- const countries = await client.news.trendingCountries({ days: 7, source: "reuters" });
99
- const nvda = await client.news.stock("NVDA", { days: 7 });
96
+ const trending = await client.news.trending({ source: "reuters" });
97
+ const sectors = await client.news.trendingSectors({ source: "reuters" });
98
+ const countries = await client.news.trendingCountries({ source: "reuters" });
99
+ const nvda = await client.news.stock("NVDA");
100
100
  const explanation = await client.news.explain("NVDA");
101
- const results = await client.news.search("Nvidia", { days: 7, limit: 10 });
102
- const comparison = await client.news.compare(["NVDA", "AAPL"], { days: 7 });
103
- const market = await client.news.marketSentiment({ days: 7 });
101
+ const results = await client.news.search("Nvidia", { limit: 10 });
102
+ const comparison = await client.news.compare(["NVDA", "AAPL"]);
103
+ const market = await client.news.marketSentiment();
104
104
  const stats = await client.news.stats();
105
105
  const health = await client.news.health();
106
106
  ```
@@ -112,14 +112,14 @@ import { AdanosClient } from "finance-sentiment";
112
112
 
113
113
  const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
114
114
 
115
- const trending = await client.x.trending({ days: 1, limit: 20 });
116
- const sectors = await client.x.trendingSectors({ days: 1, limit: 10 });
117
- const countries = await client.x.trendingCountries({ days: 1, limit: 10 });
115
+ const trending = await client.x.trending({ limit: 20 });
116
+ const sectors = await client.x.trendingSectors({ limit: 10 });
117
+ const countries = await client.x.trendingCountries({ limit: 10 });
118
118
  const nvda = await client.x.stock("NVDA");
119
119
  const explanation = await client.x.explain("NVDA");
120
- const results = await client.x.search("Nvidia", { days: 7, limit: 10 });
121
- const comparison = await client.x.compare(["NVDA", "AMD"], { days: 7 });
122
- const market = await client.x.marketSentiment({ days: 7 });
120
+ const results = await client.x.search("Nvidia", { limit: 10 });
121
+ const comparison = await client.x.compare(["NVDA", "AMD"]);
122
+ const market = await client.x.marketSentiment();
123
123
  const stats = await client.x.stats();
124
124
  const health = await client.x.health();
125
125
  ```
@@ -131,13 +131,13 @@ import { AdanosClient } from "finance-sentiment";
131
131
 
132
132
  const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
133
133
 
134
- const trending = await client.polymarket.trending({ days: 7, limit: 20, type: "stock" });
135
- const sectors = await client.polymarket.trendingSectors({ days: 7, limit: 10 });
136
- const countries = await client.polymarket.trendingCountries({ days: 7, limit: 10 });
134
+ const trending = await client.polymarket.trending({ limit: 20, type: "stock" });
135
+ const sectors = await client.polymarket.trendingSectors({ limit: 10 });
136
+ const countries = await client.polymarket.trendingCountries({ limit: 10 });
137
137
  const aapl = await client.polymarket.stock("AAPL");
138
- const results = await client.polymarket.search("Apple", { days: 7, limit: 10 });
139
- const comparison = await client.polymarket.compare(["AAPL", "TSLA"], { days: 7 });
140
- const market = await client.polymarket.marketSentiment({ days: 7 });
138
+ const results = await client.polymarket.search("Apple", { limit: 10 });
139
+ const comparison = await client.polymarket.compare(["AAPL", "TSLA"]);
140
+ const market = await client.polymarket.marketSentiment();
141
141
  const stats = await client.polymarket.stats();
142
142
  const health = await client.polymarket.health();
143
143
  ```
@@ -149,19 +149,19 @@ import { AdanosClient } from "finance-sentiment";
149
149
 
150
150
  const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
151
151
 
152
- const trending = await client.crypto.trending({ days: 7, limit: 20 });
153
- const btc = await client.crypto.token("BTC", { days: 14 });
154
- const mentions = await client.crypto.mentions("BTC", { days: 7, limit: 10, offset: 10 });
155
- const results = await client.crypto.search("bitcoin", { days: 7, limit: 10 });
156
- const comparison = await client.crypto.compare(["BTC", "ETH"], { days: 7 });
157
- const market = await client.crypto.marketSentiment({ days: 7 });
152
+ const trending = await client.crypto.trending({ limit: 20 });
153
+ const btc = await client.crypto.token("BTC");
154
+ const mentions = await client.crypto.mentions("BTC", { from: "2026-05-01", to: "2026-05-07", limit: 10, offset: 10 });
155
+ const results = await client.crypto.search("bitcoin", { limit: 10 });
156
+ const comparison = await client.crypto.compare(["BTC", "ETH"]);
157
+ const market = await client.crypto.marketSentiment();
158
158
  const stats = await client.crypto.stats();
159
159
  const health = await client.crypto.health();
160
160
  ```
161
161
 
162
162
  Polymarket semantics:
163
163
  - `buzz_score` is activity-first and optimized for current market attention
164
- - `total_liquidity` is a windowed signal over the selected `days`
164
+ - `total_liquidity` is a windowed signal over the selected period
165
165
  - `current_market_count` is the live-only active-market breadth; `market_count` remains the selected-window breadth
166
166
  - `top_mentions` on `stock()` are relevance-sorted by trading activity first
167
167
 
@@ -177,31 +177,33 @@ Polymarket semantics:
177
177
 
178
178
  | Method | Description |
179
179
  |--------|-------------|
180
- | `trending({ days, limit, offset, type })` | Trending stocks by buzz score |
181
- | `trendingSectors({ days, limit, offset })` | Trending sectors |
182
- | `trendingCountries({ days, limit, offset })` | Trending countries |
183
- | `stock(ticker, { days })` | Detailed sentiment for a ticker |
184
- | `mentions(ticker, { days, limit, offset, includeInherited })` | Raw Reddit mention rows |
180
+ | `trending({ from, to, days, limit, offset, type })` | Trending stocks by buzz score |
181
+ | `trendingSectors({ from, to, days, limit, offset })` | Trending sectors |
182
+ | `trendingCountries({ from, to, days, limit, offset })` | Trending countries |
183
+ | `stock(ticker, { from, to, days })` | Detailed sentiment for a ticker |
184
+ | `mentions(ticker, { from, to, days, limit, offset, includeInherited })` | Raw Reddit mention rows |
185
185
  | `explain(ticker)` | AI-generated trend explanation |
186
- | `search(query, { days, limit })` | Search stocks by name or ticker with recent-period summaries |
187
- | `compare(tickers, { days })` | Compare up to 10 stocks |
188
- | `marketSentiment({ days })` | Service-level Reddit market sentiment snapshot |
186
+ | `search(query, { from, to, days, limit })` | Search stocks by name or ticker with recent-period summaries |
187
+ | `compare(tickers, { from, to, days })` | Compare up to 10 stocks |
188
+ | `marketSentiment({ from, to, days })` | Service-level Reddit market sentiment snapshot |
189
189
  | `stats()` | Dataset statistics |
190
190
  | `health()` | Public service health |
191
191
 
192
+ Period options: use `from` and `to` as `YYYY-MM-DD` inclusive UTC dates for reproducible windows. `days` remains available as a legacy shorthand for v1 compatibility. The API returns `422` if `from`, `to`, and `days` are all sent together. Responses keep `period_days`; retain requested dates client-side if you need them later.
193
+
192
194
  ### `client.news.*`
193
195
 
194
196
  | Method | Description |
195
197
  |--------|-------------|
196
- | `trending({ days, limit, offset, type, source })` | Trending stocks from news |
197
- | `trendingSectors({ days, limit, offset, source })` | Trending sectors from news |
198
- | `trendingCountries({ days, limit, offset, source })` | Trending countries from news |
199
- | `stock(ticker, { days })` | Detailed news sentiment for a ticker |
200
- | `mentions(ticker, { days, limit, offset })` | Raw news mention rows |
198
+ | `trending({ from, to, days, limit, offset, type, source })` | Trending stocks from news |
199
+ | `trendingSectors({ from, to, days, limit, offset, source })` | Trending sectors from news |
200
+ | `trendingCountries({ from, to, days, limit, offset, source })` | Trending countries from news |
201
+ | `stock(ticker, { from, to, days })` | Detailed news sentiment for a ticker |
202
+ | `mentions(ticker, { from, to, days, limit, offset })` | Raw news mention rows |
201
203
  | `explain(ticker)` | AI-generated explanation from news context |
202
- | `search(query, { days, limit })` | Search stocks in the news dataset with recent-period summaries |
203
- | `compare(tickers, { days })` | Compare up to 10 stocks in news |
204
- | `marketSentiment({ days })` | Service-level News market sentiment snapshot |
204
+ | `search(query, { from, to, days, limit })` | Search stocks in the news dataset with recent-period summaries |
205
+ | `compare(tickers, { from, to, days })` | Compare up to 10 stocks in news |
206
+ | `marketSentiment({ from, to, days })` | Service-level News market sentiment snapshot |
205
207
  | `stats()` | News dataset statistics |
206
208
  | `health()` | Public news service health |
207
209
 
@@ -209,15 +211,15 @@ Polymarket semantics:
209
211
 
210
212
  | Method | Description |
211
213
  |--------|-------------|
212
- | `trending({ days, limit, offset, type })` | Trending stocks on X/Twitter |
213
- | `trendingSectors({ days, limit, offset })` | Trending sectors |
214
- | `trendingCountries({ days, limit, offset })` | Trending countries |
215
- | `stock(ticker, { days })` | Detailed X/Twitter sentiment |
216
- | `mentions(ticker, { days, limit, offset })` | Raw X/Twitter mention rows |
214
+ | `trending({ from, to, days, limit, offset, type })` | Trending stocks on X/Twitter |
215
+ | `trendingSectors({ from, to, days, limit, offset })` | Trending sectors |
216
+ | `trendingCountries({ from, to, days, limit, offset })` | Trending countries |
217
+ | `stock(ticker, { from, to, days })` | Detailed X/Twitter sentiment |
218
+ | `mentions(ticker, { from, to, days, limit, offset })` | Raw X/Twitter mention rows |
217
219
  | `explain(ticker)` | AI-generated explanation from X/Twitter context |
218
- | `search(query, { days, limit })` | Search stocks with recent-period summaries |
219
- | `compare(tickers, { days })` | Compare stocks |
220
- | `marketSentiment({ days })` | Service-level X/Twitter market sentiment snapshot |
220
+ | `search(query, { from, to, days, limit })` | Search stocks with recent-period summaries |
221
+ | `compare(tickers, { from, to, days })` | Compare stocks |
222
+ | `marketSentiment({ from, to, days })` | Service-level X/Twitter market sentiment snapshot |
221
223
  | `stats()` | Dataset statistics |
222
224
  | `health()` | Public service health |
223
225
 
@@ -225,14 +227,14 @@ Polymarket semantics:
225
227
 
226
228
  | Method | Description |
227
229
  |--------|-------------|
228
- | `trending({ days, limit, offset, type })` | Trending stocks on Polymarket with activity-first buzz and windowed liquidity |
229
- | `trendingSectors({ days, limit, offset })` | Trending sectors |
230
- | `trendingCountries({ days, limit, offset })` | Trending countries |
231
- | `stock(ticker, { days })` | Detailed Polymarket activity, sentiment, and relevance-sorted market questions |
232
- | `mentions(ticker, { days, limit, offset })` | Raw Polymarket market snapshots |
233
- | `search(query, { days, limit })` | Search stocks with recent-period summaries |
234
- | `compare(tickers, { days })` | Compare stocks with windowed Polymarket activity signals |
235
- | `marketSentiment({ days })` | Service-level Polymarket market sentiment snapshot |
230
+ | `trending({ from, to, days, limit, offset, type })` | Trending stocks on Polymarket with activity-first buzz and windowed liquidity |
231
+ | `trendingSectors({ from, to, days, limit, offset })` | Trending sectors |
232
+ | `trendingCountries({ from, to, days, limit, offset })` | Trending countries |
233
+ | `stock(ticker, { from, to, days })` | Detailed Polymarket activity, sentiment, and relevance-sorted market questions |
234
+ | `mentions(ticker, { from, to, days, limit, offset })` | Raw Polymarket market snapshots |
235
+ | `search(query, { from, to, days, limit })` | Search stocks with recent-period summaries |
236
+ | `compare(tickers, { from, to, days })` | Compare stocks with windowed Polymarket activity signals |
237
+ | `marketSentiment({ from, to, days })` | Service-level Polymarket market sentiment snapshot |
236
238
  | `stats()` | Dataset statistics |
237
239
  | `health()` | Public service health |
238
240
 
@@ -240,12 +242,12 @@ Polymarket semantics:
240
242
 
241
243
  | Method | Description |
242
244
  |--------|-------------|
243
- | `trending({ days, limit, offset })` | Trending Reddit crypto tokens |
244
- | `token(symbol, { days })` | Detailed token sentiment and buzz |
245
- | `mentions(symbol, { days, limit, offset, includeInherited })` | Raw Reddit crypto mention rows |
246
- | `search(query, { days, limit })` | Search tokens by symbol or name with recent-period summaries and market cap metadata |
247
- | `compare(symbols, { days })` | Compare multiple tokens |
248
- | `marketSentiment({ days })` | Service-level Reddit Crypto market sentiment snapshot |
245
+ | `trending({ from, to, days, limit, offset })` | Trending Reddit crypto tokens |
246
+ | `token(symbol, { from, to, days })` | Detailed token sentiment and buzz |
247
+ | `mentions(symbol, { from, to, days, limit, offset, includeInherited })` | Raw Reddit crypto mention rows |
248
+ | `search(query, { from, to, days, limit })` | Search tokens by symbol or name with recent-period summaries and market cap metadata |
249
+ | `compare(symbols, { from, to, days })` | Compare multiple tokens |
250
+ | `marketSentiment({ from, to, days })` | Service-level Reddit Crypto market sentiment snapshot |
249
251
  | `stats()` | Dataset statistics |
250
252
  | `health()` | Public service health |
251
253
 
package/dist/index.cjs CHANGED
@@ -40,13 +40,57 @@ var StockSentimentError = class extends Error {
40
40
  var ApiError = class extends StockSentimentError {
41
41
  status;
42
42
  detail;
43
- constructor(status, detail) {
43
+ payload;
44
+ constructor(status, detail, payload) {
44
45
  super(`${status}: ${detail}`);
45
46
  this.name = "ApiError";
46
47
  this.status = status;
47
48
  this.detail = detail;
49
+ this.payload = payload;
48
50
  }
49
51
  };
52
+ function isRecord(value) {
53
+ return typeof value === "object" && value !== null && !Array.isArray(value);
54
+ }
55
+ function formatValidationLocation(loc) {
56
+ if (Array.isArray(loc)) {
57
+ return loc.map(String).join(".");
58
+ }
59
+ return loc === void 0 || loc === null ? "" : String(loc);
60
+ }
61
+ function formatErrorDetail(detail) {
62
+ if (typeof detail === "string" && detail.trim()) {
63
+ return detail.trim();
64
+ }
65
+ if (Array.isArray(detail)) {
66
+ const messages = detail.map((item) => {
67
+ if (!isRecord(item)) return null;
68
+ const message = item.msg ?? item.message ?? item.error;
69
+ if (typeof message !== "string" || !message.trim()) return null;
70
+ const location = formatValidationLocation(item.loc);
71
+ return location ? `${location}: ${message.trim()}` : message.trim();
72
+ }).filter((message) => Boolean(message));
73
+ if (messages.length > 0) {
74
+ return messages.join("; ");
75
+ }
76
+ }
77
+ if (isRecord(detail)) {
78
+ for (const key of ["message", "error", "detail"]) {
79
+ const value = detail[key];
80
+ if (typeof value === "string" && value.trim()) {
81
+ return value.trim();
82
+ }
83
+ }
84
+ }
85
+ return JSON.stringify(detail);
86
+ }
87
+ function periodParams(options) {
88
+ return {
89
+ from: options.from,
90
+ to: options.to,
91
+ days: options.days
92
+ };
93
+ }
50
94
  var HttpClient = class {
51
95
  baseUrl;
52
96
  apiKey;
@@ -75,13 +119,14 @@ var HttpClient = class {
75
119
  });
76
120
  if (!response.ok) {
77
121
  let detail;
122
+ let payload;
78
123
  try {
79
- const body = await response.json();
80
- detail = body.detail ?? JSON.stringify(body);
124
+ payload = await response.json();
125
+ detail = isRecord(payload) && "detail" in payload ? formatErrorDetail(payload.detail) : JSON.stringify(payload);
81
126
  } catch {
82
127
  detail = response.statusText || `HTTP ${response.status}`;
83
128
  }
84
- throw new ApiError(response.status, detail);
129
+ throw new ApiError(response.status, detail, payload);
85
130
  }
86
131
  return response.json();
87
132
  }
@@ -105,7 +150,7 @@ var RedditNamespace = class extends PlatformNamespace {
105
150
  /** Get trending stocks on Reddit. */
106
151
  async trending(options = {}) {
107
152
  return this.request("/trending", {
108
- days: options.days,
153
+ ...periodParams(options),
109
154
  limit: options.limit,
110
155
  offset: options.offset,
111
156
  type: options.type
@@ -114,7 +159,7 @@ var RedditNamespace = class extends PlatformNamespace {
114
159
  /** Get trending sectors on Reddit. */
115
160
  async trendingSectors(options = {}) {
116
161
  return this.request("/trending/sectors", {
117
- days: options.days,
162
+ ...periodParams(options),
118
163
  limit: options.limit,
119
164
  offset: options.offset
120
165
  });
@@ -122,7 +167,7 @@ var RedditNamespace = class extends PlatformNamespace {
122
167
  /** Get trending countries on Reddit. */
123
168
  async trendingCountries(options = {}) {
124
169
  return this.request("/trending/countries", {
125
- days: options.days,
170
+ ...periodParams(options),
126
171
  limit: options.limit,
127
172
  offset: options.offset
128
173
  });
@@ -130,13 +175,13 @@ var RedditNamespace = class extends PlatformNamespace {
130
175
  /** Get sentiment for a specific stock ticker. */
131
176
  async stock(ticker, options = {}) {
132
177
  return this.request(`/stock/${encodeURIComponent(ticker)}`, {
133
- days: options.days
178
+ ...periodParams(options)
134
179
  });
135
180
  }
136
181
  /** Get raw Reddit mentions for a specific stock ticker. */
137
182
  async mentions(ticker, options = {}) {
138
183
  return this.request(`/stock/${encodeURIComponent(ticker)}/mentions`, {
139
- days: options.days,
184
+ ...periodParams(options),
140
185
  limit: options.limit,
141
186
  offset: options.offset,
142
187
  include_inherited: options.includeInherited?.toString()
@@ -150,7 +195,7 @@ var RedditNamespace = class extends PlatformNamespace {
150
195
  async search(query, options = {}) {
151
196
  return this.request("/search", {
152
197
  q: query,
153
- days: options.days,
198
+ ...periodParams(options),
154
199
  limit: options.limit
155
200
  });
156
201
  }
@@ -158,13 +203,13 @@ var RedditNamespace = class extends PlatformNamespace {
158
203
  async compare(tickers, options = {}) {
159
204
  return this.request("/compare", {
160
205
  tickers: tickers.join(","),
161
- days: options.days
206
+ ...periodParams(options)
162
207
  });
163
208
  }
164
209
  /** Get the service-level Reddit market sentiment snapshot. */
165
210
  async marketSentiment(options = {}) {
166
211
  return this.request("/market-sentiment", {
167
- days: options.days
212
+ ...periodParams(options)
168
213
  });
169
214
  }
170
215
  /** Get Reddit stock data statistics. */
@@ -184,7 +229,7 @@ var NewsNamespace = class extends PlatformNamespace {
184
229
  /** Get trending stocks from news. */
185
230
  async trending(options = {}) {
186
231
  return this.request("/trending", {
187
- days: options.days,
232
+ ...periodParams(options),
188
233
  limit: options.limit,
189
234
  offset: options.offset,
190
235
  type: options.type,
@@ -194,7 +239,7 @@ var NewsNamespace = class extends PlatformNamespace {
194
239
  /** Get trending sectors from news. */
195
240
  async trendingSectors(options = {}) {
196
241
  return this.request("/trending/sectors", {
197
- days: options.days,
242
+ ...periodParams(options),
198
243
  limit: options.limit,
199
244
  offset: options.offset,
200
245
  source: options.source
@@ -203,7 +248,7 @@ var NewsNamespace = class extends PlatformNamespace {
203
248
  /** Get trending countries from news. */
204
249
  async trendingCountries(options = {}) {
205
250
  return this.request("/trending/countries", {
206
- days: options.days,
251
+ ...periodParams(options),
207
252
  limit: options.limit,
208
253
  offset: options.offset,
209
254
  source: options.source
@@ -212,13 +257,13 @@ var NewsNamespace = class extends PlatformNamespace {
212
257
  /** Get sentiment for a specific stock ticker from news. */
213
258
  async stock(ticker, options = {}) {
214
259
  return this.request(`/stock/${encodeURIComponent(ticker)}`, {
215
- days: options.days
260
+ ...periodParams(options)
216
261
  });
217
262
  }
218
263
  /** Get raw news mentions for a specific stock ticker. */
219
264
  async mentions(ticker, options = {}) {
220
265
  return this.request(`/stock/${encodeURIComponent(ticker)}/mentions`, {
221
- days: options.days,
266
+ ...periodParams(options),
222
267
  limit: options.limit,
223
268
  offset: options.offset
224
269
  });
@@ -231,7 +276,7 @@ var NewsNamespace = class extends PlatformNamespace {
231
276
  async search(query, options = {}) {
232
277
  return this.request("/search", {
233
278
  q: query,
234
- days: options.days,
279
+ ...periodParams(options),
235
280
  limit: options.limit
236
281
  });
237
282
  }
@@ -239,13 +284,13 @@ var NewsNamespace = class extends PlatformNamespace {
239
284
  async compare(tickers, options = {}) {
240
285
  return this.request("/compare", {
241
286
  tickers: tickers.join(","),
242
- days: options.days
287
+ ...periodParams(options)
243
288
  });
244
289
  }
245
290
  /** Get the service-level News market sentiment snapshot. */
246
291
  async marketSentiment(options = {}) {
247
292
  return this.request("/market-sentiment", {
248
- days: options.days
293
+ ...periodParams(options)
249
294
  });
250
295
  }
251
296
  /** Get news data statistics. */
@@ -265,7 +310,7 @@ var XNamespace = class extends PlatformNamespace {
265
310
  /** Get trending stocks on X/Twitter. */
266
311
  async trending(options = {}) {
267
312
  return this.request("/trending", {
268
- days: options.days,
313
+ ...periodParams(options),
269
314
  limit: options.limit,
270
315
  offset: options.offset,
271
316
  type: options.type
@@ -274,7 +319,7 @@ var XNamespace = class extends PlatformNamespace {
274
319
  /** Get trending sectors on X/Twitter. */
275
320
  async trendingSectors(options = {}) {
276
321
  return this.request("/trending/sectors", {
277
- days: options.days,
322
+ ...periodParams(options),
278
323
  limit: options.limit,
279
324
  offset: options.offset
280
325
  });
@@ -282,7 +327,7 @@ var XNamespace = class extends PlatformNamespace {
282
327
  /** Get trending countries on X/Twitter. */
283
328
  async trendingCountries(options = {}) {
284
329
  return this.request("/trending/countries", {
285
- days: options.days,
330
+ ...periodParams(options),
286
331
  limit: options.limit,
287
332
  offset: options.offset
288
333
  });
@@ -290,13 +335,13 @@ var XNamespace = class extends PlatformNamespace {
290
335
  /** Get X/Twitter sentiment for a specific stock ticker. */
291
336
  async stock(ticker, options = {}) {
292
337
  return this.request(`/stock/${encodeURIComponent(ticker)}`, {
293
- days: options.days
338
+ ...periodParams(options)
294
339
  });
295
340
  }
296
341
  /** Get raw X/Twitter mentions for a specific stock ticker. */
297
342
  async mentions(ticker, options = {}) {
298
343
  return this.request(`/stock/${encodeURIComponent(ticker)}/mentions`, {
299
- days: options.days,
344
+ ...periodParams(options),
300
345
  limit: options.limit,
301
346
  offset: options.offset
302
347
  });
@@ -309,7 +354,7 @@ var XNamespace = class extends PlatformNamespace {
309
354
  async search(query, options = {}) {
310
355
  return this.request("/search", {
311
356
  q: query,
312
- days: options.days,
357
+ ...periodParams(options),
313
358
  limit: options.limit
314
359
  });
315
360
  }
@@ -317,13 +362,13 @@ var XNamespace = class extends PlatformNamespace {
317
362
  async compare(tickers, options = {}) {
318
363
  return this.request("/compare", {
319
364
  tickers: tickers.join(","),
320
- days: options.days
365
+ ...periodParams(options)
321
366
  });
322
367
  }
323
368
  /** Get the service-level X/Twitter market sentiment snapshot. */
324
369
  async marketSentiment(options = {}) {
325
370
  return this.request("/market-sentiment", {
326
- days: options.days
371
+ ...periodParams(options)
327
372
  });
328
373
  }
329
374
  /** Get X/Twitter data statistics. */
@@ -343,7 +388,7 @@ var PolymarketNamespace = class extends PlatformNamespace {
343
388
  /** Get trending stocks on Polymarket. */
344
389
  async trending(options = {}) {
345
390
  return this.request("/trending", {
346
- days: options.days,
391
+ ...periodParams(options),
347
392
  limit: options.limit,
348
393
  offset: options.offset,
349
394
  type: options.type
@@ -352,7 +397,7 @@ var PolymarketNamespace = class extends PlatformNamespace {
352
397
  /** Get trending sectors on Polymarket. */
353
398
  async trendingSectors(options = {}) {
354
399
  return this.request("/trending/sectors", {
355
- days: options.days,
400
+ ...periodParams(options),
356
401
  limit: options.limit,
357
402
  offset: options.offset
358
403
  });
@@ -360,7 +405,7 @@ var PolymarketNamespace = class extends PlatformNamespace {
360
405
  /** Get trending countries on Polymarket. */
361
406
  async trendingCountries(options = {}) {
362
407
  return this.request("/trending/countries", {
363
- days: options.days,
408
+ ...periodParams(options),
364
409
  limit: options.limit,
365
410
  offset: options.offset
366
411
  });
@@ -368,13 +413,13 @@ var PolymarketNamespace = class extends PlatformNamespace {
368
413
  /** Get Polymarket sentiment for a specific stock ticker. */
369
414
  async stock(ticker, options = {}) {
370
415
  return this.request(`/stock/${encodeURIComponent(ticker)}`, {
371
- days: options.days
416
+ ...periodParams(options)
372
417
  });
373
418
  }
374
419
  /** Get raw Polymarket snapshots for a specific stock ticker. */
375
420
  async mentions(ticker, options = {}) {
376
421
  return this.request(`/stock/${encodeURIComponent(ticker)}/mentions`, {
377
- days: options.days,
422
+ ...periodParams(options),
378
423
  limit: options.limit,
379
424
  offset: options.offset
380
425
  });
@@ -383,7 +428,7 @@ var PolymarketNamespace = class extends PlatformNamespace {
383
428
  async search(query, options = {}) {
384
429
  return this.request("/search", {
385
430
  q: query,
386
- days: options.days,
431
+ ...periodParams(options),
387
432
  limit: options.limit
388
433
  });
389
434
  }
@@ -391,13 +436,13 @@ var PolymarketNamespace = class extends PlatformNamespace {
391
436
  async compare(tickers, options = {}) {
392
437
  return this.request("/compare", {
393
438
  tickers: tickers.join(","),
394
- days: options.days
439
+ ...periodParams(options)
395
440
  });
396
441
  }
397
442
  /** Get the service-level Polymarket market sentiment snapshot. */
398
443
  async marketSentiment(options = {}) {
399
444
  return this.request("/market-sentiment", {
400
- days: options.days
445
+ ...periodParams(options)
401
446
  });
402
447
  }
403
448
  /** Get Polymarket data statistics. */
@@ -417,7 +462,7 @@ var RedditCryptoNamespace = class extends PlatformNamespace {
417
462
  /** Get trending crypto tokens on Reddit. */
418
463
  async trending(options = {}) {
419
464
  return this.request("/trending", {
420
- days: options.days,
465
+ ...periodParams(options),
421
466
  limit: options.limit,
422
467
  offset: options.offset
423
468
  });
@@ -425,13 +470,13 @@ var RedditCryptoNamespace = class extends PlatformNamespace {
425
470
  /** Get sentiment for a specific crypto token. */
426
471
  async token(symbol, options = {}) {
427
472
  return this.request(`/token/${encodeURIComponent(symbol)}`, {
428
- days: options.days
473
+ ...periodParams(options)
429
474
  });
430
475
  }
431
476
  /** Get raw Reddit mentions for a specific crypto token. */
432
477
  async mentions(symbol, options = {}) {
433
478
  return this.request(`/token/${encodeURIComponent(symbol)}/mentions`, {
434
- days: options.days,
479
+ ...periodParams(options),
435
480
  limit: options.limit,
436
481
  offset: options.offset,
437
482
  include_inherited: options.includeInherited?.toString()
@@ -441,7 +486,7 @@ var RedditCryptoNamespace = class extends PlatformNamespace {
441
486
  async search(query, options = {}) {
442
487
  return this.request("/search", {
443
488
  q: query,
444
- days: options.days,
489
+ ...periodParams(options),
445
490
  limit: options.limit
446
491
  });
447
492
  }
@@ -449,13 +494,13 @@ var RedditCryptoNamespace = class extends PlatformNamespace {
449
494
  async compare(symbols, options = {}) {
450
495
  return this.request("/compare", {
451
496
  symbols: symbols.join(","),
452
- days: options.days
497
+ ...periodParams(options)
453
498
  });
454
499
  }
455
500
  /** Get the service-level Reddit Crypto market sentiment snapshot. */
456
501
  async marketSentiment(options = {}) {
457
502
  return this.request("/market-sentiment", {
458
- days: options.days
503
+ ...periodParams(options)
459
504
  });
460
505
  }
461
506
  /** Get Reddit crypto data statistics. */