fmp-node-api 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -72
- package/dist/index.d.mts +908 -508
- package/dist/index.d.ts +908 -508
- package/dist/index.js +608 -240
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +606 -237
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -7,31 +7,39 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
7
7
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
10
|
+
function unwrapSingleObject(data) {
|
|
11
|
+
if (Array.isArray(data) && data.length === 1) {
|
|
12
|
+
return data[0];
|
|
13
|
+
}
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
10
16
|
var FMPClient = class {
|
|
11
17
|
constructor(config) {
|
|
12
18
|
this.apiKey = config.apiKey;
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
this.v3Client = this.createClient("https://financialmodelingprep.com/api/v3", config.timeout);
|
|
20
|
+
this.v4Client = this.createClient("https://financialmodelingprep.com/api/v4", config.timeout);
|
|
21
|
+
this.stableClient = this.createClient(
|
|
22
|
+
"https://financialmodelingprep.com/api/stable",
|
|
23
|
+
config.timeout
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
createClient(baseURL, timeout) {
|
|
27
|
+
const client = axios__default.default.create({
|
|
28
|
+
baseURL,
|
|
29
|
+
timeout: timeout || 1e4,
|
|
30
|
+
headers: { "Content-Type": "application/json" }
|
|
20
31
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
apikey: this.apiKey
|
|
25
|
-
};
|
|
26
|
-
return config2;
|
|
32
|
+
client.interceptors.request.use((config) => {
|
|
33
|
+
config.params = { ...config.params, apikey: this.apiKey };
|
|
34
|
+
return config;
|
|
27
35
|
});
|
|
36
|
+
return client;
|
|
28
37
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
async get(endpoint, params) {
|
|
38
|
+
// Standard get method - returns raw API response
|
|
39
|
+
async get(endpoint, version = "v3", params) {
|
|
40
|
+
const client = this.getClientForVersion(version);
|
|
33
41
|
try {
|
|
34
|
-
const response = await
|
|
42
|
+
const response = await client.get(endpoint, { params });
|
|
35
43
|
return {
|
|
36
44
|
success: true,
|
|
37
45
|
data: response.data,
|
|
@@ -45,15 +53,14 @@ var FMPClient = class {
|
|
|
45
53
|
};
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
async post(endpoint, data, config) {
|
|
56
|
+
// Get method for single-object endpoints - unwraps single-item arrays
|
|
57
|
+
async getSingle(endpoint, version = "v3", params) {
|
|
58
|
+
const client = this.getClientForVersion(version);
|
|
52
59
|
try {
|
|
53
|
-
const response = await
|
|
60
|
+
const response = await client.get(endpoint, { params });
|
|
54
61
|
return {
|
|
55
62
|
success: true,
|
|
56
|
-
data: response.data,
|
|
63
|
+
data: unwrapSingleObject(response.data),
|
|
57
64
|
status: response.status
|
|
58
65
|
};
|
|
59
66
|
} catch (error) {
|
|
@@ -64,11 +71,17 @@ var FMPClient = class {
|
|
|
64
71
|
};
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
getClientForVersion(version) {
|
|
75
|
+
switch (version) {
|
|
76
|
+
case "v3":
|
|
77
|
+
return this.v3Client;
|
|
78
|
+
case "v4":
|
|
79
|
+
return this.v4Client;
|
|
80
|
+
case "stable":
|
|
81
|
+
return this.stableClient;
|
|
82
|
+
default:
|
|
83
|
+
return this.v3Client;
|
|
84
|
+
}
|
|
72
85
|
}
|
|
73
86
|
};
|
|
74
87
|
|
|
@@ -81,36 +94,22 @@ var FMPError = class extends Error {
|
|
|
81
94
|
this.name = "FMPError";
|
|
82
95
|
}
|
|
83
96
|
};
|
|
97
|
+
|
|
98
|
+
// src/utils/validation.ts
|
|
84
99
|
function validateApiKey(apiKey) {
|
|
85
|
-
if (!apiKey || typeof apiKey !== "string") {
|
|
86
|
-
throw new FMPError("API key is required and must be a string");
|
|
100
|
+
if (!apiKey || typeof apiKey !== "string" || apiKey.trim().length === 0) {
|
|
101
|
+
throw new FMPError("API key is required and must be a non-empty string");
|
|
87
102
|
}
|
|
88
103
|
}
|
|
89
104
|
function validateSymbol(symbol) {
|
|
90
|
-
if (!symbol || typeof symbol !== "string") {
|
|
91
|
-
throw new FMPError("Symbol is required and must be a string");
|
|
105
|
+
if (!symbol || typeof symbol !== "string" || symbol.trim().length === 0) {
|
|
106
|
+
throw new FMPError("Symbol is required and must be a non-empty string");
|
|
92
107
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Period2["QUARTER"] = "quarter";
|
|
99
|
-
return Period2;
|
|
100
|
-
})(Period || {});
|
|
101
|
-
var Exchange = /* @__PURE__ */ ((Exchange2) => {
|
|
102
|
-
Exchange2["NYSE"] = "NYSE";
|
|
103
|
-
Exchange2["NASDAQ"] = "NASDAQ";
|
|
104
|
-
Exchange2["AMEX"] = "AMEX";
|
|
105
|
-
Exchange2["TSX"] = "TSX";
|
|
106
|
-
Exchange2["LSE"] = "LSE";
|
|
107
|
-
return Exchange2;
|
|
108
|
-
})(Exchange || {});
|
|
109
|
-
|
|
110
|
-
// src/utils/validation.ts
|
|
111
|
-
function validateApiKey2(apiKey) {
|
|
112
|
-
if (!apiKey || typeof apiKey !== "string" || apiKey.trim().length === 0) {
|
|
113
|
-
throw new FMPError("API key is required and must be a non-empty string");
|
|
108
|
+
const symbolRegex = /^[A-Z0-9.-]+$/;
|
|
109
|
+
if (!symbolRegex.test(symbol.toUpperCase())) {
|
|
110
|
+
throw new FMPError(
|
|
111
|
+
"Invalid symbol format. Symbols should contain only letters, numbers, dots, and hyphens"
|
|
112
|
+
);
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
function validateDate(date) {
|
|
@@ -149,68 +148,59 @@ var StockEndpoints = class {
|
|
|
149
148
|
}
|
|
150
149
|
/**
|
|
151
150
|
* Get real-time stock quote
|
|
151
|
+
* https://site.financialmodelingprep.com/developer/docs#full-quote-quote
|
|
152
|
+
* @param symbol - The stock symbol to get the quote for
|
|
153
|
+
* @returns This endpoint gives you the latest bid and ask prices for a stock, as well as the volume and last trade price in real time.
|
|
152
154
|
*/
|
|
153
155
|
async getQuote({ symbol }) {
|
|
154
|
-
return this.client.
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Get company profile
|
|
158
|
-
*/
|
|
159
|
-
async getCompanyProfile({ symbol }) {
|
|
160
|
-
return this.client.get(`/profile/${symbol}`);
|
|
156
|
+
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
161
157
|
}
|
|
162
158
|
/**
|
|
163
159
|
* Get historical stock prices
|
|
160
|
+
* https://site.financialmodelingprep.com/developer/docs#daily-chart-charts
|
|
161
|
+
* @param symbol - The stock symbol to get the historical prices for
|
|
162
|
+
* @param from - The start date to get the historical prices for
|
|
163
|
+
* @param to - The end date to get the historical prices for
|
|
164
|
+
* @returns The FMP Daily Chart endpoint provides daily stock data for a specified company, including opening, high, low, and closing prices, with a default limit of 5 years of historical data. To access data beyond this limit, use the from and to parameters for custom date ranges, each with a 5-year limit
|
|
164
165
|
*/
|
|
165
166
|
async getHistoricalPrice({
|
|
166
167
|
symbol,
|
|
167
168
|
from,
|
|
168
169
|
to
|
|
169
170
|
}) {
|
|
170
|
-
const params =
|
|
171
|
-
if (from) params.
|
|
172
|
-
if (to) params.
|
|
173
|
-
|
|
174
|
-
return this.client.get(
|
|
175
|
-
`/historical-price-full/${symbol}${queryString ? `?${queryString}` : ""}`
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Get list of all stocks
|
|
180
|
-
*/
|
|
181
|
-
async getStockList() {
|
|
182
|
-
return this.client.get("/stock/list");
|
|
171
|
+
const params = {};
|
|
172
|
+
if (from) params.from = from;
|
|
173
|
+
if (to) params.to = to;
|
|
174
|
+
return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", params);
|
|
183
175
|
}
|
|
184
176
|
/**
|
|
185
|
-
* Get market
|
|
177
|
+
* Get market cap
|
|
178
|
+
* https://site.financialmodelingprep.com/developer/docs#market-cap-company-information
|
|
179
|
+
* @param symbol - The stock symbol to get the market cap for
|
|
180
|
+
* @returns The FMP Market Cap endpoint provides the current market capitalization of a company. Market cap is a measure of the size and relative importance of a company in the stock market. It is calculated by multiplying the current share price by the number of outstanding shares.
|
|
186
181
|
*/
|
|
187
182
|
async getMarketCap({ symbol }) {
|
|
188
|
-
return this.client.
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Get earnings calendar
|
|
192
|
-
*/
|
|
193
|
-
async getEarningsCalendar(params) {
|
|
194
|
-
const queryParams = {};
|
|
195
|
-
if (params.from) queryParams.from = params.from;
|
|
196
|
-
if (params.to) queryParams.to = params.to;
|
|
197
|
-
return this.client.get("/earning_calendar", queryParams);
|
|
183
|
+
return this.client.getSingle(`/market-capitalization/${symbol}`, "v3");
|
|
198
184
|
}
|
|
199
185
|
/**
|
|
200
186
|
* Get stock splits
|
|
187
|
+
* https://site.financialmodelingprep.com/developer/docs#splits-historical-splits
|
|
188
|
+
* @param symbol - The stock symbol to get the splits for
|
|
189
|
+
* @returns A list of historical stock splits for publicly traded companies, including the date of the stock split, the split ratio, and the type of stock split.
|
|
201
190
|
*/
|
|
202
191
|
async getStockSplits({ symbol }) {
|
|
203
|
-
return this.client.get(`/
|
|
192
|
+
return this.client.get(`/historical-price-full/stock_split/${symbol}`, "v3");
|
|
204
193
|
}
|
|
205
194
|
/**
|
|
206
195
|
* Get dividend history
|
|
196
|
+
* https://site.financialmodelingprep.com/developer/docs#dividends-historical-dividends
|
|
197
|
+
* @param symbol - The stock symbol to get the dividend history for
|
|
198
|
+
* @returns A list of historical dividend payments for publicly traded companies, including the date of the dividend payment, the ex-dividend date, and the dividend per share.
|
|
207
199
|
*/
|
|
208
|
-
async getDividendHistory({
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
data: response.success && response.data && Array.isArray(response.data.historical) ? response.data.historical : []
|
|
213
|
-
};
|
|
200
|
+
async getDividendHistory({
|
|
201
|
+
symbol
|
|
202
|
+
}) {
|
|
203
|
+
return this.client.getSingle(`/historical-price-full/stock_dividend/${symbol}`, "v3");
|
|
214
204
|
}
|
|
215
205
|
};
|
|
216
206
|
|
|
@@ -221,63 +211,190 @@ var FinancialEndpoints = class {
|
|
|
221
211
|
}
|
|
222
212
|
/**
|
|
223
213
|
* Get income statement
|
|
214
|
+
* https://site.financialmodelingprep.com/developer/docs#income-statements-financial-statements
|
|
215
|
+
* @param symbol - The stock symbol to get the income statement for
|
|
216
|
+
* @param period - The period to get the income statement for (annual or quarter)
|
|
217
|
+
* @param limit - The number of periods to get
|
|
218
|
+
* @returns FMP's Income Statement API provides access to real-time income statement data for a wide range of companies, including public companies, private companies, and ETFs. This data can be used to track a company's profitability over time, to compare a company to its competitors, and to identify trends in a company's business.
|
|
224
219
|
*/
|
|
225
220
|
async getIncomeStatement({
|
|
226
221
|
symbol,
|
|
227
222
|
period = "annual",
|
|
228
223
|
limit = 5
|
|
229
224
|
}) {
|
|
230
|
-
return this.client.get(`/income-statement/${symbol}?period=${period}&limit=${limit}
|
|
225
|
+
return this.client.get(`/income-statement/${symbol}?period=${period}&limit=${limit}`, "v3");
|
|
231
226
|
}
|
|
232
227
|
/**
|
|
233
228
|
* Get balance sheet
|
|
229
|
+
* https://site.financialmodelingprep.com/developer/docs#balance-sheet-statements-financial-statements
|
|
230
|
+
* @param symbol - The stock symbol to get the balance sheet for
|
|
231
|
+
* @param period - The period to get the balance sheet for (annual or quarter)
|
|
232
|
+
* @param limit - The number of periods to get
|
|
233
|
+
* @returns The balance sheet is a financial statement that displays a company's total assets, liabilities, and shareholder equity over a specific timeframe (quarterly or yearly). Investors can use this statement to determine if the company can fund its operations, meet its debt obligations, and pay a dividend.
|
|
234
234
|
*/
|
|
235
235
|
async getBalanceSheet({
|
|
236
236
|
symbol,
|
|
237
237
|
period = "annual",
|
|
238
238
|
limit = 5
|
|
239
239
|
}) {
|
|
240
|
-
return this.client.get(
|
|
240
|
+
return this.client.get(
|
|
241
|
+
`/balance-sheet-statement/${symbol}?period=${period}&limit=${limit}`,
|
|
242
|
+
"v3"
|
|
243
|
+
);
|
|
241
244
|
}
|
|
242
245
|
/**
|
|
243
246
|
* Get cash flow statement
|
|
247
|
+
* https://site.financialmodelingprep.com/developer/docs#cashflow-statements-financial-statements
|
|
248
|
+
* @param symbol - The stock symbol to get the cash flow statement for
|
|
249
|
+
* @param period - The period to get the cash flow statement for (annual or quarter)
|
|
250
|
+
* @param limit - The number of periods to get
|
|
251
|
+
* @returns The cash flow statement is a financial statement that highlights how cash moves through the company, including both cash inflows and outflows. This statement shows the cash flows in 3 main categories "Operating Cash Flows", "Investing Cash Flows", and "Financing Cash Flows", which help investors to understand if the company is making money or losing money by conducting business.
|
|
244
252
|
*/
|
|
245
253
|
async getCashFlowStatement({
|
|
246
254
|
symbol,
|
|
247
255
|
period = "annual",
|
|
248
256
|
limit = 5
|
|
249
257
|
}) {
|
|
250
|
-
return this.client.get(`/cash-flow-statement/${symbol}?period=${period}&limit=${limit}
|
|
258
|
+
return this.client.get(`/cash-flow-statement/${symbol}?period=${period}&limit=${limit}`, "v3");
|
|
251
259
|
}
|
|
252
260
|
/**
|
|
253
261
|
* Get key metrics
|
|
262
|
+
* https://site.financialmodelingprep.com/developer/docs#key-metrics-statement-analysis
|
|
263
|
+
* @param symbol - The stock symbol to get the key metrics for
|
|
264
|
+
* @param period - The period to get the key metrics for (annual or quarter)
|
|
265
|
+
* @param limit - The number of periods to get
|
|
266
|
+
* @returns Get key financial metrics for a company, including revenue, net income, and price-to-earnings ratio (P/E ratio). Assess a company's financial performance and compare it to its competitors.
|
|
254
267
|
*/
|
|
255
268
|
async getKeyMetrics({
|
|
256
269
|
symbol,
|
|
257
270
|
period = "annual",
|
|
258
271
|
limit = 5
|
|
259
272
|
}) {
|
|
260
|
-
return this.client.get(`/key-metrics/${symbol}?period=${period}&limit=${limit}
|
|
273
|
+
return this.client.get(`/key-metrics/${symbol}?period=${period}&limit=${limit}`, "v3");
|
|
261
274
|
}
|
|
262
275
|
/**
|
|
263
276
|
* Get financial ratios
|
|
277
|
+
* https://site.financialmodelingprep.com/developer/docs#ratios-statement-analysis
|
|
278
|
+
* @param symbol - The stock symbol to get the financial ratios for
|
|
279
|
+
* @param period - The period to get the financial ratios for (annual or quarter)
|
|
280
|
+
* @param limit - The number of periods to get
|
|
281
|
+
* @returns Get financial ratios for a company, such as the P/B ratio and the ROE. Assess a company's financial health and compare it to its competitors.
|
|
264
282
|
*/
|
|
265
283
|
async getFinancialRatios({
|
|
266
284
|
symbol,
|
|
267
285
|
period = "annual",
|
|
268
286
|
limit = 5
|
|
269
287
|
}) {
|
|
270
|
-
return this.client.get(`/ratios/${symbol}?period=${period}&limit=${limit}
|
|
288
|
+
return this.client.get(`/ratios/${symbol}?period=${period}&limit=${limit}`, "v3");
|
|
271
289
|
}
|
|
272
290
|
/**
|
|
273
291
|
* Get enterprise value
|
|
292
|
+
* https://site.financialmodelingprep.com/developer/docs#enterprise-values-statement-analysis
|
|
293
|
+
* @param symbol - The stock symbol to get the enterprise value for
|
|
294
|
+
* @param period - The period to get the enterprise value for (annual or quarter)
|
|
295
|
+
* @param limit - The number of periods to get
|
|
296
|
+
* @returns Get the enterprise value of a company, which is the total value of a company, including its equity and debt. Assess a company's overall value and compare it to its peers.
|
|
274
297
|
*/
|
|
275
298
|
async getEnterpriseValue({
|
|
276
299
|
symbol,
|
|
277
300
|
period = "annual",
|
|
278
301
|
limit = 5
|
|
279
302
|
}) {
|
|
280
|
-
return this.client.get(`/enterprise-value/${symbol}?period=${period}&limit=${limit}
|
|
303
|
+
return this.client.get(`/enterprise-value/${symbol}?period=${period}&limit=${limit}`, "v3");
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Get cashflow growth
|
|
307
|
+
* https://site.financialmodelingprep.com/developer/docs#cashflow-growth-statement-analysis
|
|
308
|
+
* @param symbol - The stock symbol to get the cashflow growth for
|
|
309
|
+
* @param period - The period to get the cashflow growth for (annual or quarter)
|
|
310
|
+
* @param limit - The number of periods to get
|
|
311
|
+
* @returns Get the cash flow growth rate for a company. Measure how quickly a company's cash flow is growing.
|
|
312
|
+
*/
|
|
313
|
+
async getCashflowGrowth({
|
|
314
|
+
symbol,
|
|
315
|
+
period = "annual",
|
|
316
|
+
limit = 5
|
|
317
|
+
}) {
|
|
318
|
+
return this.client.get(
|
|
319
|
+
`/cash-flow-statement-growth/${symbol}?period=${period}&limit=${limit}`,
|
|
320
|
+
"v3"
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get income growth
|
|
325
|
+
* https://site.financialmodelingprep.com/developer/docs#income-growth-statement-analysis
|
|
326
|
+
* @param symbol - The stock symbol to get the income growth for
|
|
327
|
+
* @param period - The period to get the income growth for (annual or quarter)
|
|
328
|
+
* @param limit - The number of periods to get
|
|
329
|
+
* @returns Get the income growth rate for a company. Measure how quickly a company's income is growing.
|
|
330
|
+
*/
|
|
331
|
+
async getIncomeGrowth({
|
|
332
|
+
symbol,
|
|
333
|
+
period = "annual",
|
|
334
|
+
limit = 5
|
|
335
|
+
}) {
|
|
336
|
+
return this.client.get(
|
|
337
|
+
`/income-statement-growth/${symbol}?period=${period}&limit=${limit}`,
|
|
338
|
+
"v3"
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Get balance sheet growth
|
|
343
|
+
* https://site.financialmodelingprep.com/developer/docs#balance-sheet-growth-statement-analysis
|
|
344
|
+
* @param symbol - The stock symbol to get the balance sheet growth for
|
|
345
|
+
* @param period - The period to get the balance sheet growth for (annual or quarter)
|
|
346
|
+
* @param limit - The number of periods to get
|
|
347
|
+
* @returns Get the balance sheet growth rate for a company. Measure how quickly a company's assets and liabilities are growing.
|
|
348
|
+
*/
|
|
349
|
+
async getBalanceSheetGrowth({
|
|
350
|
+
symbol,
|
|
351
|
+
period = "annual",
|
|
352
|
+
limit = 5
|
|
353
|
+
}) {
|
|
354
|
+
return this.client.get(
|
|
355
|
+
`/balance-sheet-statement-growth/${symbol}?period=${period}&limit=${limit}`,
|
|
356
|
+
"v3"
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Get financial growth
|
|
361
|
+
* https://site.financialmodelingprep.com/developer/docs#financial-growth-statement-analysis
|
|
362
|
+
* @param symbol - The stock symbol to get the financial growth for
|
|
363
|
+
* @param period - The period to get the financial growth for (annual or quarter)
|
|
364
|
+
* @param limit - The number of periods to get
|
|
365
|
+
* @returns Financial Growth Get the financial growth rate for a company. Measure how quickly a company's overall financial performance is improving.
|
|
366
|
+
*/
|
|
367
|
+
async getFinancialGrowth({
|
|
368
|
+
symbol,
|
|
369
|
+
period = "annual",
|
|
370
|
+
limit = 5
|
|
371
|
+
}) {
|
|
372
|
+
return this.client.get(`/financial-growth/${symbol}?period=${period}&limit=${limit}`, "v3");
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Get earnings historical
|
|
376
|
+
* https://site.financialmodelingprep.com/developer/docs#earnings-historical-earnings
|
|
377
|
+
* @param symbol - The stock symbol to get the earnings historical for
|
|
378
|
+
* @param limit - The number of periods to get
|
|
379
|
+
* @returns A list of historical & upcoming earnings announcements for a specific company, including the date, estimated EPS, and actual EPS.
|
|
380
|
+
*/
|
|
381
|
+
async getEarningsHistorical({
|
|
382
|
+
symbol,
|
|
383
|
+
limit = 5
|
|
384
|
+
}) {
|
|
385
|
+
return this.client.get(`/historical/earning_calendar/${symbol}?limit=${limit}`, "v3");
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Get earnings surprises
|
|
389
|
+
* https://site.financialmodelingprep.com/developer/docs#earnings-surprises-earnings
|
|
390
|
+
* @param symbol - The stock symbol to get the earnings surprises for
|
|
391
|
+
* @param limit - The number of periods to get
|
|
392
|
+
* @returns A list of earnings announcements for publicly traded companies that were either positive or negative surprises. This endpoint includes the date of the earnings announcement, the estimated EPS, the actual EPS, and the earnings surprise.
|
|
393
|
+
*/
|
|
394
|
+
async getEarningsSurprises({
|
|
395
|
+
symbol
|
|
396
|
+
}) {
|
|
397
|
+
return this.client.get(`/earnings-surprises/${symbol}`, "v3");
|
|
281
398
|
}
|
|
282
399
|
};
|
|
283
400
|
|
|
@@ -287,59 +404,44 @@ var ForexEndpoints = class {
|
|
|
287
404
|
this.client = client;
|
|
288
405
|
}
|
|
289
406
|
/**
|
|
290
|
-
* Get
|
|
407
|
+
* Get forex quote
|
|
408
|
+
* @param params - Parameters for the forex quote request
|
|
409
|
+
* @returns Forex quote data
|
|
291
410
|
*/
|
|
292
411
|
async getQuote(params) {
|
|
293
|
-
return this.client.get(
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Get historical forex data
|
|
297
|
-
*/
|
|
298
|
-
async getHistoricalPrice(params) {
|
|
299
|
-
const queryParams = {};
|
|
300
|
-
if (params.from) queryParams.from = params.from;
|
|
301
|
-
if (params.to) queryParams.to = params.to;
|
|
302
|
-
if (params.timeseries) queryParams.timeseries = params.timeseries;
|
|
303
|
-
return this.client.get(`/historical-price-full/${params.symbol}`, queryParams);
|
|
412
|
+
return this.client.get("/quote", "v3", params);
|
|
304
413
|
}
|
|
305
414
|
/**
|
|
306
|
-
* Get
|
|
307
|
-
*
|
|
415
|
+
* Get historical forex prices
|
|
416
|
+
* @param symbol - The forex symbol to get the historical prices for
|
|
417
|
+
* @param from - The start date to get the historical prices for
|
|
418
|
+
* @param to - The end date to get the historical prices for
|
|
419
|
+
* @returns Historical forex price data
|
|
308
420
|
*/
|
|
309
|
-
async
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
return {
|
|
320
|
-
...response,
|
|
321
|
-
data: Array.isArray(response.data) ? response.data : Array.isArray(response.data?.forexList) ? response.data.forexList : []
|
|
322
|
-
};
|
|
323
|
-
} catch (error) {
|
|
324
|
-
return {
|
|
325
|
-
success: false,
|
|
326
|
-
error: "Failed to fetch forex pairs",
|
|
327
|
-
status: 500,
|
|
328
|
-
data: []
|
|
329
|
-
};
|
|
330
|
-
}
|
|
421
|
+
async getHistoricalPrice({
|
|
422
|
+
symbol,
|
|
423
|
+
from,
|
|
424
|
+
to
|
|
425
|
+
}) {
|
|
426
|
+
const params = {};
|
|
427
|
+
if (from) params.from = from;
|
|
428
|
+
if (to) params.to = to;
|
|
429
|
+
return this.client.get(`/historical-price-full/${symbol}`, "v3", params);
|
|
331
430
|
}
|
|
332
431
|
/**
|
|
333
|
-
* Get forex rates for a specific currency
|
|
432
|
+
* Get forex rates for a specific base currency
|
|
433
|
+
* @param baseCurrency - The base currency to get forex rates for
|
|
434
|
+
* @returns Forex rates data
|
|
334
435
|
*/
|
|
335
436
|
async getForexRates(baseCurrency = "USD") {
|
|
336
|
-
return this.client.get(`/forex/${baseCurrency}
|
|
437
|
+
return this.client.get(`/forex/${baseCurrency}`, "v3");
|
|
337
438
|
}
|
|
338
439
|
/**
|
|
339
|
-
* Get forex rates
|
|
440
|
+
* Get all forex rates
|
|
441
|
+
* @returns All forex rates data
|
|
340
442
|
*/
|
|
341
443
|
async getAllForexRates() {
|
|
342
|
-
return this.client.get("/forex");
|
|
444
|
+
return this.client.get("/forex", "v3");
|
|
343
445
|
}
|
|
344
446
|
};
|
|
345
447
|
|
|
@@ -349,26 +451,31 @@ var CryptoEndpoints = class {
|
|
|
349
451
|
this.client = client;
|
|
350
452
|
}
|
|
351
453
|
/**
|
|
352
|
-
* Get
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Get historical crypto data
|
|
454
|
+
* Get crypto quote
|
|
455
|
+
* https://site.financialmodelingprep.com/developer/docs#full-quote-crypto
|
|
456
|
+
* @param symbol - The crypto symbol to get the quote for
|
|
457
|
+
* @returns Crypto quote data
|
|
359
458
|
*/
|
|
360
|
-
async
|
|
361
|
-
|
|
362
|
-
if (params.from) queryParams.from = params.from;
|
|
363
|
-
if (params.to) queryParams.to = params.to;
|
|
364
|
-
if (params.timeseries) queryParams.timeseries = params.timeseries;
|
|
365
|
-
return this.client.get(`/historical-price-full/${params.symbol}`, queryParams);
|
|
459
|
+
async getQuote({ symbol }) {
|
|
460
|
+
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
366
461
|
}
|
|
367
462
|
/**
|
|
368
|
-
* Get
|
|
463
|
+
* Get historical crypto prices
|
|
464
|
+
* https://site.financialmodelingprep.com/developer/docs#cryptocurrency-daily-crypto
|
|
465
|
+
* @param symbol - The crypto symbol to get the historical prices for
|
|
466
|
+
* @param from - The start date to get the historical prices for
|
|
467
|
+
* @param to - The end date to get the historical prices for
|
|
468
|
+
* @returns Provides daily price data for all cryptocurrencies that are traded on exchanges around the world.
|
|
369
469
|
*/
|
|
370
|
-
async
|
|
371
|
-
|
|
470
|
+
async getHistoricalPrice({
|
|
471
|
+
symbol,
|
|
472
|
+
from,
|
|
473
|
+
to
|
|
474
|
+
}) {
|
|
475
|
+
const params = {};
|
|
476
|
+
if (from) params.from = from;
|
|
477
|
+
if (to) params.to = to;
|
|
478
|
+
return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", params);
|
|
372
479
|
}
|
|
373
480
|
};
|
|
374
481
|
|
|
@@ -378,31 +485,78 @@ var ETFEndpoints = class {
|
|
|
378
485
|
this.client = client;
|
|
379
486
|
}
|
|
380
487
|
/**
|
|
381
|
-
* Get
|
|
488
|
+
* Get ETF holding dates
|
|
489
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-holding-dates-etf-holdings
|
|
490
|
+
* @param symbol - The symbol of the ETF to get the holding dates for
|
|
491
|
+
* @returns The FMP ETF Holding Dates endpoint provides a list of the dates on which ETF holdings are updated. For example, an investor may want to know when an ETF's holdings are updated in order to make sure that they are still aligned with their investment goals.
|
|
382
492
|
*/
|
|
383
|
-
async
|
|
384
|
-
|
|
493
|
+
async getHoldingDates({ symbol }) {
|
|
494
|
+
const params = {};
|
|
495
|
+
if (symbol) params.symbol = symbol;
|
|
496
|
+
return this.client.get("/etf-holdings/portfolio-date", "v4", params);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Get ETF holdings
|
|
500
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-holdings-etf-holdings
|
|
501
|
+
* @param symbol - The symbol of the ETF to get the holdings for
|
|
502
|
+
* @param date - The date to get the holdings for
|
|
503
|
+
* @returns The FMP ETF Holdings endpoint provides a list of all the institutional investors that own shares of an ETF. For example, an investor may want to know which ETF has the highest exposure to a particular industry or sector.
|
|
504
|
+
*/
|
|
505
|
+
async getHoldings({
|
|
506
|
+
symbol,
|
|
507
|
+
date
|
|
508
|
+
}) {
|
|
509
|
+
const params = {};
|
|
510
|
+
if (symbol) params.symbol = symbol;
|
|
511
|
+
if (date) params.date = date;
|
|
512
|
+
return this.client.get("/etf-holdings", "v4", params);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Get ETF holder
|
|
516
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-holder-etf-holdings
|
|
517
|
+
* @param symbol - The symbol of the ETF to get the holder for
|
|
518
|
+
* @returns This endpoint returns all stocks held by a specific ETF. Assets, share number, and weight are among the fields returned. For example you can get components of SPY, VOO and more.
|
|
519
|
+
*/
|
|
520
|
+
async getHolder({ symbol }) {
|
|
521
|
+
return this.client.get(`/etf-holder/${symbol}`, "v3");
|
|
385
522
|
}
|
|
386
523
|
/**
|
|
387
524
|
* Get ETF profile
|
|
525
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-information-etf-holdings
|
|
526
|
+
* @param symbol - The symbol of the ETF to get the profile for
|
|
527
|
+
* @returns The FMP ETF Information endpoint provides basic information about an ETF, such as its ticker symbol, name, expense ratio, and asset under management. For example, an investor may want to compare the expense ratios of different ETFs to find the one that is most cost-effective.
|
|
388
528
|
*/
|
|
389
|
-
async getProfile(
|
|
390
|
-
|
|
529
|
+
async getProfile({ symbol }) {
|
|
530
|
+
const params = {};
|
|
531
|
+
if (symbol) params.symbol = symbol;
|
|
532
|
+
return this.client.getSingle("/etf-info", "v4", params);
|
|
391
533
|
}
|
|
392
534
|
/**
|
|
393
|
-
* Get ETF
|
|
535
|
+
* Get ETF sector weighting
|
|
536
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-sector-weighting-etf-holdings
|
|
537
|
+
* @param symbol - The symbol of the ETF to get the sector exposure for
|
|
538
|
+
* @returns The FMP ETF Sector Weighting endpoint provides a breakdown of the percentage of an ETF's assets that are invested in each sector. For example, an investor may want to invest in an ETF that has a high exposure to the technology sector if they believe that the technology sector is poised for growth.
|
|
394
539
|
*/
|
|
395
|
-
async
|
|
396
|
-
|
|
397
|
-
if (params.limit) queryParams.limit = params.limit;
|
|
398
|
-
if (params.page) queryParams.page = params.page;
|
|
399
|
-
return this.client.get(`/etf-holder/${params.symbol}`, queryParams);
|
|
540
|
+
async getSectorWeighting({ symbol }) {
|
|
541
|
+
return this.client.get(`/etf-sector-weightings/${symbol}`, "v3");
|
|
400
542
|
}
|
|
401
543
|
/**
|
|
402
|
-
* Get
|
|
544
|
+
* Get ETF country weighting
|
|
545
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-country-weighting-etf-holdings
|
|
546
|
+
* @param symbol - The symbol of the ETF to get the country weighting for
|
|
547
|
+
* @returns The FMP ETF Country Weighting endpoint provides a breakdown of the percentage of an ETF's assets that are invested in each country. For example, an investor may want to invest in an ETF that has a high exposure to China if they believe that the Chinese economy is poised for growth.
|
|
403
548
|
*/
|
|
404
|
-
async
|
|
405
|
-
return this.client.get(
|
|
549
|
+
async getCountryWeighting({ symbol }) {
|
|
550
|
+
return this.client.get(`/etf-country-weightings/${symbol}`, "v3");
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Get ETF Stock exposure
|
|
554
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-sector-exposure-etf-holdings
|
|
555
|
+
* @param symbol - The symbol of the ETF to get the stock exposure for
|
|
556
|
+
* @returns This endpoint returns asset exposure from all ETFs that have it in their holdings. It has properties like market value, share number or weight percentage. It can be useful for looking up stock you like to check what ETF has it on their portfolio.
|
|
557
|
+
*/
|
|
558
|
+
async getStockExposure({ symbol }) {
|
|
559
|
+
return this.client.get(`/etf-stock-exposure/${symbol}`, "v3");
|
|
406
560
|
}
|
|
407
561
|
};
|
|
408
562
|
|
|
@@ -412,31 +566,24 @@ var MutualFundEndpoints = class {
|
|
|
412
566
|
this.client = client;
|
|
413
567
|
}
|
|
414
568
|
/**
|
|
415
|
-
* Get
|
|
569
|
+
* Get mutual fund quote
|
|
570
|
+
* @param params - Parameters for the mutual fund quote request
|
|
571
|
+
* @returns Mutual fund quote data
|
|
416
572
|
*/
|
|
417
573
|
async getQuote(params) {
|
|
418
|
-
return this.client.get(
|
|
574
|
+
return this.client.get("/quote", "v3", params);
|
|
419
575
|
}
|
|
420
576
|
/**
|
|
421
577
|
* Get mutual fund profile
|
|
422
578
|
*/
|
|
423
579
|
async getProfile(params) {
|
|
424
|
-
return this.client.get(
|
|
580
|
+
return this.client.get("/profile", "v3", params);
|
|
425
581
|
}
|
|
426
582
|
/**
|
|
427
583
|
* Get mutual fund holdings
|
|
428
584
|
*/
|
|
429
585
|
async getHoldings(params) {
|
|
430
|
-
|
|
431
|
-
if (params.limit) queryParams.limit = params.limit;
|
|
432
|
-
if (params.page) queryParams.page = params.page;
|
|
433
|
-
return this.client.get(`/mutual-fund-holder/${params.symbol}`, queryParams);
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Get list of all mutual funds
|
|
437
|
-
*/
|
|
438
|
-
async getMutualFundList() {
|
|
439
|
-
return this.client.get("/mutual-fund/list");
|
|
586
|
+
return this.client.get("/holdings", "v3", params);
|
|
440
587
|
}
|
|
441
588
|
};
|
|
442
589
|
|
|
@@ -446,26 +593,29 @@ var BondEndpoints = class {
|
|
|
446
593
|
this.client = client;
|
|
447
594
|
}
|
|
448
595
|
/**
|
|
449
|
-
* Get
|
|
596
|
+
* Get bond quote
|
|
597
|
+
* @param params - Parameters for the bond quote request
|
|
598
|
+
* @returns Bond quote data
|
|
450
599
|
*/
|
|
451
600
|
async getQuote(params) {
|
|
452
|
-
return this.client.get(
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Get historical bond data
|
|
456
|
-
*/
|
|
457
|
-
async getHistoricalPrice(params) {
|
|
458
|
-
const queryParams = {};
|
|
459
|
-
if (params.from) queryParams.from = params.from;
|
|
460
|
-
if (params.to) queryParams.to = params.to;
|
|
461
|
-
if (params.timeseries) queryParams.timeseries = params.timeseries;
|
|
462
|
-
return this.client.get(`/historical-price-full/${params.symbol}`, queryParams);
|
|
601
|
+
return this.client.get("/quote", "v3", params);
|
|
463
602
|
}
|
|
464
603
|
/**
|
|
465
|
-
* Get
|
|
604
|
+
* Get historical bond prices
|
|
605
|
+
* @param symbol - The bond symbol to get the historical prices for
|
|
606
|
+
* @param from - The start date to get the historical prices for
|
|
607
|
+
* @param to - The end date to get the historical prices for
|
|
608
|
+
* @returns Historical bond price data
|
|
466
609
|
*/
|
|
467
|
-
async
|
|
468
|
-
|
|
610
|
+
async getHistoricalPrice({
|
|
611
|
+
symbol,
|
|
612
|
+
from,
|
|
613
|
+
to
|
|
614
|
+
}) {
|
|
615
|
+
const params = {};
|
|
616
|
+
if (from) params.from = from;
|
|
617
|
+
if (to) params.to = to;
|
|
618
|
+
return this.client.get(`/historical-price-full/${symbol}`, "v3", params);
|
|
469
619
|
}
|
|
470
620
|
};
|
|
471
621
|
|
|
@@ -478,46 +628,31 @@ var EconomicEndpoints = class {
|
|
|
478
628
|
* Get treasury rates
|
|
479
629
|
*/
|
|
480
630
|
async getTreasuryRates(params = {}) {
|
|
481
|
-
|
|
482
|
-
if (params.from) queryParams.from = params.from;
|
|
483
|
-
if (params.to) queryParams.to = params.to;
|
|
484
|
-
return this.client.get("/treasury-rates", queryParams);
|
|
631
|
+
return this.client.get("/treasury-rates", "v3", params);
|
|
485
632
|
}
|
|
486
633
|
/**
|
|
487
634
|
* Get federal funds rate
|
|
488
635
|
*/
|
|
489
636
|
async getFederalFundsRate(params = {}) {
|
|
490
|
-
|
|
491
|
-
if (params.from) queryParams.from = params.from;
|
|
492
|
-
if (params.to) queryParams.to = params.to;
|
|
493
|
-
return this.client.get("/federal-funds-rate", queryParams);
|
|
637
|
+
return this.client.get("/federal-funds-rate", "v3", params);
|
|
494
638
|
}
|
|
495
639
|
/**
|
|
496
640
|
* Get CPI data
|
|
497
641
|
*/
|
|
498
642
|
async getCPI(params = {}) {
|
|
499
|
-
|
|
500
|
-
if (params.from) queryParams.from = params.from;
|
|
501
|
-
if (params.to) queryParams.to = params.to;
|
|
502
|
-
return this.client.get("/economic-indicator/cpi", queryParams);
|
|
643
|
+
return this.client.get("/economic/cpi", "v3", params);
|
|
503
644
|
}
|
|
504
645
|
/**
|
|
505
646
|
* Get GDP data
|
|
506
647
|
*/
|
|
507
648
|
async getGDP(params = {}) {
|
|
508
|
-
|
|
509
|
-
if (params.from) queryParams.from = params.from;
|
|
510
|
-
if (params.to) queryParams.to = params.to;
|
|
511
|
-
return this.client.get("/economic-indicator/gdp", queryParams);
|
|
649
|
+
return this.client.get("/economic/gdp", "v3", params);
|
|
512
650
|
}
|
|
513
651
|
/**
|
|
514
652
|
* Get unemployment data
|
|
515
653
|
*/
|
|
516
654
|
async getUnemployment(params = {}) {
|
|
517
|
-
|
|
518
|
-
if (params.from) queryParams.from = params.from;
|
|
519
|
-
if (params.to) queryParams.to = params.to;
|
|
520
|
-
return this.client.get("/economic-indicator/unemployment", queryParams);
|
|
655
|
+
return this.client.get("/economic/unemployment", "v3", params);
|
|
521
656
|
}
|
|
522
657
|
};
|
|
523
658
|
|
|
@@ -530,63 +665,282 @@ var MarketEndpoints = class {
|
|
|
530
665
|
* Get market hours
|
|
531
666
|
*/
|
|
532
667
|
async getMarketHours() {
|
|
533
|
-
return this.client.get("/market-hours");
|
|
668
|
+
return this.client.get("/market-hours", "v3");
|
|
534
669
|
}
|
|
535
670
|
/**
|
|
536
671
|
* Get market performance
|
|
537
672
|
*/
|
|
538
673
|
async getMarketPerformance() {
|
|
539
|
-
return this.client.get("/market-performance");
|
|
674
|
+
return this.client.get("/market-performance", "v3");
|
|
540
675
|
}
|
|
541
676
|
/**
|
|
542
|
-
* Get
|
|
677
|
+
* Get top gainers
|
|
678
|
+
* https://site.financialmodelingprep.com/developer/docs#market-biggest-gainers-market-overview
|
|
679
|
+
* @returns The FMP Market Biggest Gainers endpoint provides a list of the stocks that have gained the most value on a given day. This information can be used by investors to identify stocks that are momentum and to potential investment opportunities.
|
|
543
680
|
*/
|
|
544
681
|
async getGainers() {
|
|
545
|
-
return this.client.get("/gainers");
|
|
682
|
+
return this.client.get("/stock_market/gainers", "v3");
|
|
546
683
|
}
|
|
547
684
|
/**
|
|
548
|
-
* Get
|
|
685
|
+
* Get top losers
|
|
686
|
+
* https://site.financialmodelingprep.com/developer/docs#market-biggest-losers-market-overview
|
|
687
|
+
* @returns The FMP Market Biggest Losers endpoint provides a list of the stocks that have lost the most value on a given day. This information can be used by investors to identify stocks that are underperforming and to potential trading opportunities.
|
|
549
688
|
*/
|
|
550
689
|
async getLosers() {
|
|
551
|
-
return this.client.get("/losers");
|
|
690
|
+
return this.client.get("/stock_market/losers", "v3");
|
|
552
691
|
}
|
|
553
692
|
/**
|
|
554
693
|
* Get most active stocks
|
|
555
694
|
*/
|
|
556
695
|
async getMostActive() {
|
|
557
|
-
return this.client.get("/
|
|
696
|
+
return this.client.get("/stock_market/actives", "v3");
|
|
558
697
|
}
|
|
559
698
|
/**
|
|
560
699
|
* Get sector performance
|
|
700
|
+
* https://site.financialmodelingprep.com/developer/docs#sector-performance-market-overview
|
|
701
|
+
* @returns The FMP Sector Performance endpoint provides the performance of each sector of the stock market over a specified period of time. This information can be used by investors to identify sectors that are outperforming or underperforming the market.
|
|
561
702
|
*/
|
|
562
703
|
async getSectorPerformance() {
|
|
563
|
-
return this.client.get("/sector-performance");
|
|
704
|
+
return this.client.get("/sector-performance", "v3");
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Get market indices
|
|
708
|
+
* https://site.financialmodelingprep.com/developer/docs#market-index-market-overview
|
|
709
|
+
* @returns The FMP Market Index endpoint provides a list of all the major stock market indices, such as the S&P 500, the Dow Jones Industrial Average, and the Nasdaq Composite Index. This information can be used by investors to track the performance of the overall stock market and to identify sectors and industries that are outperforming or underperforming the market.
|
|
710
|
+
*/
|
|
711
|
+
async getMarketIndex() {
|
|
712
|
+
return this.client.get("/quotes/index", "v3");
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
// src/endpoints/list.ts
|
|
717
|
+
var ListEndpoints = class {
|
|
718
|
+
constructor(client) {
|
|
719
|
+
this.client = client;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Get stock list
|
|
723
|
+
* https://site.financialmodelingprep.com/developer/docs#symbol-list-stock-list
|
|
724
|
+
* @returns The stock list
|
|
725
|
+
*/
|
|
726
|
+
async getStockList() {
|
|
727
|
+
return this.client.get("/stock/list");
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Get ETF list
|
|
731
|
+
* https://site.financialmodelingprep.com/developer/docs#exchange-traded-fund-search-stock-list
|
|
732
|
+
* @returns The ETF list
|
|
733
|
+
*/
|
|
734
|
+
async getETFList() {
|
|
735
|
+
return this.client.get("/etf/list");
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Get crypto list
|
|
739
|
+
* https://site.financialmodelingprep.com/developer/docs#cryptocurrencies-list-crypto
|
|
740
|
+
* @returns The crypto list
|
|
741
|
+
*/
|
|
742
|
+
async getCryptoList() {
|
|
743
|
+
return this.client.get("/symbol/available-cryptocurrencies");
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Get forex list
|
|
747
|
+
* https://site.financialmodelingprep.com/developer/docs#forex-list-forex
|
|
748
|
+
* @returns The forex list
|
|
749
|
+
*/
|
|
750
|
+
async getForexList() {
|
|
751
|
+
return this.client.get("/symbol/available-forex-currency-pairs");
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Get available indexes list
|
|
755
|
+
* https://site.financialmodelingprep.com/developer/docs#available-indexes
|
|
756
|
+
* @returns The available indexes list
|
|
757
|
+
*/
|
|
758
|
+
async getAvailableIndexes() {
|
|
759
|
+
return this.client.get("/symbol/available-indexes");
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
// src/endpoints/calendar.ts
|
|
764
|
+
var CalendarEndpoints = class {
|
|
765
|
+
constructor(client) {
|
|
766
|
+
this.client = client;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Get earnings calendar
|
|
770
|
+
* https://site.financialmodelingprep.com/developer/docs#earnings-calendar-earnings
|
|
771
|
+
* @param from - The start date to get the earnings calendar for
|
|
772
|
+
* @param to - The end date to get the earnings calendar for
|
|
773
|
+
* @returns The earnings calendar
|
|
774
|
+
*/
|
|
775
|
+
async getEarningsCalendar({ from, to } = {}) {
|
|
776
|
+
const params = {};
|
|
777
|
+
if (from) params.from = from;
|
|
778
|
+
if (to) params.to = to;
|
|
779
|
+
return this.client.get("/earning_calendar", "v3", params);
|
|
564
780
|
}
|
|
565
781
|
/**
|
|
566
|
-
* Get
|
|
782
|
+
* Get dividends calendar
|
|
783
|
+
* https://site.financialmodelingprep.com/developer/docs#dividends-calendar-dividends
|
|
784
|
+
* @param from - The start date to get the dividends calendar for
|
|
785
|
+
* @param to - The end date to get the dividends calendar for
|
|
786
|
+
* @returns The dividends calendar
|
|
567
787
|
*/
|
|
568
|
-
async
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
571
|
-
if (
|
|
572
|
-
return this.client.get("/
|
|
788
|
+
async getDividendsCalendar({ from, to } = {}) {
|
|
789
|
+
const params = {};
|
|
790
|
+
if (from) params.from = from;
|
|
791
|
+
if (to) params.to = to;
|
|
792
|
+
return this.client.get("/stock_dividend_calendar", "v3", params);
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Get economics calendar
|
|
796
|
+
* https://site.financialmodelingprep.com/developer/docs#economics-calendar-economics-data
|
|
797
|
+
* @param from - The start date to get the economics calendar for
|
|
798
|
+
* @param to - The end date to get the economics calendar for
|
|
799
|
+
* @returns The economics calendar
|
|
800
|
+
*/
|
|
801
|
+
async getEconomicsCalendar({ from, to } = {}) {
|
|
802
|
+
const params = {};
|
|
803
|
+
if (from) params.from = from;
|
|
804
|
+
if (to) params.to = to;
|
|
805
|
+
return this.client.get("/economic_calendar", "v3", params);
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Get IPO calendar
|
|
809
|
+
* https://site.financialmodelingprep.com/developer/docs#ipo-calender-by-ipo-calendar
|
|
810
|
+
* @param from - The start date to get the IPO calendar for
|
|
811
|
+
* @param to - The end date to get the IPO calendar for
|
|
812
|
+
* @returns The IPO calendar
|
|
813
|
+
*/
|
|
814
|
+
async getIPOCalendar({ from, to } = {}) {
|
|
815
|
+
const params = {};
|
|
816
|
+
if (from) params.from = from;
|
|
817
|
+
if (to) params.to = to;
|
|
818
|
+
return this.client.get("/ipo_calendar", "v3", params);
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Get stock splits calendar
|
|
822
|
+
* https://site.financialmodelingprep.com/developer/docs#splits-calendar-splits
|
|
823
|
+
* @param from - The start date to get the stock splits calendar for
|
|
824
|
+
* @param to - The end date to get the stock splits calendar for
|
|
825
|
+
* @returns The stock splits calendar
|
|
826
|
+
*/
|
|
827
|
+
async getSplitsCalendar({ from, to } = {}) {
|
|
828
|
+
const params = {};
|
|
829
|
+
if (from) params.from = from;
|
|
830
|
+
if (to) params.to = to;
|
|
831
|
+
return this.client.get("/stock_split_calendar", "v3", params);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
// src/endpoints/company.ts
|
|
836
|
+
var CompanyEndpoints = class {
|
|
837
|
+
constructor(client) {
|
|
838
|
+
this.client = client;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Get company profile
|
|
842
|
+
* https://site.financialmodelingprep.com/developer/docs#company-profile-company-information
|
|
843
|
+
* @param symbol - The stock symbol to get the profile for
|
|
844
|
+
* @returns Get a comprehensive overview of a company with our Company Profile endpoint. This endpoint provides key information such as price, beta, market capitalization, description, headquarters, and more.
|
|
845
|
+
*/
|
|
846
|
+
async getCompanyProfile({
|
|
847
|
+
symbol
|
|
848
|
+
}) {
|
|
849
|
+
return this.client.getSingle(`/profile/${symbol}`, "v3");
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Get executive compensation
|
|
853
|
+
* https://site.financialmodelingprep.com/developer/docs#executive-compensation-company-information
|
|
854
|
+
* @param symbol - The stock symbol to get the executive compensation for
|
|
855
|
+
* @returns Understand how a company compensates its executives with our Executive Compensation endpoint. This endpoint provides information such as salary, bonus, and stock options for each executive.
|
|
856
|
+
*/
|
|
857
|
+
async getExecutiveCompensation({
|
|
858
|
+
symbol
|
|
859
|
+
}) {
|
|
860
|
+
const params = { symbol };
|
|
861
|
+
return this.client.get(`/governance/executive_compensation`, "v4", params);
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Get company notes
|
|
865
|
+
* https://site.financialmodelingprep.com/developer/docs#company-notes-company-information
|
|
866
|
+
* @param symbol - The stock symbol to get the notes for
|
|
867
|
+
* @returns Stay up-to-date on a company's financial condition, operations, and risks with our Company Notes endpoint. This endpoint provides information about notes reported by a company in their financial statements.
|
|
868
|
+
*/
|
|
869
|
+
async getCompanyNotes({
|
|
870
|
+
symbol
|
|
871
|
+
}) {
|
|
872
|
+
const params = { symbol };
|
|
873
|
+
return this.client.get(`/company-notes`, "v4", params);
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Get historical employee count
|
|
877
|
+
* https://site.financialmodelingprep.com/developer/docs#historical-employee-company-information
|
|
878
|
+
* @param symbol - The stock symbol to get the historical employee count for
|
|
879
|
+
* @returns Track a company's employee count over time with our Historical Employee Count endpoint. This endpoint provides information about the number of employees a company has had each year.
|
|
880
|
+
*/
|
|
881
|
+
async getHistoricalEmployeeCount({
|
|
882
|
+
symbol
|
|
883
|
+
}) {
|
|
884
|
+
const params = { symbol };
|
|
885
|
+
return this.client.get(`/historical/employee_count`, "v4", params);
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Get shares float
|
|
889
|
+
* https://site.financialmodelingprep.com/developer/docs#company-share-float-share-float
|
|
890
|
+
* @param symbol - The stock symbol to get the shares float for
|
|
891
|
+
* @returns The FMP Company Share Float endpoint provides the total number of shares that are publicly traded for a given company. This is also known as the company's float. The float is calculated by subtracting the number of restricted shares from the total number of outstanding shares.
|
|
892
|
+
*/
|
|
893
|
+
async getSharesFloat({ symbol }) {
|
|
894
|
+
const params = { symbol };
|
|
895
|
+
return this.client.getSingle(`/shares_float`, "v4", params);
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Get historical shares float
|
|
899
|
+
* https://site.financialmodelingprep.com/developer/docs#company-historical-share-float
|
|
900
|
+
* @param symbol - The stock symbol to get the historical shares float for
|
|
901
|
+
* @returns The FMP Historical Share Float endpoint provides historical data on the number of shares that are publicly traded for a given company. This is also known as the company's float. The float is calculated by subtracting the number of restricted shares from the total number of outstanding shares.
|
|
902
|
+
*/
|
|
903
|
+
async getHistoricalSharesFloat({
|
|
904
|
+
symbol
|
|
905
|
+
}) {
|
|
906
|
+
const params = { symbol };
|
|
907
|
+
return this.client.get(`/historical/shares_float`, "v4", params);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Get earnings call transcript
|
|
911
|
+
* https://site.financialmodelingprep.com/developer/docs#earnings-transcript-earnings-transcripts
|
|
912
|
+
* @param symbol - The stock symbol to get the earnings call transcript for
|
|
913
|
+
* @param year - The year of the earnings call
|
|
914
|
+
* @param quarter - The quarter of the earnings call
|
|
915
|
+
* @returns The FMP Earnings Call Transcript endpoint provides the transcript of a company's earnings call.
|
|
916
|
+
*/
|
|
917
|
+
async getEarningsCallTranscript({
|
|
918
|
+
symbol,
|
|
919
|
+
year,
|
|
920
|
+
quarter
|
|
921
|
+
}) {
|
|
922
|
+
const params = { year, quarter };
|
|
923
|
+
return this.client.getSingle(`/earning_call_transcript/${symbol}`, "v3", params);
|
|
573
924
|
}
|
|
574
925
|
};
|
|
575
926
|
|
|
576
927
|
// src/fmp.ts
|
|
577
928
|
var FMP = class {
|
|
578
929
|
constructor(config) {
|
|
579
|
-
|
|
930
|
+
validateApiKey(config.apiKey);
|
|
580
931
|
const client = new FMPClient(config);
|
|
581
932
|
this.stock = new StockEndpoints(client);
|
|
582
933
|
this.financial = new FinancialEndpoints(client);
|
|
583
|
-
this.forex = new ForexEndpoints(client);
|
|
584
934
|
this.crypto = new CryptoEndpoints(client);
|
|
585
935
|
this.etf = new ETFEndpoints(client);
|
|
586
|
-
this.mutualFund = new MutualFundEndpoints(client);
|
|
587
|
-
this.bond = new BondEndpoints(client);
|
|
588
|
-
this.economic = new EconomicEndpoints(client);
|
|
589
936
|
this.market = new MarketEndpoints(client);
|
|
937
|
+
this.list = new ListEndpoints(client);
|
|
938
|
+
this.calendar = new CalendarEndpoints(client);
|
|
939
|
+
this.company = new CompanyEndpoints(client);
|
|
940
|
+
this.forex = new ForexEndpoints(client);
|
|
941
|
+
this.economic = new EconomicEndpoints(client);
|
|
942
|
+
this.bond = new BondEndpoints(client);
|
|
943
|
+
this.mutualFund = new MutualFundEndpoints(client);
|
|
590
944
|
}
|
|
591
945
|
/**
|
|
592
946
|
* Get the underlying client instance for advanced usage
|
|
@@ -597,7 +951,22 @@ var FMP = class {
|
|
|
597
951
|
};
|
|
598
952
|
|
|
599
953
|
// src/types/common.ts
|
|
600
|
-
var
|
|
954
|
+
var Period = /* @__PURE__ */ ((Period2) => {
|
|
955
|
+
Period2["ANNUAL"] = "annual";
|
|
956
|
+
Period2["QUARTER"] = "quarter";
|
|
957
|
+
return Period2;
|
|
958
|
+
})(Period || {});
|
|
959
|
+
var Exchange = /* @__PURE__ */ ((Exchange2) => {
|
|
960
|
+
Exchange2["NYSE"] = "NYSE";
|
|
961
|
+
Exchange2["NASDAQ"] = "NASDAQ";
|
|
962
|
+
Exchange2["AMEX"] = "AMEX";
|
|
963
|
+
Exchange2["TSX"] = "TSX";
|
|
964
|
+
Exchange2["LSE"] = "LSE";
|
|
965
|
+
Exchange2["ASX"] = "ASX";
|
|
966
|
+
Exchange2["NSE"] = "NSE";
|
|
967
|
+
Exchange2["BSE"] = "BSE";
|
|
968
|
+
return Exchange2;
|
|
969
|
+
})(Exchange || {});
|
|
601
970
|
|
|
602
971
|
// src/utils/formatting.ts
|
|
603
972
|
function formatCurrency(value, currency = "USD") {
|
|
@@ -720,6 +1089,8 @@ var HTTP_STATUS = {
|
|
|
720
1089
|
|
|
721
1090
|
exports.BondEndpoints = BondEndpoints;
|
|
722
1091
|
exports.COUNTRIES = COUNTRIES;
|
|
1092
|
+
exports.CalendarEndpoints = CalendarEndpoints;
|
|
1093
|
+
exports.CompanyEndpoints = CompanyEndpoints;
|
|
723
1094
|
exports.CryptoEndpoints = CryptoEndpoints;
|
|
724
1095
|
exports.DEFAULT_LIMIT = DEFAULT_LIMIT;
|
|
725
1096
|
exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
|
|
@@ -730,13 +1101,10 @@ exports.EconomicEndpoints = EconomicEndpoints;
|
|
|
730
1101
|
exports.Exchange = Exchange;
|
|
731
1102
|
exports.FMP = FMP;
|
|
732
1103
|
exports.FMPClient = FMPClient;
|
|
733
|
-
exports.FMPError = FMPError;
|
|
734
|
-
exports.FMP_BASE_URL = FMP_BASE_URL;
|
|
735
|
-
exports.FMP_BASE_URL_V4 = FMP_BASE_URL_V4;
|
|
736
|
-
exports.FMP_STABLE_URL = FMP_STABLE_URL;
|
|
737
1104
|
exports.FinancialEndpoints = FinancialEndpoints;
|
|
738
1105
|
exports.ForexEndpoints = ForexEndpoints;
|
|
739
1106
|
exports.HTTP_STATUS = HTTP_STATUS;
|
|
1107
|
+
exports.ListEndpoints = ListEndpoints;
|
|
740
1108
|
exports.MAX_LIMIT = MAX_LIMIT;
|
|
741
1109
|
exports.MarketEndpoints = MarketEndpoints;
|
|
742
1110
|
exports.MutualFundEndpoints = MutualFundEndpoints;
|