sentisense 0.1.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/LICENSE +21 -0
- package/README.md +138 -0
- package/dist/index.cjs +434 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +413 -0
- package/dist/index.d.ts +413 -0
- package/dist/index.mjs +401 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
interface SentiSenseOptions {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
}
|
|
6
|
+
interface StockPrice {
|
|
7
|
+
ticker: string;
|
|
8
|
+
price: number;
|
|
9
|
+
change: number;
|
|
10
|
+
changePercent: number;
|
|
11
|
+
previousClose: number;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
}
|
|
14
|
+
interface StockDetail {
|
|
15
|
+
ticker: string;
|
|
16
|
+
name: string;
|
|
17
|
+
kbEntityId?: string;
|
|
18
|
+
urlSlug?: string;
|
|
19
|
+
}
|
|
20
|
+
interface StockImage {
|
|
21
|
+
iconUrl: string | null;
|
|
22
|
+
logoUrl: string | null;
|
|
23
|
+
}
|
|
24
|
+
interface StockProfile {
|
|
25
|
+
ticker: string;
|
|
26
|
+
name: string;
|
|
27
|
+
ceo?: string;
|
|
28
|
+
sector?: string;
|
|
29
|
+
industry?: string;
|
|
30
|
+
marketCap?: number;
|
|
31
|
+
description?: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
interface StockEntity {
|
|
35
|
+
entityId: string;
|
|
36
|
+
name: string;
|
|
37
|
+
type: string;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
interface ChartDataPoint {
|
|
41
|
+
date: string;
|
|
42
|
+
open: number;
|
|
43
|
+
high: number;
|
|
44
|
+
low: number;
|
|
45
|
+
close: number;
|
|
46
|
+
volume: number;
|
|
47
|
+
}
|
|
48
|
+
interface ChartData {
|
|
49
|
+
ticker: string;
|
|
50
|
+
timeframe: string;
|
|
51
|
+
data: ChartDataPoint[];
|
|
52
|
+
}
|
|
53
|
+
interface MarketStatus {
|
|
54
|
+
status: string;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
interface Fundamentals {
|
|
58
|
+
ticker: string;
|
|
59
|
+
timeframe: string;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
interface FundamentalsPeriod {
|
|
63
|
+
fiscalPeriod: string;
|
|
64
|
+
fiscalYear: number;
|
|
65
|
+
}
|
|
66
|
+
interface ShortInterest {
|
|
67
|
+
ticker: string;
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
}
|
|
70
|
+
interface FloatInfo {
|
|
71
|
+
ticker: string;
|
|
72
|
+
[key: string]: unknown;
|
|
73
|
+
}
|
|
74
|
+
interface ShortVolume {
|
|
75
|
+
ticker: string;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
78
|
+
interface MetricsBreakdown {
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
interface AISummary {
|
|
82
|
+
ticker: string;
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
interface GetChartOptions {
|
|
86
|
+
timeframe?: "1M" | "3M" | "6M" | "1Y";
|
|
87
|
+
}
|
|
88
|
+
interface GetImagesOptions {
|
|
89
|
+
forced?: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface GetDescriptionsOptions {
|
|
92
|
+
forced?: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface GetSimilarOptions {
|
|
95
|
+
limit?: number;
|
|
96
|
+
}
|
|
97
|
+
interface GetProfileOptions {
|
|
98
|
+
forced?: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface GetAISummaryOptions {
|
|
101
|
+
depth?: "basic" | "deep";
|
|
102
|
+
forceRefresh?: boolean;
|
|
103
|
+
}
|
|
104
|
+
interface GetMetricsBreakdownOptions {
|
|
105
|
+
startTime?: number;
|
|
106
|
+
endTime?: number;
|
|
107
|
+
}
|
|
108
|
+
interface GetFundamentalsOptions {
|
|
109
|
+
timeframe?: "quarterly" | "annual";
|
|
110
|
+
fiscalPeriod?: string;
|
|
111
|
+
fiscalYear?: number;
|
|
112
|
+
}
|
|
113
|
+
type DocumentSource = "news" | "reddit" | "x" | "substack";
|
|
114
|
+
interface Document {
|
|
115
|
+
id: string;
|
|
116
|
+
text: string;
|
|
117
|
+
subtext: string;
|
|
118
|
+
url: string;
|
|
119
|
+
source: "NEWS" | "REDDIT" | "X" | "SUBSTACK";
|
|
120
|
+
publisher: string;
|
|
121
|
+
published: number;
|
|
122
|
+
averageSentiment: number;
|
|
123
|
+
reliability: number;
|
|
124
|
+
sentimentMap: Record<string, string>;
|
|
125
|
+
primaryImageUrl: string | null;
|
|
126
|
+
}
|
|
127
|
+
interface StoryCluster {
|
|
128
|
+
id: string;
|
|
129
|
+
title: string;
|
|
130
|
+
summarizedContent: string;
|
|
131
|
+
selectedImageUrl: string | null;
|
|
132
|
+
clusterSize: number;
|
|
133
|
+
averageSentiment: number;
|
|
134
|
+
createdAt: number;
|
|
135
|
+
}
|
|
136
|
+
interface Story {
|
|
137
|
+
cluster: StoryCluster;
|
|
138
|
+
displayTickers: string[];
|
|
139
|
+
tickers: string[];
|
|
140
|
+
impactScore: number;
|
|
141
|
+
representativeTimestamp: number;
|
|
142
|
+
topDocuments?: Document[];
|
|
143
|
+
}
|
|
144
|
+
interface TheNewsResponse {
|
|
145
|
+
[key: string]: unknown;
|
|
146
|
+
}
|
|
147
|
+
interface GetByTickerOptions {
|
|
148
|
+
source?: DocumentSource;
|
|
149
|
+
days?: number;
|
|
150
|
+
hours?: number;
|
|
151
|
+
limit?: number;
|
|
152
|
+
}
|
|
153
|
+
interface GetByTickerRangeOptions {
|
|
154
|
+
startDate: string;
|
|
155
|
+
endDate: string;
|
|
156
|
+
source?: DocumentSource;
|
|
157
|
+
limit?: number;
|
|
158
|
+
}
|
|
159
|
+
interface GetByEntityOptions {
|
|
160
|
+
source?: DocumentSource;
|
|
161
|
+
days?: number;
|
|
162
|
+
hours?: number;
|
|
163
|
+
limit?: number;
|
|
164
|
+
}
|
|
165
|
+
interface SearchDocumentsOptions {
|
|
166
|
+
source?: DocumentSource;
|
|
167
|
+
days?: number;
|
|
168
|
+
limit?: number;
|
|
169
|
+
}
|
|
170
|
+
interface GetBySourceOptions {
|
|
171
|
+
days?: number;
|
|
172
|
+
hours?: number;
|
|
173
|
+
limit?: number;
|
|
174
|
+
}
|
|
175
|
+
interface GetStoriesOptions {
|
|
176
|
+
limit?: number;
|
|
177
|
+
days?: number;
|
|
178
|
+
offset?: number;
|
|
179
|
+
expanded?: boolean;
|
|
180
|
+
filterHours?: number;
|
|
181
|
+
}
|
|
182
|
+
interface GetStoryOptions {
|
|
183
|
+
share?: boolean;
|
|
184
|
+
}
|
|
185
|
+
interface GetStoriesByTickerOptions {
|
|
186
|
+
limit?: number;
|
|
187
|
+
}
|
|
188
|
+
interface Quarter {
|
|
189
|
+
value: string;
|
|
190
|
+
label: string;
|
|
191
|
+
reportDate: string;
|
|
192
|
+
}
|
|
193
|
+
interface InstitutionalFlow {
|
|
194
|
+
ticker: string;
|
|
195
|
+
companyName: string;
|
|
196
|
+
totalSharesBought: number;
|
|
197
|
+
totalSharesSold: number;
|
|
198
|
+
netSharesChange: number;
|
|
199
|
+
newPositions: number;
|
|
200
|
+
increasedPositions: number;
|
|
201
|
+
decreasedPositions: number;
|
|
202
|
+
soldOutPositions: number;
|
|
203
|
+
indexFundNetChange: number;
|
|
204
|
+
hedgeFundNetChange: number;
|
|
205
|
+
activistActivity: boolean;
|
|
206
|
+
reportDate: string;
|
|
207
|
+
}
|
|
208
|
+
interface Holder {
|
|
209
|
+
filerCik: string;
|
|
210
|
+
filerName: string;
|
|
211
|
+
filerCategory: string;
|
|
212
|
+
shares: number;
|
|
213
|
+
valueUsd: number;
|
|
214
|
+
changeType: "NEW" | "INCREASED" | "DECREASED" | "SOLD_OUT" | "UNCHANGED";
|
|
215
|
+
sharesChange: number;
|
|
216
|
+
sharesChangePct: number;
|
|
217
|
+
}
|
|
218
|
+
interface GetFlowsOptions {
|
|
219
|
+
limit?: number;
|
|
220
|
+
}
|
|
221
|
+
interface MentionData {
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
interface MentionCount {
|
|
225
|
+
[key: string]: unknown;
|
|
226
|
+
}
|
|
227
|
+
interface SentimentData {
|
|
228
|
+
[key: string]: unknown;
|
|
229
|
+
}
|
|
230
|
+
interface EntityMetricsDateRange {
|
|
231
|
+
startDate?: string;
|
|
232
|
+
endDate?: string;
|
|
233
|
+
}
|
|
234
|
+
interface GetMentionsOptions extends EntityMetricsDateRange {
|
|
235
|
+
source?: DocumentSource;
|
|
236
|
+
}
|
|
237
|
+
interface GetMentionCountOptions extends EntityMetricsDateRange {
|
|
238
|
+
source?: DocumentSource;
|
|
239
|
+
}
|
|
240
|
+
interface GetSentimentBySourceOptions {
|
|
241
|
+
date?: string;
|
|
242
|
+
}
|
|
243
|
+
interface MarketMood {
|
|
244
|
+
[key: string]: unknown;
|
|
245
|
+
}
|
|
246
|
+
interface KBEntity {
|
|
247
|
+
entityId: string;
|
|
248
|
+
name: string;
|
|
249
|
+
[key: string]: unknown;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
declare class Documents {
|
|
253
|
+
private client;
|
|
254
|
+
constructor(client: APIClient);
|
|
255
|
+
/** Get news articles for a stock. */
|
|
256
|
+
getByTicker(ticker: string, options?: GetByTickerOptions): Promise<Document[]>;
|
|
257
|
+
/** Get news articles for a stock within a date range. */
|
|
258
|
+
getByTickerRange(ticker: string, options: GetByTickerRangeOptions): Promise<Document[]>;
|
|
259
|
+
/** Get documents for a KB entity. */
|
|
260
|
+
getByEntity(entityId: string, options?: GetByEntityOptions): Promise<Document[]>;
|
|
261
|
+
/** Smart search with natural language query parsing. */
|
|
262
|
+
search(query: string, options?: SearchDocumentsOptions): Promise<Document[]>;
|
|
263
|
+
/** Get latest documents from a source type. */
|
|
264
|
+
getBySource(source: DocumentSource, options?: GetBySourceOptions): Promise<Document[]>;
|
|
265
|
+
/** Get AI-curated news story clusters. */
|
|
266
|
+
getStories(options?: GetStoriesOptions): Promise<Story[]>;
|
|
267
|
+
/** Get detailed story with all source documents. Free users get preview. */
|
|
268
|
+
getStory(clusterId: string, options?: GetStoryOptions): Promise<Story>;
|
|
269
|
+
/** Get stories for a specific stock. */
|
|
270
|
+
getStoriesByTicker(ticker: string, options?: GetStoriesByTickerOptions): Promise<Story[]>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
declare class EntityMetrics {
|
|
274
|
+
private client;
|
|
275
|
+
constructor(client: APIClient);
|
|
276
|
+
/** Get mention data for a stock. */
|
|
277
|
+
getMentions(symbol: string, options?: GetMentionsOptions): Promise<MentionData>;
|
|
278
|
+
/** Get mention counts broken down by source. */
|
|
279
|
+
getMentionCountBySource(symbol: string, options?: EntityMetricsDateRange): Promise<MentionCount>;
|
|
280
|
+
/** Get total mention count. */
|
|
281
|
+
getMentionCount(symbol: string, options?: GetMentionCountOptions): Promise<MentionCount>;
|
|
282
|
+
/** Get sentiment data for a stock. */
|
|
283
|
+
getSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
|
|
284
|
+
/** Get sentiment broken down by source. */
|
|
285
|
+
getSentimentBySource(symbol: string, options?: GetSentimentBySourceOptions): Promise<SentimentData>;
|
|
286
|
+
/** Get average sentiment score. */
|
|
287
|
+
getAverageSentiment(symbol: string, options?: EntityMetricsDateRange): Promise<SentimentData>;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
declare class Institutional {
|
|
291
|
+
private client;
|
|
292
|
+
constructor(client: APIClient);
|
|
293
|
+
/** Get available 13F reporting quarters. */
|
|
294
|
+
getQuarters(): Promise<Quarter[]>;
|
|
295
|
+
/** Get aggregate institutional activity per ticker for a quarter. */
|
|
296
|
+
getFlows(reportDate: string, options?: GetFlowsOptions): Promise<InstitutionalFlow[]>;
|
|
297
|
+
/** Get institutional holders for a specific stock. */
|
|
298
|
+
getHolders(ticker: string, reportDate: string): Promise<Holder[]>;
|
|
299
|
+
/** Get activist investor positions (NEW or INCREASED). */
|
|
300
|
+
getActivists(reportDate: string): Promise<Holder[]>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
declare class KB {
|
|
304
|
+
private client;
|
|
305
|
+
constructor(client: APIClient);
|
|
306
|
+
/** Get popular entities for search suggestions. */
|
|
307
|
+
getPopularEntities(): Promise<KBEntity[]>;
|
|
308
|
+
/** Get entity detail with metrics and relationships. */
|
|
309
|
+
getEntity(entityId: string): Promise<KBEntity>;
|
|
310
|
+
/** Get all tracked entities. */
|
|
311
|
+
getAllEntities(): Promise<KBEntity[]>;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
declare class MarketMoodResource {
|
|
315
|
+
private client;
|
|
316
|
+
constructor(client: APIClient);
|
|
317
|
+
/** Get market mood data (scores, history, sectors). */
|
|
318
|
+
get(): Promise<MarketMood>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
declare class Stocks {
|
|
322
|
+
private client;
|
|
323
|
+
constructor(client: APIClient);
|
|
324
|
+
/** List all available ticker symbols. */
|
|
325
|
+
list(): Promise<string[]>;
|
|
326
|
+
/** List all stocks with name, kbEntityId, urlSlug. */
|
|
327
|
+
listDetailed(): Promise<StockDetail[]>;
|
|
328
|
+
/** Get popular ticker symbols. */
|
|
329
|
+
listPopular(): Promise<string[]>;
|
|
330
|
+
/** Get popular stocks with details. */
|
|
331
|
+
listPopularDetailed(): Promise<StockDetail[]>;
|
|
332
|
+
/** Get real-time price for a single ticker. */
|
|
333
|
+
getPrice(ticker: string): Promise<StockPrice>;
|
|
334
|
+
/** Get real-time prices for multiple tickers. */
|
|
335
|
+
getPrices(tickers: string[]): Promise<Record<string, StockPrice>>;
|
|
336
|
+
/** Get batch company logo URLs. */
|
|
337
|
+
getImages(tickers: string[], options?: GetImagesOptions): Promise<Record<string, StockImage>>;
|
|
338
|
+
/** Get company profiles with branding, market cap, sector. */
|
|
339
|
+
getDescriptions(tickers: string[], options?: GetDescriptionsOptions): Promise<Record<string, StockProfile>>;
|
|
340
|
+
/** Get peer/similar stocks. */
|
|
341
|
+
getSimilar(ticker: string, options?: GetSimilarOptions): Promise<StockDetail[]>;
|
|
342
|
+
/** Get company profile (CEO, sector, industry, market data). */
|
|
343
|
+
getProfile(ticker: string, options?: GetProfileOptions): Promise<StockProfile>;
|
|
344
|
+
/** Get related KB entities (people, products, partners). */
|
|
345
|
+
getEntities(ticker: string): Promise<StockEntity[]>;
|
|
346
|
+
/** Get AI-generated stock analysis report. Requires PRO tier. */
|
|
347
|
+
getAISummary(ticker: string, options?: GetAISummaryOptions): Promise<AISummary>;
|
|
348
|
+
/** Get sentiment/mention metrics breakdown by entity. */
|
|
349
|
+
getMetricsBreakdown(ticker: string, metricType: string, options?: GetMetricsBreakdownOptions): Promise<MetricsBreakdown>;
|
|
350
|
+
/** Get historical OHLCV chart data. */
|
|
351
|
+
getChart(ticker: string, options?: GetChartOptions): Promise<ChartData>;
|
|
352
|
+
/** Get current market open/closed/pre-market/after-hours status. */
|
|
353
|
+
getMarketStatus(): Promise<MarketStatus>;
|
|
354
|
+
/** Get financial statement data. */
|
|
355
|
+
getFundamentals(ticker: string, options?: GetFundamentalsOptions): Promise<Fundamentals>;
|
|
356
|
+
/** Get available fiscal periods. */
|
|
357
|
+
getFundamentalsPeriods(ticker: string): Promise<FundamentalsPeriod[]>;
|
|
358
|
+
/** Get most recent fundamentals snapshot. */
|
|
359
|
+
getCurrentFundamentals(ticker: string): Promise<Fundamentals>;
|
|
360
|
+
/** Get historical P/E, P/B, P/S ratios. */
|
|
361
|
+
getHistoricalRatios(ticker: string): Promise<unknown>;
|
|
362
|
+
/** Get historical revenue data. */
|
|
363
|
+
getHistoricalRevenue(ticker: string): Promise<unknown>;
|
|
364
|
+
/** Get short interest metrics (FINRA). */
|
|
365
|
+
getShortInterest(ticker: string): Promise<ShortInterest>;
|
|
366
|
+
/** Get float information. */
|
|
367
|
+
getFloat(ticker: string): Promise<FloatInfo>;
|
|
368
|
+
/** Get short volume trading data. */
|
|
369
|
+
getShortVolume(ticker: string): Promise<ShortVolume>;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** @internal HTTP interface exposed to resource classes. */
|
|
373
|
+
interface APIClient {
|
|
374
|
+
get<T = unknown>(path: string, params?: object): Promise<T>;
|
|
375
|
+
}
|
|
376
|
+
declare class SentiSense implements APIClient {
|
|
377
|
+
private baseUrl;
|
|
378
|
+
private apiKey;
|
|
379
|
+
private timeout;
|
|
380
|
+
readonly stocks: Stocks;
|
|
381
|
+
readonly documents: Documents;
|
|
382
|
+
readonly institutional: Institutional;
|
|
383
|
+
readonly entityMetrics: EntityMetrics;
|
|
384
|
+
readonly marketMood: MarketMoodResource;
|
|
385
|
+
readonly kb: KB;
|
|
386
|
+
constructor(options?: SentiSenseOptions);
|
|
387
|
+
/** @internal */
|
|
388
|
+
get<T = unknown>(path: string, params?: object): Promise<T>;
|
|
389
|
+
private buildUrl;
|
|
390
|
+
private handleErrorResponse;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
declare class SentiSenseError extends Error {
|
|
394
|
+
status?: number;
|
|
395
|
+
code?: string;
|
|
396
|
+
constructor(message: string, status?: number, code?: string);
|
|
397
|
+
}
|
|
398
|
+
declare class AuthenticationError extends SentiSenseError {
|
|
399
|
+
constructor(message: string, status: number, code?: string);
|
|
400
|
+
}
|
|
401
|
+
declare class NotFoundError extends SentiSenseError {
|
|
402
|
+
constructor(message: string, code?: string);
|
|
403
|
+
}
|
|
404
|
+
declare class RateLimitError extends SentiSenseError {
|
|
405
|
+
constructor(message: string, code?: string);
|
|
406
|
+
}
|
|
407
|
+
declare class APIError extends SentiSenseError {
|
|
408
|
+
constructor(message: string, status: number, code?: string);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare const VERSION = "0.1.0";
|
|
412
|
+
|
|
413
|
+
export { type AISummary, APIError, AuthenticationError, type ChartData, type ChartDataPoint, type Document, type DocumentSource, type FloatInfo, type Fundamentals, type FundamentalsPeriod, type Holder, type InstitutionalFlow, type KBEntity, type MarketMood, type MarketStatus, type MentionCount, type MentionData, type MetricsBreakdown, NotFoundError, type Quarter, RateLimitError, SentiSense, SentiSenseError, type SentiSenseOptions, type SentimentData, type ShortInterest, type ShortVolume, type StockDetail, type StockEntity, type StockImage, type StockPrice, type StockProfile, type Story, type StoryCluster, type TheNewsResponse, VERSION, SentiSense as default };
|