@axionquant/sdk 1.0.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/dist/index.d.ts +161 -0
- package/dist/index.js +296 -0
- package/dist/models.d.ts +1 -0
- package/dist/models.js +2 -0
- package/package.json +36 -0
- package/readme.md +282 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ApiResponse } from './models';
|
|
2
|
+
export declare class Axion {
|
|
3
|
+
private client;
|
|
4
|
+
private apiKey?;
|
|
5
|
+
constructor(apiKey?: string);
|
|
6
|
+
private _request;
|
|
7
|
+
searchCredit(query: string): Promise<ApiResponse>;
|
|
8
|
+
getCreditRatings(entityId: string): Promise<ApiResponse>;
|
|
9
|
+
getEsgData(ticker: string): Promise<ApiResponse>;
|
|
10
|
+
getEtfFundData(ticker: string): Promise<ApiResponse>;
|
|
11
|
+
getEtfHoldings(ticker: string): Promise<ApiResponse>;
|
|
12
|
+
getEtfExposure(ticker: string): Promise<ApiResponse>;
|
|
13
|
+
getSupplyChainCustomers(ticker: string): Promise<ApiResponse>;
|
|
14
|
+
getSupplyChainPeers(ticker: string): Promise<ApiResponse>;
|
|
15
|
+
getSupplyChainSuppliers(ticker: string): Promise<ApiResponse>;
|
|
16
|
+
getStockTickers(params?: {
|
|
17
|
+
country?: string;
|
|
18
|
+
exchange?: string;
|
|
19
|
+
}): Promise<ApiResponse>;
|
|
20
|
+
getStockTickerBySymbol(ticker: string): Promise<ApiResponse>;
|
|
21
|
+
getStockPrices(ticker: string, params?: {
|
|
22
|
+
from?: string;
|
|
23
|
+
to?: string;
|
|
24
|
+
frame?: string;
|
|
25
|
+
}): Promise<ApiResponse>;
|
|
26
|
+
getCryptoTickers(params?: {
|
|
27
|
+
type?: string;
|
|
28
|
+
}): Promise<ApiResponse>;
|
|
29
|
+
getCryptoTickerBySymbol(ticker: string): Promise<ApiResponse>;
|
|
30
|
+
getCryptoPrices(ticker: string, params?: {
|
|
31
|
+
from?: string;
|
|
32
|
+
to?: string;
|
|
33
|
+
frame?: string;
|
|
34
|
+
}): Promise<ApiResponse>;
|
|
35
|
+
getForexTickers(params?: {
|
|
36
|
+
country?: string;
|
|
37
|
+
exchange?: string;
|
|
38
|
+
}): Promise<ApiResponse>;
|
|
39
|
+
getForexTickerBySymbol(ticker: string): Promise<ApiResponse>;
|
|
40
|
+
getForexPrices(ticker: string, params?: {
|
|
41
|
+
from?: string;
|
|
42
|
+
to?: string;
|
|
43
|
+
frame?: string;
|
|
44
|
+
}): Promise<ApiResponse>;
|
|
45
|
+
getFuturesTickers(params?: {
|
|
46
|
+
exchange?: string;
|
|
47
|
+
}): Promise<ApiResponse>;
|
|
48
|
+
getFuturesTickerBySymbol(ticker: string): Promise<ApiResponse>;
|
|
49
|
+
getFuturesPrices(ticker: string, params?: {
|
|
50
|
+
from?: string;
|
|
51
|
+
to?: string;
|
|
52
|
+
frame?: string;
|
|
53
|
+
}): Promise<ApiResponse>;
|
|
54
|
+
getIndexTickers(params?: {
|
|
55
|
+
exchange?: string;
|
|
56
|
+
}): Promise<ApiResponse>;
|
|
57
|
+
getIndexTickerBySymbol(ticker: string): Promise<ApiResponse>;
|
|
58
|
+
getIndexPrices(ticker: string, params?: {
|
|
59
|
+
from?: string;
|
|
60
|
+
to?: string;
|
|
61
|
+
frame?: string;
|
|
62
|
+
}): Promise<ApiResponse>;
|
|
63
|
+
searchEcon(query: string): Promise<ApiResponse>;
|
|
64
|
+
getEconDataset(seriesId: string): Promise<ApiResponse>;
|
|
65
|
+
getEconCalendar(params?: {
|
|
66
|
+
from?: string;
|
|
67
|
+
to?: string;
|
|
68
|
+
country?: string;
|
|
69
|
+
minImportance?: number;
|
|
70
|
+
currency?: string;
|
|
71
|
+
category?: string;
|
|
72
|
+
}): Promise<ApiResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Get asset profile information for a stock
|
|
75
|
+
*/
|
|
76
|
+
getStockAsset(ticker: string): Promise<ApiResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Get recommendation trend for a stock
|
|
79
|
+
*/
|
|
80
|
+
getStockRecommendation(ticker: string): Promise<ApiResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Get cash flow statement history for a stock
|
|
83
|
+
*/
|
|
84
|
+
getStockCashflow(ticker: string): Promise<ApiResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* Get index trend estimates for a stock
|
|
87
|
+
*/
|
|
88
|
+
getStockTrendIndex(ticker: string): Promise<ApiResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Get key statistics for a stock
|
|
91
|
+
*/
|
|
92
|
+
getStockStatistics(ticker: string): Promise<ApiResponse>;
|
|
93
|
+
/**
|
|
94
|
+
* Get income statement history for a stock
|
|
95
|
+
*/
|
|
96
|
+
getStockIncome(ticker: string): Promise<ApiResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Get fund ownership data for a stock
|
|
99
|
+
*/
|
|
100
|
+
getStockFund(ticker: string): Promise<ApiResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Get summary detail for a stock
|
|
103
|
+
*/
|
|
104
|
+
getStockSummary(ticker: string): Promise<ApiResponse>;
|
|
105
|
+
/**
|
|
106
|
+
* Get insider holders for a stock
|
|
107
|
+
*/
|
|
108
|
+
getStockInsiders(ticker: string): Promise<ApiResponse>;
|
|
109
|
+
/**
|
|
110
|
+
* Get calendar events for a stock
|
|
111
|
+
*/
|
|
112
|
+
getStockCalendar(ticker: string): Promise<ApiResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* Get balance sheet history for a stock
|
|
115
|
+
*/
|
|
116
|
+
getStockBalancesheet(ticker: string): Promise<ApiResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* Get earnings trend estimates for a stock
|
|
119
|
+
*/
|
|
120
|
+
getStockTrendEarnings(ticker: string): Promise<ApiResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Get institution ownership for a stock
|
|
123
|
+
*/
|
|
124
|
+
getStockInstitution(ticker: string): Promise<ApiResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Get major holders breakdown for a stock
|
|
127
|
+
*/
|
|
128
|
+
getStockOwnership(ticker: string): Promise<ApiResponse>;
|
|
129
|
+
/**
|
|
130
|
+
* Get earnings history for a stock
|
|
131
|
+
*/
|
|
132
|
+
getStockEarnings(ticker: string): Promise<ApiResponse>;
|
|
133
|
+
/**
|
|
134
|
+
* Get summary profile information for a stock
|
|
135
|
+
*/
|
|
136
|
+
getStockInfo(ticker: string): Promise<ApiResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Get net share purchase activity for a stock
|
|
139
|
+
*/
|
|
140
|
+
getStockActivity(ticker: string): Promise<ApiResponse>;
|
|
141
|
+
/**
|
|
142
|
+
* Get insider transactions for a stock
|
|
143
|
+
*/
|
|
144
|
+
getStockTransactions(ticker: string): Promise<ApiResponse>;
|
|
145
|
+
/**
|
|
146
|
+
* Get financial data for a stock
|
|
147
|
+
*/
|
|
148
|
+
getStockFinancials(ticker: string): Promise<ApiResponse>;
|
|
149
|
+
/**
|
|
150
|
+
* Get web traffic data for a company
|
|
151
|
+
*/
|
|
152
|
+
getStockTraffic(ticker: string): Promise<ApiResponse>;
|
|
153
|
+
getNews(): Promise<ApiResponse>;
|
|
154
|
+
getCompanyNews(ticker: string): Promise<ApiResponse>;
|
|
155
|
+
getCountryNews(country: string): Promise<ApiResponse>;
|
|
156
|
+
getCategoryNews(category: string): Promise<ApiResponse>;
|
|
157
|
+
getSentimentAll(ticker: string): Promise<ApiResponse>;
|
|
158
|
+
getSentimentSocial(ticker: string): Promise<ApiResponse>;
|
|
159
|
+
getSentimentNews(ticker: string): Promise<ApiResponse>;
|
|
160
|
+
getSentimentAnalyst(ticker: string): Promise<ApiResponse>;
|
|
161
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Axion = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const BASE_URL = "http://localhost:3001";
|
|
9
|
+
class Axion {
|
|
10
|
+
constructor(apiKey) {
|
|
11
|
+
this.apiKey = apiKey;
|
|
12
|
+
this.client = axios_1.default.create({
|
|
13
|
+
baseURL: BASE_URL,
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
if (apiKey) {
|
|
19
|
+
this.client.defaults.headers.common["Authorization"] = `Bearer ${this.apiKey}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async _request(method, path, params = {}, data = {}, authRequired = true) {
|
|
23
|
+
const config = {
|
|
24
|
+
method,
|
|
25
|
+
url: path,
|
|
26
|
+
params,
|
|
27
|
+
data,
|
|
28
|
+
headers: { ...this.client.defaults.headers.common }
|
|
29
|
+
};
|
|
30
|
+
if (!authRequired) {
|
|
31
|
+
delete config.headers["Authorization"];
|
|
32
|
+
}
|
|
33
|
+
else if (authRequired && !this.apiKey) {
|
|
34
|
+
throw new Error("Authentication required but no API key provided to client.");
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const response = await this.client.request(config);
|
|
38
|
+
// The python version has a normalize function, which seems to coerce strings to numbers/booleans.
|
|
39
|
+
// This is generally not needed in JS/TS as JSON parsing handles types correctly.
|
|
40
|
+
// If the API returns numbers as strings, a normalization step would be needed here.
|
|
41
|
+
return response.data;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
const axiosError = error;
|
|
45
|
+
if (axiosError.response) {
|
|
46
|
+
const errorData = axiosError.response.data;
|
|
47
|
+
throw new Error(`HTTP Error ${axiosError.response.status}: ${errorData?.message || 'Unknown HTTP error'}`);
|
|
48
|
+
}
|
|
49
|
+
else if (axiosError.request) {
|
|
50
|
+
throw new Error(`Connection Error: Could not connect to ${BASE_URL}`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
throw new Error(`Request Error: ${axiosError.message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// --- Credit API ---
|
|
58
|
+
searchCredit(query) {
|
|
59
|
+
return this._request("GET", "credit/search", { query });
|
|
60
|
+
}
|
|
61
|
+
getCreditRatings(entityId) {
|
|
62
|
+
return this._request("GET", `credit/ratings/${entityId}`);
|
|
63
|
+
}
|
|
64
|
+
// --- ESG API ---
|
|
65
|
+
getEsgData(ticker) {
|
|
66
|
+
return this._request("GET", `esg/${ticker}`);
|
|
67
|
+
}
|
|
68
|
+
// --- ETF API ---
|
|
69
|
+
getEtfFundData(ticker) {
|
|
70
|
+
return this._request("GET", `etfs/${ticker}/fund`);
|
|
71
|
+
}
|
|
72
|
+
getEtfHoldings(ticker) {
|
|
73
|
+
return this._request("GET", `etfs/${ticker}/holdings`);
|
|
74
|
+
}
|
|
75
|
+
getEtfExposure(ticker) {
|
|
76
|
+
return this._request("GET", `etfs/${ticker}/exposure`);
|
|
77
|
+
}
|
|
78
|
+
// --- Supply Chain API ---
|
|
79
|
+
getSupplyChainCustomers(ticker) {
|
|
80
|
+
return this._request("GET", `supply-chain/${ticker}/customers`);
|
|
81
|
+
}
|
|
82
|
+
getSupplyChainPeers(ticker) {
|
|
83
|
+
return this._request("GET", `supply-chain/${ticker}/peers`);
|
|
84
|
+
}
|
|
85
|
+
getSupplyChainSuppliers(ticker) {
|
|
86
|
+
return this._request("GET", `supply-chain/${ticker}/suppliers`);
|
|
87
|
+
}
|
|
88
|
+
// --- Stocks API ---
|
|
89
|
+
getStockTickers(params = {}) {
|
|
90
|
+
return this._request("GET", "stocks/tickers", params);
|
|
91
|
+
}
|
|
92
|
+
getStockTickerBySymbol(ticker) {
|
|
93
|
+
return this._request("GET", `stocks/${ticker}`);
|
|
94
|
+
}
|
|
95
|
+
getStockPrices(ticker, params = {}) {
|
|
96
|
+
return this._request("GET", `stocks/${ticker}/prices`, params);
|
|
97
|
+
}
|
|
98
|
+
// --- Crypto API ---
|
|
99
|
+
getCryptoTickers(params = {}) {
|
|
100
|
+
return this._request("GET", "crypto/tickers", params);
|
|
101
|
+
}
|
|
102
|
+
getCryptoTickerBySymbol(ticker) {
|
|
103
|
+
return this._request("GET", `crypto/${ticker}`);
|
|
104
|
+
}
|
|
105
|
+
getCryptoPrices(ticker, params = {}) {
|
|
106
|
+
return this._request("GET", `crypto/${ticker}/prices`, params);
|
|
107
|
+
}
|
|
108
|
+
// --- Forex API ---
|
|
109
|
+
getForexTickers(params = {}) {
|
|
110
|
+
return this._request("GET", "forex/tickers", params);
|
|
111
|
+
}
|
|
112
|
+
getForexTickerBySymbol(ticker) {
|
|
113
|
+
return this._request("GET", `forex/${ticker}`);
|
|
114
|
+
}
|
|
115
|
+
getForexPrices(ticker, params = {}) {
|
|
116
|
+
return this._request("GET", `forex/${ticker}/prices`, params);
|
|
117
|
+
}
|
|
118
|
+
// --- Futures API ---
|
|
119
|
+
getFuturesTickers(params = {}) {
|
|
120
|
+
return this._request("GET", "futures/tickers", params);
|
|
121
|
+
}
|
|
122
|
+
getFuturesTickerBySymbol(ticker) {
|
|
123
|
+
return this._request("GET", `futures/${ticker}`);
|
|
124
|
+
}
|
|
125
|
+
getFuturesPrices(ticker, params = {}) {
|
|
126
|
+
return this._request("GET", `futures/${ticker}/prices`, params);
|
|
127
|
+
}
|
|
128
|
+
// --- Indices API ---
|
|
129
|
+
getIndexTickers(params = {}) {
|
|
130
|
+
return this._request("GET", "indices/tickers", params);
|
|
131
|
+
}
|
|
132
|
+
getIndexTickerBySymbol(ticker) {
|
|
133
|
+
return this._request("GET", `indices/${ticker}`);
|
|
134
|
+
}
|
|
135
|
+
getIndexPrices(ticker, params = {}) {
|
|
136
|
+
return this._request("GET", `indices/${ticker}/prices`, params);
|
|
137
|
+
}
|
|
138
|
+
// --- Economic API ---
|
|
139
|
+
searchEcon(query) {
|
|
140
|
+
return this._request("GET", "econ/search", { query });
|
|
141
|
+
}
|
|
142
|
+
getEconDataset(seriesId) {
|
|
143
|
+
return this._request("GET", `econ/dataset/${seriesId}`);
|
|
144
|
+
}
|
|
145
|
+
getEconCalendar(params = {}) {
|
|
146
|
+
return this._request("GET", "econ/calendar", params);
|
|
147
|
+
}
|
|
148
|
+
// --- Profiles API ---
|
|
149
|
+
/**
|
|
150
|
+
* Get asset profile information for a stock
|
|
151
|
+
*/
|
|
152
|
+
getStockAsset(ticker) {
|
|
153
|
+
return this._request("GET", `profiles/${ticker}/asset`);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get recommendation trend for a stock
|
|
157
|
+
*/
|
|
158
|
+
getStockRecommendation(ticker) {
|
|
159
|
+
return this._request("GET", `profiles/${ticker}/recommendation`);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get cash flow statement history for a stock
|
|
163
|
+
*/
|
|
164
|
+
getStockCashflow(ticker) {
|
|
165
|
+
return this._request("GET", `profiles/${ticker}/cashflow`);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get index trend estimates for a stock
|
|
169
|
+
*/
|
|
170
|
+
getStockTrendIndex(ticker) {
|
|
171
|
+
return this._request("GET", `profiles/${ticker}/trend/index`);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get key statistics for a stock
|
|
175
|
+
*/
|
|
176
|
+
getStockStatistics(ticker) {
|
|
177
|
+
return this._request("GET", `profiles/${ticker}/statistics`);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get income statement history for a stock
|
|
181
|
+
*/
|
|
182
|
+
getStockIncome(ticker) {
|
|
183
|
+
return this._request("GET", `profiles/${ticker}/income`);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get fund ownership data for a stock
|
|
187
|
+
*/
|
|
188
|
+
getStockFund(ticker) {
|
|
189
|
+
return this._request("GET", `profiles/${ticker}/fund`);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get summary detail for a stock
|
|
193
|
+
*/
|
|
194
|
+
getStockSummary(ticker) {
|
|
195
|
+
return this._request("GET", `profiles/${ticker}/summary`);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get insider holders for a stock
|
|
199
|
+
*/
|
|
200
|
+
getStockInsiders(ticker) {
|
|
201
|
+
return this._request("GET", `profiles/${ticker}/insiders`);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get calendar events for a stock
|
|
205
|
+
*/
|
|
206
|
+
getStockCalendar(ticker) {
|
|
207
|
+
return this._request("GET", `profiles/${ticker}/calendar`);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get balance sheet history for a stock
|
|
211
|
+
*/
|
|
212
|
+
getStockBalancesheet(ticker) {
|
|
213
|
+
return this._request("GET", `profiles/${ticker}/balancesheet`);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get earnings trend estimates for a stock
|
|
217
|
+
*/
|
|
218
|
+
getStockTrendEarnings(ticker) {
|
|
219
|
+
return this._request("GET", `profiles/${ticker}/trend/earnings`);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get institution ownership for a stock
|
|
223
|
+
*/
|
|
224
|
+
getStockInstitution(ticker) {
|
|
225
|
+
return this._request("GET", `profiles/${ticker}/institution`);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Get major holders breakdown for a stock
|
|
229
|
+
*/
|
|
230
|
+
getStockOwnership(ticker) {
|
|
231
|
+
return this._request("GET", `profiles/${ticker}/ownership`);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Get earnings history for a stock
|
|
235
|
+
*/
|
|
236
|
+
getStockEarnings(ticker) {
|
|
237
|
+
return this._request("GET", `profiles/${ticker}/earnings`);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get summary profile information for a stock
|
|
241
|
+
*/
|
|
242
|
+
getStockInfo(ticker) {
|
|
243
|
+
return this._request("GET", `profiles/${ticker}/info`);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get net share purchase activity for a stock
|
|
247
|
+
*/
|
|
248
|
+
getStockActivity(ticker) {
|
|
249
|
+
return this._request("GET", `profiles/${ticker}/activity`);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get insider transactions for a stock
|
|
253
|
+
*/
|
|
254
|
+
getStockTransactions(ticker) {
|
|
255
|
+
return this._request("GET", `profiles/${ticker}/transactions`);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get financial data for a stock
|
|
259
|
+
*/
|
|
260
|
+
getStockFinancials(ticker) {
|
|
261
|
+
return this._request("GET", `profiles/${ticker}/financials`);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get web traffic data for a company
|
|
265
|
+
*/
|
|
266
|
+
getStockTraffic(ticker) {
|
|
267
|
+
return this._request("GET", `profiles/${ticker}/traffic`);
|
|
268
|
+
}
|
|
269
|
+
// --- News API ---
|
|
270
|
+
getNews() {
|
|
271
|
+
return this._request("GET", "news");
|
|
272
|
+
}
|
|
273
|
+
getCompanyNews(ticker) {
|
|
274
|
+
return this._request("GET", `news/${ticker}`);
|
|
275
|
+
}
|
|
276
|
+
getCountryNews(country) {
|
|
277
|
+
return this._request("GET", `news/country/${country}`);
|
|
278
|
+
}
|
|
279
|
+
getCategoryNews(category) {
|
|
280
|
+
return this._request("GET", `news/category/${category}`);
|
|
281
|
+
}
|
|
282
|
+
// --- Sentiment API ---
|
|
283
|
+
getSentimentAll(ticker) {
|
|
284
|
+
return this._request("GET", `sentiment/${ticker}/all`);
|
|
285
|
+
}
|
|
286
|
+
getSentimentSocial(ticker) {
|
|
287
|
+
return this._request("GET", `sentiment/${ticker}/social`);
|
|
288
|
+
}
|
|
289
|
+
getSentimentNews(ticker) {
|
|
290
|
+
return this._request("GET", `sentiment/${ticker}/news`);
|
|
291
|
+
}
|
|
292
|
+
getSentimentAnalyst(ticker) {
|
|
293
|
+
return this._request("GET", `sentiment/${ticker}/analyst`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
exports.Axion = Axion;
|
package/dist/models.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ApiResponse = any;
|
package/dist/models.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@axionquant/sdk",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Axion SDK for Node.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"axios": "^1.0.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/node": "^20.0.0",
|
|
18
|
+
"typescript": "^5.0.0"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"financial-data",
|
|
22
|
+
"stocks",
|
|
23
|
+
"crypto",
|
|
24
|
+
"etf"
|
|
25
|
+
],
|
|
26
|
+
"author": "Axion",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/axionquant/js-sdk.git"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/axionquant/js-sdk/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/axionquant/js-sdk#readme"
|
|
36
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# Axion SDK
|
|
2
|
+
|
|
3
|
+
A TypeScript/JavaScript SDK for the Axion financial data API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install axion-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Axion } from 'axion-sdk';
|
|
15
|
+
|
|
16
|
+
// Initialize with API key
|
|
17
|
+
const client = new Axion('your-api-key');
|
|
18
|
+
|
|
19
|
+
// Get stock price data
|
|
20
|
+
const prices = await client.getStockPrices('AAPL', {
|
|
21
|
+
from: '2024-01-01',
|
|
22
|
+
to: '2024-12-31'
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Authentication
|
|
27
|
+
|
|
28
|
+
Some endpoints require authentication. Provide your API key when initializing the client:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
const client = new Axion('your-api-key');
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For endpoints that don't require authentication, you can initialize without an API key:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const client = new Axion();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API Reference
|
|
41
|
+
|
|
42
|
+
### Credit
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// Search for credit entities
|
|
46
|
+
await client.searchCredit('Apple Inc');
|
|
47
|
+
|
|
48
|
+
// Get credit ratings for an entity
|
|
49
|
+
await client.getCreditRatings('entity-id');
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### ESG
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Get ESG data for a stock
|
|
56
|
+
await client.getEsgData('AAPL');
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### ETFs
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Get ETF fund data
|
|
63
|
+
await client.getEtfFundData('SPY');
|
|
64
|
+
|
|
65
|
+
// Get ETF holdings
|
|
66
|
+
await client.getEtfHoldings('SPY');
|
|
67
|
+
|
|
68
|
+
// Get ETF exposure data
|
|
69
|
+
await client.getEtfExposure('SPY');
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Supply Chain
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Get company customers
|
|
76
|
+
await client.getSupplyChainCustomers('AAPL');
|
|
77
|
+
|
|
78
|
+
// Get company peers
|
|
79
|
+
await client.getSupplyChainPeers('AAPL');
|
|
80
|
+
|
|
81
|
+
// Get company suppliers
|
|
82
|
+
await client.getSupplyChainSuppliers('AAPL');
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Stocks
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// Get all stock tickers
|
|
89
|
+
await client.getStockTickers({ country: 'US', exchange: 'NASDAQ' });
|
|
90
|
+
|
|
91
|
+
// Get ticker information
|
|
92
|
+
await client.getStockTickerBySymbol('AAPL');
|
|
93
|
+
|
|
94
|
+
// Get historical prices
|
|
95
|
+
await client.getStockPrices('AAPL', {
|
|
96
|
+
from: '2024-01-01',
|
|
97
|
+
to: '2024-12-31',
|
|
98
|
+
frame: '1d' // daily
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Crypto
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// Get all crypto tickers
|
|
106
|
+
await client.getCryptoTickers({ type: 'coin' });
|
|
107
|
+
|
|
108
|
+
// Get crypto ticker information
|
|
109
|
+
await client.getCryptoTickerBySymbol('BTC');
|
|
110
|
+
|
|
111
|
+
// Get crypto prices
|
|
112
|
+
await client.getCryptoPrices('BTC', {
|
|
113
|
+
from: '2024-01-01',
|
|
114
|
+
to: '2024-12-31',
|
|
115
|
+
frame: '1h'
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Forex
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// Get forex tickers
|
|
123
|
+
await client.getForexTickers({ country: 'US' });
|
|
124
|
+
|
|
125
|
+
// Get forex ticker information
|
|
126
|
+
await client.getForexTickerBySymbol('EURUSD');
|
|
127
|
+
|
|
128
|
+
// Get forex prices
|
|
129
|
+
await client.getForexPrices('EURUSD', {
|
|
130
|
+
from: '2024-01-01',
|
|
131
|
+
to: '2024-12-31'
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Futures
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
// Get futures tickers
|
|
139
|
+
await client.getFuturesTickers({ exchange: 'CME' });
|
|
140
|
+
|
|
141
|
+
// Get futures ticker information
|
|
142
|
+
await client.getFuturesTickerBySymbol('ES');
|
|
143
|
+
|
|
144
|
+
// Get futures prices
|
|
145
|
+
await client.getFuturesPrices('ES', {
|
|
146
|
+
from: '2024-01-01',
|
|
147
|
+
to: '2024-12-31'
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Indices
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
// Get index tickers
|
|
155
|
+
await client.getIndexTickers({ exchange: 'NYSE' });
|
|
156
|
+
|
|
157
|
+
// Get index ticker information
|
|
158
|
+
await client.getIndexTickerBySymbol('SPX');
|
|
159
|
+
|
|
160
|
+
// Get index prices
|
|
161
|
+
await client.getIndexPrices('SPX', {
|
|
162
|
+
from: '2024-01-01',
|
|
163
|
+
to: '2024-12-31'
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Economic Data
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
// Search for economic datasets
|
|
171
|
+
await client.searchEcon('unemployment rate');
|
|
172
|
+
|
|
173
|
+
// Get economic dataset
|
|
174
|
+
await client.getEconDataset('UNRATE');
|
|
175
|
+
|
|
176
|
+
// Get economic calendar
|
|
177
|
+
await client.getEconCalendar({
|
|
178
|
+
from: '2024-01-01',
|
|
179
|
+
to: '2024-12-31',
|
|
180
|
+
country: 'US',
|
|
181
|
+
minImportance: 3
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Company Profiles
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
// Asset profile
|
|
189
|
+
await client.getStockAsset('AAPL');
|
|
190
|
+
|
|
191
|
+
// Recommendations
|
|
192
|
+
await client.getStockRecommendation('AAPL');
|
|
193
|
+
|
|
194
|
+
// Financial statements
|
|
195
|
+
await client.getStockCashflow('AAPL');
|
|
196
|
+
await client.getStockIncome('AAPL');
|
|
197
|
+
await client.getStockBalancesheet('AAPL');
|
|
198
|
+
await client.getStockFinancials('AAPL');
|
|
199
|
+
|
|
200
|
+
// Company statistics
|
|
201
|
+
await client.getStockStatistics('AAPL');
|
|
202
|
+
await client.getStockSummary('AAPL');
|
|
203
|
+
await client.getStockInfo('AAPL');
|
|
204
|
+
|
|
205
|
+
// Ownership and holders
|
|
206
|
+
await client.getStockFund('AAPL');
|
|
207
|
+
await client.getStockInsiders('AAPL');
|
|
208
|
+
await client.getStockInstitution('AAPL');
|
|
209
|
+
await client.getStockOwnership('AAPL');
|
|
210
|
+
|
|
211
|
+
// Earnings and trends
|
|
212
|
+
await client.getStockEarnings('AAPL');
|
|
213
|
+
await client.getStockTrendEarnings('AAPL');
|
|
214
|
+
await client.getStockTrendIndex('AAPL');
|
|
215
|
+
|
|
216
|
+
// Insider activity
|
|
217
|
+
await client.getStockActivity('AAPL');
|
|
218
|
+
await client.getStockTransactions('AAPL');
|
|
219
|
+
|
|
220
|
+
// Calendar events
|
|
221
|
+
await client.getStockCalendar('AAPL');
|
|
222
|
+
|
|
223
|
+
// Web traffic
|
|
224
|
+
await client.getStockTraffic('AAPL');
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### News
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// Get latest news
|
|
231
|
+
await client.getNews();
|
|
232
|
+
|
|
233
|
+
// Get company-specific news
|
|
234
|
+
await client.getCompanyNews('AAPL');
|
|
235
|
+
|
|
236
|
+
// Get country news
|
|
237
|
+
await client.getCountryNews('US');
|
|
238
|
+
|
|
239
|
+
// Get category news
|
|
240
|
+
await client.getCategoryNews('technology');
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Sentiment
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
// Get all sentiment data
|
|
247
|
+
await client.getSentimentAll('AAPL');
|
|
248
|
+
|
|
249
|
+
// Get social media sentiment
|
|
250
|
+
await client.getSentimentSocial('AAPL');
|
|
251
|
+
|
|
252
|
+
// Get news sentiment
|
|
253
|
+
await client.getSentimentNews('AAPL');
|
|
254
|
+
|
|
255
|
+
// Get analyst sentiment
|
|
256
|
+
await client.getSentimentAnalyst('AAPL');
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Error Handling
|
|
260
|
+
|
|
261
|
+
The SDK throws errors for failed requests. Use try-catch blocks to handle them:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
try {
|
|
265
|
+
const data = await client.getStockPrices('AAPL');
|
|
266
|
+
console.log(data);
|
|
267
|
+
} catch (error) {
|
|
268
|
+
console.error('Error fetching data:', error.message);
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## TypeScript Support
|
|
273
|
+
|
|
274
|
+
This SDK is written in TypeScript and includes type definitions. Import types as needed:
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import { Axion, ApiResponse } from 'axion-sdk';
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Base URL
|
|
281
|
+
|
|
282
|
+
By default, the SDK connects to `http://localhost:3001`. To use a different base URL, modify the `BASE_URL` constant in the source code.
|