fmp-node-api 0.0.8 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,1599 +1,2 @@
1
- import axios from 'axios';
2
-
3
- // src/client.ts
4
- function unwrapSingleObject(data) {
5
- if (Array.isArray(data) && data.length === 1) {
6
- return data[0];
7
- }
8
- return data;
9
- }
10
- function normalizeArrayResponse(data) {
11
- if (Array.isArray(data)) return data;
12
- if (data == null) return [];
13
- return data;
14
- }
15
- function normalizeObjectResponse(data) {
16
- if (data == null) return {};
17
- return data;
18
- }
19
- var FMPClient = class {
20
- constructor(config) {
21
- this.apiKey = config.apiKey;
22
- this.v3Client = this.createClient("https://financialmodelingprep.com/api/v3", config.timeout);
23
- this.v4Client = this.createClient("https://financialmodelingprep.com/api/v4", config.timeout);
24
- this.stableClient = this.createClient(
25
- "https://financialmodelingprep.com/stable",
26
- config.timeout
27
- );
28
- }
29
- createClient(baseURL, timeout) {
30
- const client = axios.create({
31
- baseURL,
32
- timeout: timeout || 1e4,
33
- headers: { "Content-Type": "application/json" }
34
- });
35
- client.interceptors.request.use((config) => {
36
- config.params = { ...config.params, apikey: this.apiKey };
37
- return config;
38
- });
39
- return client;
40
- }
41
- /**
42
- * Standard get method - returns raw API response
43
- *
44
- * For endpoints that return arrays, this will always return an array (possibly empty) for `data` when success is true.
45
- * For endpoints that return objects, data is returned as-is.
46
- */
47
- async get(endpoint, version = "v3", params) {
48
- const client = this.getClientForVersion(version);
49
- try {
50
- const response = await client.get(endpoint, { params });
51
- let data = response.data;
52
- if (Array.isArray(data) || data == null) {
53
- data = normalizeArrayResponse(data);
54
- }
55
- return {
56
- success: true,
57
- data,
58
- error: null,
59
- status: response.status
60
- };
61
- } catch (error) {
62
- return {
63
- success: false,
64
- data: null,
65
- error: error.message || "Unknown error occurred",
66
- status: error.response?.status || 500
67
- };
68
- }
69
- }
70
- /**
71
- * Get method for single-object endpoints - unwraps single-item arrays
72
- *
73
- * For endpoints that return single objects, this will always return an object (possibly empty) for `data` when success is true.
74
- */
75
- async getSingle(endpoint, version = "v3", params) {
76
- const client = this.getClientForVersion(version);
77
- try {
78
- const response = await client.get(endpoint, { params });
79
- const data = normalizeObjectResponse(unwrapSingleObject(response.data));
80
- return {
81
- success: true,
82
- data,
83
- error: null,
84
- status: response.status
85
- };
86
- } catch (error) {
87
- return {
88
- success: false,
89
- data: null,
90
- error: error.message || "Unknown error occurred",
91
- status: error.response?.status || 500
92
- };
93
- }
94
- }
95
- getClientForVersion(version) {
96
- switch (version) {
97
- case "v3":
98
- return this.v3Client;
99
- case "v4":
100
- return this.v4Client;
101
- case "stable":
102
- return this.stableClient;
103
- default:
104
- return this.v3Client;
105
- }
106
- }
107
- };
108
-
109
- // src/shared.ts
110
- var FMPError = class extends Error {
111
- constructor(message, status, code) {
112
- super(message);
113
- this.status = status;
114
- this.code = code;
115
- this.name = "FMPError";
116
- }
117
- };
118
-
119
- // src/utils/validation.ts
120
- function validateApiKey(apiKey) {
121
- if (!apiKey || typeof apiKey !== "string" || apiKey.trim().length === 0) {
122
- throw new FMPError("API key is required and must be a non-empty string");
123
- }
124
- }
125
- function validateSymbol(symbol) {
126
- if (!symbol || typeof symbol !== "string" || symbol.trim().length === 0) {
127
- throw new FMPError("Symbol is required and must be a non-empty string");
128
- }
129
- const symbolRegex = /^[A-Z0-9.-]+$/;
130
- if (!symbolRegex.test(symbol.toUpperCase())) {
131
- throw new FMPError(
132
- "Invalid symbol format. Symbols should contain only letters, numbers, dots, and hyphens"
133
- );
134
- }
135
- }
136
- function validateDate(date) {
137
- if (!date || typeof date !== "string") {
138
- throw new FMPError("Date is required and must be a string");
139
- }
140
- const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
141
- if (!dateRegex.test(date)) {
142
- throw new FMPError("Invalid date format. Use YYYY-MM-DD format");
143
- }
144
- const parsedDate = new Date(date);
145
- if (isNaN(parsedDate.getTime())) {
146
- throw new FMPError("Invalid date");
147
- }
148
- }
149
- function validatePeriod(period) {
150
- if (period && !["annual", "quarter"].includes(period)) {
151
- throw new FMPError('Period must be either "annual" or "quarter"');
152
- }
153
- }
154
- function validateLimit(limit) {
155
- if (limit !== void 0 && (typeof limit !== "number" || limit < 1 || limit > 1e3)) {
156
- throw new FMPError("Limit must be a number between 1 and 1000");
157
- }
158
- }
159
- function validatePage(page) {
160
- if (page !== void 0 && (typeof page !== "number" || page < 0)) {
161
- throw new FMPError("Page must be a non-negative number");
162
- }
163
- }
164
-
165
- // src/endpoints/stock.ts
166
- var StockEndpoints = class {
167
- constructor(client) {
168
- this.client = client;
169
- }
170
- /**
171
- * Get real-time stock quote
172
- * @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
173
- * @param symbol - The stock symbol to get the quote for
174
- * @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.
175
- */
176
- async getQuote({ symbol }) {
177
- console.warn(
178
- "\u26A0\uFE0F StockEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
179
- );
180
- return this.client.getSingle(`/quote/${symbol}`, "v3");
181
- }
182
- /**
183
- * Get historical stock prices
184
- * @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
185
- * @param symbol - The stock symbol to get the historical prices for
186
- * @param from - The start date to get the historical prices for
187
- * @param to - The end date to get the historical prices for
188
- * @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
189
- */
190
- async getHistoricalPrice({
191
- symbol,
192
- from,
193
- to
194
- }) {
195
- console.warn(
196
- "\u26A0\uFE0F StockEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
197
- );
198
- const params = {};
199
- if (from) params.from = from;
200
- if (to) params.to = to;
201
- return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", params);
202
- }
203
- /**
204
- * Get market cap
205
- * https://site.financialmodelingprep.com/developer/docs#market-cap-company-information
206
- * @param symbol - The stock symbol to get the market cap for
207
- * @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.
208
- */
209
- async getMarketCap({ symbol }) {
210
- return this.client.getSingle(`/market-capitalization/${symbol}`, "v3");
211
- }
212
- /**
213
- * Get stock splits
214
- * https://site.financialmodelingprep.com/developer/docs#splits-historical-splits
215
- * @param symbol - The stock symbol to get the splits for
216
- * @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.
217
- */
218
- async getStockSplits({ symbol }) {
219
- return this.client.get(`/historical-price-full/stock_split/${symbol}`, "v3");
220
- }
221
- /**
222
- * Get dividend history
223
- * https://site.financialmodelingprep.com/developer/docs#dividends-historical-dividends
224
- * @param symbol - The stock symbol to get the dividend history for
225
- * @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.
226
- */
227
- async getDividendHistory({
228
- symbol
229
- }) {
230
- return this.client.getSingle(`/historical-price-full/stock_dividend/${symbol}`, "v3");
231
- }
232
- /**
233
- * Get stock real time price
234
- * @param symbol - The stock symbol to get the real time price for
235
- * @returns The real time price for the stock
236
- */
237
- async getRealTimePrice({
238
- symbols
239
- }) {
240
- const url = `stock/real-time-price/${symbols.join(",")}`;
241
- const result = await this.client.get(url, "v3");
242
- if (result.success && result.data && !Array.isArray(result.data)) {
243
- const data = result.data;
244
- if (typeof data === "object" && data !== null && "companiesPriceList" in data && Array.isArray(data.companiesPriceList)) {
245
- const filteredData2 = data.companiesPriceList.filter((item) => item && item.symbol);
246
- if (filteredData2.length > 0) {
247
- return { ...result, data: filteredData2 };
248
- }
249
- }
250
- if (typeof data === "object" && data !== null && "stockList" in data && Array.isArray(data.stockList)) {
251
- const filteredData2 = data.stockList.filter((item) => item && item.symbol);
252
- if (filteredData2.length > 0) {
253
- return { ...result, data: filteredData2 };
254
- }
255
- }
256
- if (data.symbol) {
257
- return { ...result, data: [data] };
258
- }
259
- if (symbols.length === 1) {
260
- console.warn(`No real-time price data found for symbol: ${symbols[0]}`);
261
- }
262
- return { ...result, data: [] };
263
- }
264
- const filteredData = result.data.filter((item) => item && item.symbol);
265
- return { ...result, data: filteredData };
266
- }
267
- /**
268
- * Get stock real time price full
269
- * https://site.financialmodelingprep.com/developer/docs#real-time-full-price-quote
270
- * @param symbols - The stock symbols to get the real time price for
271
- * @returns The real time price for the stocks
272
- */
273
- async getRealTimePriceForMultipleStocks({
274
- symbols
275
- }) {
276
- const url = `stock/full/real-time-price/${symbols.join(",")}`;
277
- const result = await this.client.get(url, "v3");
278
- if (result.success && result.data && !Array.isArray(result.data)) {
279
- const data = result.data;
280
- if (typeof data === "object" && data !== null && "companiesPriceList" in data && Array.isArray(data.companiesPriceList)) {
281
- const filteredData2 = data.companiesPriceList.filter((item) => item && item.symbol);
282
- if (filteredData2.length > 0) {
283
- return { ...result, data: filteredData2 };
284
- }
285
- }
286
- if (typeof data === "object" && data !== null && "stockList" in data && Array.isArray(data.stockList)) {
287
- const filteredData2 = data.stockList.filter((item) => item && item.symbol);
288
- if (filteredData2.length > 0) {
289
- return { ...result, data: filteredData2 };
290
- }
291
- }
292
- if (data.symbol) {
293
- return { ...result, data: [data] };
294
- }
295
- if (symbols.length === 1) {
296
- console.warn(`No full real-time price data found for symbol: ${symbols[0]}`);
297
- }
298
- return { ...result, data: [] };
299
- }
300
- const filteredData = result.data.filter(
301
- (item) => item && item.symbol
302
- );
303
- return { ...result, data: filteredData };
304
- }
305
- };
306
-
307
- // src/endpoints/financial.ts
308
- var FinancialEndpoints = class {
309
- constructor(client) {
310
- this.client = client;
311
- }
312
- /**
313
- * Get income statement
314
- * https://site.financialmodelingprep.com/developer/docs#income-statements-financial-statements
315
- * @param symbol - The stock symbol to get the income statement for
316
- * @param period - The period to get the income statement for (annual or quarter)
317
- * @param limit - The number of periods to get
318
- * @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.
319
- */
320
- async getIncomeStatement({
321
- symbol,
322
- period = "annual",
323
- limit = 5
324
- }) {
325
- return this.client.get(`/income-statement/${symbol}?period=${period}&limit=${limit}`, "v3");
326
- }
327
- /**
328
- * Get balance sheet
329
- * https://site.financialmodelingprep.com/developer/docs#balance-sheet-statements-financial-statements
330
- * @param symbol - The stock symbol to get the balance sheet for
331
- * @param period - The period to get the balance sheet for (annual or quarter)
332
- * @param limit - The number of periods to get
333
- * @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.
334
- */
335
- async getBalanceSheet({
336
- symbol,
337
- period = "annual",
338
- limit = 5
339
- }) {
340
- return this.client.get(
341
- `/balance-sheet-statement/${symbol}?period=${period}&limit=${limit}`,
342
- "v3"
343
- );
344
- }
345
- /**
346
- * Get cash flow statement
347
- * https://site.financialmodelingprep.com/developer/docs#cashflow-statements-financial-statements
348
- * @param symbol - The stock symbol to get the cash flow statement for
349
- * @param period - The period to get the cash flow statement for (annual or quarter)
350
- * @param limit - The number of periods to get
351
- * @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.
352
- */
353
- async getCashFlowStatement({
354
- symbol,
355
- period = "annual",
356
- limit = 5
357
- }) {
358
- return this.client.get(`/cash-flow-statement/${symbol}?period=${period}&limit=${limit}`, "v3");
359
- }
360
- /**
361
- * Get key metrics
362
- * https://site.financialmodelingprep.com/developer/docs#key-metrics-statement-analysis
363
- * @param symbol - The stock symbol to get the key metrics for
364
- * @param period - The period to get the key metrics for (annual or quarter)
365
- * @param limit - The number of periods to get
366
- * @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.
367
- */
368
- async getKeyMetrics({
369
- symbol,
370
- period = "annual",
371
- limit = 5
372
- }) {
373
- return this.client.get(`/key-metrics/${symbol}?period=${period}&limit=${limit}`, "v3");
374
- }
375
- /**
376
- * Get financial ratios
377
- * https://site.financialmodelingprep.com/developer/docs#ratios-statement-analysis
378
- * @param symbol - The stock symbol to get the financial ratios for
379
- * @param period - The period to get the financial ratios for (annual or quarter)
380
- * @param limit - The number of periods to get
381
- * @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.
382
- */
383
- async getFinancialRatios({
384
- symbol,
385
- period = "annual",
386
- limit = 5
387
- }) {
388
- return this.client.get(`/ratios/${symbol}?period=${period}&limit=${limit}`, "v3");
389
- }
390
- /**
391
- * Get enterprise value
392
- * https://site.financialmodelingprep.com/developer/docs#enterprise-values-statement-analysis
393
- * @param symbol - The stock symbol to get the enterprise value for
394
- * @param period - The period to get the enterprise value for (annual or quarter)
395
- * @param limit - The number of periods to get
396
- * @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.
397
- */
398
- async getEnterpriseValue({
399
- symbol,
400
- period = "annual",
401
- limit = 5
402
- }) {
403
- return this.client.get(`/enterprise-value/${symbol}?period=${period}&limit=${limit}`, "v3");
404
- }
405
- /**
406
- * Get cashflow growth
407
- * https://site.financialmodelingprep.com/developer/docs#cashflow-growth-statement-analysis
408
- * @param symbol - The stock symbol to get the cashflow growth for
409
- * @param period - The period to get the cashflow growth for (annual or quarter)
410
- * @param limit - The number of periods to get
411
- * @returns Get the cash flow growth rate for a company. Measure how quickly a company's cash flow is growing.
412
- */
413
- async getCashflowGrowth({
414
- symbol,
415
- period = "annual",
416
- limit = 5
417
- }) {
418
- return this.client.get(
419
- `/cash-flow-statement-growth/${symbol}?period=${period}&limit=${limit}`,
420
- "v3"
421
- );
422
- }
423
- /**
424
- * Get income growth
425
- * https://site.financialmodelingprep.com/developer/docs#income-growth-statement-analysis
426
- * @param symbol - The stock symbol to get the income growth for
427
- * @param period - The period to get the income growth for (annual or quarter)
428
- * @param limit - The number of periods to get
429
- * @returns Get the income growth rate for a company. Measure how quickly a company's income is growing.
430
- */
431
- async getIncomeGrowth({
432
- symbol,
433
- period = "annual",
434
- limit = 5
435
- }) {
436
- return this.client.get(
437
- `/income-statement-growth/${symbol}?period=${period}&limit=${limit}`,
438
- "v3"
439
- );
440
- }
441
- /**
442
- * Get balance sheet growth
443
- * https://site.financialmodelingprep.com/developer/docs#balance-sheet-growth-statement-analysis
444
- * @param symbol - The stock symbol to get the balance sheet growth for
445
- * @param period - The period to get the balance sheet growth for (annual or quarter)
446
- * @param limit - The number of periods to get
447
- * @returns Get the balance sheet growth rate for a company. Measure how quickly a company's assets and liabilities are growing.
448
- */
449
- async getBalanceSheetGrowth({
450
- symbol,
451
- period = "annual",
452
- limit = 5
453
- }) {
454
- return this.client.get(
455
- `/balance-sheet-statement-growth/${symbol}?period=${period}&limit=${limit}`,
456
- "v3"
457
- );
458
- }
459
- /**
460
- * Get financial growth
461
- * https://site.financialmodelingprep.com/developer/docs#financial-growth-statement-analysis
462
- * @param symbol - The stock symbol to get the financial growth for
463
- * @param period - The period to get the financial growth for (annual or quarter)
464
- * @param limit - The number of periods to get
465
- * @returns Financial Growth Get the financial growth rate for a company. Measure how quickly a company's overall financial performance is improving.
466
- */
467
- async getFinancialGrowth({
468
- symbol,
469
- period = "annual",
470
- limit = 5
471
- }) {
472
- return this.client.get(`/financial-growth/${symbol}?period=${period}&limit=${limit}`, "v3");
473
- }
474
- /**
475
- * Get earnings historical
476
- * https://site.financialmodelingprep.com/developer/docs#earnings-historical-earnings
477
- * @param symbol - The stock symbol to get the earnings historical for
478
- * @param limit - The number of periods to get
479
- * @returns A list of historical & upcoming earnings announcements for a specific company, including the date, estimated EPS, and actual EPS.
480
- */
481
- async getEarningsHistorical({
482
- symbol,
483
- limit = 5
484
- }) {
485
- return this.client.get(`/historical/earning_calendar/${symbol}?limit=${limit}`, "v3");
486
- }
487
- /**
488
- * Get earnings surprises
489
- * https://site.financialmodelingprep.com/developer/docs#earnings-surprises-earnings
490
- * @param symbol - The stock symbol to get the earnings surprises for
491
- * @param limit - The number of periods to get
492
- * @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.
493
- */
494
- async getEarningsSurprises({
495
- symbol
496
- }) {
497
- return this.client.get(`/earnings-surprises/${symbol}`, "v3");
498
- }
499
- };
500
-
501
- // src/endpoints/forex.ts
502
- var ForexEndpoints = class {
503
- constructor(client) {
504
- this.client = client;
505
- }
506
- /**
507
- * Get forex quote
508
- * @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
509
- * @param params - Parameters for the forex quote request
510
- * @returns Forex quote data
511
- */
512
- async getQuote(params) {
513
- console.warn(
514
- "\u26A0\uFE0F ForexEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
515
- );
516
- return this.client.get("/quote", "v3", params);
517
- }
518
- /**
519
- * Get historical forex prices
520
- * @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
521
- * @param symbol - The forex symbol to get the historical prices for
522
- * @param from - The start date to get the historical prices for
523
- * @param to - The end date to get the historical prices for
524
- * @returns Historical forex price data
525
- */
526
- async getHistoricalPrice({
527
- symbol,
528
- from,
529
- to
530
- }) {
531
- console.warn(
532
- "\u26A0\uFE0F ForexEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
533
- );
534
- const params = {};
535
- if (from) params.from = from;
536
- if (to) params.to = to;
537
- return this.client.get(`/historical-price-full/${symbol}`, "v3", params);
538
- }
539
- };
540
-
541
- // src/endpoints/crypto.ts
542
- var CryptoEndpoints = class {
543
- constructor(client) {
544
- this.client = client;
545
- }
546
- /**
547
- * Get crypto quote
548
- * @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
549
- * @param symbol - The crypto symbol to get the quote for
550
- * @returns Crypto quote data
551
- */
552
- async getQuote({ symbol }) {
553
- console.warn(
554
- "\u26A0\uFE0F CryptoEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
555
- );
556
- return this.client.getSingle(`/quote/${symbol}`, "v3");
557
- }
558
- /**
559
- * Get historical crypto prices
560
- * @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
561
- * @param symbol - The crypto symbol to get the historical prices for
562
- * @param from - The start date to get the historical prices for
563
- * @param to - The end date to get the historical prices for
564
- * @returns Provides daily price data for all cryptocurrencies that are traded on exchanges around the world.
565
- */
566
- async getHistoricalPrice({
567
- symbol,
568
- from,
569
- to
570
- }) {
571
- console.warn(
572
- "\u26A0\uFE0F CryptoEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
573
- );
574
- const params = {};
575
- if (from) params.from = from;
576
- if (to) params.to = to;
577
- return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", params);
578
- }
579
- };
580
-
581
- // src/endpoints/etf.ts
582
- var ETFEndpoints = class {
583
- constructor(client) {
584
- this.client = client;
585
- }
586
- /**
587
- * Get ETF holding dates
588
- * https://site.financialmodelingprep.com/developer/docs#etf-holding-dates-etf-holdings
589
- * @param symbol - The symbol of the ETF to get the holding dates for
590
- * @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.
591
- */
592
- async getHoldingDates({ symbol }) {
593
- const params = {};
594
- if (symbol) params.symbol = symbol;
595
- return this.client.get("/etf-holdings/portfolio-date", "v4", params);
596
- }
597
- /**
598
- * Get ETF holdings
599
- * https://site.financialmodelingprep.com/developer/docs#etf-holdings-etf-holdings
600
- * @param symbol - The symbol of the ETF to get the holdings for
601
- * @param date - The date to get the holdings for
602
- * @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.
603
- */
604
- async getHoldings({
605
- symbol,
606
- date
607
- }) {
608
- const params = {};
609
- if (symbol) params.symbol = symbol;
610
- if (date) params.date = date;
611
- return this.client.get("/etf-holdings", "v4", params);
612
- }
613
- /**
614
- * Get ETF holder
615
- * https://site.financialmodelingprep.com/developer/docs#etf-holder-etf-holdings
616
- * @param symbol - The symbol of the ETF to get the holder for
617
- * @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.
618
- */
619
- async getHolder({ symbol }) {
620
- return this.client.get(`/etf-holder/${symbol}`, "v3");
621
- }
622
- /**
623
- * Get ETF profile
624
- * https://site.financialmodelingprep.com/developer/docs#etf-information-etf-holdings
625
- * @param symbol - The symbol of the ETF to get the profile for
626
- * @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.
627
- */
628
- async getProfile({ symbol }) {
629
- const params = {};
630
- if (symbol) params.symbol = symbol;
631
- return this.client.getSingle("/etf-info", "v4", params);
632
- }
633
- /**
634
- * Get ETF sector weighting
635
- * https://site.financialmodelingprep.com/developer/docs#etf-sector-weighting-etf-holdings
636
- * @param symbol - The symbol of the ETF to get the sector exposure for
637
- * @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.
638
- */
639
- async getSectorWeighting({ symbol }) {
640
- return this.client.get(`/etf-sector-weightings/${symbol}`, "v3");
641
- }
642
- /**
643
- * Get ETF country weighting
644
- * https://site.financialmodelingprep.com/developer/docs#etf-country-weighting-etf-holdings
645
- * @param symbol - The symbol of the ETF to get the country weighting for
646
- * @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.
647
- */
648
- async getCountryWeighting({ symbol }) {
649
- return this.client.get(`/etf-country-weightings/${symbol}`, "v3");
650
- }
651
- /**
652
- * Get ETF Stock exposure
653
- * https://site.financialmodelingprep.com/developer/docs#etf-sector-exposure-etf-holdings
654
- * @param symbol - The symbol of the ETF to get the stock exposure for
655
- * @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.
656
- */
657
- async getStockExposure({ symbol }) {
658
- return this.client.get(`/etf-stock-exposure/${symbol}`, "v3");
659
- }
660
- };
661
-
662
- // src/endpoints/mutual-fund.ts
663
- var MutualFundEndpoints = class {
664
- constructor(client) {
665
- this.client = client;
666
- }
667
- /**
668
- * Get mutual fund quote
669
- * @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in a future release.
670
- * @param params - Parameters for the mutual fund quote request
671
- * @returns Mutual fund quote data
672
- */
673
- async getQuote(params) {
674
- return this.client.get("/quote", "v3", params);
675
- }
676
- /**
677
- * Get mutual fund holders
678
- * https://site.financialmodelingprep.com/developer/docs#mutual-fund-holder-mutual-funds-holdings
679
- * @param symbol - The symbol of the mutual fund to get the holders for
680
- * @returns Mutual fund holders data
681
- */
682
- async getHolders({ symbol }) {
683
- return this.client.get(`/mutual-fund-holder/${symbol}`, "v3");
684
- }
685
- };
686
-
687
- // src/endpoints/economic.ts
688
- var EconomicEndpoints = class {
689
- constructor(client) {
690
- this.client = client;
691
- }
692
- /**
693
- * Get treasury rates
694
- * https://site.financialmodelingprep.com/developer/docs#treasury-rates-economics-data
695
- * @param from - The start date to get the treasury rates for
696
- * @param to - The end date to get the treasury rates for
697
- * @returns Treasury rates data
698
- */
699
- async getTreasuryRates(params) {
700
- const { from, to } = params;
701
- const queryParams = {};
702
- if (from) queryParams.from = from;
703
- if (to) queryParams.to = to;
704
- return this.client.get("/treasury", "v4", queryParams);
705
- }
706
- /**
707
- * Get economic indicators
708
- * https://site.financialmodelingprep.com/developer/docs#economic-indicators-economics-data
709
- * @param name - GDP, realGDP, nominalPotentialGDP, realGDPPerCapita, federalFunds, CPI, inflationRate, inflation, retailSales, consumerSentiment, durableGoods, unemploymentRate, totalNonfarmPayroll, initialClaims, industrialProductionTotalIndex, newPrivatelyOwnedHousingUnitsStartedTotalUnits, totalVehicleSales, retailMoneyFunds, smoothedUSRecessionProbabilities, 3MonthOr90DayRatesAndYieldsCertificatesOfDeposit, commercialBankInterestRateOnCreditCardPlansAllAccounts, 30YearFixedRateMortgageAverage, 15YearFixedRateMortgageAverage
710
- * @param from - The start date to get the economic indicators for
711
- * @param to - The end date to get the economic indicators for
712
- * @returns Provides real-time and historical economic data for a variety of economic indicators, such as GDP, unemployment, and inflation.
713
- */
714
- async getEconomicIndicators(params) {
715
- const { name, from, to } = params;
716
- const queryParams = { name };
717
- if (from) queryParams.from = from;
718
- if (to) queryParams.to = to;
719
- return this.client.get(`/economic`, "v4", queryParams);
720
- }
721
- };
722
-
723
- // src/endpoints/market.ts
724
- var MarketEndpoints = class {
725
- constructor(client) {
726
- this.client = client;
727
- }
728
- /**
729
- * Get market hours
730
- */
731
- async getMarketHours() {
732
- return this.client.get("/market-hours", "v3");
733
- }
734
- /**
735
- * Get market performance
736
- */
737
- async getMarketPerformance() {
738
- return this.client.get("/market-performance", "v3");
739
- }
740
- /**
741
- * Get top gainers
742
- * https://site.financialmodelingprep.com/developer/docs#market-biggest-gainers-market-overview
743
- * @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.
744
- */
745
- async getGainers() {
746
- return this.client.get("/stock_market/gainers", "v3");
747
- }
748
- /**
749
- * Get top losers
750
- * https://site.financialmodelingprep.com/developer/docs#market-biggest-losers-market-overview
751
- * @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.
752
- */
753
- async getLosers() {
754
- return this.client.get("/stock_market/losers", "v3");
755
- }
756
- /**
757
- * Get most active stocks
758
- */
759
- async getMostActive() {
760
- return this.client.get("/stock_market/actives", "v3");
761
- }
762
- /**
763
- * Get sector performance
764
- * https://site.financialmodelingprep.com/developer/docs#sector-performance-market-overview
765
- * @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.
766
- */
767
- async getSectorPerformance() {
768
- return this.client.get("/sector-performance", "v3");
769
- }
770
- /**
771
- * Get market indices
772
- * https://site.financialmodelingprep.com/developer/docs#market-index-market-overview
773
- * @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.
774
- */
775
- async getMarketIndex() {
776
- return this.client.get("/quotes/index", "v3");
777
- }
778
- };
779
-
780
- // src/endpoints/list.ts
781
- var ListEndpoints = class {
782
- constructor(client) {
783
- this.client = client;
784
- }
785
- /**
786
- * Get stock list
787
- * https://site.financialmodelingprep.com/developer/docs#symbol-list-stock-list
788
- * @returns The stock list
789
- */
790
- async getStockList() {
791
- return this.client.get("/stock/list");
792
- }
793
- /**
794
- * Get ETF list
795
- * https://site.financialmodelingprep.com/developer/docs#exchange-traded-fund-search-stock-list
796
- * @returns The ETF list
797
- */
798
- async getETFList() {
799
- return this.client.get("/etf/list");
800
- }
801
- /**
802
- * Get crypto list
803
- * https://site.financialmodelingprep.com/developer/docs#cryptocurrencies-list-crypto
804
- * @returns The crypto list
805
- */
806
- async getCryptoList() {
807
- return this.client.get("/symbol/available-cryptocurrencies");
808
- }
809
- /**
810
- * Get forex list
811
- * https://site.financialmodelingprep.com/developer/docs#forex-list-forex
812
- * @returns The forex list
813
- */
814
- async getForexList() {
815
- return this.client.get("/symbol/available-forex-currency-pairs");
816
- }
817
- /**
818
- * Get available indexes list
819
- * https://site.financialmodelingprep.com/developer/docs#available-indexes
820
- * @returns The available indexes list
821
- */
822
- async getAvailableIndexes() {
823
- return this.client.get("/symbol/available-indexes");
824
- }
825
- };
826
-
827
- // src/endpoints/calendar.ts
828
- var CalendarEndpoints = class {
829
- constructor(client) {
830
- this.client = client;
831
- }
832
- /**
833
- * Get earnings calendar
834
- * https://site.financialmodelingprep.com/developer/docs#earnings-calendar-earnings
835
- * @param from - The start date to get the earnings calendar for
836
- * @param to - The end date to get the earnings calendar for
837
- * @returns The earnings calendar
838
- */
839
- async getEarningsCalendar({ from, to } = {}) {
840
- const params = {};
841
- if (from) params.from = from;
842
- if (to) params.to = to;
843
- return this.client.get("/earning_calendar", "v3", params);
844
- }
845
- /**
846
- * Get earnings confirmed
847
- * https://site.financialmodelingprep.com/developer/docs#earnings-confirmed-earnings
848
- * @param from - The start date to get the earnings confirmed for
849
- * @param to - The end date to get the earnings confirmed for
850
- * @returns The earnings confirmed
851
- */
852
- async getEarningsConfirmed({ from, to } = {}) {
853
- const params = {};
854
- if (from) params.from = from;
855
- if (to) params.to = to;
856
- return this.client.get("/earning-calendar-confirmed", "v4", params);
857
- }
858
- /**
859
- * Get dividends calendar
860
- * https://site.financialmodelingprep.com/developer/docs#dividends-calendar-dividends
861
- * @param from - The start date to get the dividends calendar for
862
- * @param to - The end date to get the dividends calendar for
863
- * @returns The dividends calendar
864
- */
865
- async getDividendsCalendar({ from, to } = {}) {
866
- const params = {};
867
- if (from) params.from = from;
868
- if (to) params.to = to;
869
- return this.client.get("/stock_dividend_calendar", "v3", params);
870
- }
871
- /**
872
- * Get economics calendar
873
- * https://site.financialmodelingprep.com/developer/docs#economics-calendar-economics-data
874
- * @param from - The start date to get the economics calendar for
875
- * @param to - The end date to get the economics calendar for
876
- * @returns The economics calendar
877
- */
878
- async getEconomicsCalendar({ from, to } = {}) {
879
- const params = {};
880
- if (from) params.from = from;
881
- if (to) params.to = to;
882
- return this.client.get("/economic_calendar", "v3", params);
883
- }
884
- /**
885
- * Get IPO calendar
886
- * https://site.financialmodelingprep.com/developer/docs#ipo-calender-by-ipo-calendar
887
- * @param from - The start date to get the IPO calendar for
888
- * @param to - The end date to get the IPO calendar for
889
- * @returns The IPO calendar
890
- */
891
- async getIPOCalendar({ from, to } = {}) {
892
- const params = {};
893
- if (from) params.from = from;
894
- if (to) params.to = to;
895
- return this.client.get("/ipo_calendar", "v3", params);
896
- }
897
- /**
898
- * Get stock splits calendar
899
- * https://site.financialmodelingprep.com/developer/docs#splits-calendar-splits
900
- * @param from - The start date to get the stock splits calendar for
901
- * @param to - The end date to get the stock splits calendar for
902
- * @returns The stock splits calendar
903
- */
904
- async getSplitsCalendar({ from, to } = {}) {
905
- const params = {};
906
- if (from) params.from = from;
907
- if (to) params.to = to;
908
- return this.client.get("/stock_split_calendar", "v3", params);
909
- }
910
- };
911
-
912
- // src/endpoints/company.ts
913
- var CompanyEndpoints = class {
914
- constructor(client) {
915
- this.client = client;
916
- }
917
- /**
918
- * Get company profile
919
- * https://site.financialmodelingprep.com/developer/docs#company-profile-company-information
920
- * @param symbol - The stock symbol to get the profile for
921
- * @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.
922
- */
923
- async getCompanyProfile({ symbol }) {
924
- return this.client.getSingle(`/profile/${symbol}`, "v3");
925
- }
926
- /**
927
- * Get executive compensation
928
- * https://site.financialmodelingprep.com/developer/docs#executive-compensation-company-information
929
- * @param symbol - The stock symbol to get the executive compensation for
930
- * @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.
931
- */
932
- async getExecutiveCompensation({
933
- symbol
934
- }) {
935
- const params = { symbol };
936
- return this.client.get(`/governance/executive_compensation`, "v4", params);
937
- }
938
- /**
939
- * Get company notes
940
- * https://site.financialmodelingprep.com/developer/docs#company-notes-company-information
941
- * @param symbol - The stock symbol to get the notes for
942
- * @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.
943
- */
944
- async getCompanyNotes({ symbol }) {
945
- const params = { symbol };
946
- return this.client.get(`/company-notes`, "v4", params);
947
- }
948
- /**
949
- * Get historical employee count
950
- * https://site.financialmodelingprep.com/developer/docs#historical-employee-company-information
951
- * @param symbol - The stock symbol to get the historical employee count for
952
- * @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.
953
- */
954
- async getHistoricalEmployeeCount({
955
- symbol
956
- }) {
957
- const params = { symbol };
958
- return this.client.get(`/historical/employee_count`, "v4", params);
959
- }
960
- /**
961
- * Get shares float
962
- * https://site.financialmodelingprep.com/developer/docs#company-share-float-share-float
963
- * @param symbol - The stock symbol to get the shares float for
964
- * @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.
965
- */
966
- async getSharesFloat({ symbol }) {
967
- const params = { symbol };
968
- return this.client.getSingle(`/shares_float`, "v4", params);
969
- }
970
- /**
971
- * Get historical shares float
972
- * https://site.financialmodelingprep.com/developer/docs#company-historical-share-float
973
- * @param symbol - The stock symbol to get the historical shares float for
974
- * @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.
975
- */
976
- async getHistoricalSharesFloat({
977
- symbol
978
- }) {
979
- const params = { symbol };
980
- return this.client.get(`/historical/shares_float`, "v4", params);
981
- }
982
- /**
983
- * Get earnings call transcript
984
- * https://site.financialmodelingprep.com/developer/docs#earnings-transcript-earnings-transcripts
985
- * @param symbol - The stock symbol to get the earnings call transcript for
986
- * @param year - The year of the earnings call
987
- * @param quarter - The quarter of the earnings call
988
- * @returns The FMP Earnings Call Transcript endpoint provides the transcript of a company's earnings call.
989
- */
990
- async getEarningsCallTranscript({
991
- symbol,
992
- year,
993
- quarter
994
- }) {
995
- const params = { year, quarter };
996
- return this.client.getSingle(`/earning_call_transcript/${symbol}`, "v3", params);
997
- }
998
- /**
999
- * Get company transcript dates
1000
- * https://site.financialmodelingprep.com/developer/docs#transcript-dates-earnings-transcripts
1001
- * @param symbol - The stock symbol to get the transcript data for
1002
- * @returns The FMP Company Transcript Data endpoint provides the transcript data for a company's earnings call.
1003
- */
1004
- async getCompanyTranscriptData({
1005
- symbol
1006
- }) {
1007
- const params = { symbol };
1008
- return this.client.getSingle(`/earning_call_transcript`, "v4", params);
1009
- }
1010
- };
1011
-
1012
- // src/endpoints/quote.ts
1013
- var QuoteEndpoints = class {
1014
- constructor(client) {
1015
- this.client = client;
1016
- }
1017
- /**
1018
- * Get quote for any asset type (stock, crypto, forex, commodity, ETF)
1019
- * @param params - Parameters for the quote request
1020
- * @returns Quote data for the specified asset
1021
- */
1022
- async getQuote(params) {
1023
- const { symbol } = params;
1024
- return this.client.getSingle(`/quote/${symbol}`, "v3");
1025
- }
1026
- /**
1027
- * Get historical prices for any asset type
1028
- * @param params - Parameters for the historical price request
1029
- * @returns Historical price data for the specified asset
1030
- */
1031
- async getHistoricalPrice(params) {
1032
- const { symbol, from, to } = params;
1033
- const queryParams = {};
1034
- if (from) queryParams.from = from;
1035
- if (to) queryParams.to = to;
1036
- return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", queryParams);
1037
- }
1038
- /**
1039
- * Get multiple quotes for any asset type
1040
- * @param symbols - Array of symbols to get quotes for
1041
- * @returns Array of quote data
1042
- */
1043
- async getQuotes(symbols) {
1044
- const symbolsParam = symbols.join(",");
1045
- return this.client.get(`/quote/${symbolsParam}`, "v3");
1046
- }
1047
- /**
1048
- * Get intraday data for any asset type
1049
- * @param params - Parameters for the intraday request
1050
- * @returns Intraday price data for the specified asset
1051
- */
1052
- async getIntraday(params) {
1053
- const { symbol, interval, from, to } = params;
1054
- const queryParams = {};
1055
- if (from) queryParams.from = from;
1056
- if (to) queryParams.to = to;
1057
- return this.client.get(`/historical-chart/${interval}/${symbol}`, "v3", queryParams);
1058
- }
1059
- };
1060
-
1061
- // src/endpoints/senate-house.ts
1062
- var SenateHouseEndpoints = class {
1063
- constructor(client) {
1064
- this.client = client;
1065
- }
1066
- /**
1067
- * Get senate trading data only
1068
- * https://site.financialmodelingprep.com/developer/docs#senate-trading
1069
- * @param symbol - The stock symbol to get the senate trading data for
1070
- * @returns Senate trading data only
1071
- */
1072
- async getSenateTrading(params) {
1073
- const { symbol } = params;
1074
- return this.client.get(`/senate-trading`, "v4", { symbol });
1075
- }
1076
- /** Get senate trading RSS feed
1077
- * https://site.financialmodelingprep.com/developer/docs#senate-trading-rss-feed-senate
1078
- * @param page - The page number to get
1079
- * @returns Senate trading RSS feed
1080
- */
1081
- async getSenateTradingRSSFeed(params) {
1082
- const { page } = params;
1083
- return this.client.get("/senate-trading-rss-feed", "v4", { page });
1084
- }
1085
- /** Get Senate trades by name
1086
- * https://site.financialmodelingprep.com/developer/docs/stable#senate-trading-by-name
1087
- * @param name - The name of the senator to get the trades for
1088
- * @returns Senate trades by name
1089
- */
1090
- async getSenateTradingByName(params) {
1091
- const { name } = params;
1092
- return this.client.get("/senate-trades-by-name", "stable", { name });
1093
- }
1094
- /**
1095
- * Get house trading data only
1096
- * https://site.financialmodelingprep.com/developer/docs#house-disclosure
1097
- * @param symbol - The stock symbol to get the house trading data for
1098
- * @returns House trading data only
1099
- */
1100
- async getHouseTrading(params) {
1101
- const { symbol } = params;
1102
- return this.client.get("/senate-disclosure", "v4", { symbol });
1103
- }
1104
- /** Get house trading RSS feed
1105
- * https://site.financialmodelingprep.com/developer/docs#house-disclosure-rss-feed-senate
1106
- * @param page - The page number to get
1107
- * @returns House trading RSS feed
1108
- */
1109
- async getHouseTradingRSSFeed(params) {
1110
- const { page } = params;
1111
- return this.client.get("/senate-disclosure-rss-feed", "v4", { page });
1112
- }
1113
- /** Get house trading by name
1114
- * https://site.financialmodelingprep.com/developer/docs/stable#house-trading-by-name
1115
- * @param name - The name of the representative to get the trades for
1116
- * @returns House trading by name
1117
- */
1118
- async getHouseTradingByName(params) {
1119
- const { name } = params;
1120
- return this.client.get("/house-trades-by-name", "stable", { name });
1121
- }
1122
- };
1123
-
1124
- // src/endpoints/institutional.ts
1125
- var InstitutionalEndpoints = class {
1126
- constructor(client) {
1127
- this.client = client;
1128
- }
1129
- /**
1130
- * Get Form 13F institutional stock ownership data
1131
- * https://site.financialmodelingprep.com/developer/docs#form-13f-13f---institutional-stock-ownership
1132
- * @param symbol - The stock symbol to get the Form 13F data for
1133
- * @param date - The date to get the Form 13F data for (optional)
1134
- * @returns Form 13F institutional stock ownership data
1135
- */
1136
- async getForm13F(params) {
1137
- const { cik, date } = params;
1138
- const queryParams = {};
1139
- if (date) queryParams.date = date;
1140
- return this.client.get(`/form-thirteen/${cik}`, "v3", queryParams);
1141
- }
1142
- /**
1143
- * Get Form 13F dates for institutional stock ownership
1144
- * https://site.financialmodelingprep.com/developer/docs#form-13f-dates-13f---institutional-stock-ownership
1145
- * @param symbol - The stock symbol to get the Form 13F dates for
1146
- * @returns Form 13F dates for institutional stock ownership
1147
- */
1148
- async getForm13FDates(params) {
1149
- const { cik } = params;
1150
- return this.client.get(`/form-thirteen-date/${cik}`, "v3");
1151
- }
1152
- /**
1153
- * Get institutional holders data
1154
- * https://site.financialmodelingprep.com/developer/docs#institutional-holder-13f---institutional-stock-ownership
1155
- * @param symbol - The stock symbol to get the institutional holders for
1156
- * @returns Institutional holders data
1157
- */
1158
- async getInstitutionalHolders(params) {
1159
- const { symbol } = params;
1160
- return this.client.get(`/institutional-holder/${symbol}`, "v3");
1161
- }
1162
- };
1163
-
1164
- // src/endpoints/insider.ts
1165
- var InsiderEndpoints = class {
1166
- constructor(client) {
1167
- this.client = client;
1168
- }
1169
- /**
1170
- * Get insider trading RSS feed
1171
- * https://site.financialmodelingprep.com/developer/docs#insider-trades-rss-insider-trading
1172
- * @param params - Parameters for the RSS feed request
1173
- * @returns An RSS feed of insider trades, updated in real time
1174
- */
1175
- async getInsiderTradingRSS({
1176
- page
1177
- }) {
1178
- return this.client.get(`/insider-trading-rss-feed`, "v4", { page });
1179
- }
1180
- /**
1181
- * Search for insider trades
1182
- * https://site.financialmodelingprep.com/developer/docs#insider-trades-search-insider-trading
1183
- * @param params - Parameters for the insider trading search
1184
- * @returns A list of insider trades filtered by the provided parameters
1185
- */
1186
- async searchInsiderTrading({
1187
- symbol,
1188
- reportingCik,
1189
- companyCik,
1190
- transactionType,
1191
- page
1192
- }) {
1193
- const params = { page };
1194
- if (symbol) params.symbol = symbol;
1195
- if (reportingCik) params.reportingCik = reportingCik;
1196
- if (companyCik) params.companyCik = companyCik;
1197
- if (transactionType) params.transactionType = transactionType;
1198
- return this.client.get(`/insider-trading`, "v4", params);
1199
- }
1200
- /**
1201
- * Get transaction types
1202
- * https://site.financialmodelingprep.com/developer/docs#transaction-types-insider-trading
1203
- * @returns A list of all insider transaction types
1204
- */
1205
- async getTransactionTypes() {
1206
- return this.client.get(`/insider-trading-transaction-type`, "v4");
1207
- }
1208
- /**
1209
- * Get insiders by symbol
1210
- * https://site.financialmodelingprep.com/developer/docs#insiders-by-symbol-insider-trading
1211
- * @param params - Parameters for the insiders request
1212
- * @returns A list of insiders for a specific company
1213
- */
1214
- async getInsidersBySymbol({
1215
- symbol
1216
- }) {
1217
- return this.client.get(`/insider-roaster`, "v4", { symbol });
1218
- }
1219
- /**
1220
- * Get insider trade statistics
1221
- * https://site.financialmodelingprep.com/developer/docs#insider-trade-statistics-insider-trading
1222
- * @param params - Parameters for the statistics request
1223
- * @returns Statistics on insider trading activity for a specific company
1224
- */
1225
- async getInsiderTradeStatistics({
1226
- symbol
1227
- }) {
1228
- return this.client.get(`/insider-roaster-statistic`, "v4", { symbol });
1229
- }
1230
- /**
1231
- * Get CIK mapper
1232
- * https://site.financialmodelingprep.com/developer/docs#cik-mapper-insider-trading
1233
- * @param params - Parameters for the CIK mapper request
1234
- * @returns A list of CIK numbers and corresponding company names
1235
- */
1236
- async getCikMapper({ page }) {
1237
- return this.client.get(`/mapper-cik-name`, "v4", { page });
1238
- }
1239
- /**
1240
- * Get CIK mapper by name
1241
- * https://site.financialmodelingprep.com/developer/docs#cik-mapper-by-name-insider-trading
1242
- * @param params - Parameters for the CIK mapper by name request
1243
- * @returns A list of CIK numbers and corresponding names matching the search term
1244
- */
1245
- async getCikMapperByName({
1246
- name,
1247
- page = 0
1248
- }) {
1249
- return this.client.get(`/mapper-cik-name`, "v4", { name, page });
1250
- }
1251
- /**
1252
- * Get CIK mapper by symbol
1253
- * https://site.financialmodelingprep.com/developer/docs#cik-mapper-company-insider-trading
1254
- * @param params - Parameters for the CIK mapper by symbol request
1255
- * @returns CIK number and corresponding company name for a specific symbol
1256
- */
1257
- async getCikMapperBySymbol({
1258
- symbol
1259
- }) {
1260
- return this.client.getSingle(`/mapper-cik-company/${symbol}`, "v4");
1261
- }
1262
- /**
1263
- * Get beneficial ownership acquisitions
1264
- * https://site.financialmodelingprep.com/developer/docs#acquisition-of-beneficial-ownership
1265
- * @param params - Parameters for the beneficial ownership request
1266
- * @returns A list of acquisitions of beneficial ownership for a specific company
1267
- */
1268
- async getBeneficialOwnership({
1269
- symbol
1270
- }) {
1271
- return this.client.get(`/insider/ownership/acquisition_of_beneficial_ownership`, "v4", {
1272
- symbol
1273
- });
1274
- }
1275
- /**
1276
- * Get fail to deliver data
1277
- * https://site.financialmodelingprep.com/developer/docs#fail-to-deliver
1278
- * @param params - Parameters for the fail to deliver request
1279
- * @returns A list of fail to deliver data for a specific company
1280
- */
1281
- async getFailToDeliver({
1282
- symbol,
1283
- page = 0
1284
- }) {
1285
- return this.client.get(`/fail_to_deliver`, "v4", { symbol, page });
1286
- }
1287
- /**
1288
- * Get all insider trades for a symbol (convenience method)
1289
- * @param symbol - The stock symbol to get insider trades for
1290
- * @param page - Page number for pagination (default: 0)
1291
- * @returns A list of insider trades for the specified symbol
1292
- */
1293
- async getInsiderTradesBySymbol(symbol, page = 0) {
1294
- return this.searchInsiderTrading({ symbol, page });
1295
- }
1296
- /**
1297
- * Get insider trades by transaction type (convenience method)
1298
- * @param transactionType - The transaction type to filter by
1299
- * @param page - Page number for pagination (default: 0)
1300
- * @returns A list of insider trades filtered by transaction type
1301
- */
1302
- async getInsiderTradesByType(transactionType, page = 0) {
1303
- return this.searchInsiderTrading({ transactionType, page });
1304
- }
1305
- /**
1306
- * Get insider trades by reporting CIK (convenience method)
1307
- * @param reportingCik - The reporting CIK to filter by
1308
- * @param page - Page number for pagination (default: 0)
1309
- * @returns A list of insider trades filtered by reporting CIK
1310
- */
1311
- async getInsiderTradesByReportingCik(reportingCik, page = 0) {
1312
- return this.searchInsiderTrading({ reportingCik, page });
1313
- }
1314
- /**
1315
- * Get insider trades by company CIK (convenience method)
1316
- * @param companyCik - The company CIK to filter by
1317
- * @param page - Page number for pagination (default: 0)
1318
- * @returns A list of insider trades filtered by company CIK
1319
- */
1320
- async getInsiderTradesByCompanyCik(companyCik, page = 0) {
1321
- return this.searchInsiderTrading({ companyCik, page });
1322
- }
1323
- };
1324
-
1325
- // src/endpoints/sec.ts
1326
- var SECEndpoints = class {
1327
- constructor(client) {
1328
- this.client = client;
1329
- }
1330
- /**
1331
- * Get RSS feed of SEC filings
1332
- * https://site.financialmodelingprep.com/developer/docs#rss-feed-securities-and-exchange-commission-(s.e.c)
1333
- * @param params - RSS feed parameters
1334
- * @returns A real-time feed of SEC filings from publicly traded companies, including the filing type, link to SEC page, and direct link to the filing. This endpoint can be used to stay up-to-date on the latest SEC filings for all companies or for a specific set of companies.
1335
- */
1336
- async getRSSFeed(params) {
1337
- return this.client.get("/rss_feed", "v4", params);
1338
- }
1339
- /**
1340
- * Get RSS feed of all SEC filings
1341
- * https://site.financialmodelingprep.com/developer/docs#rss-feed-all-securities-and-exchange-commission-(s.e.c)
1342
- * @param params - RSS feed all parameters
1343
- * @returns A real-time feed of all SEC filings from publicly traded companies in the latest RSS feed format. This endpoint provides a comprehensive overview of all SEC filings, including the filing type, link to SEC page, and direct link to the filing.
1344
- */
1345
- async getRSSFeedAll(params) {
1346
- return this.client.get("/rss_feed_all", "v4", params);
1347
- }
1348
- /**
1349
- * Get RSS feed V3 of SEC filings
1350
- * https://site.financialmodelingprep.com/developer/docs#rss-feed-v3-securities-and-exchange-commission-(s.e.c)
1351
- * @param params - RSS feed V3 parameters
1352
- * @returns A real-time feed of SEC filings from publicly traded companies in the latest RSS feed format (V3)
1353
- */
1354
- async getRSSFeedV3(params) {
1355
- return this.client.get("/rss_feed", "v3", params);
1356
- }
1357
- /**
1358
- * Get RSS feed of 8-K SEC filings
1359
- * https://site.financialmodelingprep.com/developer/docs#rss-feed-8-k-securities-and-exchange-commission-(s.e.c)
1360
- * @param params - RSS feed 8-K parameters
1361
- * @returns A real-time feed of 8-K SEC filings from publicly traded companies
1362
- */
1363
- async getRSSFeed8K(params) {
1364
- return this.client.get("/rss_feed_8k", "v4", params);
1365
- }
1366
- /**
1367
- * Get SEC filings for a specific company
1368
- * https://site.financialmodelingprep.com/developer/docs#sec-filings-securities-and-exchange-commission-(s.e.c)
1369
- * @param symbol - The stock symbol to get SEC filings for
1370
- * @param params - SEC filings parameters
1371
- * @returns Access direct links to SEC filings, including the filing type, link to the SEC page, and direct link to the specific filing
1372
- */
1373
- async getSECFilings({
1374
- symbol,
1375
- params
1376
- }) {
1377
- return this.client.get(`/sec_filings/${symbol}`, "v3", params);
1378
- }
1379
- /**
1380
- * Get individual industry classification
1381
- * https://site.financialmodelingprep.com/developer/docs#individual-industry-classification-standard-industrial-classification
1382
- * @param params - Industry classification parameters
1383
- * @returns Identify the industry in which a particular company operates, based on the Standard Industrial Classification (SIC) system
1384
- */
1385
- async getIndividualIndustryClassification(params) {
1386
- return this.client.getSingle("/standard_industrial_classification", "v4", params);
1387
- }
1388
- /**
1389
- * Get all industry classifications
1390
- * https://site.financialmodelingprep.com/developer/docs#all-industry-classification-standard-industrial-classification
1391
- * @returns Get a comprehensive overview of all industries, classified according to the SIC system
1392
- */
1393
- async getAllIndustryClassifications() {
1394
- return this.client.get("/standard_industrial_classification/all", "v4");
1395
- }
1396
- /**
1397
- * Get industry classification codes
1398
- * https://site.financialmodelingprep.com/developer/docs#industry-classification-codes-standard-industrial-classification
1399
- * @param params - Industry classification codes parameters
1400
- * @returns Learn more about the SIC system and identify the SIC code for a particular industry
1401
- */
1402
- async getIndustryClassificationCodes(params) {
1403
- return this.client.get("/standard_industrial_classification_list", "v4", params);
1404
- }
1405
- };
1406
-
1407
- // src/fmp.ts
1408
- var FMP = class {
1409
- constructor(config) {
1410
- validateApiKey(config.apiKey);
1411
- const client = new FMPClient(config);
1412
- this.stock = new StockEndpoints(client);
1413
- this.financial = new FinancialEndpoints(client);
1414
- this.crypto = new CryptoEndpoints(client);
1415
- this.etf = new ETFEndpoints(client);
1416
- this.market = new MarketEndpoints(client);
1417
- this.list = new ListEndpoints(client);
1418
- this.calendar = new CalendarEndpoints(client);
1419
- this.company = new CompanyEndpoints(client);
1420
- this.quote = new QuoteEndpoints(client);
1421
- this.senateHouse = new SenateHouseEndpoints(client);
1422
- this.institutional = new InstitutionalEndpoints(client);
1423
- this.insider = new InsiderEndpoints(client);
1424
- this.sec = new SECEndpoints(client);
1425
- this.forex = new ForexEndpoints(client);
1426
- this.economic = new EconomicEndpoints(client);
1427
- this.mutualFund = new MutualFundEndpoints(client);
1428
- }
1429
- /**
1430
- * Get the underlying client instance for advanced usage
1431
- */
1432
- getClient() {
1433
- return this.stock["client"];
1434
- }
1435
- };
1436
-
1437
- // src/types/common.ts
1438
- var Period = /* @__PURE__ */ ((Period2) => {
1439
- Period2["ANNUAL"] = "annual";
1440
- Period2["QUARTER"] = "quarter";
1441
- return Period2;
1442
- })(Period || {});
1443
- var Exchange = /* @__PURE__ */ ((Exchange2) => {
1444
- Exchange2["NYSE"] = "NYSE";
1445
- Exchange2["NASDAQ"] = "NASDAQ";
1446
- Exchange2["AMEX"] = "AMEX";
1447
- Exchange2["TSX"] = "TSX";
1448
- Exchange2["LSE"] = "LSE";
1449
- Exchange2["ASX"] = "ASX";
1450
- Exchange2["NSE"] = "NSE";
1451
- Exchange2["BSE"] = "BSE";
1452
- return Exchange2;
1453
- })(Exchange || {});
1454
-
1455
- // src/types/insider.ts
1456
- var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
1457
- TransactionType2["AWARD"] = "A-Award";
1458
- TransactionType2["CONVERSION"] = "C-Conversion";
1459
- TransactionType2["RETURN"] = "D-Return";
1460
- TransactionType2["EXPIRE_SHORT"] = "E-ExpireShort";
1461
- TransactionType2["IN_KIND"] = "F-InKind";
1462
- TransactionType2["GIFT"] = "G-Gift";
1463
- TransactionType2["EXPIRE_LONG"] = "H-ExpireLong";
1464
- TransactionType2["DISCRETIONARY"] = "I-Discretionary";
1465
- TransactionType2["OTHER"] = "J-Other";
1466
- TransactionType2["SMALL"] = "L-Small";
1467
- TransactionType2["EXEMPT"] = "M-Exempt";
1468
- TransactionType2["OUT_OF_THE_MONEY"] = "O-OutOfTheMoney";
1469
- TransactionType2["PURCHASE"] = "P-Purchase";
1470
- TransactionType2["SALE"] = "S-Sale";
1471
- TransactionType2["TENDER"] = "U-Tender";
1472
- TransactionType2["WILL"] = "W-Will";
1473
- TransactionType2["IN_THE_MONEY"] = "X-InTheMoney";
1474
- TransactionType2["TRUST"] = "Z-Trust";
1475
- return TransactionType2;
1476
- })(TransactionType || {});
1477
-
1478
- // src/utils/formatting.ts
1479
- function formatCurrency(value, currency = "USD") {
1480
- return new Intl.NumberFormat("en-US", {
1481
- style: "currency",
1482
- currency
1483
- }).format(value);
1484
- }
1485
- function formatPercentage(value, decimals = 2) {
1486
- return `${value.toFixed(decimals)}%`;
1487
- }
1488
- function formatLargeNumber(value) {
1489
- if (value >= 1e12) {
1490
- return `${(value / 1e12).toFixed(2)}T`;
1491
- } else if (value >= 1e9) {
1492
- return `${(value / 1e9).toFixed(2)}B`;
1493
- } else if (value >= 1e6) {
1494
- return `${(value / 1e6).toFixed(2)}M`;
1495
- } else if (value >= 1e3) {
1496
- return `${(value / 1e3).toFixed(2)}K`;
1497
- }
1498
- return value.toString();
1499
- }
1500
- function formatDate(date) {
1501
- const d = typeof date === "string" ? new Date(date) : date;
1502
- return d.toISOString().split("T")[0];
1503
- }
1504
- function formatReadableDate(date) {
1505
- const d = typeof date === "string" ? new Date(date) : date;
1506
- return d.toLocaleDateString("en-US", {
1507
- year: "numeric",
1508
- month: "long",
1509
- day: "numeric"
1510
- });
1511
- }
1512
- function formatTimestamp(timestamp) {
1513
- const date = new Date(timestamp * 1e3);
1514
- return date.toLocaleString("en-US");
1515
- }
1516
- function formatNumber(value, decimals = 2) {
1517
- return value.toFixed(decimals);
1518
- }
1519
- function formatVolume(volume) {
1520
- if (volume >= 1e9) {
1521
- return `${(volume / 1e9).toFixed(2)}B`;
1522
- } else if (volume >= 1e6) {
1523
- return `${(volume / 1e6).toFixed(2)}M`;
1524
- } else if (volume >= 1e3) {
1525
- return `${(volume / 1e3).toFixed(2)}K`;
1526
- }
1527
- return volume.toString();
1528
- }
1529
-
1530
- // src/utils/constants.ts
1531
- var DEFAULT_TIMEOUT = 1e4;
1532
- var DEFAULT_LIMIT = 100;
1533
- var MAX_LIMIT = 1e3;
1534
- var PERIODS = {
1535
- ANNUAL: "annual",
1536
- QUARTER: "quarter"
1537
- };
1538
- var EXCHANGES = {
1539
- NYSE: "NYSE",
1540
- NASDAQ: "NASDAQ",
1541
- AMEX: "AMEX",
1542
- TSX: "TSX",
1543
- LSE: "LSE",
1544
- ASX: "ASX",
1545
- NSE: "NSE",
1546
- BSE: "BSE"
1547
- };
1548
- var SECTORS = {
1549
- TECHNOLOGY: "Technology",
1550
- HEALTHCARE: "Healthcare",
1551
- FINANCIAL: "Financial",
1552
- CONSUMER_DISCRETIONARY: "Consumer Discretionary",
1553
- CONSUMER_STAPLES: "Consumer Staples",
1554
- INDUSTRIALS: "Industrials",
1555
- ENERGY: "Energy",
1556
- MATERIALS: "Materials",
1557
- UTILITIES: "Utilities",
1558
- REAL_ESTATE: "Real Estate",
1559
- COMMUNICATION_SERVICES: "Communication Services"
1560
- };
1561
- var COUNTRIES = {
1562
- US: "US",
1563
- CA: "CA",
1564
- GB: "GB",
1565
- AU: "AU",
1566
- IN: "IN",
1567
- DE: "DE",
1568
- FR: "FR",
1569
- JP: "JP",
1570
- CN: "CN",
1571
- BR: "BR"
1572
- };
1573
- var ERROR_MESSAGES = {
1574
- API_KEY_REQUIRED: "API key is required",
1575
- SYMBOL_REQUIRED: "Symbol is required",
1576
- INVALID_SYMBOL: "Invalid symbol format",
1577
- INVALID_DATE: "Invalid date format. Use YYYY-MM-DD",
1578
- INVALID_PERIOD: 'Period must be either "annual" or "quarter"',
1579
- INVALID_LIMIT: "Limit must be between 1 and 1000",
1580
- INVALID_PAGE: "Page must be a non-negative number",
1581
- REQUEST_FAILED: "Request failed",
1582
- RATE_LIMIT_EXCEEDED: "Rate limit exceeded",
1583
- UNAUTHORIZED: "Unauthorized - Invalid API key",
1584
- NOT_FOUND: "Resource not found"
1585
- };
1586
- var HTTP_STATUS = {
1587
- OK: 200,
1588
- CREATED: 201,
1589
- BAD_REQUEST: 400,
1590
- UNAUTHORIZED: 401,
1591
- FORBIDDEN: 403,
1592
- NOT_FOUND: 404,
1593
- TOO_MANY_REQUESTS: 429,
1594
- INTERNAL_SERVER_ERROR: 500
1595
- };
1596
-
1597
- export { COUNTRIES, CalendarEndpoints, CompanyEndpoints, CryptoEndpoints, DEFAULT_LIMIT, DEFAULT_TIMEOUT, ERROR_MESSAGES, ETFEndpoints, EXCHANGES, EconomicEndpoints, Exchange, FMP, FMPClient, FinancialEndpoints, ForexEndpoints, HTTP_STATUS, InsiderEndpoints, InstitutionalEndpoints, ListEndpoints, MAX_LIMIT, MarketEndpoints, MutualFundEndpoints, PERIODS, Period, QuoteEndpoints, SECEndpoints, SECTORS, SenateHouseEndpoints, StockEndpoints, TransactionType, formatCurrency, formatDate, formatLargeNumber, formatNumber, formatPercentage, formatReadableDate, formatTimestamp, formatVolume, validateApiKey, validateDate, validateLimit, validatePage, validatePeriod, validateSymbol };
1598
- //# sourceMappingURL=index.mjs.map
1599
- //# sourceMappingURL=index.mjs.map
1
+ import {a}from'./chunk-RM7ETDL3.mjs';export{a as FMPValidation}from'./chunk-RM7ETDL3.mjs';import b from'axios';function E(i){return Array.isArray(i)&&i.length===1?i[0]:i}function F(i){return Array.isArray(i)?i:i??[]}function v(i){return i==null?{}:Array.isArray(i)&&i.length===0?{}:i}var c=class{constructor(e){if(!e.apiKey)throw new Error("API key is required for FMPClient");this.apiKey=e.apiKey,this.v3Client=b.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=b.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=b.create({baseURL:"https://financialmodelingprep.com/stable",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),[this.v3Client,this.v4Client,this.stableClient].forEach(t=>{t.interceptors.request.use(r=>(r.params={...r.params,apikey:this.apiKey},r));});}async get(e,t="v3",r){let n=this.getClientForVersion(t);try{let s=await n.get(e,{params:r}),o=s.data;return (Array.isArray(o)||o==null)&&(o=F(o)),{success:!0,data:o,error:null,status:s.status}}catch(s){return {success:false,data:null,error:s.message||"Unknown error occurred",status:s.response?.status||500}}}async getSingle(e,t="v3",r){let n=this.getClientForVersion(t);try{let s=await n.get(e,{params:r});return {success:!0,data:v(E(s.data)),error:null,status:s.status}}catch(s){return {success:false,data:null,error:s.message||"Unknown error occurred",status:s.response?.status||500}}}getClientForVersion(e){switch(e){case "v3":return this.v3Client;case "v4":return this.v4Client;case "stable":return this.stableClient;default:return this.v3Client}}};var l=class{constructor(e){this.client=e;}async getMarketCap(e){return this.client.getSingle(`/market-capitalization/${e}`,"v3")}async getStockSplits(e){return this.client.get(`/historical-price-full/stock_split/${e}`,"v3")}async getDividendHistory(e){return this.client.getSingle(`/historical-price-full/stock_dividend/${e}`,"v3")}async getRealTimePrice(e){let t=`stock/real-time-price/${e.join(",")}`,r=await this.client.get(t,"v3");if(r.success&&r.data&&!Array.isArray(r.data)){let s=r.data;if(typeof s=="object"&&s!==null&&"companiesPriceList"in s&&Array.isArray(s.companiesPriceList)){let o=s.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...r,data:o}}if(typeof s=="object"&&s!==null&&"stockList"in s&&Array.isArray(s.stockList)){let o=s.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...r,data:o}}return s.symbol?{...r,data:[s]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...r,data:[]})}let n=r.data.filter(s=>s&&s.symbol);return {...r,data:n}}async getRealTimePriceForMultipleStocks(e){let t=`stock/full/real-time-price/${e.join(",")}`,r=await this.client.get(t,"v3");if(r.success&&r.data&&!Array.isArray(r.data)){let s=r.data;if(typeof s=="object"&&s!==null&&"companiesPriceList"in s&&Array.isArray(s.companiesPriceList)){let o=s.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...r,data:o}}if(typeof s=="object"&&s!==null&&"stockList"in s&&Array.isArray(s.stockList)){let o=s.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...r,data:o}}return s.symbol?{...r,data:[s]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...r,data:[]})}let n=r.data.filter(s=>s&&s.symbol);return {...r,data:n}}};var m=class{constructor(e){this.client=e;}async getIncomeStatement(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/income-statement/${t}?period=${r}&limit=${n}`,"v3")}async getBalanceSheet(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/balance-sheet-statement/${t}?period=${r}&limit=${n}`,"v3")}async getCashFlowStatement(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/cash-flow-statement/${t}?period=${r}&limit=${n}`,"v3")}async getKeyMetrics(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/key-metrics/${t}?period=${r}&limit=${n}`,"v3")}async getFinancialRatios(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/ratios/${t}?period=${r}&limit=${n}`,"v3")}async getEnterpriseValue(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/enterprise-value/${t}?period=${r}&limit=${n}`,"v3")}async getCashflowGrowth(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/cash-flow-statement-growth/${t}?period=${r}&limit=${n}`,"v3")}async getIncomeGrowth(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/income-statement-growth/${t}?period=${r}&limit=${n}`,"v3")}async getBalanceSheetGrowth(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/balance-sheet-statement-growth/${t}?period=${r}&limit=${n}`,"v3")}async getFinancialGrowth(e){let{symbol:t,period:r="annual",limit:n=5}=e;return this.client.get(`/financial-growth/${t}?period=${r}&limit=${n}`,"v3")}async getEarningsHistorical(e){let{symbol:t,limit:r=5}=e;return this.client.get(`/historical/earning_calendar/${t}?limit=${r}`,"v3")}async getEarningsSurprises(e){return this.client.get(`/earnings-surprises/${e}`,"v3")}};var p=class{constructor(e){this.client=e;}async getHoldingDates(e){return this.client.get("/etf-holdings/portfolio-date","v4",{symbol:e})}async getHoldings(e){let{symbol:t,date:r}=e,n={};return t&&(n.symbol=t),r&&(n.date=r),this.client.get("/etf-holdings","v4",n)}async getHolder(e){return this.client.get(`/etf-holder/${e}`,"v3")}async getProfile(e){return this.client.getSingle("/etf-info","v4",{symbol:e})}async getSectorWeighting(e){return this.client.get(`/etf-sector-weightings/${e}`,"v3")}async getCountryWeighting(e){return this.client.get(`/etf-country-weightings/${e}`,"v3")}async getStockExposure(e){return this.client.get(`/etf-stock-exposure/${e}`,"v3")}};var g=class{constructor(e){this.client=e;}async getTreasuryRates(e){let{from:t,to:r}=e,n={};return t&&(n.from=t),r&&(n.to=r),this.client.get("/treasury","v4",n)}async getEconomicIndicators(e){let{name:t,from:r,to:n}=e,s={name:t};return r&&(s.from=r),n&&(s.to=n),this.client.get("/economic","v4",s)}};var u=class{constructor(e){this.client=e;}async getMarketHours(){return this.client.get("/market-hours","v3")}async getMarketPerformance(){return this.client.get("/market-performance","v3")}async getGainers(){return this.client.get("/stock_market/gainers","v3")}async getLosers(){return this.client.get("/stock_market/losers","v3")}async getMostActive(){return this.client.get("/stock_market/actives","v3")}async getSectorPerformance(){return this.client.get("/sector-performance","v3")}async getMarketIndex(){return this.client.get("/quotes/index","v3")}};var d=class{constructor(e){this.client=e;}async getStockList(){return this.client.get("/stock/list")}async getETFList(){return this.client.get("/etf/list")}async getCryptoList(){return this.client.get("/symbol/available-cryptocurrencies")}async getForexList(){return this.client.get("/symbol/available-forex-currency-pairs")}async getAvailableIndexes(){return this.client.get("/symbol/available-indexes")}};var y=class{constructor(e){this.client=e;}async getEarningsCalendar(e={}){let{from:t,to:r}=e,n={};return t&&(n.from=t),r&&(n.to=r),this.client.get("/earning_calendar","v3",n)}async getEarningsConfirmed(e={}){let{from:t,to:r}=e,n={};return t&&(n.from=t),r&&(n.to=r),this.client.get("/earning-calendar-confirmed","v4",n)}async getDividendsCalendar(e={}){let{from:t,to:r}=e,n={};return t&&(n.from=t),r&&(n.to=r),this.client.get("/stock_dividend_calendar","v3",n)}async getEconomicsCalendar(e={}){let{from:t,to:r}=e,n={};return t&&(n.from=t),r&&(n.to=r),this.client.get("/economic_calendar","v3",n)}async getIPOCalendar(e={}){let{from:t,to:r}=e,n={};return t&&(n.from=t),r&&(n.to=r),this.client.get("/ipo_calendar","v3",n)}async getSplitsCalendar(e={}){let{from:t,to:r}=e,n={};return t&&(n.from=t),r&&(n.to=r),this.client.get("/stock_split_calendar","v3",n)}};var P=class{constructor(e){this.client=e;}async getCompanyProfile(e){return this.client.getSingle(`/profile/${e}`,"v3")}async getExecutiveCompensation(e){return this.client.get("/governance/executive_compensation","v4",{symbol:e})}async getCompanyNotes(e){return this.client.get("/company-notes","v4",{symbol:e})}async getHistoricalEmployeeCount(e){return this.client.get("/historical/employee_count","v4",{symbol:e})}async getSharesFloat(e){return this.client.getSingle("/shares_float","v4",{symbol:e})}async getHistoricalSharesFloat(e){return this.client.get("/historical/shares_float","v4",{symbol:e})}async getEarningsCallTranscript(e){let{symbol:t,year:r,quarter:n}=e;return this.client.getSingle(`/earning_call_transcript/${t}`,"v3",{year:r,quarter:n})}async getCompanyTranscriptData(e){return this.client.getSingle("/earning_call_transcript","v4",{symbol:e})}};var f=class{constructor(e){this.client=e;}async getQuote(e){return this.client.getSingle(`/quote/${e}`,"v3")}async getHistoricalPrice(e){let{symbol:t,from:r,to:n}=e,s={};return r&&(s.from=r),n&&(s.to=n),this.client.getSingle(`/historical-price-full/${t}`,"v3",s)}async getQuotes(e){let t=e.join(",");return this.client.get(`/quote/${t}`,"v3")}async getIntraday(e){let{symbol:t,interval:r,from:n,to:s}=e,o={};return n&&(o.from=n),s&&(o.to=s),this.client.get(`/historical-chart/${r}/${t}`,"v3",o)}};var R=class{constructor(e){this.client=e;}async getSenateTrading(e){let{symbol:t}=e;return this.client.get("/senate-trading","v4",{symbol:t})}async getSenateTradingRSSFeed(e){let{page:t}=e;return this.client.get("/senate-trading-rss-feed","v4",{page:t})}async getSenateTradingByName(e){let{name:t}=e;return this.client.get("/senate-trades-by-name","stable",{name:t})}async getHouseTrading(e){let{symbol:t}=e;return this.client.get("/senate-disclosure","v4",{symbol:t})}async getHouseTradingRSSFeed(e){let{page:t}=e;return this.client.get("/senate-disclosure-rss-feed","v4",{page:t})}async getHouseTradingByName(e){let{name:t}=e;return this.client.get("/house-trades-by-name","stable",{name:t})}};var I=class{constructor(e){this.client=e;}async getForm13F(e){let{cik:t,date:r}=e,n={};return r&&(n.date=r),this.client.get(`/form-thirteen/${t}`,"v3",n)}async getForm13FDates(e){let{cik:t}=e;return this.client.get(`/form-thirteen-date/${t}`,"v3")}async getInstitutionalHolders(e){let{symbol:t}=e;return this.client.get(`/institutional-holder/${t}`,"v3")}};var h=class{constructor(e){this.client=e;}async getInsiderTradingRSS(e){let{page:t=0}=e;return this.client.get("/insider-trading-rss-feed","v4",{page:t})}async searchInsiderTrading(e){let{symbol:t,reportingCik:r,companyCik:n,transactionType:s,page:o=0}=e,a={page:o};return t&&(a.symbol=t),r&&(a.reportingCik=r),n&&(a.companyCik=n),s&&(a.transactionType=s),this.client.get("/insider-trading","v4",a)}async getTransactionTypes(){return this.client.get("/insider-trading-transaction-type","v4")}async getInsidersBySymbol(e){let{symbol:t}=e;return this.client.get("/insider-roaster","v4",{symbol:t})}async getInsiderTradeStatistics(e){let{symbol:t}=e;return this.client.get("/insider-roaster-statistic","v4",{symbol:t})}async getCikMapper(e){let{page:t=0}=e;return this.client.get("/mapper-cik-name","v4",{page:t})}async getCikMapperByName(e){let{name:t,page:r=0}=e;return this.client.get("/mapper-cik-name","v4",{name:t,page:r})}async getCikMapperBySymbol(e){let{symbol:t}=e;return this.client.getSingle(`/mapper-cik-company/${t}`,"v4")}async getBeneficialOwnership(e){let{symbol:t}=e;return this.client.get("/insider/ownership/acquisition_of_beneficial_ownership","v4",{symbol:t})}async getFailToDeliver(e){let{symbol:t,page:r=0}=e;return this.client.get("/fail_to_deliver","v4",{symbol:t,page:r})}async getInsiderTradesBySymbol(e,t=0){return this.searchInsiderTrading({symbol:e,page:t})}async getInsiderTradesByType(e,t=0){return this.searchInsiderTrading({transactionType:e,page:t})}async getInsiderTradesByReportingCik(e,t=0){return this.searchInsiderTrading({reportingCik:e,page:t})}async getInsiderTradesByCompanyCik(e,t=0){return this.searchInsiderTrading({companyCik:e,page:t})}};var S=class{constructor(e){this.client=e;}async getRSSFeed(e){return this.client.get("/rss_feed","v4",e)}async getRSSFeedAll(e){return this.client.get("/rss_feed_all","v4",e)}async getRSSFeedV3(e){return this.client.get("/rss_feed","v3",e)}async getRSSFeed8K(e){return this.client.get("/rss_feed_8k","v4",e)}async getSECFilings({symbol:e,params:t}){return this.client.get(`/sec_filings/${e}`,"v3",t)}async getIndividualIndustryClassification(e){return this.client.getSingle("/standard_industrial_classification","v4",e)}async getAllIndustryClassifications(){return this.client.get("/standard_industrial_classification/all","v4")}async getIndustryClassificationCodes(e){return this.client.get("/standard_industrial_classification_list","v4",e)}};var A=class{constructor(e){this.client=e;}async getHolders(e){return this.client.get(`/mutual-fund-holder/${e}`,"v3")}};var T=class{constructor(e={}){let t=e.apiKey||process.env.FMP_API_KEY;if(!t)throw new Error("FMP API key is required. Please provide it in the config or set the FMP_API_KEY environment variable.");if(!a.isValidApiKey(t))throw new Error("Invalid API key format");let r=new c({...e,apiKey:t});this.stock=new l(r),this.financial=new m(r),this.etf=new p(r),this.economic=new g(r),this.market=new u(r),this.list=new d(r),this.calendar=new y(r),this.company=new P(r),this.quote=new f(r),this.senateHouse=new R(r),this.institutional=new I(r),this.insider=new h(r),this.sec=new S(r),this.mutualFund=new A(r);}getClient(){return this.stock.client}};function k(i,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(i)}function M(i,e=2){return `${i.toFixed(e)}%`}function x(i){return i>=1e12?`${(i/1e12).toFixed(2)}T`:i>=1e9?`${(i/1e9).toFixed(2)}B`:i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(2)}K`:i.toString()}function D(i){return (typeof i=="string"?new Date(i):i).toISOString().split("T")[0]}function _(i){return i>=1e9?`${(i/1e9).toFixed(2)}B`:i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(2)}K`:i.toString()}var L=1e4,w=100,$=1e3,H={ANNUAL:"annual",QUARTER:"quarter"},N={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},U={TECHNOLOGY:"Technology",HEALTHCARE:"Healthcare",FINANCIAL:"Financial",CONSUMER_DISCRETIONARY:"Consumer Discretionary",CONSUMER_STAPLES:"Consumer Staples",INDUSTRIALS:"Industrials",ENERGY:"Energy",MATERIALS:"Materials",UTILITIES:"Utilities",REAL_ESTATE:"Real Estate",COMMUNICATION_SERVICES:"Communication Services"};
2
+ export{y as CalendarEndpoints,P as CompanyEndpoints,w as DEFAULT_LIMIT,L as DEFAULT_TIMEOUT,p as ETFEndpoints,N as EXCHANGES,g as EconomicEndpoints,T as FMP,c as FMPClient,m as FinancialEndpoints,h as InsiderEndpoints,I as InstitutionalEndpoints,d as ListEndpoints,$ as MAX_LIMIT,u as MarketEndpoints,A as MutualFundEndpoints,H as PERIODS,f as QuoteEndpoints,S as SECEndpoints,U as SECTORS,R as SenateHouseEndpoints,l as StockEndpoints,k as formatCurrency,D as formatDate,x as formatLargeNumber,M as formatPercentage,_ as formatVolume};