finance-sentiment 1.0.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 +263 -0
- package/dist/index.cjs +344 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +532 -0
- package/dist/index.d.ts +532 -0
- package/dist/index.js +312 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alexander Schneider
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# finance-sentiment
|
|
2
|
+
|
|
3
|
+
`finance-sentiment` is the public TypeScript SDK for the [Adanos Finance Sentiment API](https://api.adanos.org/docs).
|
|
4
|
+
|
|
5
|
+
It gives you typed access to:
|
|
6
|
+
- Reddit stock sentiment
|
|
7
|
+
- News sentiment and source-filtered rankings
|
|
8
|
+
- X/Twitter stock sentiment
|
|
9
|
+
- Polymarket stock activity and market attention
|
|
10
|
+
|
|
11
|
+
Links:
|
|
12
|
+
- Source: https://github.com/adanos-software/adanos-ts-sdk
|
|
13
|
+
- npm: https://www.npmjs.com/package/finance-sentiment
|
|
14
|
+
- API docs: https://api.adanos.org/docs
|
|
15
|
+
- Homepage: https://adanos.org
|
|
16
|
+
|
|
17
|
+
Package and import:
|
|
18
|
+
- npm package: `finance-sentiment`
|
|
19
|
+
- Primary client: `AdanosClient`
|
|
20
|
+
- Compatibility alias: `StockSentimentClient`
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install finance-sentiment
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { AdanosClient } from "finance-sentiment";
|
|
32
|
+
|
|
33
|
+
const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
|
|
34
|
+
|
|
35
|
+
const trending = await client.reddit.trending({ days: 7, limit: 10 });
|
|
36
|
+
const tsla = await client.reddit.stock("TSLA", { days: 14 });
|
|
37
|
+
const explanation = await client.reddit.explain("TSLA");
|
|
38
|
+
|
|
39
|
+
console.log(trending[0].ticker);
|
|
40
|
+
console.log(tsla.buzz_score);
|
|
41
|
+
console.log(explanation.explanation);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## What You Can Do
|
|
45
|
+
|
|
46
|
+
- Rank trending stocks across Reddit, News, X, and Polymarket
|
|
47
|
+
- Pull detailed ticker reports for a configurable lookback window
|
|
48
|
+
- Search and compare tickers across datasets
|
|
49
|
+
- Generate AI-written explanations for Reddit and News stock trends
|
|
50
|
+
- Use the same client shape across all supported stock datasets
|
|
51
|
+
|
|
52
|
+
## Namespaces
|
|
53
|
+
|
|
54
|
+
- `client.reddit.*` for Reddit Stocks
|
|
55
|
+
- `client.news.*` for News Stocks
|
|
56
|
+
- `client.x.*` for X/Twitter Stocks
|
|
57
|
+
- `client.polymarket.*` for Polymarket Stocks
|
|
58
|
+
|
|
59
|
+
## Examples
|
|
60
|
+
|
|
61
|
+
### Reddit Stocks
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { AdanosClient } from "finance-sentiment";
|
|
65
|
+
|
|
66
|
+
const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
|
|
67
|
+
|
|
68
|
+
const trending = await client.reddit.trending({ days: 7, limit: 10 });
|
|
69
|
+
const sectors = await client.reddit.trendingSectors({ days: 7, limit: 10 });
|
|
70
|
+
const countries = await client.reddit.trendingCountries({ days: 7, limit: 10 });
|
|
71
|
+
const tsla = await client.reddit.stock("TSLA", { days: 14 });
|
|
72
|
+
const explanation = await client.reddit.explain("TSLA");
|
|
73
|
+
const results = await client.reddit.search("Tesla");
|
|
74
|
+
const comparison = await client.reddit.compare(["TSLA", "AAPL", "MSFT"], { days: 7 });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### News
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { AdanosClient } from "finance-sentiment";
|
|
81
|
+
|
|
82
|
+
const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
|
|
83
|
+
|
|
84
|
+
const trending = await client.news.trending({ days: 7, source: "reuters" });
|
|
85
|
+
const sectors = await client.news.trendingSectors({ days: 7, source: "reuters" });
|
|
86
|
+
const countries = await client.news.trendingCountries({ days: 7, source: "reuters" });
|
|
87
|
+
const nvda = await client.news.stock("NVDA", { days: 7 });
|
|
88
|
+
const explanation = await client.news.explain("NVDA");
|
|
89
|
+
const results = await client.news.search("Nvidia");
|
|
90
|
+
const comparison = await client.news.compare(["NVDA", "AAPL"], { days: 7 });
|
|
91
|
+
const stats = await client.news.stats();
|
|
92
|
+
const health = await client.news.health();
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### X/Twitter
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { AdanosClient } from "finance-sentiment";
|
|
99
|
+
|
|
100
|
+
const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
|
|
101
|
+
|
|
102
|
+
const trending = await client.x.trending({ days: 1, limit: 20 });
|
|
103
|
+
const sectors = await client.x.trendingSectors({ days: 1, limit: 10 });
|
|
104
|
+
const countries = await client.x.trendingCountries({ days: 1, limit: 10 });
|
|
105
|
+
const nvda = await client.x.stock("NVDA");
|
|
106
|
+
const results = await client.x.search("Nvidia");
|
|
107
|
+
const comparison = await client.x.compare(["NVDA", "AMD"], { days: 7 });
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Polymarket
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { AdanosClient } from "finance-sentiment";
|
|
114
|
+
|
|
115
|
+
const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
|
|
116
|
+
|
|
117
|
+
const trending = await client.polymarket.trending({ days: 7, limit: 20, type: "stock" });
|
|
118
|
+
const sectors = await client.polymarket.trendingSectors({ days: 7, limit: 10 });
|
|
119
|
+
const countries = await client.polymarket.trendingCountries({ days: 7, limit: 10 });
|
|
120
|
+
const aapl = await client.polymarket.stock("AAPL");
|
|
121
|
+
const results = await client.polymarket.search("Apple");
|
|
122
|
+
const comparison = await client.polymarket.compare(["AAPL", "TSLA"], { days: 7 });
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Polymarket semantics:
|
|
126
|
+
- `buzz_score` is activity-first and optimized for current market attention
|
|
127
|
+
- `total_liquidity` is a windowed signal over the selected `days`
|
|
128
|
+
- `top_mentions` on `stock()` are relevance-sorted by trading activity first
|
|
129
|
+
|
|
130
|
+
## Available Methods
|
|
131
|
+
|
|
132
|
+
### `client.reddit.*`
|
|
133
|
+
|
|
134
|
+
| Method | Description |
|
|
135
|
+
|--------|-------------|
|
|
136
|
+
| `trending({ days, limit, offset, type })` | Trending stocks by buzz score |
|
|
137
|
+
| `trendingSectors({ days, limit, offset })` | Trending sectors |
|
|
138
|
+
| `trendingCountries({ days, limit, offset })` | Trending countries |
|
|
139
|
+
| `stock(ticker, { days })` | Detailed sentiment for a ticker |
|
|
140
|
+
| `explain(ticker)` | AI-generated trend explanation |
|
|
141
|
+
| `search(query)` | Search stocks by name or ticker |
|
|
142
|
+
| `compare(tickers, { days })` | Compare up to 10 stocks |
|
|
143
|
+
| `stats()` | Dataset statistics |
|
|
144
|
+
| `health()` | Public service health |
|
|
145
|
+
|
|
146
|
+
### `client.news.*`
|
|
147
|
+
|
|
148
|
+
| Method | Description |
|
|
149
|
+
|--------|-------------|
|
|
150
|
+
| `trending({ days, limit, offset, type, source })` | Trending stocks from news |
|
|
151
|
+
| `trendingSectors({ days, limit, offset, source })` | Trending sectors from news |
|
|
152
|
+
| `trendingCountries({ days, limit, offset, source })` | Trending countries from news |
|
|
153
|
+
| `stock(ticker, { days })` | Detailed news sentiment for a ticker |
|
|
154
|
+
| `explain(ticker)` | AI-generated explanation from news context |
|
|
155
|
+
| `search(query)` | Search stocks in the news dataset |
|
|
156
|
+
| `compare(tickers, { days })` | Compare up to 10 stocks in news |
|
|
157
|
+
| `stats()` | News dataset statistics |
|
|
158
|
+
| `health()` | Public news service health |
|
|
159
|
+
|
|
160
|
+
### `client.x.*`
|
|
161
|
+
|
|
162
|
+
| Method | Description |
|
|
163
|
+
|--------|-------------|
|
|
164
|
+
| `trending({ days, limit, offset, type })` | Trending stocks on X/Twitter |
|
|
165
|
+
| `trendingSectors({ days, limit, offset })` | Trending sectors |
|
|
166
|
+
| `trendingCountries({ days, limit, offset })` | Trending countries |
|
|
167
|
+
| `stock(ticker, { days })` | Detailed X/Twitter sentiment |
|
|
168
|
+
| `search(query)` | Search stocks |
|
|
169
|
+
| `compare(tickers, { days })` | Compare stocks |
|
|
170
|
+
| `stats()` | Dataset statistics |
|
|
171
|
+
| `health()` | Public service health |
|
|
172
|
+
|
|
173
|
+
### `client.polymarket.*`
|
|
174
|
+
|
|
175
|
+
| Method | Description |
|
|
176
|
+
|--------|-------------|
|
|
177
|
+
| `trending({ days, limit, offset, type })` | Trending stocks on Polymarket with activity-first buzz and windowed liquidity |
|
|
178
|
+
| `trendingSectors({ days, limit, offset })` | Trending sectors |
|
|
179
|
+
| `trendingCountries({ days, limit, offset })` | Trending countries |
|
|
180
|
+
| `stock(ticker, { days })` | Detailed Polymarket activity, sentiment, and relevance-sorted market questions |
|
|
181
|
+
| `search(query)` | Search stocks |
|
|
182
|
+
| `compare(tickers, { days })` | Compare stocks with windowed Polymarket activity signals |
|
|
183
|
+
| `stats()` | Dataset statistics |
|
|
184
|
+
| `health()` | Public service health |
|
|
185
|
+
|
|
186
|
+
## Error Handling
|
|
187
|
+
|
|
188
|
+
All non-2xx responses throw an `ApiError`:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { AdanosClient, ApiError } from "finance-sentiment";
|
|
192
|
+
|
|
193
|
+
const client = new AdanosClient({ apiKey: "adanos_api_key_here" });
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
await client.reddit.trending();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
if (error instanceof ApiError) {
|
|
199
|
+
console.error(`API error ${error.status}: ${error.detail}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Authentication and Configuration
|
|
205
|
+
|
|
206
|
+
Get your API key at [adanos.org](https://adanos.org).
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { AdanosClient } from "finance-sentiment";
|
|
210
|
+
|
|
211
|
+
const client = new AdanosClient({
|
|
212
|
+
apiKey: "adanos_api_key_here",
|
|
213
|
+
baseUrl: "https://api.adanos.org",
|
|
214
|
+
timeout: 60_000,
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Rate Limits
|
|
219
|
+
|
|
220
|
+
| Tier | Monthly Requests | Burst Limit |
|
|
221
|
+
|------|------------------|-------------|
|
|
222
|
+
| Free | 250 | 100/min |
|
|
223
|
+
| Paid | Unlimited | 1000/min |
|
|
224
|
+
|
|
225
|
+
Successful protected responses include rate-limit headers.
|
|
226
|
+
|
|
227
|
+
## Requirements
|
|
228
|
+
|
|
229
|
+
- Node.js `>=18`
|
|
230
|
+
- ESM and CJS consumers supported
|
|
231
|
+
- Works in Bun and modern runtimes with `fetch`
|
|
232
|
+
|
|
233
|
+
## Migration from `social-stock-sentiment`
|
|
234
|
+
|
|
235
|
+
Version `1.0.0` starts the new `finance-sentiment` package line and promotes `AdanosClient` as the primary public client name.
|
|
236
|
+
|
|
237
|
+
Old:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
npm install social-stock-sentiment
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
import { StockSentimentClient } from "social-stock-sentiment";
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
New:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
npm install finance-sentiment
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { AdanosClient } from "finance-sentiment";
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
`StockSentimentClient` remains available as a compatibility alias.
|
|
258
|
+
|
|
259
|
+
## License
|
|
260
|
+
|
|
261
|
+
MIT
|
|
262
|
+
|
|
263
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AdanosClient: () => AdanosClient,
|
|
24
|
+
ApiError: () => ApiError,
|
|
25
|
+
NewsNamespace: () => NewsNamespace,
|
|
26
|
+
PolymarketNamespace: () => PolymarketNamespace,
|
|
27
|
+
RedditNamespace: () => RedditNamespace,
|
|
28
|
+
StockSentimentClient: () => StockSentimentClient,
|
|
29
|
+
StockSentimentError: () => StockSentimentError,
|
|
30
|
+
XNamespace: () => XNamespace
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
33
|
+
var StockSentimentError = class extends Error {
|
|
34
|
+
constructor(message) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = "StockSentimentError";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var ApiError = class extends StockSentimentError {
|
|
40
|
+
status;
|
|
41
|
+
detail;
|
|
42
|
+
constructor(status, detail) {
|
|
43
|
+
super(`${status}: ${detail}`);
|
|
44
|
+
this.name = "ApiError";
|
|
45
|
+
this.status = status;
|
|
46
|
+
this.detail = detail;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var HttpClient = class {
|
|
50
|
+
baseUrl;
|
|
51
|
+
apiKey;
|
|
52
|
+
timeout;
|
|
53
|
+
constructor(baseUrl, apiKey, timeout) {
|
|
54
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
55
|
+
this.apiKey = apiKey;
|
|
56
|
+
this.timeout = timeout;
|
|
57
|
+
}
|
|
58
|
+
async get(path, params) {
|
|
59
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
60
|
+
if (params) {
|
|
61
|
+
for (const [key, value] of Object.entries(params)) {
|
|
62
|
+
if (value !== void 0) {
|
|
63
|
+
url.searchParams.set(key, String(value));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const response = await fetch(url.toString(), {
|
|
68
|
+
method: "GET",
|
|
69
|
+
headers: {
|
|
70
|
+
"X-API-Key": this.apiKey,
|
|
71
|
+
"Accept": "application/json"
|
|
72
|
+
},
|
|
73
|
+
signal: AbortSignal.timeout(this.timeout)
|
|
74
|
+
});
|
|
75
|
+
if (!response.ok) {
|
|
76
|
+
let detail;
|
|
77
|
+
try {
|
|
78
|
+
const body = await response.json();
|
|
79
|
+
detail = body.detail ?? JSON.stringify(body);
|
|
80
|
+
} catch {
|
|
81
|
+
detail = response.statusText || `HTTP ${response.status}`;
|
|
82
|
+
}
|
|
83
|
+
throw new ApiError(response.status, detail);
|
|
84
|
+
}
|
|
85
|
+
return response.json();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var PlatformNamespace = class {
|
|
89
|
+
http;
|
|
90
|
+
prefix;
|
|
91
|
+
constructor(http, prefix) {
|
|
92
|
+
this.http = http;
|
|
93
|
+
this.prefix = prefix;
|
|
94
|
+
}
|
|
95
|
+
request(path, params) {
|
|
96
|
+
return this.http.get(`${this.prefix}${path}`, params);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var RedditNamespace = class extends PlatformNamespace {
|
|
100
|
+
/** @internal */
|
|
101
|
+
constructor(http) {
|
|
102
|
+
super(http, "/reddit/stocks/v1");
|
|
103
|
+
}
|
|
104
|
+
/** Get trending stocks on Reddit. */
|
|
105
|
+
async trending(options = {}) {
|
|
106
|
+
return this.request("/trending", {
|
|
107
|
+
days: options.days,
|
|
108
|
+
limit: options.limit,
|
|
109
|
+
offset: options.offset,
|
|
110
|
+
type: options.type
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** Get trending sectors on Reddit. */
|
|
114
|
+
async trendingSectors(options = {}) {
|
|
115
|
+
return this.request("/trending/sectors", {
|
|
116
|
+
days: options.days,
|
|
117
|
+
limit: options.limit,
|
|
118
|
+
offset: options.offset
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/** Get trending countries on Reddit. */
|
|
122
|
+
async trendingCountries(options = {}) {
|
|
123
|
+
return this.request("/trending/countries", {
|
|
124
|
+
days: options.days,
|
|
125
|
+
limit: options.limit,
|
|
126
|
+
offset: options.offset
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/** Get sentiment for a specific stock ticker. */
|
|
130
|
+
async stock(ticker, options = {}) {
|
|
131
|
+
return this.request(`/stock/${encodeURIComponent(ticker)}`, {
|
|
132
|
+
days: options.days
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/** Get AI-generated explanation for a stock's trend. */
|
|
136
|
+
async explain(ticker) {
|
|
137
|
+
return this.request(`/stock/${encodeURIComponent(ticker)}/explain`);
|
|
138
|
+
}
|
|
139
|
+
/** Search for stocks by name or ticker. */
|
|
140
|
+
async search(query) {
|
|
141
|
+
return this.request("/search", { q: query });
|
|
142
|
+
}
|
|
143
|
+
/** Compare multiple stocks side-by-side. */
|
|
144
|
+
async compare(tickers, options = {}) {
|
|
145
|
+
return this.request("/compare", {
|
|
146
|
+
tickers: tickers.join(","),
|
|
147
|
+
days: options.days
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var NewsNamespace = class extends PlatformNamespace {
|
|
152
|
+
/** @internal */
|
|
153
|
+
constructor(http) {
|
|
154
|
+
super(http, "/news/stocks/v1");
|
|
155
|
+
}
|
|
156
|
+
/** Get trending stocks from news. */
|
|
157
|
+
async trending(options = {}) {
|
|
158
|
+
return this.request("/trending", {
|
|
159
|
+
days: options.days,
|
|
160
|
+
limit: options.limit,
|
|
161
|
+
offset: options.offset,
|
|
162
|
+
type: options.type,
|
|
163
|
+
source: options.source
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/** Get trending sectors from news. */
|
|
167
|
+
async trendingSectors(options = {}) {
|
|
168
|
+
return this.request("/trending/sectors", {
|
|
169
|
+
days: options.days,
|
|
170
|
+
limit: options.limit,
|
|
171
|
+
offset: options.offset,
|
|
172
|
+
source: options.source
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/** Get trending countries from news. */
|
|
176
|
+
async trendingCountries(options = {}) {
|
|
177
|
+
return this.request("/trending/countries", {
|
|
178
|
+
days: options.days,
|
|
179
|
+
limit: options.limit,
|
|
180
|
+
offset: options.offset,
|
|
181
|
+
source: options.source
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/** Get sentiment for a specific stock ticker from news. */
|
|
185
|
+
async stock(ticker, options = {}) {
|
|
186
|
+
return this.request(`/stock/${encodeURIComponent(ticker)}`, {
|
|
187
|
+
days: options.days
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/** Get AI-generated explanation for a stock's news trend. */
|
|
191
|
+
async explain(ticker) {
|
|
192
|
+
return this.request(`/stock/${encodeURIComponent(ticker)}/explain`);
|
|
193
|
+
}
|
|
194
|
+
/** Search for stocks by name or ticker in news. */
|
|
195
|
+
async search(query) {
|
|
196
|
+
return this.request("/search", { q: query });
|
|
197
|
+
}
|
|
198
|
+
/** Compare multiple stocks side-by-side using news sentiment. */
|
|
199
|
+
async compare(tickers, options = {}) {
|
|
200
|
+
return this.request("/compare", {
|
|
201
|
+
tickers: tickers.join(","),
|
|
202
|
+
days: options.days
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/** Get news data statistics. */
|
|
206
|
+
async stats() {
|
|
207
|
+
return this.request("/stats");
|
|
208
|
+
}
|
|
209
|
+
/** Get public news service health (no auth required on server side). */
|
|
210
|
+
async health() {
|
|
211
|
+
return this.request("/health");
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var XNamespace = class extends PlatformNamespace {
|
|
215
|
+
/** @internal */
|
|
216
|
+
constructor(http) {
|
|
217
|
+
super(http, "/x/stocks/v1");
|
|
218
|
+
}
|
|
219
|
+
/** Get trending stocks on X/Twitter. */
|
|
220
|
+
async trending(options = {}) {
|
|
221
|
+
return this.request("/trending", {
|
|
222
|
+
days: options.days,
|
|
223
|
+
limit: options.limit,
|
|
224
|
+
offset: options.offset,
|
|
225
|
+
type: options.type
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/** Get trending sectors on X/Twitter. */
|
|
229
|
+
async trendingSectors(options = {}) {
|
|
230
|
+
return this.request("/trending/sectors", {
|
|
231
|
+
days: options.days,
|
|
232
|
+
limit: options.limit,
|
|
233
|
+
offset: options.offset
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/** Get trending countries on X/Twitter. */
|
|
237
|
+
async trendingCountries(options = {}) {
|
|
238
|
+
return this.request("/trending/countries", {
|
|
239
|
+
days: options.days,
|
|
240
|
+
limit: options.limit,
|
|
241
|
+
offset: options.offset
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/** Get X/Twitter sentiment for a specific stock ticker. */
|
|
245
|
+
async stock(ticker, options = {}) {
|
|
246
|
+
return this.request(`/stock/${encodeURIComponent(ticker)}`, {
|
|
247
|
+
days: options.days
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/** Search for stocks by name or ticker on X/Twitter. */
|
|
251
|
+
async search(query) {
|
|
252
|
+
return this.request("/search", { q: query });
|
|
253
|
+
}
|
|
254
|
+
/** Compare multiple stocks side-by-side on X/Twitter. */
|
|
255
|
+
async compare(tickers, options = {}) {
|
|
256
|
+
return this.request("/compare", {
|
|
257
|
+
tickers: tickers.join(","),
|
|
258
|
+
days: options.days
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
var PolymarketNamespace = class extends PlatformNamespace {
|
|
263
|
+
/** @internal */
|
|
264
|
+
constructor(http) {
|
|
265
|
+
super(http, "/polymarket/stocks/v1");
|
|
266
|
+
}
|
|
267
|
+
/** Get trending stocks on Polymarket. */
|
|
268
|
+
async trending(options = {}) {
|
|
269
|
+
return this.request("/trending", {
|
|
270
|
+
days: options.days,
|
|
271
|
+
limit: options.limit,
|
|
272
|
+
offset: options.offset,
|
|
273
|
+
type: options.type
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/** Get trending sectors on Polymarket. */
|
|
277
|
+
async trendingSectors(options = {}) {
|
|
278
|
+
return this.request("/trending/sectors", {
|
|
279
|
+
days: options.days,
|
|
280
|
+
limit: options.limit,
|
|
281
|
+
offset: options.offset
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/** Get trending countries on Polymarket. */
|
|
285
|
+
async trendingCountries(options = {}) {
|
|
286
|
+
return this.request("/trending/countries", {
|
|
287
|
+
days: options.days,
|
|
288
|
+
limit: options.limit,
|
|
289
|
+
offset: options.offset
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/** Get Polymarket sentiment for a specific stock ticker. */
|
|
293
|
+
async stock(ticker, options = {}) {
|
|
294
|
+
return this.request(`/stock/${encodeURIComponent(ticker)}`, {
|
|
295
|
+
days: options.days
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
/** Search for stocks by name or ticker on Polymarket. */
|
|
299
|
+
async search(query) {
|
|
300
|
+
return this.request("/search", { q: query });
|
|
301
|
+
}
|
|
302
|
+
/** Compare multiple stocks side-by-side on Polymarket. */
|
|
303
|
+
async compare(tickers, options = {}) {
|
|
304
|
+
return this.request("/compare", {
|
|
305
|
+
tickers: tickers.join(","),
|
|
306
|
+
days: options.days
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
var AdanosClient = class {
|
|
311
|
+
news;
|
|
312
|
+
reddit;
|
|
313
|
+
x;
|
|
314
|
+
polymarket;
|
|
315
|
+
/**
|
|
316
|
+
* Create a new Finance Sentiment API client.
|
|
317
|
+
*
|
|
318
|
+
* @param options.apiKey - Your API key (`adanos_api_key_here`).
|
|
319
|
+
* @param options.baseUrl - API base URL. Default: `https://api.adanos.org`.
|
|
320
|
+
* @param options.timeout - Request timeout in ms. Default: 30000.
|
|
321
|
+
*/
|
|
322
|
+
constructor(options) {
|
|
323
|
+
const baseUrl = options.baseUrl ?? "https://api.adanos.org";
|
|
324
|
+
const timeout = options.timeout ?? 3e4;
|
|
325
|
+
const http = new HttpClient(baseUrl, options.apiKey, timeout);
|
|
326
|
+
this.news = new NewsNamespace(http);
|
|
327
|
+
this.reddit = new RedditNamespace(http);
|
|
328
|
+
this.x = new XNamespace(http);
|
|
329
|
+
this.polymarket = new PolymarketNamespace(http);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
var StockSentimentClient = AdanosClient;
|
|
333
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
334
|
+
0 && (module.exports = {
|
|
335
|
+
AdanosClient,
|
|
336
|
+
ApiError,
|
|
337
|
+
NewsNamespace,
|
|
338
|
+
PolymarketNamespace,
|
|
339
|
+
RedditNamespace,
|
|
340
|
+
StockSentimentClient,
|
|
341
|
+
StockSentimentError,
|
|
342
|
+
XNamespace
|
|
343
|
+
});
|
|
344
|
+
//# sourceMappingURL=index.cjs.map
|