@axionquant/sdk 1.0.3 → 1.1.3
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 +174 -120
- package/dist/index.js +278 -212
- package/package.json +1 -1
- package/readme.md +137 -179
package/dist/index.d.ts
CHANGED
|
@@ -1,68 +1,87 @@
|
|
|
1
1
|
import { ApiResponse } from './models';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
declare class BaseAPI {
|
|
3
|
+
protected client: Axion;
|
|
4
|
+
constructor(client: Axion);
|
|
5
|
+
protected _request(method: string, path: string, params?: Record<string, any>, data?: Record<string, any>, authRequired?: boolean): Promise<ApiResponse>;
|
|
6
|
+
}
|
|
7
|
+
declare class CreditAPI extends BaseAPI {
|
|
8
|
+
search(query: string): Promise<ApiResponse>;
|
|
9
|
+
ratings(entityId: string): Promise<ApiResponse>;
|
|
10
|
+
}
|
|
11
|
+
declare class ESGAPI extends BaseAPI {
|
|
12
|
+
data(ticker: string): Promise<ApiResponse>;
|
|
13
|
+
}
|
|
14
|
+
declare class ETFAPI extends BaseAPI {
|
|
15
|
+
fund(ticker: string): Promise<ApiResponse>;
|
|
16
|
+
holdings(ticker: string): Promise<ApiResponse>;
|
|
17
|
+
exposure(ticker: string): Promise<ApiResponse>;
|
|
18
|
+
}
|
|
19
|
+
declare class SupplyChainAPI extends BaseAPI {
|
|
20
|
+
customers(ticker: string): Promise<ApiResponse>;
|
|
21
|
+
peers(ticker: string): Promise<ApiResponse>;
|
|
22
|
+
suppliers(ticker: string): Promise<ApiResponse>;
|
|
23
|
+
}
|
|
24
|
+
declare class StocksAPI extends BaseAPI {
|
|
25
|
+
tickers(params?: {
|
|
17
26
|
country?: string;
|
|
18
27
|
exchange?: string;
|
|
19
28
|
}): Promise<ApiResponse>;
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
ticker(ticker: string): Promise<ApiResponse>;
|
|
30
|
+
prices(ticker: string, params?: {
|
|
22
31
|
from?: string;
|
|
23
32
|
to?: string;
|
|
24
33
|
frame?: string;
|
|
25
34
|
}): Promise<ApiResponse>;
|
|
26
|
-
|
|
35
|
+
}
|
|
36
|
+
declare class CryptoAPI extends BaseAPI {
|
|
37
|
+
tickers(params?: {
|
|
27
38
|
type?: string;
|
|
28
39
|
}): Promise<ApiResponse>;
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
ticker(ticker: string): Promise<ApiResponse>;
|
|
41
|
+
prices(ticker: string, params?: {
|
|
31
42
|
from?: string;
|
|
32
43
|
to?: string;
|
|
33
44
|
frame?: string;
|
|
34
45
|
}): Promise<ApiResponse>;
|
|
35
|
-
|
|
46
|
+
}
|
|
47
|
+
declare class ForexAPI extends BaseAPI {
|
|
48
|
+
tickers(params?: {
|
|
36
49
|
country?: string;
|
|
37
50
|
exchange?: string;
|
|
38
51
|
}): Promise<ApiResponse>;
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
ticker(ticker: string): Promise<ApiResponse>;
|
|
53
|
+
prices(ticker: string, params?: {
|
|
41
54
|
from?: string;
|
|
42
55
|
to?: string;
|
|
43
56
|
frame?: string;
|
|
44
57
|
}): Promise<ApiResponse>;
|
|
45
|
-
|
|
58
|
+
}
|
|
59
|
+
declare class FuturesAPI extends BaseAPI {
|
|
60
|
+
tickers(params?: {
|
|
46
61
|
exchange?: string;
|
|
47
62
|
}): Promise<ApiResponse>;
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
ticker(ticker: string): Promise<ApiResponse>;
|
|
64
|
+
prices(ticker: string, params?: {
|
|
50
65
|
from?: string;
|
|
51
66
|
to?: string;
|
|
52
67
|
frame?: string;
|
|
53
68
|
}): Promise<ApiResponse>;
|
|
54
|
-
|
|
69
|
+
}
|
|
70
|
+
declare class IndicesAPI extends BaseAPI {
|
|
71
|
+
tickers(params?: {
|
|
55
72
|
exchange?: string;
|
|
56
73
|
}): Promise<ApiResponse>;
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
ticker(ticker: string): Promise<ApiResponse>;
|
|
75
|
+
prices(ticker: string, params?: {
|
|
59
76
|
from?: string;
|
|
60
77
|
to?: string;
|
|
61
78
|
frame?: string;
|
|
62
79
|
}): Promise<ApiResponse>;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
}
|
|
81
|
+
declare class EconAPI extends BaseAPI {
|
|
82
|
+
search(query: string): Promise<ApiResponse>;
|
|
83
|
+
dataset(seriesId: string): Promise<ApiResponse>;
|
|
84
|
+
calendar(params?: {
|
|
66
85
|
from?: string;
|
|
67
86
|
to?: string;
|
|
68
87
|
country?: string;
|
|
@@ -70,92 +89,127 @@ export declare class Axion {
|
|
|
70
89
|
currency?: string;
|
|
71
90
|
category?: string;
|
|
72
91
|
}): 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
92
|
}
|
|
93
|
+
declare class NewsAPI extends BaseAPI {
|
|
94
|
+
general(): Promise<ApiResponse>;
|
|
95
|
+
company(ticker: string): Promise<ApiResponse>;
|
|
96
|
+
country(country: string): Promise<ApiResponse>;
|
|
97
|
+
category(category: string): Promise<ApiResponse>;
|
|
98
|
+
}
|
|
99
|
+
declare class SentimentAPI extends BaseAPI {
|
|
100
|
+
all(ticker: string): Promise<ApiResponse>;
|
|
101
|
+
social(ticker: string): Promise<ApiResponse>;
|
|
102
|
+
news(ticker: string): Promise<ApiResponse>;
|
|
103
|
+
analyst(ticker: string): Promise<ApiResponse>;
|
|
104
|
+
}
|
|
105
|
+
declare class ProfilesAPI extends BaseAPI {
|
|
106
|
+
profile(ticker: string): Promise<ApiResponse>;
|
|
107
|
+
recommendation(ticker: string): Promise<ApiResponse>;
|
|
108
|
+
statistics(ticker: string): Promise<ApiResponse>;
|
|
109
|
+
summary(ticker: string): Promise<ApiResponse>;
|
|
110
|
+
calendar(ticker: string): Promise<ApiResponse>;
|
|
111
|
+
info(ticker: string): Promise<ApiResponse>;
|
|
112
|
+
}
|
|
113
|
+
declare class EarningsAPI extends BaseAPI {
|
|
114
|
+
history(ticker: string): Promise<ApiResponse>;
|
|
115
|
+
trend(ticker: string): Promise<ApiResponse>;
|
|
116
|
+
index(ticker: string): Promise<ApiResponse>;
|
|
117
|
+
report(ticker: string, params: {
|
|
118
|
+
year: string;
|
|
119
|
+
quarter: string;
|
|
120
|
+
}): Promise<ApiResponse>;
|
|
121
|
+
}
|
|
122
|
+
declare class FilingsAPI extends BaseAPI {
|
|
123
|
+
filings(ticker: string, params?: {
|
|
124
|
+
limit?: number;
|
|
125
|
+
form?: string;
|
|
126
|
+
}): Promise<ApiResponse>;
|
|
127
|
+
forms(ticker: string, formType: string, params?: {
|
|
128
|
+
year?: string;
|
|
129
|
+
quarter?: string;
|
|
130
|
+
limit?: number;
|
|
131
|
+
}): Promise<ApiResponse>;
|
|
132
|
+
descForms(): Promise<ApiResponse>;
|
|
133
|
+
search(params: {
|
|
134
|
+
year: string;
|
|
135
|
+
quarter: string;
|
|
136
|
+
form?: string;
|
|
137
|
+
ticker?: string;
|
|
138
|
+
}): Promise<ApiResponse>;
|
|
139
|
+
}
|
|
140
|
+
declare class FinancialsAPI extends BaseAPI {
|
|
141
|
+
revenue(ticker: string, params?: {
|
|
142
|
+
periods?: number;
|
|
143
|
+
}): Promise<ApiResponse>;
|
|
144
|
+
netIncome(ticker: string, params?: {
|
|
145
|
+
periods?: number;
|
|
146
|
+
}): Promise<ApiResponse>;
|
|
147
|
+
totalAssets(ticker: string, params?: {
|
|
148
|
+
periods?: number;
|
|
149
|
+
}): Promise<ApiResponse>;
|
|
150
|
+
totalLiabilities(ticker: string, params?: {
|
|
151
|
+
periods?: number;
|
|
152
|
+
}): Promise<ApiResponse>;
|
|
153
|
+
stockholdersEquity(ticker: string, params?: {
|
|
154
|
+
periods?: number;
|
|
155
|
+
}): Promise<ApiResponse>;
|
|
156
|
+
currentAssets(ticker: string, params?: {
|
|
157
|
+
periods?: number;
|
|
158
|
+
}): Promise<ApiResponse>;
|
|
159
|
+
currentLiabilities(ticker: string, params?: {
|
|
160
|
+
periods?: number;
|
|
161
|
+
}): Promise<ApiResponse>;
|
|
162
|
+
operatingCashFlow(ticker: string, params?: {
|
|
163
|
+
periods?: number;
|
|
164
|
+
}): Promise<ApiResponse>;
|
|
165
|
+
capitalExpenditures(ticker: string, params?: {
|
|
166
|
+
periods?: number;
|
|
167
|
+
}): Promise<ApiResponse>;
|
|
168
|
+
freeCashFlow(ticker: string, params?: {
|
|
169
|
+
periods?: number;
|
|
170
|
+
}): Promise<ApiResponse>;
|
|
171
|
+
sharesOutstandingBasic(ticker: string, params?: {
|
|
172
|
+
periods?: number;
|
|
173
|
+
}): Promise<ApiResponse>;
|
|
174
|
+
sharesOutstandingDiluted(ticker: string, params?: {
|
|
175
|
+
periods?: number;
|
|
176
|
+
}): Promise<ApiResponse>;
|
|
177
|
+
metrics(ticker: string): Promise<ApiResponse>;
|
|
178
|
+
snapshot(ticker: string): Promise<ApiResponse>;
|
|
179
|
+
}
|
|
180
|
+
declare class InsidersAPI extends BaseAPI {
|
|
181
|
+
funds(ticker: string): Promise<ApiResponse>;
|
|
182
|
+
individuals(ticker: string): Promise<ApiResponse>;
|
|
183
|
+
institutions(ticker: string): Promise<ApiResponse>;
|
|
184
|
+
ownership(ticker: string): Promise<ApiResponse>;
|
|
185
|
+
activity(ticker: string): Promise<ApiResponse>;
|
|
186
|
+
transactions(ticker: string): Promise<ApiResponse>;
|
|
187
|
+
}
|
|
188
|
+
declare class WebTrafficAPI extends BaseAPI {
|
|
189
|
+
traffic(ticker: string): Promise<ApiResponse>;
|
|
190
|
+
}
|
|
191
|
+
export declare class Axion {
|
|
192
|
+
private client;
|
|
193
|
+
private apiKey?;
|
|
194
|
+
credit: CreditAPI;
|
|
195
|
+
esg: ESGAPI;
|
|
196
|
+
etfs: ETFAPI;
|
|
197
|
+
supplyChain: SupplyChainAPI;
|
|
198
|
+
stocks: StocksAPI;
|
|
199
|
+
crypto: CryptoAPI;
|
|
200
|
+
forex: ForexAPI;
|
|
201
|
+
futures: FuturesAPI;
|
|
202
|
+
indices: IndicesAPI;
|
|
203
|
+
econ: EconAPI;
|
|
204
|
+
news: NewsAPI;
|
|
205
|
+
sentiment: SentimentAPI;
|
|
206
|
+
profiles: ProfilesAPI;
|
|
207
|
+
earnings: EarningsAPI;
|
|
208
|
+
filings: FilingsAPI;
|
|
209
|
+
financials: FinancialsAPI;
|
|
210
|
+
insiders: InsidersAPI;
|
|
211
|
+
webTraffic: WebTrafficAPI;
|
|
212
|
+
constructor(apiKey?: string);
|
|
213
|
+
_request(method: string, path: string, params?: Record<string, any>, data?: Record<string, any>, authRequired?: boolean): Promise<ApiResponse>;
|
|
214
|
+
}
|
|
215
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -5,292 +5,358 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Axion = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const BASE_URL = "
|
|
9
|
-
class
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
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
|
-
}
|
|
8
|
+
const BASE_URL = "https://api.axionquant.com";
|
|
9
|
+
class BaseAPI {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
21
12
|
}
|
|
22
13
|
async _request(method, path, params = {}, data = {}, authRequired = true) {
|
|
23
|
-
|
|
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
|
-
}
|
|
14
|
+
return this.client._request(method, path, params, data, authRequired);
|
|
56
15
|
}
|
|
57
|
-
|
|
58
|
-
|
|
16
|
+
}
|
|
17
|
+
class CreditAPI extends BaseAPI {
|
|
18
|
+
search(query) {
|
|
59
19
|
return this._request("GET", "credit/search", { query });
|
|
60
20
|
}
|
|
61
|
-
|
|
21
|
+
ratings(entityId) {
|
|
62
22
|
return this._request("GET", `credit/ratings/${entityId}`);
|
|
63
23
|
}
|
|
64
|
-
|
|
65
|
-
|
|
24
|
+
}
|
|
25
|
+
class ESGAPI extends BaseAPI {
|
|
26
|
+
data(ticker) {
|
|
66
27
|
return this._request("GET", `esg/${ticker}`);
|
|
67
28
|
}
|
|
68
|
-
|
|
69
|
-
|
|
29
|
+
}
|
|
30
|
+
class ETFAPI extends BaseAPI {
|
|
31
|
+
fund(ticker) {
|
|
70
32
|
return this._request("GET", `etfs/${ticker}/fund`);
|
|
71
33
|
}
|
|
72
|
-
|
|
34
|
+
holdings(ticker) {
|
|
73
35
|
return this._request("GET", `etfs/${ticker}/holdings`);
|
|
74
36
|
}
|
|
75
|
-
|
|
37
|
+
exposure(ticker) {
|
|
76
38
|
return this._request("GET", `etfs/${ticker}/exposure`);
|
|
77
39
|
}
|
|
78
|
-
|
|
79
|
-
|
|
40
|
+
}
|
|
41
|
+
class SupplyChainAPI extends BaseAPI {
|
|
42
|
+
customers(ticker) {
|
|
80
43
|
return this._request("GET", `supply-chain/${ticker}/customers`);
|
|
81
44
|
}
|
|
82
|
-
|
|
45
|
+
peers(ticker) {
|
|
83
46
|
return this._request("GET", `supply-chain/${ticker}/peers`);
|
|
84
47
|
}
|
|
85
|
-
|
|
48
|
+
suppliers(ticker) {
|
|
86
49
|
return this._request("GET", `supply-chain/${ticker}/suppliers`);
|
|
87
50
|
}
|
|
88
|
-
|
|
89
|
-
|
|
51
|
+
}
|
|
52
|
+
class StocksAPI extends BaseAPI {
|
|
53
|
+
tickers(params = {}) {
|
|
90
54
|
return this._request("GET", "stocks/tickers", params);
|
|
91
55
|
}
|
|
92
|
-
|
|
56
|
+
ticker(ticker) {
|
|
93
57
|
return this._request("GET", `stocks/${ticker}`);
|
|
94
58
|
}
|
|
95
|
-
|
|
59
|
+
prices(ticker, params = {}) {
|
|
96
60
|
return this._request("GET", `stocks/${ticker}/prices`, params);
|
|
97
61
|
}
|
|
98
|
-
|
|
99
|
-
|
|
62
|
+
}
|
|
63
|
+
class CryptoAPI extends BaseAPI {
|
|
64
|
+
tickers(params = {}) {
|
|
100
65
|
return this._request("GET", "crypto/tickers", params);
|
|
101
66
|
}
|
|
102
|
-
|
|
67
|
+
ticker(ticker) {
|
|
103
68
|
return this._request("GET", `crypto/${ticker}`);
|
|
104
69
|
}
|
|
105
|
-
|
|
70
|
+
prices(ticker, params = {}) {
|
|
106
71
|
return this._request("GET", `crypto/${ticker}/prices`, params);
|
|
107
72
|
}
|
|
108
|
-
|
|
109
|
-
|
|
73
|
+
}
|
|
74
|
+
class ForexAPI extends BaseAPI {
|
|
75
|
+
tickers(params = {}) {
|
|
110
76
|
return this._request("GET", "forex/tickers", params);
|
|
111
77
|
}
|
|
112
|
-
|
|
78
|
+
ticker(ticker) {
|
|
113
79
|
return this._request("GET", `forex/${ticker}`);
|
|
114
80
|
}
|
|
115
|
-
|
|
81
|
+
prices(ticker, params = {}) {
|
|
116
82
|
return this._request("GET", `forex/${ticker}/prices`, params);
|
|
117
83
|
}
|
|
118
|
-
|
|
119
|
-
|
|
84
|
+
}
|
|
85
|
+
class FuturesAPI extends BaseAPI {
|
|
86
|
+
tickers(params = {}) {
|
|
120
87
|
return this._request("GET", "futures/tickers", params);
|
|
121
88
|
}
|
|
122
|
-
|
|
89
|
+
ticker(ticker) {
|
|
123
90
|
return this._request("GET", `futures/${ticker}`);
|
|
124
91
|
}
|
|
125
|
-
|
|
92
|
+
prices(ticker, params = {}) {
|
|
126
93
|
return this._request("GET", `futures/${ticker}/prices`, params);
|
|
127
94
|
}
|
|
128
|
-
|
|
129
|
-
|
|
95
|
+
}
|
|
96
|
+
class IndicesAPI extends BaseAPI {
|
|
97
|
+
tickers(params = {}) {
|
|
130
98
|
return this._request("GET", "indices/tickers", params);
|
|
131
99
|
}
|
|
132
|
-
|
|
100
|
+
ticker(ticker) {
|
|
133
101
|
return this._request("GET", `indices/${ticker}`);
|
|
134
102
|
}
|
|
135
|
-
|
|
103
|
+
prices(ticker, params = {}) {
|
|
136
104
|
return this._request("GET", `indices/${ticker}/prices`, params);
|
|
137
105
|
}
|
|
138
|
-
|
|
139
|
-
|
|
106
|
+
}
|
|
107
|
+
class EconAPI extends BaseAPI {
|
|
108
|
+
search(query) {
|
|
140
109
|
return this._request("GET", "econ/search", { query });
|
|
141
110
|
}
|
|
142
|
-
|
|
111
|
+
dataset(seriesId) {
|
|
143
112
|
return this._request("GET", `econ/dataset/${seriesId}`);
|
|
144
113
|
}
|
|
145
|
-
|
|
114
|
+
calendar(params = {}) {
|
|
146
115
|
return this._request("GET", "econ/calendar", params);
|
|
147
116
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
117
|
+
}
|
|
118
|
+
class NewsAPI extends BaseAPI {
|
|
119
|
+
general() {
|
|
120
|
+
return this._request("GET", "news");
|
|
121
|
+
}
|
|
122
|
+
company(ticker) {
|
|
123
|
+
return this._request("GET", `news/${ticker}`);
|
|
124
|
+
}
|
|
125
|
+
country(country) {
|
|
126
|
+
return this._request("GET", `news/country/${country}`);
|
|
127
|
+
}
|
|
128
|
+
category(category) {
|
|
129
|
+
return this._request("GET", `news/category/${category}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
class SentimentAPI extends BaseAPI {
|
|
133
|
+
all(ticker) {
|
|
134
|
+
return this._request("GET", `sentiment/${ticker}/all`);
|
|
135
|
+
}
|
|
136
|
+
social(ticker) {
|
|
137
|
+
return this._request("GET", `sentiment/${ticker}/social`);
|
|
138
|
+
}
|
|
139
|
+
news(ticker) {
|
|
140
|
+
return this._request("GET", `sentiment/${ticker}/news`);
|
|
141
|
+
}
|
|
142
|
+
analyst(ticker) {
|
|
143
|
+
return this._request("GET", `sentiment/${ticker}/analyst`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
class ProfilesAPI extends BaseAPI {
|
|
147
|
+
// GET /:ticker - Returns asset profile
|
|
148
|
+
profile(ticker) {
|
|
149
|
+
return this._request("GET", `profiles/${ticker}`);
|
|
150
|
+
}
|
|
151
|
+
// GET /:ticker/recommendation - Returns recommendation trend
|
|
152
|
+
recommendation(ticker) {
|
|
159
153
|
return this._request("GET", `profiles/${ticker}/recommendation`);
|
|
160
154
|
}
|
|
161
|
-
|
|
162
|
-
|
|
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) {
|
|
155
|
+
// GET /:ticker/statistics - Returns key statistics
|
|
156
|
+
statistics(ticker) {
|
|
177
157
|
return this._request("GET", `profiles/${ticker}/statistics`);
|
|
178
158
|
}
|
|
179
|
-
|
|
180
|
-
|
|
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) {
|
|
159
|
+
// GET /:ticker/summary - Returns summary detail
|
|
160
|
+
summary(ticker) {
|
|
195
161
|
return this._request("GET", `profiles/${ticker}/summary`);
|
|
196
162
|
}
|
|
197
|
-
|
|
198
|
-
|
|
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) {
|
|
163
|
+
// GET /:ticker/calendar - Returns calendar events (earnings, dividends)
|
|
164
|
+
calendar(ticker) {
|
|
207
165
|
return this._request("GET", `profiles/${ticker}/calendar`);
|
|
208
166
|
}
|
|
209
|
-
|
|
210
|
-
|
|
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) {
|
|
167
|
+
// GET /:ticker/info - Returns company info (summary profile)
|
|
168
|
+
info(ticker) {
|
|
243
169
|
return this._request("GET", `profiles/${ticker}/info`);
|
|
244
170
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return this._request("GET", `
|
|
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");
|
|
171
|
+
}
|
|
172
|
+
class EarningsAPI extends BaseAPI {
|
|
173
|
+
// GET /:ticker/history - Returns earnings history
|
|
174
|
+
history(ticker) {
|
|
175
|
+
return this._request("GET", `earnings/${ticker}/history`);
|
|
272
176
|
}
|
|
273
|
-
|
|
274
|
-
|
|
177
|
+
// GET /:ticker/trend - Returns earnings trend
|
|
178
|
+
trend(ticker) {
|
|
179
|
+
return this._request("GET", `earnings/${ticker}/trend`);
|
|
275
180
|
}
|
|
276
|
-
|
|
277
|
-
|
|
181
|
+
// GET /:ticker/index - Returns index trend
|
|
182
|
+
index(ticker) {
|
|
183
|
+
return this._request("GET", `earnings/${ticker}/index`);
|
|
278
184
|
}
|
|
279
|
-
|
|
280
|
-
|
|
185
|
+
// GET /:ticker/report - Returns earnings report (requires year and quarter query params)
|
|
186
|
+
report(ticker, params) {
|
|
187
|
+
return this._request("GET", `earnings/${ticker}/report`, params);
|
|
281
188
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
189
|
+
}
|
|
190
|
+
class FilingsAPI extends BaseAPI {
|
|
191
|
+
// GET /:ticker - Get recent filings for a company
|
|
192
|
+
filings(ticker, params = {}) {
|
|
193
|
+
return this._request("GET", `filings/${ticker}`, params);
|
|
285
194
|
}
|
|
286
|
-
|
|
287
|
-
|
|
195
|
+
// GET /:ticker/forms/:formType - Get specific form type filings
|
|
196
|
+
forms(ticker, formType, params = {}) {
|
|
197
|
+
return this._request("GET", `filings/${ticker}/forms/${formType}`, params);
|
|
288
198
|
}
|
|
289
|
-
|
|
290
|
-
|
|
199
|
+
// GET /desc/forms - List available form types and their descriptions
|
|
200
|
+
descForms() {
|
|
201
|
+
return this._request("GET", "filings/desc/forms");
|
|
291
202
|
}
|
|
292
|
-
|
|
293
|
-
|
|
203
|
+
// GET /search - Search filings by year/quarter
|
|
204
|
+
search(params) {
|
|
205
|
+
return this._request("GET", "filings/search", params);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
class FinancialsAPI extends BaseAPI {
|
|
209
|
+
// GET /:ticker/revenue - Get revenue data
|
|
210
|
+
revenue(ticker, params = {}) {
|
|
211
|
+
return this._request("GET", `financials/${ticker}/revenue`, params);
|
|
212
|
+
}
|
|
213
|
+
// GET /:ticker/netincome - Get net income data
|
|
214
|
+
netIncome(ticker, params = {}) {
|
|
215
|
+
return this._request("GET", `financials/${ticker}/netincome`, params);
|
|
216
|
+
}
|
|
217
|
+
// GET /:ticker/total/assets - Get total assets data
|
|
218
|
+
totalAssets(ticker, params = {}) {
|
|
219
|
+
return this._request("GET", `financials/${ticker}/total/assets`, params);
|
|
220
|
+
}
|
|
221
|
+
// GET /:ticker/total/liabilities - Get total liabilities data
|
|
222
|
+
totalLiabilities(ticker, params = {}) {
|
|
223
|
+
return this._request("GET", `financials/${ticker}/total/liabilities`, params);
|
|
224
|
+
}
|
|
225
|
+
// GET /:ticker/stockholdersequity - Get stockholders equity data
|
|
226
|
+
stockholdersEquity(ticker, params = {}) {
|
|
227
|
+
return this._request("GET", `financials/${ticker}/stockholdersequity`, params);
|
|
228
|
+
}
|
|
229
|
+
// GET /:ticker/current/assets - Get current assets data
|
|
230
|
+
currentAssets(ticker, params = {}) {
|
|
231
|
+
return this._request("GET", `financials/${ticker}/current/assets`, params);
|
|
232
|
+
}
|
|
233
|
+
// GET /:ticker/current/liabilities - Get current liabilities data
|
|
234
|
+
currentLiabilities(ticker, params = {}) {
|
|
235
|
+
return this._request("GET", `financials/${ticker}/current/liabilities`, params);
|
|
236
|
+
}
|
|
237
|
+
// GET /:ticker/cashflow/operating - Get operating cash flow data
|
|
238
|
+
operatingCashFlow(ticker, params = {}) {
|
|
239
|
+
return this._request("GET", `financials/${ticker}/cashflow/operating`, params);
|
|
240
|
+
}
|
|
241
|
+
// GET /:ticker/capitalexpenditures - Get capital expenditures data
|
|
242
|
+
capitalExpenditures(ticker, params = {}) {
|
|
243
|
+
return this._request("GET", `financials/${ticker}/capitalexpenditures`, params);
|
|
244
|
+
}
|
|
245
|
+
// GET /:ticker/cashflow/free - Get free cash flow data
|
|
246
|
+
freeCashFlow(ticker, params = {}) {
|
|
247
|
+
return this._request("GET", `financials/${ticker}/cashflow/free`, params);
|
|
248
|
+
}
|
|
249
|
+
// GET /:ticker/sharesoutstanding/basic - Get basic shares outstanding data
|
|
250
|
+
sharesOutstandingBasic(ticker, params = {}) {
|
|
251
|
+
return this._request("GET", `financials/${ticker}/sharesoutstanding/basic`, params);
|
|
252
|
+
}
|
|
253
|
+
// GET /:ticker/sharesoutstanding/diluted - Get diluted shares outstanding data
|
|
254
|
+
sharesOutstandingDiluted(ticker, params = {}) {
|
|
255
|
+
return this._request("GET", `financials/${ticker}/sharesoutstanding/diluted`, params);
|
|
256
|
+
}
|
|
257
|
+
// GET /:ticker/metrics - Get calculated financial metrics
|
|
258
|
+
metrics(ticker) {
|
|
259
|
+
return this._request("GET", `financials/${ticker}/metrics`);
|
|
260
|
+
}
|
|
261
|
+
// GET /:ticker/snapshot - Get financial data snapshot
|
|
262
|
+
snapshot(ticker) {
|
|
263
|
+
return this._request("GET", `financials/${ticker}/snapshot`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
class InsidersAPI extends BaseAPI {
|
|
267
|
+
// GET /:ticker/funds - Get fund ownership data
|
|
268
|
+
funds(ticker) {
|
|
269
|
+
return this._request("GET", `insiders/${ticker}/funds`);
|
|
270
|
+
}
|
|
271
|
+
// GET /:ticker/individuals - Get insider holders (individuals)
|
|
272
|
+
individuals(ticker) {
|
|
273
|
+
return this._request("GET", `insiders/${ticker}/individuals`);
|
|
274
|
+
}
|
|
275
|
+
// GET /:ticker/institutions - Get institutional ownership data
|
|
276
|
+
institutions(ticker) {
|
|
277
|
+
return this._request("GET", `insiders/${ticker}/institutions`);
|
|
278
|
+
}
|
|
279
|
+
// GET /:ticker/ownership - Get major holders breakdown
|
|
280
|
+
ownership(ticker) {
|
|
281
|
+
return this._request("GET", `insiders/${ticker}/ownership`);
|
|
282
|
+
}
|
|
283
|
+
// GET /:ticker/activity - Get net share purchase activity
|
|
284
|
+
activity(ticker) {
|
|
285
|
+
return this._request("GET", `insiders/${ticker}/activity`);
|
|
286
|
+
}
|
|
287
|
+
// GET /:ticker/transactions - Get insider transactions
|
|
288
|
+
transactions(ticker) {
|
|
289
|
+
return this._request("GET", `insiders/${ticker}/transactions`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
class WebTrafficAPI extends BaseAPI {
|
|
293
|
+
// GET /:ticker/traffic - Get web traffic data for a company's website
|
|
294
|
+
traffic(ticker) {
|
|
295
|
+
return this._request("GET", `webtraffic/${ticker}/traffic`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
class Axion {
|
|
299
|
+
constructor(apiKey) {
|
|
300
|
+
this.apiKey = apiKey;
|
|
301
|
+
this.client = axios_1.default.create({
|
|
302
|
+
baseURL: BASE_URL,
|
|
303
|
+
headers: {
|
|
304
|
+
"Content-Type": "application/json",
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
if (apiKey) {
|
|
308
|
+
this.client.defaults.headers.common["Authorization"] = `Bearer ${this.apiKey}`;
|
|
309
|
+
}
|
|
310
|
+
this.credit = new CreditAPI(this);
|
|
311
|
+
this.esg = new ESGAPI(this);
|
|
312
|
+
this.etfs = new ETFAPI(this);
|
|
313
|
+
this.supplyChain = new SupplyChainAPI(this);
|
|
314
|
+
this.stocks = new StocksAPI(this);
|
|
315
|
+
this.crypto = new CryptoAPI(this);
|
|
316
|
+
this.forex = new ForexAPI(this);
|
|
317
|
+
this.futures = new FuturesAPI(this);
|
|
318
|
+
this.indices = new IndicesAPI(this);
|
|
319
|
+
this.econ = new EconAPI(this);
|
|
320
|
+
this.news = new NewsAPI(this);
|
|
321
|
+
this.sentiment = new SentimentAPI(this);
|
|
322
|
+
this.profiles = new ProfilesAPI(this);
|
|
323
|
+
this.earnings = new EarningsAPI(this);
|
|
324
|
+
this.filings = new FilingsAPI(this);
|
|
325
|
+
this.financials = new FinancialsAPI(this);
|
|
326
|
+
this.insiders = new InsidersAPI(this);
|
|
327
|
+
this.webTraffic = new WebTrafficAPI(this);
|
|
328
|
+
}
|
|
329
|
+
async _request(method, path, params = {}, data = {}, authRequired = true) {
|
|
330
|
+
const config = {
|
|
331
|
+
method,
|
|
332
|
+
url: path,
|
|
333
|
+
params,
|
|
334
|
+
data,
|
|
335
|
+
headers: { ...this.client.defaults.headers.common }
|
|
336
|
+
};
|
|
337
|
+
if (!authRequired) {
|
|
338
|
+
delete config.headers["Authorization"];
|
|
339
|
+
}
|
|
340
|
+
else if (authRequired && !this.apiKey) {
|
|
341
|
+
throw new Error("Authentication required but no API key provided to client.");
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const response = await this.client.request(config);
|
|
345
|
+
return response.data;
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
const axiosError = error;
|
|
349
|
+
if (axiosError.response) {
|
|
350
|
+
const errorData = axiosError.response.data;
|
|
351
|
+
throw new Error(`HTTP Error ${axiosError.response.status}: ${errorData?.message || 'Unknown HTTP error'}`);
|
|
352
|
+
}
|
|
353
|
+
else if (axiosError.request) {
|
|
354
|
+
throw new Error(`Connection Error: Could not connect to ${BASE_URL}`);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
throw new Error(`Request Error: ${axiosError.message}`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
294
360
|
}
|
|
295
361
|
}
|
|
296
362
|
exports.Axion = Axion;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Axion SDK
|
|
2
2
|
|
|
3
|
-
A TypeScript/JavaScript SDK for the Axion financial data API.
|
|
3
|
+
A TypeScript/JavaScript SDK for the [Axion](https://axionquant.com) financial data API.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,167 +10,170 @@ npm install @axionquant/sdk
|
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
[Get your free API key](https://axionquant.com/dashboard/api-keys)
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
const { Axion } = require('@axionquant/sdk');
|
|
15
17
|
|
|
16
|
-
// Initialize with API key
|
|
17
18
|
const client = new Axion('your-api-key');
|
|
18
19
|
|
|
19
|
-
// Get stock
|
|
20
|
+
// Get stock tickers
|
|
21
|
+
const tickers = await client.stocks.tickers({ country: 'US', exchange: 'NASDAQ' });
|
|
22
|
+
|
|
23
|
+
// Get historical prices
|
|
20
24
|
const prices = await client.stocks.prices('AAPL', {
|
|
21
25
|
from: '2024-01-01',
|
|
22
|
-
to: '2024-12-31'
|
|
26
|
+
to: '2024-12-31',
|
|
27
|
+
frame: '1d'
|
|
23
28
|
});
|
|
24
29
|
```
|
|
25
30
|
|
|
26
31
|
## Authentication
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
Most endpoints require an API key. Pass it when initializing the client:
|
|
29
34
|
|
|
30
|
-
```
|
|
35
|
+
```js
|
|
31
36
|
const client = new Axion('your-api-key');
|
|
32
37
|
```
|
|
33
38
|
|
|
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
39
|
## API Reference
|
|
41
40
|
|
|
42
|
-
###
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
// Search for credit entities
|
|
46
|
-
await client.credit.search('Apple Inc');
|
|
41
|
+
### Stocks
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
```js
|
|
44
|
+
// Get all stock tickers
|
|
45
|
+
await client.stocks.tickers({ country: 'US', exchange: 'NASDAQ' });
|
|
51
46
|
|
|
52
|
-
|
|
47
|
+
// Get ticker info
|
|
48
|
+
await client.stocks.ticker('AAPL');
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
await client.esg.data('AAPL');
|
|
50
|
+
// Get historical prices
|
|
51
|
+
await client.stocks.prices('AAPL', { from: '2024-01-01', to: '2024-12-31', frame: '1d' });
|
|
57
52
|
```
|
|
58
53
|
|
|
59
|
-
###
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
// Get ETF fund data
|
|
63
|
-
await client.etfs.fund('SPY');
|
|
64
|
-
|
|
65
|
-
// Get ETF holdings
|
|
66
|
-
await client.etfs.holdings('SPY');
|
|
54
|
+
### Crypto
|
|
67
55
|
|
|
68
|
-
|
|
69
|
-
await client.
|
|
56
|
+
```js
|
|
57
|
+
await client.crypto.tickers({ type: 'coin' });
|
|
58
|
+
await client.crypto.ticker('BTC');
|
|
59
|
+
await client.crypto.prices('BTC', { from: '2024-01-01', to: '2024-12-31', frame: '1h' });
|
|
70
60
|
```
|
|
71
61
|
|
|
72
|
-
###
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
// Get company customers
|
|
76
|
-
await client.supplyChain.customers('AAPL');
|
|
77
|
-
|
|
78
|
-
// Get company peers
|
|
79
|
-
await client.supplyChain.peers('AAPL');
|
|
62
|
+
### Forex
|
|
80
63
|
|
|
81
|
-
|
|
82
|
-
await client.
|
|
64
|
+
```js
|
|
65
|
+
await client.forex.tickers({ country: 'US' });
|
|
66
|
+
await client.forex.ticker('EURUSD');
|
|
67
|
+
await client.forex.prices('EURUSD', { from: '2024-01-01', to: '2024-12-31' });
|
|
83
68
|
```
|
|
84
69
|
|
|
85
|
-
###
|
|
70
|
+
### Futures
|
|
86
71
|
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
await client.
|
|
72
|
+
```js
|
|
73
|
+
await client.futures.tickers({ exchange: 'CME' });
|
|
74
|
+
await client.futures.ticker('ES');
|
|
75
|
+
await client.futures.prices('ES', { from: '2024-01-01', to: '2024-12-31' });
|
|
76
|
+
```
|
|
90
77
|
|
|
91
|
-
|
|
92
|
-
await client.stocks.ticker('AAPL');
|
|
78
|
+
### Indices
|
|
93
79
|
|
|
94
|
-
|
|
95
|
-
await client.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
frame: '1d' // daily
|
|
99
|
-
});
|
|
80
|
+
```js
|
|
81
|
+
await client.indices.tickers({ exchange: 'NYSE' });
|
|
82
|
+
await client.indices.ticker('SPX');
|
|
83
|
+
await client.indices.prices('SPX', { from: '2024-01-01', to: '2024-12-31' });
|
|
100
84
|
```
|
|
101
85
|
|
|
102
|
-
###
|
|
86
|
+
### Financials
|
|
103
87
|
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
await client.
|
|
88
|
+
```js
|
|
89
|
+
await client.financials.revenue('AAPL', { periods: 8 });
|
|
90
|
+
await client.financials.netIncome('AAPL');
|
|
91
|
+
await client.financials.totalAssets('AAPL');
|
|
92
|
+
await client.financials.totalLiabilities('AAPL');
|
|
93
|
+
await client.financials.stockholdersEquity('AAPL');
|
|
94
|
+
await client.financials.currentAssets('AAPL');
|
|
95
|
+
await client.financials.currentLiabilities('AAPL');
|
|
96
|
+
await client.financials.operatingCashFlow('AAPL');
|
|
97
|
+
await client.financials.capitalExpenditures('AAPL');
|
|
98
|
+
await client.financials.freeCashFlow('AAPL');
|
|
99
|
+
await client.financials.sharesOutstandingBasic('AAPL');
|
|
100
|
+
await client.financials.sharesOutstandingDiluted('AAPL');
|
|
101
|
+
await client.financials.metrics('AAPL');
|
|
102
|
+
await client.financials.snapshot('AAPL');
|
|
103
|
+
```
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
await client.crypto.ticker('BTC');
|
|
105
|
+
### Earnings
|
|
110
106
|
|
|
111
|
-
|
|
112
|
-
await client.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
107
|
+
```js
|
|
108
|
+
await client.earnings.history('AAPL');
|
|
109
|
+
await client.earnings.trend('AAPL');
|
|
110
|
+
await client.earnings.index('AAPL');
|
|
111
|
+
await client.earnings.report('AAPL', { year: '2024', quarter: 'Q1' });
|
|
117
112
|
```
|
|
118
113
|
|
|
119
|
-
###
|
|
114
|
+
### Filings
|
|
120
115
|
|
|
121
|
-
```
|
|
122
|
-
// Get
|
|
123
|
-
await client.
|
|
116
|
+
```js
|
|
117
|
+
// Get recent filings
|
|
118
|
+
await client.filings.filings('AAPL', { limit: 10, form: '10-K' });
|
|
124
119
|
|
|
125
|
-
// Get
|
|
126
|
-
await client.
|
|
120
|
+
// Get specific form type
|
|
121
|
+
await client.filings.forms('AAPL', '10-K', { year: '2024', quarter: 'Q1' });
|
|
127
122
|
|
|
128
|
-
//
|
|
129
|
-
await client.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
123
|
+
// List available form types
|
|
124
|
+
await client.filings.descForms();
|
|
125
|
+
|
|
126
|
+
// Search filings by year/quarter
|
|
127
|
+
await client.filings.search({ year: '2024', quarter: 'Q1', form: '10-Q', ticker: 'AAPL' });
|
|
133
128
|
```
|
|
134
129
|
|
|
135
|
-
###
|
|
130
|
+
### Insiders
|
|
136
131
|
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
await client.
|
|
132
|
+
```js
|
|
133
|
+
await client.insiders.funds('AAPL');
|
|
134
|
+
await client.insiders.individuals('AAPL');
|
|
135
|
+
await client.insiders.institutions('AAPL');
|
|
136
|
+
await client.insiders.ownership('AAPL');
|
|
137
|
+
await client.insiders.activity('AAPL');
|
|
138
|
+
await client.insiders.transactions('AAPL');
|
|
139
|
+
```
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
await client.futures.ticker('ES');
|
|
141
|
+
### Company Profiles
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
await client.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
```js
|
|
144
|
+
await client.profiles.profile('AAPL');
|
|
145
|
+
await client.profiles.recommendation('AAPL');
|
|
146
|
+
await client.profiles.statistics('AAPL');
|
|
147
|
+
await client.profiles.summary('AAPL');
|
|
148
|
+
await client.profiles.info('AAPL');
|
|
149
|
+
await client.profiles.calendar('AAPL');
|
|
149
150
|
```
|
|
150
151
|
|
|
151
|
-
###
|
|
152
|
+
### Sentiment
|
|
152
153
|
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
await client.
|
|
154
|
+
```js
|
|
155
|
+
await client.sentiment.all('AAPL');
|
|
156
|
+
await client.sentiment.social('AAPL');
|
|
157
|
+
await client.sentiment.news('AAPL');
|
|
158
|
+
await client.sentiment.analyst('AAPL');
|
|
159
|
+
```
|
|
156
160
|
|
|
157
|
-
|
|
158
|
-
await client.indices.ticker('SPX');
|
|
161
|
+
### News
|
|
159
162
|
|
|
160
|
-
|
|
161
|
-
await client.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
```js
|
|
164
|
+
await client.news.general();
|
|
165
|
+
await client.news.company('AAPL');
|
|
166
|
+
await client.news.country('US');
|
|
167
|
+
await client.news.category('technology');
|
|
165
168
|
```
|
|
166
169
|
|
|
167
170
|
### Economic Data
|
|
168
171
|
|
|
169
|
-
```
|
|
170
|
-
// Search
|
|
172
|
+
```js
|
|
173
|
+
// Search datasets
|
|
171
174
|
await client.econ.search('unemployment rate');
|
|
172
175
|
|
|
173
|
-
// Get
|
|
176
|
+
// Get a dataset
|
|
174
177
|
await client.econ.dataset('UNRATE');
|
|
175
178
|
|
|
176
179
|
// Get economic calendar
|
|
@@ -184,101 +187,56 @@ await client.econ.calendar({
|
|
|
184
187
|
});
|
|
185
188
|
```
|
|
186
189
|
|
|
187
|
-
###
|
|
188
|
-
|
|
189
|
-
```typescript
|
|
190
|
-
// Get latest general news
|
|
191
|
-
await client.news.general();
|
|
192
|
-
|
|
193
|
-
// Get company-specific news
|
|
194
|
-
await client.news.company('AAPL');
|
|
195
|
-
|
|
196
|
-
// Get country news
|
|
197
|
-
await client.news.country('US');
|
|
190
|
+
### Credit
|
|
198
191
|
|
|
199
|
-
|
|
200
|
-
await client.
|
|
192
|
+
```js
|
|
193
|
+
await client.credit.search('Apple Inc');
|
|
194
|
+
await client.credit.ratings('entity-id');
|
|
201
195
|
```
|
|
202
196
|
|
|
203
|
-
###
|
|
204
|
-
|
|
205
|
-
```typescript
|
|
206
|
-
// Get all sentiment data
|
|
207
|
-
await client.sentiment.all('AAPL');
|
|
208
|
-
|
|
209
|
-
// Get social media sentiment
|
|
210
|
-
await client.sentiment.social('AAPL');
|
|
211
|
-
|
|
212
|
-
// Get news sentiment
|
|
213
|
-
await client.sentiment.news('AAPL');
|
|
197
|
+
### ESG
|
|
214
198
|
|
|
215
|
-
|
|
216
|
-
await client.
|
|
199
|
+
```js
|
|
200
|
+
await client.esg.data('AAPL');
|
|
217
201
|
```
|
|
218
202
|
|
|
219
|
-
###
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
// Asset profile
|
|
223
|
-
await client.profiles.asset('AAPL');
|
|
224
|
-
|
|
225
|
-
// Recommendations
|
|
226
|
-
await client.profiles.recommendation('AAPL');
|
|
227
|
-
|
|
228
|
-
// Financial statements
|
|
229
|
-
await client.profiles.cashflow('AAPL');
|
|
230
|
-
await client.profiles.income('AAPL');
|
|
231
|
-
await client.profiles.balancesheet('AAPL');
|
|
232
|
-
await client.profiles.financials('AAPL');
|
|
233
|
-
|
|
234
|
-
// Company statistics
|
|
235
|
-
await client.profiles.statistics('AAPL');
|
|
236
|
-
await client.profiles.summary('AAPL');
|
|
237
|
-
await client.profiles.info('AAPL');
|
|
203
|
+
### ETFs
|
|
238
204
|
|
|
239
|
-
|
|
240
|
-
await client.
|
|
241
|
-
await client.
|
|
242
|
-
await client.
|
|
243
|
-
|
|
205
|
+
```js
|
|
206
|
+
await client.etfs.fund('SPY');
|
|
207
|
+
await client.etfs.holdings('SPY');
|
|
208
|
+
await client.etfs.exposure('SPY');
|
|
209
|
+
```
|
|
244
210
|
|
|
245
|
-
|
|
246
|
-
await client.profiles.earnings('AAPL');
|
|
247
|
-
await client.profiles.earningsTrend('AAPL');
|
|
248
|
-
await client.profiles.indexTrend('AAPL');
|
|
211
|
+
### Supply Chain
|
|
249
212
|
|
|
250
|
-
|
|
251
|
-
await client.
|
|
252
|
-
await client.
|
|
213
|
+
```js
|
|
214
|
+
await client.supplyChain.customers('AAPL');
|
|
215
|
+
await client.supplyChain.peers('AAPL');
|
|
216
|
+
await client.supplyChain.suppliers('AAPL');
|
|
217
|
+
```
|
|
253
218
|
|
|
254
|
-
|
|
255
|
-
await client.profiles.calendar('AAPL');
|
|
219
|
+
### Web Traffic
|
|
256
220
|
|
|
257
|
-
|
|
258
|
-
await client.
|
|
221
|
+
```js
|
|
222
|
+
await client.webTraffic.traffic('AAPL');
|
|
259
223
|
```
|
|
260
224
|
|
|
261
225
|
## Error Handling
|
|
262
226
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
```typescript
|
|
227
|
+
```js
|
|
266
228
|
try {
|
|
267
229
|
const data = await client.stocks.prices('AAPL');
|
|
268
230
|
console.log(data);
|
|
269
231
|
} catch (error) {
|
|
270
|
-
console.error('Error
|
|
232
|
+
console.error('Error:', error.message);
|
|
271
233
|
}
|
|
272
234
|
```
|
|
273
235
|
|
|
274
|
-
##
|
|
236
|
+
## Get Started
|
|
275
237
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
import { Axion, ApiResponse } from '@axionquant/sdk';
|
|
280
|
-
```
|
|
238
|
+
For detailed API documentation, support, or to obtain an API key, visit the [Axion](https://axionquant.com) website.
|
|
281
239
|
|
|
282
|
-
##
|
|
240
|
+
## License
|
|
283
241
|
|
|
284
|
-
|
|
242
|
+
MIT
|