fmp-node-api 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -14,29 +14,36 @@ function normalizeArrayResponse(data) {
14
14
  }
15
15
  function normalizeObjectResponse(data) {
16
16
  if (data == null) return {};
17
+ if (Array.isArray(data) && data.length === 0) return {};
17
18
  return data;
18
19
  }
19
20
  var FMPClient = class {
20
21
  constructor(config) {
22
+ if (!config.apiKey) {
23
+ throw new Error("API key is required for FMPClient");
24
+ }
21
25
  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,
26
+ this.v3Client = axios.create({
27
+ baseURL: "https://financialmodelingprep.com/api/v3",
28
+ timeout: config.timeout || 1e4,
29
+ headers: { "Content-Type": "application/json" }
30
+ });
31
+ this.v4Client = axios.create({
32
+ baseURL: "https://financialmodelingprep.com/api/v4",
33
+ timeout: config.timeout || 1e4,
34
+ headers: { "Content-Type": "application/json" }
35
+ });
36
+ this.stableClient = axios.create({
37
+ baseURL: "https://financialmodelingprep.com/stable",
38
+ timeout: config.timeout || 1e4,
33
39
  headers: { "Content-Type": "application/json" }
34
40
  });
35
- client.interceptors.request.use((config) => {
36
- config.params = { ...config.params, apikey: this.apiKey };
37
- return config;
41
+ [this.v3Client, this.v4Client, this.stableClient].forEach((client) => {
42
+ client.interceptors.request.use((config2) => {
43
+ config2.params = { ...config2.params, apikey: this.apiKey };
44
+ return config2;
45
+ });
38
46
  });
39
- return client;
40
47
  }
41
48
  /**
42
49
  * Standard get method - returns raw API response
@@ -106,137 +113,310 @@ var FMPClient = class {
106
113
  }
107
114
  };
108
115
 
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
116
  // 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");
117
+ var FMPValidation = class {
118
+ /**
119
+ * Validate stock symbol format
120
+ * @param symbol - The symbol to validate
121
+ * @returns True if the symbol format is valid
122
+ */
123
+ static isValidSymbol(symbol) {
124
+ if (!symbol || typeof symbol !== "string") {
125
+ return false;
126
+ }
127
+ return /^[A-Z]{1,5}$/.test(symbol);
123
128
  }
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
- );
129
+ /**
130
+ * Validate crypto symbol format
131
+ * @param symbol - The crypto symbol to validate
132
+ * @returns True if the crypto symbol format is valid
133
+ */
134
+ static isValidCryptoSymbol(symbol) {
135
+ if (!symbol || typeof symbol !== "string") {
136
+ return false;
137
+ }
138
+ return /^[A-Z]{2,10}(USD|EUR|GBP|JPY|CAD|AUD|CHF|CNY)$/.test(symbol);
134
139
  }
135
- }
136
- function validateDate(date) {
137
- if (!date || typeof date !== "string") {
138
- throw new FMPError("Date is required and must be a string");
140
+ /**
141
+ * Validate forex pair format
142
+ * @param symbol - The forex pair to validate
143
+ * @returns True if the forex pair format is valid
144
+ */
145
+ static isValidForexPair(symbol) {
146
+ if (!symbol || typeof symbol !== "string") {
147
+ return false;
148
+ }
149
+ return /^[A-Z]{3}[A-Z]{3}$/.test(symbol);
139
150
  }
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");
151
+ /**
152
+ * Validate date format (YYYY-MM-DD)
153
+ * @param date - The date string to validate
154
+ * @returns True if the date format is valid
155
+ */
156
+ static isValidDate(date) {
157
+ if (!date || typeof date !== "string") {
158
+ return false;
159
+ }
160
+ const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
161
+ if (!dateRegex.test(date)) {
162
+ return false;
163
+ }
164
+ const dateObj = new Date(date);
165
+ return !isNaN(dateObj.getTime()) && dateObj.toISOString().split("T")[0] === date;
143
166
  }
144
- const parsedDate = new Date(date);
145
- if (isNaN(parsedDate.getTime())) {
146
- throw new FMPError("Invalid date");
167
+ /**
168
+ * Validate date range
169
+ * @param from - Start date
170
+ * @param to - End date
171
+ * @returns True if the date range is valid
172
+ */
173
+ static isValidDateRange(from, to) {
174
+ if (!this.isValidDate(from) || !this.isValidDate(to)) {
175
+ return false;
176
+ }
177
+ const fromDate = new Date(from);
178
+ const toDate = new Date(to);
179
+ return fromDate <= toDate;
147
180
  }
148
- }
149
- function validatePeriod(period) {
150
- if (period && !["annual", "quarter"].includes(period)) {
151
- throw new FMPError('Period must be either "annual" or "quarter"');
181
+ /**
182
+ * Validate API response structure
183
+ * @param response - The response to validate
184
+ * @returns True if the response has the expected structure
185
+ */
186
+ static isValidResponse(response) {
187
+ return Boolean(
188
+ response && typeof response === "object" && typeof response.success === "boolean"
189
+ );
152
190
  }
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");
191
+ /**
192
+ * Validate API key format
193
+ * @param apiKey - The API key to validate
194
+ * @returns True if the API key format is valid
195
+ */
196
+ static isValidApiKey(apiKey) {
197
+ if (!apiKey || typeof apiKey !== "string") {
198
+ return false;
199
+ }
200
+ return /^[a-zA-Z0-9]{32,}$/.test(apiKey);
157
201
  }
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");
202
+ /**
203
+ * Validate period parameter
204
+ * @param period - The period to validate
205
+ * @returns True if the period is valid
206
+ */
207
+ static isValidPeriod(period) {
208
+ if (!period || typeof period !== "string") {
209
+ return false;
210
+ }
211
+ return ["annual", "quarter", "fy"].includes(period.toLowerCase());
162
212
  }
163
- }
164
-
165
- // src/endpoints/stock.ts
166
- var StockEndpoints = class {
167
- constructor(client) {
168
- this.client = client;
213
+ /**
214
+ * Validate limit parameter
215
+ * @param limit - The limit to validate
216
+ * @returns True if the limit is valid
217
+ */
218
+ static isValidLimit(limit) {
219
+ return typeof limit === "number" && Number.isInteger(limit) && limit > 0 && limit <= 1e3;
169
220
  }
170
221
  /**
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.
222
+ * Get validation errors for quote parameters
223
+ * @param params - The parameters to validate
224
+ * @returns Array of validation error messages
175
225
  */
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");
226
+ static validateQuoteParams(params) {
227
+ const errors = [];
228
+ if (!params) {
229
+ errors.push("Parameters object is required");
230
+ return errors;
231
+ }
232
+ if (!params.symbol) {
233
+ errors.push("Symbol is required");
234
+ } else if (!this.isValidSymbol(params.symbol) && !this.isValidCryptoSymbol(params.symbol) && !this.isValidForexPair(params.symbol)) {
235
+ errors.push("Invalid symbol format");
236
+ }
237
+ if (params.from && !this.isValidDate(params.from)) {
238
+ errors.push("Invalid from date format (expected YYYY-MM-DD)");
239
+ }
240
+ if (params.to && !this.isValidDate(params.to)) {
241
+ errors.push("Invalid to date format (expected YYYY-MM-DD)");
242
+ }
243
+ if (params.from && params.to && !this.isValidDateRange(params.from, params.to)) {
244
+ errors.push("From date must be before or equal to to date");
245
+ }
246
+ return errors;
181
247
  }
182
248
  /**
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
249
+ * Get validation errors for financial statement parameters
250
+ * @param params - The parameters to validate
251
+ * @returns Array of validation error messages
189
252
  */
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);
253
+ static validateFinancialParams(params) {
254
+ const errors = [];
255
+ if (!params) {
256
+ errors.push("Parameters object is required");
257
+ return errors;
258
+ }
259
+ if (!params.symbol) {
260
+ errors.push("Symbol is required");
261
+ } else if (!this.isValidSymbol(params.symbol)) {
262
+ errors.push("Invalid symbol format");
263
+ }
264
+ if (params.period && !this.isValidPeriod(params.period)) {
265
+ errors.push('Invalid period (must be "annual", "quarter", or "FY")');
266
+ }
267
+ if (params.limit && !this.isValidLimit(params.limit)) {
268
+ errors.push("Invalid limit (must be a positive integer <= 1000)");
269
+ }
270
+ return errors;
271
+ }
272
+ /**
273
+ * Get validation errors for date range parameters
274
+ * @param params - The parameters to validate
275
+ * @returns Array of validation error messages
276
+ */
277
+ static validateDateRangeParams(params) {
278
+ const errors = [];
279
+ if (!params) {
280
+ errors.push("Parameters object is required");
281
+ return errors;
282
+ }
283
+ if (params.from && !this.isValidDate(params.from)) {
284
+ errors.push("Invalid from date format (expected YYYY-MM-DD)");
285
+ }
286
+ if (params.to && !this.isValidDate(params.to)) {
287
+ errors.push("Invalid to date format (expected YYYY-MM-DD)");
288
+ }
289
+ if (params.from && params.to && !this.isValidDateRange(params.from, params.to)) {
290
+ errors.push("From date must be before or equal to to date");
291
+ }
292
+ return errors;
293
+ }
294
+ /**
295
+ * Validate and throw error if validation fails
296
+ * @param errors - Array of validation errors
297
+ * @param context - Context for the error message
298
+ */
299
+ static throwIfInvalid(errors, context = "Validation") {
300
+ if (errors.length > 0) {
301
+ throw new Error(`${context} failed: ${errors.join(", ")}`);
302
+ }
303
+ }
304
+ };
305
+
306
+ // src/endpoints/stock.ts
307
+ var StockEndpoints = class {
308
+ constructor(client) {
309
+ this.client = client;
202
310
  }
203
311
  /**
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.
312
+ * Get current market capitalization for a stock
313
+ *
314
+ * Market capitalization represents the total value of a company's outstanding shares.
315
+ * Calculated by multiplying the current share price by the number of outstanding shares.
316
+ * This metric is crucial for understanding a company's size and market position.
317
+ *
318
+ * @param symbol - The stock symbol to get market cap for (e.g., 'AAPL', 'MSFT', 'GOOGL')
319
+ *
320
+ * @returns Promise resolving to market cap data including symbol, date, and market cap value
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * // Get market cap for Apple
325
+ * const marketCap = await fmp.stock.getMarketCap('AAPL');
326
+ * console.log(`Apple's market cap: $${marketCap.data.marketCap.toLocaleString()}`);
327
+ *
328
+ * // Get market cap for Microsoft
329
+ * const msftCap = await fmp.stock.getMarketCap('MSFT');
330
+ * ```
331
+ *
332
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#market-cap-company-information|FMP Market Cap Documentation}
208
333
  */
209
- async getMarketCap({ symbol }) {
334
+ async getMarketCap(symbol) {
210
335
  return this.client.getSingle(`/market-capitalization/${symbol}`, "v3");
211
336
  }
212
337
  /**
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.
338
+ * Get historical stock splits for a company
339
+ *
340
+ * Stock splits occur when a company increases the number of shares by dividing existing shares.
341
+ * This endpoint provides the complete history of stock splits including dates, ratios, and split types.
342
+ * Useful for adjusting historical price data and understanding corporate actions.
343
+ *
344
+ * @param symbol - The stock symbol to get split history for (e.g., 'AAPL', 'TSLA', 'NVDA')
345
+ *
346
+ * @returns Promise resolving to historical stock splits with dates, labels, and split ratios
347
+ *
348
+ * @example
349
+ * ```typescript
350
+ * // Get Apple's split history
351
+ * const splits = await fmp.stock.getStockSplits('AAPL');
352
+ * splits.data.historical.forEach(split => {
353
+ * console.log(`${split.date}: ${split.numerator}:${split.denominator} split`);
354
+ * });
355
+ *
356
+ * // Get Tesla's split history
357
+ * const teslaSplits = await fmp.stock.getStockSplits('TSLA');
358
+ * ```
359
+ *
360
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#splits-historical-splits|FMP Stock Splits Documentation}
217
361
  */
218
- async getStockSplits({ symbol }) {
362
+ async getStockSplits(symbol) {
219
363
  return this.client.get(`/historical-price-full/stock_split/${symbol}`, "v3");
220
364
  }
221
365
  /**
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.
366
+ * Get historical dividend payments for a stock
367
+ *
368
+ * Dividends are periodic payments made by companies to shareholders from profits.
369
+ * This endpoint provides the complete dividend history including payment dates, amounts,
370
+ * and important dates like ex-dividend, record, and declaration dates.
371
+ *
372
+ * @param symbol - The stock symbol to get dividend history for (e.g., 'KO', 'JNJ', 'PG')
373
+ *
374
+ * @returns Promise resolving to dividend history with payment details and important dates
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * // Get Coca-Cola's dividend history
379
+ * const dividends = await fmp.stock.getDividendHistory('KO');
380
+ * dividends.data.historical.forEach(dividend => {
381
+ * console.log(`${dividend.date}: $${dividend.dividend} per share`);
382
+ * });
383
+ *
384
+ * // Get Johnson & Johnson's dividend history
385
+ * const jnjDividends = await fmp.stock.getDividendHistory('JNJ');
386
+ * ```
387
+ *
388
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#dividends-historical-dividends|FMP Dividends Documentation}
226
389
  */
227
- async getDividendHistory({
228
- symbol
229
- }) {
390
+ async getDividendHistory(symbol) {
230
391
  return this.client.getSingle(`/historical-price-full/stock_dividend/${symbol}`, "v3");
231
392
  }
232
393
  /**
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
394
+ * Get real-time stock prices for multiple symbols
395
+ *
396
+ * Provides current market prices for stocks with minimal data overhead.
397
+ * Returns basic price information including symbol and current price.
398
+ * Ideal for quick price checks and portfolio monitoring.
399
+ *
400
+ * @param symbols - Array of stock symbols to get real-time prices for
401
+ *
402
+ * @returns Promise resolving to array of real-time price data with symbol and price
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * // Get prices for multiple tech stocks
407
+ * const prices = await fmp.stock.getRealTimePrice([
408
+ * 'AAPL', 'MSFT', 'GOOGL', 'AMZN', 'TSLA'
409
+ * ]);
410
+ *
411
+ * prices.data.forEach(stock => {
412
+ * console.log(`${stock.symbol}: $${stock.price}`);
413
+ * });
414
+ *
415
+ * // Get price for single stock
416
+ * const aaplPrice = await fmp.stock.getRealTimePrice(['AAPL']);
417
+ * ```
236
418
  */
237
- async getRealTimePrice({
238
- symbols
239
- }) {
419
+ async getRealTimePrice(symbols) {
240
420
  const url = `stock/real-time-price/${symbols.join(",")}`;
241
421
  const result = await this.client.get(url, "v3");
242
422
  if (result.success && result.data && !Array.isArray(result.data)) {
@@ -265,14 +445,38 @@ var StockEndpoints = class {
265
445
  return { ...result, data: filteredData };
266
446
  }
267
447
  /**
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
448
+ * Get comprehensive real-time stock data for multiple symbols
449
+ *
450
+ * Provides detailed real-time market data including bid/ask prices, volume, trade sizes,
451
+ * and timestamps. This endpoint offers much more information than the basic real-time price.
452
+ * Perfect for trading applications, market analysis, and detailed price monitoring.
453
+ *
454
+ * @param symbols - Array of stock symbols to get detailed real-time data for
455
+ *
456
+ * @returns Promise resolving to array of detailed real-time data including bid/ask, volume, and timestamps
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * // Get detailed data for multiple stocks
461
+ * const detailedData = await fmp.stock.getRealTimePriceForMultipleStocks([
462
+ * 'AAPL', 'MSFT', 'GOOGL'
463
+ * ]);
464
+ *
465
+ * detailedData.data.forEach(stock => {
466
+ * console.log(`${stock.symbol}:`);
467
+ * console.log(` Bid: $${stock.bidPrice} (${stock.bidSize} shares)`);
468
+ * console.log(` Ask: $${stock.askPrice} (${stock.askSize} shares)`);
469
+ * console.log(` Last: $${stock.lastSalePrice} (${stock.lastSaleSize} shares)`);
470
+ * console.log(` Volume: ${stock.volume.toLocaleString()}`);
471
+ * });
472
+ *
473
+ * // Get detailed data for single stock
474
+ * const aaplDetailed = await fmp.stock.getRealTimePriceForMultipleStocks(['AAPL']);
475
+ * ```
476
+ *
477
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#real-time-full-price-quote|FMP Real-Time Full Price Documentation}
272
478
  */
273
- async getRealTimePriceForMultipleStocks({
274
- symbols
275
- }) {
479
+ async getRealTimePriceForMultipleStocks(symbols) {
276
480
  const url = `stock/full/real-time-price/${symbols.join(",")}`;
277
481
  const result = await this.client.get(url, "v3");
278
482
  if (result.success && result.data && !Array.isArray(result.data)) {
@@ -310,391 +514,643 @@ var FinancialEndpoints = class {
310
514
  this.client = client;
311
515
  }
312
516
  /**
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.
517
+ * Get income statement data
518
+ *
519
+ * Provides comprehensive income statement data including revenue, expenses,
520
+ * net income, and earnings per share. Essential for analyzing company
521
+ * profitability, revenue trends, and financial performance over time.
522
+ *
523
+ * @param params - Income statement request parameters
524
+ * @param params.symbol - The stock symbol to get income statement for (e.g., 'AAPL', 'MSFT', 'GOOGL')
525
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
526
+ * @param params.limit - Number of periods to retrieve (default: 5)
527
+ *
528
+ * @returns Promise resolving to array of income statement data with financial metrics
529
+ *
530
+ * @example
531
+ * ```typescript
532
+ * // Get annual income statements for Apple
533
+ * const incomeStatements = await fmp.financial.getIncomeStatement({ symbol: 'AAPL' });
534
+ * incomeStatements.data.forEach(statement => {
535
+ * console.log(`${statement.date}: Revenue $${statement.revenue.toLocaleString()}, Net Income $${statement.netIncome.toLocaleString()}`);
536
+ * });
537
+ *
538
+ * // Get quarterly income statements for Microsoft
539
+ * const quarterlyIncome = await fmp.financial.getIncomeStatement({ symbol: 'MSFT', period: 'quarter', limit: 8 });
540
+ * ```
541
+ *
542
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#income-statements-financial-statements|FMP Income Statement Documentation}
319
543
  */
320
- async getIncomeStatement({
321
- symbol,
322
- period = "annual",
323
- limit = 5
324
- }) {
544
+ async getIncomeStatement(params) {
545
+ const { symbol, period = "annual", limit = 5 } = params;
325
546
  return this.client.get(`/income-statement/${symbol}?period=${period}&limit=${limit}`, "v3");
326
547
  }
327
548
  /**
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.
549
+ * Get balance sheet data
550
+ *
551
+ * Provides comprehensive balance sheet data including assets, liabilities,
552
+ * and shareholder equity. Essential for analyzing company financial position,
553
+ * liquidity, and capital structure.
554
+ *
555
+ * @param params - Balance sheet request parameters
556
+ * @param params.symbol - The stock symbol to get balance sheet for (e.g., 'AAPL', 'MSFT', 'GOOGL')
557
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
558
+ * @param params.limit - Number of periods to retrieve (default: 5)
559
+ *
560
+ * @returns Promise resolving to array of balance sheet data with financial position metrics
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * // Get annual balance sheets for Apple
565
+ * const balanceSheets = await fmp.financial.getBalanceSheet({ symbol: 'AAPL' });
566
+ * balanceSheets.data.forEach(sheet => {
567
+ * console.log(`${sheet.date}: Assets $${sheet.totalAssets.toLocaleString()}, Equity $${sheet.totalStockholdersEquity.toLocaleString()}`);
568
+ * });
569
+ *
570
+ * // Get quarterly balance sheets for Microsoft
571
+ * const quarterlyBalance = await fmp.financial.getBalanceSheet({ symbol: 'MSFT', period: 'quarter', limit: 8 });
572
+ * ```
573
+ *
574
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#balance-sheet-statements-financial-statements|FMP Balance Sheet Documentation}
334
575
  */
335
- async getBalanceSheet({
336
- symbol,
337
- period = "annual",
338
- limit = 5
339
- }) {
576
+ async getBalanceSheet(params) {
577
+ const { symbol, period = "annual", limit = 5 } = params;
340
578
  return this.client.get(
341
579
  `/balance-sheet-statement/${symbol}?period=${period}&limit=${limit}`,
342
580
  "v3"
343
581
  );
344
582
  }
345
583
  /**
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.
584
+ * Get cash flow statement data
585
+ *
586
+ * Provides comprehensive cash flow data including operating, investing,
587
+ * and financing cash flows. Essential for analyzing company cash generation,
588
+ * capital allocation, and financial sustainability.
589
+ *
590
+ * @param params - Cash flow statement request parameters
591
+ * @param params.symbol - The stock symbol to get cash flow statement for (e.g., 'AAPL', 'MSFT', 'GOOGL')
592
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
593
+ * @param params.limit - Number of periods to retrieve (default: 5)
594
+ *
595
+ * @returns Promise resolving to array of cash flow statement data with cash flow metrics
596
+ *
597
+ * @example
598
+ * ```typescript
599
+ * // Get annual cash flow statements for Apple
600
+ * const cashFlows = await fmp.financial.getCashFlowStatement({ symbol: 'AAPL' });
601
+ * cashFlows.data.forEach(flow => {
602
+ * console.log(`${flow.date}: Operating CF $${flow.operatingCashFlow.toLocaleString()}, Free CF $${flow.freeCashFlow.toLocaleString()}`);
603
+ * });
604
+ *
605
+ * // Get quarterly cash flow statements for Microsoft
606
+ * const quarterlyCashFlow = await fmp.financial.getCashFlowStatement({ symbol: 'MSFT', period: 'quarter', limit: 8 });
607
+ * ```
608
+ *
609
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#cashflow-statements-financial-statements|FMP Cash Flow Statement Documentation}
352
610
  */
353
- async getCashFlowStatement({
354
- symbol,
355
- period = "annual",
356
- limit = 5
357
- }) {
611
+ async getCashFlowStatement(params) {
612
+ const { symbol, period = "annual", limit = 5 } = params;
358
613
  return this.client.get(`/cash-flow-statement/${symbol}?period=${period}&limit=${limit}`, "v3");
359
614
  }
360
615
  /**
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.
616
+ * Get key financial metrics
617
+ *
618
+ * Provides essential financial metrics including revenue, net income,
619
+ * P/E ratio, and other key performance indicators. Essential for
620
+ * fundamental analysis and company valuation.
621
+ *
622
+ * @param params - Key metrics request parameters
623
+ * @param params.symbol - The stock symbol to get key metrics for (e.g., 'AAPL', 'MSFT', 'GOOGL')
624
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
625
+ * @param params.limit - Number of periods to retrieve (default: 5)
626
+ *
627
+ * @returns Promise resolving to array of key metrics data with financial indicators
628
+ *
629
+ * @example
630
+ * ```typescript
631
+ * // Get key metrics for Apple
632
+ * const keyMetrics = await fmp.financial.getKeyMetrics({ symbol: 'AAPL' });
633
+ * keyMetrics.data.forEach(metric => {
634
+ * console.log(`${metric.date}: P/E ${metric.peRatio}, ROE ${metric.roe}%`);
635
+ * });
636
+ *
637
+ * // Get quarterly key metrics for Microsoft
638
+ * const quarterlyMetrics = await fmp.financial.getKeyMetrics({ symbol: 'MSFT', period: 'quarter', limit: 8 });
639
+ * ```
640
+ *
641
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#key-metrics-statement-analysis|FMP Key Metrics Documentation}
367
642
  */
368
- async getKeyMetrics({
369
- symbol,
370
- period = "annual",
371
- limit = 5
372
- }) {
643
+ async getKeyMetrics(params) {
644
+ const { symbol, period = "annual", limit = 5 } = params;
373
645
  return this.client.get(`/key-metrics/${symbol}?period=${period}&limit=${limit}`, "v3");
374
646
  }
375
647
  /**
376
648
  * 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.
649
+ *
650
+ * Provides comprehensive financial ratios including P/B ratio, ROE,
651
+ * debt-to-equity, and other important ratios. Essential for analyzing
652
+ * company financial health and comparing with peers.
653
+ *
654
+ * @param params - Financial ratios request parameters
655
+ * @param params.symbol - The stock symbol to get financial ratios for (e.g., 'AAPL', 'MSFT', 'GOOGL')
656
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
657
+ * @param params.limit - Number of periods to retrieve (default: 5)
658
+ *
659
+ * @returns Promise resolving to array of financial ratios data with ratio metrics
660
+ *
661
+ * @example
662
+ * ```typescript
663
+ * // Get financial ratios for Apple
664
+ * const ratios = await fmp.financial.getFinancialRatios({ symbol: 'AAPL' });
665
+ * ratios.data.forEach(ratio => {
666
+ * console.log(`${ratio.date}: P/B ${ratio.priceToBookRatio}, Debt/Equity ${ratio.debtToEquity}`);
667
+ * });
668
+ *
669
+ * // Get quarterly ratios for Microsoft
670
+ * const quarterlyRatios = await fmp.financial.getFinancialRatios({ symbol: 'MSFT', period: 'quarter', limit: 8 });
671
+ * ```
672
+ *
673
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#ratios-statement-analysis|FMP Financial Ratios Documentation}
382
674
  */
383
- async getFinancialRatios({
384
- symbol,
385
- period = "annual",
386
- limit = 5
387
- }) {
675
+ async getFinancialRatios(params) {
676
+ const { symbol, period = "annual", limit = 5 } = params;
388
677
  return this.client.get(`/ratios/${symbol}?period=${period}&limit=${limit}`, "v3");
389
678
  }
390
679
  /**
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.
680
+ * Get enterprise value data
681
+ *
682
+ * Provides enterprise value metrics including total enterprise value,
683
+ * market cap, and debt information. Essential for company valuation
684
+ * and comparing companies with different capital structures.
685
+ *
686
+ * @param params - Enterprise value request parameters
687
+ * @param params.symbol - The stock symbol to get enterprise value for (e.g., 'AAPL', 'MSFT', 'GOOGL')
688
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
689
+ * @param params.limit - Number of periods to retrieve (default: 5)
690
+ *
691
+ * @returns Promise resolving to array of enterprise value data with valuation metrics
692
+ *
693
+ * @example
694
+ * ```typescript
695
+ * // Get enterprise value for Apple
696
+ * const enterpriseValue = await fmp.financial.getEnterpriseValue({ symbol: 'AAPL' });
697
+ * enterpriseValue.data.forEach(ev => {
698
+ * console.log(`${ev.date}: EV $${ev.enterpriseValue.toLocaleString()}, Market Cap $${ev.marketCapitalization.toLocaleString()}`);
699
+ * });
700
+ *
701
+ * // Get quarterly enterprise value for Microsoft
702
+ * const quarterlyEV = await fmp.financial.getEnterpriseValue({ symbol: 'MSFT', period: 'quarter', limit: 8 });
703
+ * ```
704
+ *
705
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#enterprise-values-statement-analysis|FMP Enterprise Value Documentation}
397
706
  */
398
- async getEnterpriseValue({
399
- symbol,
400
- period = "annual",
401
- limit = 5
402
- }) {
707
+ async getEnterpriseValue(params) {
708
+ const { symbol, period = "annual", limit = 5 } = params;
403
709
  return this.client.get(`/enterprise-value/${symbol}?period=${period}&limit=${limit}`, "v3");
404
710
  }
405
711
  /**
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.
712
+ * Get cash flow growth data
713
+ *
714
+ * Provides cash flow growth rates showing how quickly a company's
715
+ * cash flows are growing over time. Essential for analyzing cash
716
+ * generation trends and financial sustainability.
717
+ *
718
+ * @param params - Cash flow growth request parameters
719
+ * @param params.symbol - The stock symbol to get cash flow growth for (e.g., 'AAPL', 'MSFT', 'GOOGL')
720
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
721
+ * @param params.limit - Number of periods to retrieve (default: 5)
722
+ *
723
+ * @returns Promise resolving to array of cash flow growth data with growth metrics
724
+ *
725
+ * @example
726
+ * ```typescript
727
+ * // Get cash flow growth for Apple
728
+ * const cashFlowGrowth = await fmp.financial.getCashflowGrowth({ symbol: 'AAPL' });
729
+ * cashFlowGrowth.data.forEach(growth => {
730
+ * console.log(`${growth.date}: Operating CF Growth ${growth.operatingCashFlowGrowth}%`);
731
+ * });
732
+ *
733
+ * // Get quarterly cash flow growth for Microsoft
734
+ * const quarterlyGrowth = await fmp.financial.getCashflowGrowth({ symbol: 'MSFT', period: 'quarter', limit: 8 });
735
+ * ```
736
+ *
737
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#cashflow-growth-statement-analysis|FMP Cash Flow Growth Documentation}
412
738
  */
413
- async getCashflowGrowth({
414
- symbol,
415
- period = "annual",
416
- limit = 5
417
- }) {
739
+ async getCashflowGrowth(params) {
740
+ const { symbol, period = "annual", limit = 5 } = params;
418
741
  return this.client.get(
419
742
  `/cash-flow-statement-growth/${symbol}?period=${period}&limit=${limit}`,
420
743
  "v3"
421
744
  );
422
745
  }
423
746
  /**
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.
747
+ * Get income growth data
748
+ *
749
+ * Provides income growth rates showing how quickly a company's
750
+ * revenue and net income are growing over time. Essential for
751
+ * analyzing profitability trends and business momentum.
752
+ *
753
+ * @param params - Income growth request parameters
754
+ * @param params.symbol - The stock symbol to get income growth for (e.g., 'AAPL', 'MSFT', 'GOOGL')
755
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
756
+ * @param params.limit - Number of periods to retrieve (default: 5)
757
+ *
758
+ * @returns Promise resolving to array of income growth data with growth metrics
759
+ *
760
+ * @example
761
+ * ```typescript
762
+ * // Get income growth for Apple
763
+ * const incomeGrowth = await fmp.financial.getIncomeGrowth({ symbol: 'AAPL' });
764
+ * incomeGrowth.data.forEach(growth => {
765
+ * console.log(`${growth.date}: Revenue Growth ${growth.revenueGrowth}%, Net Income Growth ${growth.netIncomeGrowth}%`);
766
+ * });
767
+ *
768
+ * // Get quarterly income growth for Microsoft
769
+ * const quarterlyGrowth = await fmp.financial.getIncomeGrowth({ symbol: 'MSFT', period: 'quarter', limit: 8 });
770
+ * ```
771
+ *
772
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#income-growth-statement-analysis|FMP Income Growth Documentation}
430
773
  */
431
- async getIncomeGrowth({
432
- symbol,
433
- period = "annual",
434
- limit = 5
435
- }) {
774
+ async getIncomeGrowth(params) {
775
+ const { symbol, period = "annual", limit = 5 } = params;
436
776
  return this.client.get(
437
777
  `/income-statement-growth/${symbol}?period=${period}&limit=${limit}`,
438
778
  "v3"
439
779
  );
440
780
  }
441
781
  /**
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.
782
+ * Get balance sheet growth data
783
+ *
784
+ * Provides balance sheet growth rates showing how quickly a company's
785
+ * assets, liabilities, and equity are growing over time. Essential for
786
+ * analyzing capital structure trends and financial position changes.
787
+ *
788
+ * @param params - Balance sheet growth request parameters
789
+ * @param params.symbol - The stock symbol to get balance sheet growth for (e.g., 'AAPL', 'MSFT', 'GOOGL')
790
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
791
+ * @param params.limit - Number of periods to retrieve (default: 5)
792
+ *
793
+ * @returns Promise resolving to array of balance sheet growth data with growth metrics
794
+ *
795
+ * @example
796
+ * ```typescript
797
+ * // Get balance sheet growth for Apple
798
+ * const balanceSheetGrowth = await fmp.financial.getBalanceSheetGrowth({ symbol: 'AAPL' });
799
+ * balanceSheetGrowth.data.forEach(growth => {
800
+ * console.log(`${growth.date}: Assets Growth ${growth.totalAssetsGrowth}%, Equity Growth ${growth.totalStockholdersEquityGrowth}%`);
801
+ * });
802
+ *
803
+ * // Get quarterly balance sheet growth for Microsoft
804
+ * const quarterlyGrowth = await fmp.financial.getBalanceSheetGrowth({ symbol: 'MSFT', period: 'quarter', limit: 8 });
805
+ * ```
806
+ *
807
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#balance-sheet-growth-statement-analysis|FMP Balance Sheet Growth Documentation}
448
808
  */
449
- async getBalanceSheetGrowth({
450
- symbol,
451
- period = "annual",
452
- limit = 5
453
- }) {
809
+ async getBalanceSheetGrowth(params) {
810
+ const { symbol, period = "annual", limit = 5 } = params;
454
811
  return this.client.get(
455
812
  `/balance-sheet-statement-growth/${symbol}?period=${period}&limit=${limit}`,
456
813
  "v3"
457
814
  );
458
815
  }
459
816
  /**
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.
817
+ * Get financial growth data
818
+ *
819
+ * Provides comprehensive financial growth rates across all key
820
+ * financial metrics. Essential for analyzing overall financial
821
+ * performance trends and business momentum.
822
+ *
823
+ * @param params - Financial growth request parameters
824
+ * @param params.symbol - The stock symbol to get financial growth for (e.g., 'AAPL', 'MSFT', 'GOOGL')
825
+ * @param params.period - The reporting period: 'annual' or 'quarter' (default: 'annual')
826
+ * @param params.limit - Number of periods to retrieve (default: 5)
827
+ *
828
+ * @returns Promise resolving to array of financial growth data with comprehensive growth metrics
829
+ *
830
+ * @example
831
+ * ```typescript
832
+ * // Get financial growth for Apple
833
+ * const financialGrowth = await fmp.financial.getFinancialGrowth({ symbol: 'AAPL' });
834
+ * financialGrowth.data.forEach(growth => {
835
+ * console.log(`${growth.date}: Revenue Growth ${growth.revenueGrowth}%, EPS Growth ${growth.epsGrowth}%`);
836
+ * });
837
+ *
838
+ * // Get quarterly financial growth for Microsoft
839
+ * const quarterlyGrowth = await fmp.financial.getFinancialGrowth({ symbol: 'MSFT', period: 'quarter', limit: 8 });
840
+ * ```
841
+ *
842
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#financial-growth-statement-analysis|FMP Financial Growth Documentation}
466
843
  */
467
- async getFinancialGrowth({
468
- symbol,
469
- period = "annual",
470
- limit = 5
471
- }) {
844
+ async getFinancialGrowth(params) {
845
+ const { symbol, period = "annual", limit = 5 } = params;
472
846
  return this.client.get(`/financial-growth/${symbol}?period=${period}&limit=${limit}`, "v3");
473
847
  }
474
848
  /**
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.
849
+ * Get historical earnings data
850
+ *
851
+ * Provides historical and upcoming earnings announcements including
852
+ * dates, estimated EPS, and actual EPS. Essential for analyzing
853
+ * earnings trends and tracking company performance.
854
+ *
855
+ * @param params - Earnings historical request parameters
856
+ * @param params.symbol - The stock symbol to get earnings history for (e.g., 'AAPL', 'MSFT', 'GOOGL')
857
+ * @param params.limit - Number of periods to retrieve (default: 5)
858
+ *
859
+ * @returns Promise resolving to array of historical earnings data with announcement details
860
+ *
861
+ * @example
862
+ * ```typescript
863
+ * // Get earnings history for Apple
864
+ * const earningsHistory = await fmp.financial.getEarningsHistorical({ symbol: 'AAPL', limit: 10 });
865
+ * earningsHistory.data.forEach(earning => {
866
+ * console.log(`${earning.date}: Est. ${earning.estimatedEps}, Actual ${earning.actualEps}`);
867
+ * });
868
+ *
869
+ * // Get earnings history for Microsoft
870
+ * const msftEarnings = await fmp.financial.getEarningsHistorical({ symbol: 'MSFT', limit: 8 });
871
+ * ```
872
+ *
873
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#earnings-historical-earnings|FMP Earnings Historical Documentation}
480
874
  */
481
- async getEarningsHistorical({
482
- symbol,
483
- limit = 5
484
- }) {
875
+ async getEarningsHistorical(params) {
876
+ const { symbol, limit = 5 } = params;
485
877
  return this.client.get(`/historical/earning_calendar/${symbol}?limit=${limit}`, "v3");
486
878
  }
487
879
  /**
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.
880
+ * Get earnings surprises data
881
+ *
882
+ * Provides earnings announcements that exceeded or fell short of
883
+ * analyst estimates. Essential for analyzing earnings quality and
884
+ * market reactions to earnings releases.
885
+ *
886
+ * @param symbol - The stock symbol to get earnings surprises for (e.g., 'AAPL', 'MSFT', 'GOOGL')
887
+ *
888
+ * @returns Promise resolving to array of earnings surprises data with surprise details
889
+ *
890
+ * @example
891
+ * ```typescript
892
+ * // Get earnings surprises for Apple
893
+ * const earningsSurprises = await fmp.financial.getEarningsSurprises('AAPL');
894
+ * earningsSurprises.data.forEach(surprise => {
895
+ * console.log(`${surprise.date}: Est. ${surprise.estimatedEps}, Actual ${surprise.actualEps}, Surprise ${surprise.surprisePercentage}%`);
896
+ * });
897
+ *
898
+ * // Get earnings surprises for Microsoft
899
+ * const msftSurprises = await fmp.financial.getEarningsSurprises('MSFT');
900
+ * ```
901
+ *
902
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#earnings-surprises-earnings|FMP Earnings Surprises Documentation}
493
903
  */
494
- async getEarningsSurprises({
495
- symbol
496
- }) {
904
+ async getEarningsSurprises(symbol) {
497
905
  return this.client.get(`/earnings-surprises/${symbol}`, "v3");
498
906
  }
499
907
  };
500
908
 
501
- // src/endpoints/forex.ts
502
- var ForexEndpoints = class {
909
+ // src/endpoints/etf.ts
910
+ var ETFEndpoints = class {
503
911
  constructor(client) {
504
912
  this.client = client;
505
913
  }
506
914
  /**
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
915
+ * Get available ETF holding dates
916
+ *
917
+ * Provides a list of dates when ETF holdings are updated and available.
918
+ * Useful for determining when the most recent holdings data is available
919
+ * and ensuring you're working with current portfolio information.
920
+ *
921
+ * @param symbol - ETF symbol to get holding dates for (e.g., 'SPY', 'VOO', 'QQQ')
922
+ *
923
+ * @returns Promise resolving to array of available holding dates
924
+ *
925
+ * @example
926
+ * ```typescript
927
+ * // Get holding dates for specific ETF
928
+ * const spyDates = await fmp.etf.getHoldingDates('SPY');
929
+ * spyDates.data.forEach(date => {
930
+ * console.log(`Holdings available: ${date.date}`);
931
+ * });
932
+ *
933
+ * // Get VOO holding dates
934
+ * const vooDates = await fmp.etf.getHoldingDates('VOO');
935
+ * ```
936
+ *
937
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#etf-holding-dates-etf-holdings|FMP ETF Holding Dates Documentation}
511
938
  */
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);
939
+ async getHoldingDates(symbol) {
940
+ return this.client.get("/etf-holdings/portfolio-date", "v4", { symbol });
517
941
  }
518
942
  /**
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
943
+ * Get ETF holdings for specific date
944
+ *
945
+ * Provides detailed holdings information for an ETF on a specific date.
946
+ * Includes individual stocks, their weights, shares held, and market values.
947
+ * Essential for understanding ETF composition and portfolio analysis.
948
+ *
949
+ * @param params - ETF holdings request parameters
950
+ * @param params.symbol - The ETF symbol to get holdings for (e.g., 'SPY', 'VOO', 'QQQ')
951
+ * @param params.date - The date to get holdings for in YYYY-MM-DD format
952
+ *
953
+ * @returns Promise resolving to array of ETF holdings with detailed stock information
954
+ *
955
+ * @example
956
+ * ```typescript
957
+ * // Get SPY holdings for specific date
958
+ * const holdings = await fmp.etf.getHoldings({ symbol: 'SPY', date: '2024-01-15' });
959
+ * holdings.data.forEach(holding => {
960
+ * console.log(`${holding.asset}: ${holding.weight}% (${holding.sharesNumber} shares)`);
961
+ * });
962
+ *
963
+ * // Get VOO holdings
964
+ * const vooHoldings = await fmp.etf.getHoldings({ symbol: 'VOO', date: '2024-01-15' });
965
+ * ```
966
+ *
967
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#etf-holdings-etf-holdings|FMP ETF Holdings Documentation}
525
968
  */
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;
969
+ async getHoldings(params) {
970
+ const { symbol, date } = params;
971
+ const queryParams = {};
972
+ if (symbol) queryParams.symbol = symbol;
973
+ if (date) queryParams.date = date;
974
+ return this.client.get("/etf-holdings", "v4", queryParams);
545
975
  }
546
976
  /**
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
977
+ * Get ETF holdings and components
978
+ *
979
+ * Provides all stocks held by a specific ETF including assets, share numbers,
980
+ * and weight percentages. Essential for understanding ETF composition and
981
+ * finding which ETFs hold specific stocks.
982
+ *
983
+ * @param symbol - The ETF symbol to get holdings for (e.g., 'SPY', 'VOO', 'QQQ')
984
+ *
985
+ * @returns Promise resolving to array of ETF holdings with stock details
986
+ *
987
+ * @example
988
+ * ```typescript
989
+ * // Get SPY holdings
990
+ * const spyHoldings = await fmp.etf.getHolder('SPY');
991
+ * spyHoldings.data.forEach(holding => {
992
+ * console.log(`${holding.asset}: ${holding.weight}% (${holding.sharesNumber} shares)`);
993
+ * });
994
+ *
995
+ * // Get VOO holdings
996
+ * const vooHoldings = await fmp.etf.getHolder('VOO');
997
+ * ```
998
+ *
999
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#etf-holder-etf-holdings|FMP ETF Holder Documentation}
551
1000
  */
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");
1001
+ async getHolder(symbol) {
1002
+ return this.client.get(`/etf-holder/${symbol}`, "v3");
557
1003
  }
558
1004
  /**
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.
1005
+ * Get ETF profile and information
1006
+ *
1007
+ * Provides comprehensive information about an ETF including ticker symbol,
1008
+ * name, expense ratio, assets under management, and other key metrics.
1009
+ * Essential for ETF comparison and due diligence.
1010
+ *
1011
+ * @param symbol - ETF symbol to get profile for (e.g., 'SPY', 'VOO', 'QQQ')
1012
+ *
1013
+ * @returns Promise resolving to ETF profile with detailed information
1014
+ *
1015
+ * @example
1016
+ * ```typescript
1017
+ * // Get SPY profile
1018
+ * const spyProfile = await fmp.etf.getProfile('SPY');
1019
+ * console.log(`SPY AUM: $${spyProfile.data.aum.toLocaleString()}`);
1020
+ * console.log(`Expense Ratio: ${spyProfile.data.expenseRatio}%`);
1021
+ *
1022
+ * // Get VOO profile
1023
+ * const vooProfile = await fmp.etf.getProfile('VOO');
1024
+ * ```
1025
+ *
1026
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#etf-information-etf-holdings|FMP ETF Information Documentation}
565
1027
  */
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");
1028
+ async getProfile(symbol) {
1029
+ return this.client.getSingle("/etf-info", "v4", { symbol });
621
1030
  }
622
1031
  /**
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.
1032
+ * Get ETF sector weighting and exposure
1033
+ *
1034
+ * Provides a breakdown of an ETF's sector allocation showing the percentage
1035
+ * of assets invested in each sector. Essential for understanding sector
1036
+ * exposure and diversification analysis.
1037
+ *
1038
+ * @param symbol - The ETF symbol to get sector weighting for (e.g., 'SPY', 'VOO', 'QQQ')
1039
+ *
1040
+ * @returns Promise resolving to array of sector weightings with percentage allocations
1041
+ *
1042
+ * @example
1043
+ * ```typescript
1044
+ * // Get SPY sector weightings
1045
+ * const sectorWeightings = await fmp.etf.getSectorWeighting('SPY');
1046
+ * sectorWeightings.data.forEach(sector => {
1047
+ * console.log(`${sector.sector}: ${sector.weight}%`);
1048
+ * });
1049
+ *
1050
+ * // Get QQQ sector exposure (tech-heavy)
1051
+ * const qqqSectors = await fmp.etf.getSectorWeighting('QQQ');
1052
+ * ```
1053
+ *
1054
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#etf-sector-weighting-etf-holdings|FMP ETF Sector Weighting Documentation}
638
1055
  */
639
- async getSectorWeighting({ symbol }) {
1056
+ async getSectorWeighting(symbol) {
640
1057
  return this.client.get(`/etf-sector-weightings/${symbol}`, "v3");
641
1058
  }
642
1059
  /**
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.
1060
+ * Get ETF country weighting and exposure
1061
+ *
1062
+ * Provides a breakdown of an ETF's geographic allocation showing the percentage
1063
+ * of assets invested in each country. Essential for understanding international
1064
+ * exposure and geographic diversification.
1065
+ *
1066
+ * @param symbol - The ETF symbol to get country weighting for (e.g., 'SPY', 'VOO', 'EFA')
1067
+ *
1068
+ * @returns Promise resolving to array of country weightings with percentage allocations
1069
+ *
1070
+ * @example
1071
+ * ```typescript
1072
+ * // Get SPY country weightings
1073
+ * const countryWeightings = await fmp.etf.getCountryWeighting('SPY');
1074
+ * countryWeightings.data.forEach(country => {
1075
+ * console.log(`${country.country}: ${country.weight}%`);
1076
+ * });
1077
+ *
1078
+ * // Get international ETF exposure
1079
+ * const efaCountries = await fmp.etf.getCountryWeighting('EFA');
1080
+ * ```
1081
+ *
1082
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#etf-country-weighting-etf-holdings|FMP ETF Country Weighting Documentation}
647
1083
  */
648
- async getCountryWeighting({ symbol }) {
1084
+ async getCountryWeighting(symbol) {
649
1085
  return this.client.get(`/etf-country-weightings/${symbol}`, "v3");
650
1086
  }
651
1087
  /**
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.
1088
+ * Get ETF stock exposure and holdings
1089
+ *
1090
+ * Provides detailed exposure information for a specific stock across all ETFs
1091
+ * that hold it. Includes market value, share numbers, and weight percentages.
1092
+ * Useful for finding which ETFs have exposure to specific stocks.
1093
+ *
1094
+ * @param symbol - The stock symbol to get ETF exposure for (e.g., 'AAPL', 'MSFT', 'GOOGL')
1095
+ *
1096
+ * @returns Promise resolving to array of ETF exposures with detailed holding information
1097
+ *
1098
+ * @example
1099
+ * ```typescript
1100
+ * // Find ETFs that hold Apple
1101
+ * const appleExposure = await fmp.etf.getStockExposure('AAPL');
1102
+ * appleExposure.data.forEach(etf => {
1103
+ * console.log(`${etf.etfSymbol}: ${etf.weight}% (${etf.sharesNumber} shares)`);
1104
+ * });
1105
+ *
1106
+ * // Find ETFs that hold Microsoft
1107
+ * const msftExposure = await fmp.etf.getStockExposure('MSFT');
1108
+ * ```
1109
+ *
1110
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#etf-sector-exposure-etf-holdings|FMP ETF Stock Exposure Documentation}
656
1111
  */
657
- async getStockExposure({ symbol }) {
1112
+ async getStockExposure(symbol) {
658
1113
  return this.client.get(`/etf-stock-exposure/${symbol}`, "v3");
659
1114
  }
660
1115
  };
661
1116
 
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
1117
  // src/endpoints/economic.ts
688
1118
  var EconomicEndpoints = class {
689
1119
  constructor(client) {
690
1120
  this.client = client;
691
1121
  }
692
1122
  /**
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
1123
+ * Get treasury rates data
1124
+ *
1125
+ * Provides historical treasury rates for various maturities including
1126
+ * 1-month, 3-month, 6-month, 1-year, 2-year, 3-year, 5-year, 7-year,
1127
+ * 10-year, 20-year, and 30-year treasury bonds. Essential for analyzing
1128
+ * interest rate trends, yield curves, and fixed income investments.
1129
+ *
1130
+ * @param params - Treasury rates request parameters
1131
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to 1 year ago)
1132
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to today)
1133
+ *
1134
+ * @returns Promise resolving to array of treasury rates data with yield information
1135
+ *
1136
+ * @example
1137
+ * ```typescript
1138
+ * // Get treasury rates for the last year
1139
+ * const treasuryRates = await fmp.economic.getTreasuryRates({
1140
+ * from: '2023-01-01',
1141
+ * to: '2023-12-31'
1142
+ * });
1143
+ * treasuryRates.data.forEach(rate => {
1144
+ * console.log(`${rate.date}: 10Y ${rate.tenY}%, 2Y ${rate.twoY}%`);
1145
+ * });
1146
+ *
1147
+ * // Get recent treasury rates
1148
+ * const recentRates = await fmp.economic.getTreasuryRates({
1149
+ * from: '2024-01-01'
1150
+ * });
1151
+ * ```
1152
+ *
1153
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#treasury-rates-economics-data|FMP Treasury Rates Documentation}
698
1154
  */
699
1155
  async getTreasuryRates(params) {
700
1156
  const { from, to } = params;
@@ -704,12 +1160,47 @@ var EconomicEndpoints = class {
704
1160
  return this.client.get("/treasury", "v4", queryParams);
705
1161
  }
706
1162
  /**
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.
1163
+ * Get economic indicators data
1164
+ *
1165
+ * Provides real-time and historical economic data for a wide variety of
1166
+ * economic indicators including GDP, unemployment, inflation, retail sales,
1167
+ * and many others. Essential for macroeconomic analysis and understanding
1168
+ * economic trends and cycles.
1169
+ *
1170
+ * @param params - Economic indicators request parameters
1171
+ * @param params.name - The economic indicator to retrieve
1172
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to 1 year ago)
1173
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to today)
1174
+ *
1175
+ * @returns Promise resolving to array of economic indicator data with historical values
1176
+ *
1177
+ * @example
1178
+ * ```typescript
1179
+ * // Get GDP data for the last year
1180
+ * const gdpData = await fmp.economic.getEconomicIndicators({
1181
+ * name: 'GDP',
1182
+ * from: '2023-01-01',
1183
+ * to: '2023-12-31'
1184
+ * });
1185
+ * gdpData.data.forEach(gdp => {
1186
+ * console.log(`${gdp.date}: GDP $${gdp.value.toLocaleString()} billion`);
1187
+ * });
1188
+ *
1189
+ * // Get unemployment rate data
1190
+ * const unemploymentData = await fmp.economic.getEconomicIndicators({
1191
+ * name: 'unemploymentRate',
1192
+ * from: '2024-01-01'
1193
+ * });
1194
+ *
1195
+ * // Get inflation rate data
1196
+ * const inflationData = await fmp.economic.getEconomicIndicators({
1197
+ * name: 'inflationRate',
1198
+ * from: '2023-01-01',
1199
+ * to: '2023-12-31'
1200
+ * });
1201
+ * ```
1202
+ *
1203
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#economic-indicators-economics-data|FMP Economic Indicators Documentation}
713
1204
  */
714
1205
  async getEconomicIndicators(params) {
715
1206
  const { name, from, to } = params;
@@ -726,51 +1217,290 @@ var MarketEndpoints = class {
726
1217
  this.client = client;
727
1218
  }
728
1219
  /**
729
- * Get market hours
1220
+ * Get current market hours and trading status
1221
+ *
1222
+ * Provides real-time information about market trading hours, including
1223
+ * whether markets are currently open or closed, trading session times,
1224
+ * and upcoming market holidays. Essential for determining trading
1225
+ * availability and market status.
1226
+ *
1227
+ * @returns Promise resolving to market hours data with trading status and session information
1228
+ *
1229
+ * @example
1230
+ * ```typescript
1231
+ * // Get current market status
1232
+ * const marketHours = await fmp.market.getMarketHours();
1233
+ * console.log(`Market is ${marketHours.data.isTheStockMarketOpen ? 'OPEN' : 'CLOSED'}`);
1234
+ * console.log(`Current time: ${marketHours.data.currentTime}`);
1235
+ * console.log(`Next trading day: ${marketHours.data.nextTradingDay}`);
1236
+ *
1237
+ * // Check if it's a trading day
1238
+ * if (marketHours.data.isTheStockMarketOpen) {
1239
+ * console.log('Markets are currently open for trading');
1240
+ * } else {
1241
+ * console.log('Markets are closed');
1242
+ * }
1243
+ * ```
1244
+ *
1245
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#market-hours|FMP Market Hours Documentation}
730
1246
  */
731
1247
  async getMarketHours() {
732
1248
  return this.client.get("/market-hours", "v3");
733
1249
  }
734
1250
  /**
735
- * Get market performance
1251
+ * Get overall market performance data
1252
+ *
1253
+ * Provides comprehensive market performance data including major indices,
1254
+ * market breadth, and key performance metrics. Essential for understanding
1255
+ * overall market sentiment, trends, and daily market activity.
1256
+ *
1257
+ * @returns Promise resolving to array of market performance data with indices and metrics
1258
+ *
1259
+ * @example
1260
+ * ```typescript
1261
+ * // Get overall market performance
1262
+ * const marketPerformance = await fmp.market.getMarketPerformance();
1263
+ * marketPerformance.data.forEach(market => {
1264
+ * console.log(`${market.index}: ${market.change} (${market.changesPercentage}%)`);
1265
+ * console.log(` Open: $${market.open}, High: $${market.dayHigh}, Low: $${market.dayLow}`);
1266
+ * });
1267
+ *
1268
+ * // Find specific indices
1269
+ * const sp500 = marketPerformance.data.find(market => market.index === 'S&P 500');
1270
+ * console.log(`S&P 500 performance: ${sp500?.changesPercentage}%`);
1271
+ *
1272
+ * // Check market sentiment
1273
+ * const gainers = marketPerformance.data.filter(market => market.changesPercentage > 0);
1274
+ * const losers = marketPerformance.data.filter(market => market.changesPercentage < 0);
1275
+ * console.log(`Gaining indices: ${gainers.length}, Losing indices: ${losers.length}`);
1276
+ * ```
1277
+ *
1278
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#market-performance|FMP Market Performance Documentation}
736
1279
  */
737
1280
  async getMarketPerformance() {
738
1281
  return this.client.get("/market-performance", "v3");
739
1282
  }
740
1283
  /**
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.
1284
+ * Get top gaining stocks for the current trading day
1285
+ *
1286
+ * Provides a list of stocks that have gained the most value during the
1287
+ * current trading session. Essential for identifying momentum stocks,
1288
+ * tracking market movers, and discovering potential investment opportunities.
1289
+ * Useful for day trading, momentum strategies, and market analysis.
1290
+ *
1291
+ * @returns Promise resolving to array of top gaining stocks with price and percentage change data
1292
+ *
1293
+ * @example
1294
+ * ```typescript
1295
+ * // Get top gainers for the day
1296
+ * const gainers = await fmp.market.getGainers();
1297
+ * console.log(`Top ${gainers.data.length} gaining stocks today:`);
1298
+ *
1299
+ * gainers.data.forEach((stock, index) => {
1300
+ * console.log(`${index + 1}. ${stock.symbol} (${stock.name})`);
1301
+ * console.log(` Price: $${stock.price} | Change: +${stock.change} (${stock.changesPercentage}%)`);
1302
+ * console.log(` Volume: ${stock.volume.toLocaleString()}`);
1303
+ * });
1304
+ *
1305
+ * // Find stocks with >10% gains
1306
+ * const bigGainers = gainers.data.filter(stock => stock.changesPercentage > 10);
1307
+ * console.log(`Stocks with >10% gains: ${bigGainers.length}`);
1308
+ *
1309
+ * // Check volume leaders among gainers
1310
+ * const highVolumeGainers = gainers.data.filter(stock => stock.volume > 1000000);
1311
+ * console.log(`High volume gainers (>1M shares): ${highVolumeGainers.length}`);
1312
+ * ```
1313
+ *
1314
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#market-biggest-gainers-market-overview|FMP Market Biggest Gainers Documentation}
744
1315
  */
745
1316
  async getGainers() {
746
1317
  return this.client.get("/stock_market/gainers", "v3");
747
1318
  }
748
1319
  /**
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.
1320
+ * Get top losing stocks for the current trading day
1321
+ *
1322
+ * Provides a list of stocks that have lost the most value during the
1323
+ * current trading session. Essential for identifying underperforming stocks,
1324
+ * tracking market decliners, and discovering potential contrarian opportunities.
1325
+ * Useful for risk management, short selling strategies, and market analysis.
1326
+ *
1327
+ * @returns Promise resolving to array of top losing stocks with price and percentage change data
1328
+ *
1329
+ * @example
1330
+ * ```typescript
1331
+ * // Get top losers for the day
1332
+ * const losers = await fmp.market.getLosers();
1333
+ * console.log(`Top ${losers.data.length} losing stocks today:`);
1334
+ *
1335
+ * losers.data.forEach((stock, index) => {
1336
+ * console.log(`${index + 1}. ${stock.symbol} (${stock.name})`);
1337
+ * console.log(` Price: $${stock.price} | Change: ${stock.change} (${stock.changesPercentage}%)`);
1338
+ * console.log(` Volume: ${stock.volume.toLocaleString()}`);
1339
+ * });
1340
+ *
1341
+ * // Find stocks with >10% losses
1342
+ * const bigLosers = losers.data.filter(stock => stock.changesPercentage < -10);
1343
+ * console.log(`Stocks with >10% losses: ${bigLosers.length}`);
1344
+ *
1345
+ * // Check for potential oversold conditions
1346
+ * const highVolumeLosers = losers.data.filter(stock => stock.volume > 1000000);
1347
+ * console.log(`High volume losers (>1M shares): ${highVolumeLosers.length}`);
1348
+ *
1349
+ * // Look for potential bounce candidates
1350
+ * const oversoldStocks = losers.data.filter(stock =>
1351
+ * stock.changesPercentage < -5 && stock.volume > 500000
1352
+ * );
1353
+ * ```
1354
+ *
1355
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#market-biggest-losers-market-overview|FMP Market Biggest Losers Documentation}
752
1356
  */
753
1357
  async getLosers() {
754
1358
  return this.client.get("/stock_market/losers", "v3");
755
1359
  }
756
1360
  /**
757
- * Get most active stocks
1361
+ * Get most actively traded stocks for the current trading day
1362
+ *
1363
+ * Provides a list of stocks with the highest trading volume during the
1364
+ * current trading session. Essential for identifying stocks with high
1365
+ * liquidity, tracking market interest, and discovering stocks with
1366
+ * significant trading activity. Useful for day trading and liquidity analysis.
1367
+ *
1368
+ * @returns Promise resolving to array of most active stocks with volume and price data
1369
+ *
1370
+ * @example
1371
+ * ```typescript
1372
+ * // Get most active stocks for the day
1373
+ * const mostActive = await fmp.market.getMostActive();
1374
+ * console.log(`Top ${mostActive.data.length} most active stocks today:`);
1375
+ *
1376
+ * mostActive.data.forEach((stock, index) => {
1377
+ * console.log(`${index + 1}. ${stock.symbol} (${stock.name})`);
1378
+ * console.log(` Volume: ${stock.volume.toLocaleString()} shares`);
1379
+ * console.log(` Price: $${stock.price} | Change: ${stock.change} (${stock.changesPercentage}%)`);
1380
+ * console.log(` Avg Volume: ${stock.avgVolume?.toLocaleString() || 'N/A'}`);
1381
+ * });
1382
+ *
1383
+ * // Find stocks with unusual volume (>2x average)
1384
+ * const unusualVolume = mostActive.data.filter(stock =>
1385
+ * stock.avgVolume && stock.volume > stock.avgVolume * 2
1386
+ * );
1387
+ * console.log(`Stocks with unusual volume: ${unusualVolume.length}`);
1388
+ *
1389
+ * // Check for high volume gainers
1390
+ * const highVolumeGainers = mostActive.data.filter(stock =>
1391
+ * stock.changesPercentage > 0 && stock.volume > 1000000
1392
+ * );
1393
+ * console.log(`High volume gainers: ${highVolumeGainers.length}`);
1394
+ *
1395
+ * // Find penny stocks with high volume
1396
+ * const pennyStocks = mostActive.data.filter(stock =>
1397
+ * stock.price < 5 && stock.volume > 500000
1398
+ * );
1399
+ * ```
1400
+ *
1401
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#market-most-actives|FMP Market Most Actives Documentation}
758
1402
  */
759
1403
  async getMostActive() {
760
1404
  return this.client.get("/stock_market/actives", "v3");
761
1405
  }
762
1406
  /**
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.
1407
+ * Get sector performance data for the current trading day
1408
+ *
1409
+ * Provides performance data for all major market sectors including
1410
+ * technology, healthcare, financials, energy, and others. Essential for
1411
+ * sector rotation analysis, identifying leading/lagging sectors, and
1412
+ * understanding market breadth and sector-specific trends.
1413
+ *
1414
+ * @returns Promise resolving to array of sector performance data with percentage changes
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * // Get sector performance for the day
1419
+ * const sectorPerformance = await fmp.market.getSectorPerformance();
1420
+ * console.log(`Sector performance for ${sectorPerformance.data.length} sectors:`);
1421
+ *
1422
+ * sectorPerformance.data.forEach(sector => {
1423
+ * const changeColor = sector.changesPercentage >= 0 ? 'green' : 'red';
1424
+ * console.log(`${sector.sector}: ${sector.changesPercentage}%`);
1425
+ * console.log(` Change: ${sector.changesPercentage >= 0 ? '+' : ''}${sector.changesPercentage}%`);
1426
+ * });
1427
+ *
1428
+ * // Find best performing sectors
1429
+ * const topSectors = sectorPerformance.data
1430
+ * .sort((a, b) => b.changesPercentage - a.changesPercentage)
1431
+ * .slice(0, 3);
1432
+ * console.log('Top 3 performing sectors:');
1433
+ * topSectors.forEach((sector, index) => {
1434
+ * console.log(`${index + 1}. ${sector.sector}: ${sector.changesPercentage}%`);
1435
+ * });
1436
+ *
1437
+ * // Find worst performing sectors
1438
+ * const bottomSectors = sectorPerformance.data
1439
+ * .sort((a, b) => a.changesPercentage - b.changesPercentage)
1440
+ * .slice(0, 3);
1441
+ * console.log('Bottom 3 performing sectors:');
1442
+ * bottomSectors.forEach((sector, index) => {
1443
+ * console.log(`${index + 1}. ${sector.sector}: ${sector.changesPercentage}%`);
1444
+ * });
1445
+ *
1446
+ * // Check for sector rotation
1447
+ * const gainingSectors = sectorPerformance.data.filter(sector => sector.changesPercentage > 0);
1448
+ * const losingSectors = sectorPerformance.data.filter(sector => sector.changesPercentage < 0);
1449
+ * console.log(`Sectors gaining: ${gainingSectors.length}, Sectors losing: ${losingSectors.length}`);
1450
+ * ```
1451
+ *
1452
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#sector-performance-market-overview|FMP Sector Performance Documentation}
766
1453
  */
767
1454
  async getSectorPerformance() {
768
1455
  return this.client.get("/sector-performance", "v3");
769
1456
  }
770
1457
  /**
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.
1458
+ * Get real-time data for major market indices
1459
+ *
1460
+ * Provides real-time quote data for all major stock market indices including
1461
+ * S&P 500, Dow Jones Industrial Average, NASDAQ Composite, and other global
1462
+ * indices. Essential for tracking overall market performance, understanding
1463
+ * market sentiment, and identifying broad market trends.
1464
+ *
1465
+ * @returns Promise resolving to array of market index data with real-time quotes
1466
+ *
1467
+ * @example
1468
+ * ```typescript
1469
+ * // Get real-time market indices
1470
+ * const marketIndices = await fmp.market.getMarketIndex();
1471
+ * console.log(`Real-time data for ${marketIndices.data.length} major indices:`);
1472
+ *
1473
+ * marketIndices.data.forEach(index => {
1474
+ * console.log(`${index.symbol} (${index.name}):`);
1475
+ * console.log(` Price: $${index.price}`);
1476
+ * console.log(` Change: ${index.change} (${index.changesPercentage}%)`);
1477
+ * console.log(` Day Range: $${index.dayLow} - $${index.dayHigh}`);
1478
+ * console.log(` Volume: ${index.volume?.toLocaleString() || 'N/A'}`);
1479
+ * });
1480
+ *
1481
+ * // Find specific major indices
1482
+ * const sp500 = marketIndices.data.find(index => index.symbol === '^GSPC');
1483
+ * const nasdaq = marketIndices.data.find(index => index.symbol === '^IXIC');
1484
+ * const dowJones = marketIndices.data.find(index => index.symbol === '^DJI');
1485
+ *
1486
+ * console.log(`S&P 500: ${sp500?.price} (${sp500?.changesPercentage}%)`);
1487
+ * console.log(`NASDAQ: ${nasdaq?.price} (${nasdaq?.changesPercentage}%)`);
1488
+ * console.log(`Dow Jones: ${dowJones?.price} (${dowJones?.changesPercentage}%)`);
1489
+ *
1490
+ * // Check market breadth
1491
+ * const gainingIndices = marketIndices.data.filter(index => index.changesPercentage > 0);
1492
+ * const losingIndices = marketIndices.data.filter(index => index.changesPercentage < 0);
1493
+ * console.log(`Indices gaining: ${gainingIndices.length}, Indices losing: ${losingIndices.length}`);
1494
+ *
1495
+ * // Find international indices
1496
+ * const internationalIndices = marketIndices.data.filter(index =>
1497
+ * !index.symbol.startsWith('^') ||
1498
+ * index.name.toLowerCase().includes('europe') ||
1499
+ * index.name.toLowerCase().includes('asia')
1500
+ * );
1501
+ * ```
1502
+ *
1503
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#market-index-market-overview|FMP Market Index Documentation}
774
1504
  */
775
1505
  async getMarketIndex() {
776
1506
  return this.client.get("/quotes/index", "v3");
@@ -783,41 +1513,182 @@ var ListEndpoints = class {
783
1513
  this.client = client;
784
1514
  }
785
1515
  /**
786
- * Get stock list
787
- * https://site.financialmodelingprep.com/developer/docs#symbol-list-stock-list
788
- * @returns The stock list
1516
+ * Get comprehensive list of all available stocks
1517
+ *
1518
+ * Provides a complete list of all stocks available on major exchanges including
1519
+ * NYSE, NASDAQ, and other global markets. Essential for discovering available
1520
+ * symbols, building watchlists, or creating stock screening applications.
1521
+ *
1522
+ * @returns Promise resolving to array of stock data with symbol, name, exchange, and price information
1523
+ *
1524
+ * @example
1525
+ * ```typescript
1526
+ * // Get all available stocks
1527
+ * const stocks = await fmp.list.getStockList();
1528
+ * console.log(`Total stocks available: ${stocks.data.length}`);
1529
+ *
1530
+ * // Find specific stocks
1531
+ * const appleStock = stocks.data.find(stock => stock.symbol === 'AAPL');
1532
+ * console.log(`Apple: ${appleStock?.name} (${appleStock?.exchange})`);
1533
+ *
1534
+ * // Filter by exchange
1535
+ * const nasdaqStocks = stocks.data.filter(stock => stock.exchange === 'NASDAQ');
1536
+ * console.log(`NASDAQ stocks: ${nasdaqStocks.length}`);
1537
+ * ```
1538
+ *
1539
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#symbol-list-stock-list|FMP Stock List Documentation}
789
1540
  */
790
1541
  async getStockList() {
791
1542
  return this.client.get("/stock/list");
792
1543
  }
793
1544
  /**
794
- * Get ETF list
795
- * https://site.financialmodelingprep.com/developer/docs#exchange-traded-fund-search-stock-list
796
- * @returns The ETF list
1545
+ * Get comprehensive list of all available ETFs
1546
+ *
1547
+ * Provides a complete list of all Exchange-Traded Funds (ETFs) available for trading.
1548
+ * Includes ETFs from various asset classes including equity, bond, commodity, and
1549
+ * sector-specific funds. Essential for ETF research and portfolio construction.
1550
+ *
1551
+ * @returns Promise resolving to array of ETF data with symbol, name, exchange, and asset class information
1552
+ *
1553
+ * @example
1554
+ * ```typescript
1555
+ * // Get all available ETFs
1556
+ * const etfs = await fmp.list.getETFList();
1557
+ * console.log(`Total ETFs available: ${etfs.data.length}`);
1558
+ *
1559
+ * // Find specific ETFs
1560
+ * const spyETF = etfs.data.find(etf => etf.symbol === 'SPY');
1561
+ * console.log(`SPY: ${spyETF?.name} (${spyETF?.assetClass})`);
1562
+ *
1563
+ * // Filter by asset class
1564
+ * const equityETFs = etfs.data.filter(etf => etf.assetClass === 'Equity');
1565
+ * console.log(`Equity ETFs: ${equityETFs.length}`);
1566
+ *
1567
+ * // Find sector ETFs
1568
+ * const techETFs = etfs.data.filter(etf =>
1569
+ * etf.name.toLowerCase().includes('technology') ||
1570
+ * etf.name.toLowerCase().includes('tech')
1571
+ * );
1572
+ * ```
1573
+ *
1574
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#exchange-traded-fund-search-stock-list|FMP ETF List Documentation}
797
1575
  */
798
1576
  async getETFList() {
799
1577
  return this.client.get("/etf/list");
800
1578
  }
801
1579
  /**
802
- * Get crypto list
803
- * https://site.financialmodelingprep.com/developer/docs#cryptocurrencies-list-crypto
804
- * @returns The crypto list
1580
+ * Get comprehensive list of all available cryptocurrencies
1581
+ *
1582
+ * Provides a complete list of all cryptocurrencies available for trading.
1583
+ * Includes major cryptocurrencies like Bitcoin, Ethereum, and thousands of altcoins
1584
+ * with their trading pairs against USD and other major currencies.
1585
+ *
1586
+ * @returns Promise resolving to array of cryptocurrency data with symbol, name, and exchange information
1587
+ *
1588
+ * @example
1589
+ * ```typescript
1590
+ * // Get all available cryptocurrencies
1591
+ * const cryptos = await fmp.list.getCryptoList();
1592
+ * console.log(`Total cryptocurrencies available: ${cryptos.data.length}`);
1593
+ *
1594
+ * // Find major cryptocurrencies
1595
+ * const bitcoin = cryptos.data.find(crypto => crypto.symbol === 'BTCUSD');
1596
+ * console.log(`Bitcoin: ${bitcoin?.name} (${bitcoin?.exchange})`);
1597
+ *
1598
+ * const ethereum = cryptos.data.find(crypto => crypto.symbol === 'ETHUSD');
1599
+ * console.log(`Ethereum: ${ethereum?.name} (${ethereum?.exchange})`);
1600
+ *
1601
+ * // Filter by exchange
1602
+ * const binanceCryptos = cryptos.data.filter(crypto => crypto.exchange === 'Binance');
1603
+ * console.log(`Binance cryptocurrencies: ${binanceCryptos.length}`);
1604
+ *
1605
+ * // Find altcoins
1606
+ * const altcoins = cryptos.data.filter(crypto =>
1607
+ * !['BTCUSD', 'ETHUSD', 'USDTUSD', 'USDCUSD'].includes(crypto.symbol)
1608
+ * );
1609
+ * ```
1610
+ *
1611
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#cryptocurrencies-list-crypto|FMP Cryptocurrency List Documentation}
805
1612
  */
806
1613
  async getCryptoList() {
807
1614
  return this.client.get("/symbol/available-cryptocurrencies");
808
1615
  }
809
1616
  /**
810
- * Get forex list
811
- * https://site.financialmodelingprep.com/developer/docs#forex-list-forex
812
- * @returns The forex list
1617
+ * Get comprehensive list of all available forex currency pairs
1618
+ *
1619
+ * Provides a complete list of all foreign exchange currency pairs available for trading.
1620
+ * Includes major, minor, and exotic currency pairs with their base and quote currencies.
1621
+ * Essential for forex trading, currency analysis, and international market research.
1622
+ *
1623
+ * @returns Promise resolving to array of forex data with currency pair symbols and exchange information
1624
+ *
1625
+ * @example
1626
+ * ```typescript
1627
+ * // Get all available forex pairs
1628
+ * const forexPairs = await fmp.list.getForexList();
1629
+ * console.log(`Total forex pairs available: ${forexPairs.data.length}`);
1630
+ *
1631
+ * // Find major currency pairs
1632
+ * const eurUsd = forexPairs.data.find(pair => pair.symbol === 'EURUSD');
1633
+ * console.log(`EUR/USD: ${eurUsd?.name} (${eurUsd?.exchange})`);
1634
+ *
1635
+ * const gbpUsd = forexPairs.data.find(pair => pair.symbol === 'GBPUSD');
1636
+ * console.log(`GBP/USD: ${gbpUsd?.name} (${gbpUsd?.exchange})`);
1637
+ *
1638
+ * // Filter major pairs (USD as quote currency)
1639
+ * const majorPairs = forexPairs.data.filter(pair =>
1640
+ * pair.symbol.endsWith('USD') && pair.symbol.length === 6
1641
+ * );
1642
+ * console.log(`Major pairs: ${majorPairs.length}`);
1643
+ *
1644
+ * // Find exotic pairs
1645
+ * const exoticPairs = forexPairs.data.filter(pair =>
1646
+ * pair.symbol.includes('ZAR') || pair.symbol.includes('TRY') || pair.symbol.includes('BRL')
1647
+ * );
1648
+ * ```
1649
+ *
1650
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#forex-list-forex|FMP Forex List Documentation}
813
1651
  */
814
1652
  async getForexList() {
815
1653
  return this.client.get("/symbol/available-forex-currency-pairs");
816
1654
  }
817
1655
  /**
818
- * Get available indexes list
819
- * https://site.financialmodelingprep.com/developer/docs#available-indexes
820
- * @returns The available indexes list
1656
+ * Get comprehensive list of all available market indexes
1657
+ *
1658
+ * Provides a complete list of all market indexes available for tracking and analysis.
1659
+ * Includes major global indexes like S&P 500, NASDAQ, Dow Jones, as well as
1660
+ * international indexes, sector indexes, and specialized market benchmarks.
1661
+ *
1662
+ * @returns Promise resolving to array of index data with symbol, name, and exchange information
1663
+ *
1664
+ * @example
1665
+ * ```typescript
1666
+ * // Get all available indexes
1667
+ * const indexes = await fmp.list.getAvailableIndexes();
1668
+ * console.log(`Total indexes available: ${indexes.data.length}`);
1669
+ *
1670
+ * // Find major US indexes
1671
+ * const sp500 = indexes.data.find(index => index.symbol === '^GSPC');
1672
+ * console.log(`S&P 500: ${sp500?.name} (${sp500?.exchange})`);
1673
+ *
1674
+ * const nasdaq = indexes.data.find(index => index.symbol === '^IXIC');
1675
+ * console.log(`NASDAQ: ${nasdaq?.name} (${nasdaq?.exchange})`);
1676
+ *
1677
+ * const dowJones = indexes.data.find(index => index.symbol === '^DJI');
1678
+ * console.log(`Dow Jones: ${dowJones?.name} (${dowJones?.exchange})`);
1679
+ *
1680
+ * // Filter by exchange
1681
+ * const nyseIndexes = indexes.data.filter(index => index.exchange === 'NYSE');
1682
+ * console.log(`NYSE indexes: ${nyseIndexes.length}`);
1683
+ *
1684
+ * // Find sector indexes
1685
+ * const techIndexes = indexes.data.filter(index =>
1686
+ * index.name.toLowerCase().includes('technology') ||
1687
+ * index.name.toLowerCase().includes('tech')
1688
+ * );
1689
+ * ```
1690
+ *
1691
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#available-indexes|FMP Available Indexes Documentation}
821
1692
  */
822
1693
  async getAvailableIndexes() {
823
1694
  return this.client.get("/symbol/available-indexes");
@@ -830,82 +1701,244 @@ var CalendarEndpoints = class {
830
1701
  this.client = client;
831
1702
  }
832
1703
  /**
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
1704
+ * Get earnings calendar data
1705
+ *
1706
+ * Provides upcoming earnings announcements for all publicly traded companies
1707
+ * within a specified date range. Essential for tracking earnings season,
1708
+ * market events, and investment timing decisions.
1709
+ *
1710
+ * @param params - Earnings calendar request parameters
1711
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to today)
1712
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to 30 days from today)
1713
+ *
1714
+ * @returns Promise resolving to array of earnings calendar data with announcement details
1715
+ *
1716
+ * @example
1717
+ * ```typescript
1718
+ * // Get earnings calendar for next week
1719
+ * const earningsCalendar = await fmp.calendar.getEarningsCalendar({
1720
+ * from: '2024-01-15',
1721
+ * to: '2024-01-22'
1722
+ * });
1723
+ * earningsCalendar.data.forEach(earning => {
1724
+ * console.log(`${earning.date}: ${earning.symbol} - Est. EPS: ${earning.estimatedEps}`);
1725
+ * });
1726
+ *
1727
+ * // Get earnings calendar for current month
1728
+ * const monthlyEarnings = await fmp.calendar.getEarningsCalendar({
1729
+ * from: '2024-01-01',
1730
+ * to: '2024-01-31'
1731
+ * });
1732
+ * ```
1733
+ *
1734
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#earnings-calendar-earnings|FMP Earnings Calendar Documentation}
838
1735
  */
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);
1736
+ async getEarningsCalendar(params = {}) {
1737
+ const { from, to } = params;
1738
+ const queryParams = {};
1739
+ if (from) queryParams.from = from;
1740
+ if (to) queryParams.to = to;
1741
+ return this.client.get("/earning_calendar", "v3", queryParams);
844
1742
  }
845
1743
  /**
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
1744
+ * Get confirmed earnings calendar data
1745
+ *
1746
+ * Provides confirmed earnings announcements with verified dates and times.
1747
+ * These are earnings announcements that have been officially confirmed
1748
+ * by companies, providing more reliable scheduling information.
1749
+ *
1750
+ * @param params - Confirmed earnings calendar request parameters
1751
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to today)
1752
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to 30 days from today)
1753
+ *
1754
+ * @returns Promise resolving to array of confirmed earnings calendar data
1755
+ *
1756
+ * @example
1757
+ * ```typescript
1758
+ * // Get confirmed earnings for next week
1759
+ * const confirmedEarnings = await fmp.calendar.getEarningsConfirmed({
1760
+ * from: '2024-01-15',
1761
+ * to: '2024-01-22'
1762
+ * });
1763
+ * confirmedEarnings.data.forEach(earning => {
1764
+ * console.log(`${earning.date}: ${earning.symbol} - Confirmed: ${earning.time}`);
1765
+ * });
1766
+ *
1767
+ * // Get confirmed earnings for current month
1768
+ * const monthlyConfirmed = await fmp.calendar.getEarningsConfirmed({
1769
+ * from: '2024-01-01',
1770
+ * to: '2024-01-31'
1771
+ * });
1772
+ * ```
1773
+ *
1774
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#earnings-confirmed-earnings|FMP Earnings Confirmed Documentation}
851
1775
  */
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);
1776
+ async getEarningsConfirmed(params = {}) {
1777
+ const { from, to } = params;
1778
+ const queryParams = {};
1779
+ if (from) queryParams.from = from;
1780
+ if (to) queryParams.to = to;
1781
+ return this.client.get("/earning-calendar-confirmed", "v4", queryParams);
857
1782
  }
858
1783
  /**
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
1784
+ * Get dividends calendar data
1785
+ *
1786
+ * Provides upcoming dividend payments and ex-dividend dates for all
1787
+ * publicly traded companies within a specified date range. Essential
1788
+ * for dividend investors and income-focused strategies.
1789
+ *
1790
+ * @param params - Dividends calendar request parameters
1791
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to today)
1792
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to 30 days from today)
1793
+ *
1794
+ * @returns Promise resolving to array of dividends calendar data with payment details
1795
+ *
1796
+ * @example
1797
+ * ```typescript
1798
+ * // Get dividends calendar for next week
1799
+ * const dividendsCalendar = await fmp.calendar.getDividendsCalendar({
1800
+ * from: '2024-01-15',
1801
+ * to: '2024-01-22'
1802
+ * });
1803
+ * dividendsCalendar.data.forEach(dividend => {
1804
+ * console.log(`${dividend.date}: ${dividend.symbol} - Amount: $${dividend.amount}`);
1805
+ * });
1806
+ *
1807
+ * // Get dividends calendar for current month
1808
+ * const monthlyDividends = await fmp.calendar.getDividendsCalendar({
1809
+ * from: '2024-01-01',
1810
+ * to: '2024-01-31'
1811
+ * });
1812
+ * ```
1813
+ *
1814
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#dividends-calendar-dividends|FMP Dividends Calendar Documentation}
864
1815
  */
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);
1816
+ async getDividendsCalendar(params = {}) {
1817
+ const { from, to } = params;
1818
+ const queryParams = {};
1819
+ if (from) queryParams.from = from;
1820
+ if (to) queryParams.to = to;
1821
+ return this.client.get("/stock_dividend_calendar", "v3", queryParams);
870
1822
  }
871
1823
  /**
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
1824
+ * Get economic calendar data
1825
+ *
1826
+ * Provides upcoming economic events, indicators, and data releases
1827
+ * that can impact financial markets. Essential for understanding
1828
+ * market-moving events and economic trends.
1829
+ *
1830
+ * @param params - Economic calendar request parameters
1831
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to today)
1832
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to 30 days from today)
1833
+ *
1834
+ * @returns Promise resolving to array of economic calendar data with event details
1835
+ *
1836
+ * @example
1837
+ * ```typescript
1838
+ * // Get economic calendar for next week
1839
+ * const economicCalendar = await fmp.calendar.getEconomicsCalendar({
1840
+ * from: '2024-01-15',
1841
+ * to: '2024-01-22'
1842
+ * });
1843
+ * economicCalendar.data.forEach(event => {
1844
+ * console.log(`${event.date}: ${event.event} - Country: ${event.country}`);
1845
+ * });
1846
+ *
1847
+ * // Get economic calendar for current month
1848
+ * const monthlyEconomic = await fmp.calendar.getEconomicsCalendar({
1849
+ * from: '2024-01-01',
1850
+ * to: '2024-01-31'
1851
+ * });
1852
+ * ```
1853
+ *
1854
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#economics-calendar-economics-data|FMP Economic Calendar Documentation}
877
1855
  */
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);
1856
+ async getEconomicsCalendar(params = {}) {
1857
+ const { from, to } = params;
1858
+ const queryParams = {};
1859
+ if (from) queryParams.from = from;
1860
+ if (to) queryParams.to = to;
1861
+ return this.client.get("/economic_calendar", "v3", queryParams);
883
1862
  }
884
1863
  /**
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
1864
+ * Get IPO calendar data
1865
+ *
1866
+ * Provides upcoming initial public offerings (IPOs) and their details
1867
+ * within a specified date range. Essential for tracking new market
1868
+ * entrants and investment opportunities in newly public companies.
1869
+ *
1870
+ * @param params - IPO calendar request parameters
1871
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to today)
1872
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to 30 days from today)
1873
+ *
1874
+ * @returns Promise resolving to array of IPO calendar data with offering details
1875
+ *
1876
+ * @example
1877
+ * ```typescript
1878
+ * // Get IPO calendar for next week
1879
+ * const ipoCalendar = await fmp.calendar.getIPOCalendar({
1880
+ * from: '2024-01-15',
1881
+ * to: '2024-01-22'
1882
+ * });
1883
+ * ipoCalendar.data.forEach(ipo => {
1884
+ * console.log(`${ipo.date}: ${ipo.symbol} - Price: $${ipo.price}, Shares: ${ipo.shares.toLocaleString()}`);
1885
+ * });
1886
+ *
1887
+ * // Get IPO calendar for current month
1888
+ * const monthlyIPOs = await fmp.calendar.getIPOCalendar({
1889
+ * from: '2024-01-01',
1890
+ * to: '2024-01-31'
1891
+ * });
1892
+ * ```
1893
+ *
1894
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#ipo-calender-by-ipo-calendar|FMP IPO Calendar Documentation}
890
1895
  */
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);
1896
+ async getIPOCalendar(params = {}) {
1897
+ const { from, to } = params;
1898
+ const queryParams = {};
1899
+ if (from) queryParams.from = from;
1900
+ if (to) queryParams.to = to;
1901
+ return this.client.get("/ipo_calendar", "v3", queryParams);
896
1902
  }
897
1903
  /**
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
1904
+ * Get stock splits calendar data
1905
+ *
1906
+ * Provides upcoming stock splits for publicly traded companies within
1907
+ * a specified date range. Essential for understanding corporate actions
1908
+ * that affect share prices and trading dynamics.
1909
+ *
1910
+ * @param params - Stock splits calendar request parameters
1911
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to today)
1912
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to 30 days from today)
1913
+ *
1914
+ * @returns Promise resolving to array of stock splits calendar data with split details
1915
+ *
1916
+ * @example
1917
+ * ```typescript
1918
+ * // Get stock splits calendar for next week
1919
+ * const splitsCalendar = await fmp.calendar.getSplitsCalendar({
1920
+ * from: '2024-01-15',
1921
+ * to: '2024-01-22'
1922
+ * });
1923
+ * splitsCalendar.data.forEach(split => {
1924
+ * console.log(`${split.date}: ${split.symbol} - Ratio: ${split.numerator}:${split.denominator}`);
1925
+ * });
1926
+ *
1927
+ * // Get stock splits calendar for current month
1928
+ * const monthlySplits = await fmp.calendar.getSplitsCalendar({
1929
+ * from: '2024-01-01',
1930
+ * to: '2024-01-31'
1931
+ * });
1932
+ * ```
1933
+ *
1934
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#splits-calendar-splits|FMP Stock Splits Calendar Documentation}
903
1935
  */
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);
1936
+ async getSplitsCalendar(params = {}) {
1937
+ const { from, to } = params;
1938
+ const queryParams = {};
1939
+ if (from) queryParams.from = from;
1940
+ if (to) queryParams.to = to;
1941
+ return this.client.get("/stock_split_calendar", "v3", queryParams);
909
1942
  }
910
1943
  };
911
1944
 
@@ -915,97 +1948,243 @@ var CompanyEndpoints = class {
915
1948
  this.client = client;
916
1949
  }
917
1950
  /**
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.
1951
+ * Get comprehensive company profile and information
1952
+ *
1953
+ * Provides detailed company information including financial metrics, business description,
1954
+ * headquarters location, and key performance indicators. Essential for fundamental analysis
1955
+ * and understanding a company's business model and market position.
1956
+ *
1957
+ * @param symbol - The stock symbol to get the profile for (e.g., 'AAPL', 'MSFT', 'GOOGL')
1958
+ *
1959
+ * @returns Promise resolving to comprehensive company profile with financial and business information
1960
+ *
1961
+ * @example
1962
+ * ```typescript
1963
+ * // Get Apple's company profile
1964
+ * const profile = await fmp.company.getCompanyProfile('AAPL');
1965
+ * console.log(`Company: ${profile.data.companyName}`);
1966
+ * console.log(`Industry: ${profile.data.industry}`);
1967
+ * console.log(`Market Cap: $${profile.data.mktCap.toLocaleString()}`);
1968
+ * console.log(`Description: ${profile.data.description.substring(0, 100)}...`);
1969
+ *
1970
+ * // Get Microsoft's profile
1971
+ * const msftProfile = await fmp.company.getCompanyProfile('MSFT');
1972
+ * ```
1973
+ *
1974
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#company-profile-company-information|FMP Company Profile Documentation}
922
1975
  */
923
- async getCompanyProfile({ symbol }) {
1976
+ async getCompanyProfile(symbol) {
924
1977
  return this.client.getSingle(`/profile/${symbol}`, "v3");
925
1978
  }
926
1979
  /**
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.
1980
+ * Get executive compensation and governance information
1981
+ *
1982
+ * Provides detailed compensation data for company executives including salary, bonuses,
1983
+ * stock options, and other benefits. Essential for governance analysis and understanding
1984
+ * executive pay structures and alignment with shareholder interests.
1985
+ *
1986
+ * @param symbol - The stock symbol to get executive compensation for (e.g., 'AAPL', 'MSFT', 'TSLA')
1987
+ *
1988
+ * @returns Promise resolving to array of executive compensation data with detailed pay information
1989
+ *
1990
+ * @example
1991
+ * ```typescript
1992
+ * // Get Apple's executive compensation
1993
+ * const compensation = await fmp.company.getExecutiveCompensation('AAPL');
1994
+ * compensation.data.forEach(exec => {
1995
+ * console.log(`${exec.name} (${exec.title}):`);
1996
+ * console.log(` Salary: $${exec.salary.toLocaleString()}`);
1997
+ * console.log(` Bonus: $${exec.bonus.toLocaleString()}`);
1998
+ * console.log(` Stock Options: $${exec.stockAwards.toLocaleString()}`);
1999
+ * });
2000
+ *
2001
+ * // Get Tesla's executive compensation
2002
+ * const teslaComp = await fmp.company.getExecutiveCompensation('TSLA');
2003
+ * ```
2004
+ *
2005
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#executive-compensation-company-information|FMP Executive Compensation Documentation}
931
2006
  */
932
- async getExecutiveCompensation({
933
- symbol
934
- }) {
935
- const params = { symbol };
936
- return this.client.get(`/governance/executive_compensation`, "v4", params);
2007
+ async getExecutiveCompensation(symbol) {
2008
+ return this.client.get(`/governance/executive_compensation`, "v4", { symbol });
937
2009
  }
938
2010
  /**
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.
2011
+ * Get company notes and financial disclosures
2012
+ *
2013
+ * Provides important notes and disclosures from company financial statements.
2014
+ * These notes contain critical information about accounting policies, risks,
2015
+ * contingencies, and other material information that affects financial analysis.
2016
+ *
2017
+ * @param symbol - The stock symbol to get notes for (e.g., 'AAPL', 'MSFT', 'JPM')
2018
+ *
2019
+ * @returns Promise resolving to array of company notes with detailed disclosure information
2020
+ *
2021
+ * @example
2022
+ * ```typescript
2023
+ * // Get Apple's company notes
2024
+ * const notes = await fmp.company.getCompanyNotes('AAPL');
2025
+ * notes.data.forEach(note => {
2026
+ * console.log(`Note ${note.noteNumber}: ${note.noteTitle}`);
2027
+ * console.log(` Content: ${note.noteContent.substring(0, 100)}...`);
2028
+ * });
2029
+ *
2030
+ * // Get JPMorgan's notes
2031
+ * const jpmNotes = await fmp.company.getCompanyNotes('JPM');
2032
+ * ```
2033
+ *
2034
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#company-notes-company-information|FMP Company Notes Documentation}
943
2035
  */
944
- async getCompanyNotes({ symbol }) {
945
- const params = { symbol };
946
- return this.client.get(`/company-notes`, "v4", params);
2036
+ async getCompanyNotes(symbol) {
2037
+ return this.client.get(`/company-notes`, "v4", { symbol });
947
2038
  }
948
2039
  /**
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.
2040
+ * Get historical employee count data
2041
+ *
2042
+ * Provides historical data on company employee counts over time.
2043
+ * Useful for analyzing company growth, operational efficiency, and workforce trends.
2044
+ * Employee count is often a key indicator of company expansion or contraction.
2045
+ *
2046
+ * @param symbol - The stock symbol to get historical employee count for (e.g., 'AAPL', 'MSFT', 'AMZN')
2047
+ *
2048
+ * @returns Promise resolving to array of historical employee count data with year-by-year information
2049
+ *
2050
+ * @example
2051
+ * ```typescript
2052
+ * // Get Apple's employee count history
2053
+ * const employees = await fmp.company.getHistoricalEmployeeCount('AAPL');
2054
+ * employees.data.forEach(year => {
2055
+ * console.log(`${year.year}: ${year.employeeCount.toLocaleString()} employees`);
2056
+ * });
2057
+ *
2058
+ * // Get Amazon's employee growth
2059
+ * const amazonEmployees = await fmp.company.getHistoricalEmployeeCount('AMZN');
2060
+ * ```
2061
+ *
2062
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#historical-employee-company-information|FMP Historical Employee Count Documentation}
953
2063
  */
954
- async getHistoricalEmployeeCount({
955
- symbol
956
- }) {
957
- const params = { symbol };
958
- return this.client.get(`/historical/employee_count`, "v4", params);
2064
+ async getHistoricalEmployeeCount(symbol) {
2065
+ return this.client.get(`/historical/employee_count`, "v4", { symbol });
959
2066
  }
960
2067
  /**
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.
2068
+ * Get current shares float information
2069
+ *
2070
+ * Provides the total number of shares that are publicly traded (float) for a company.
2071
+ * The float is calculated by subtracting restricted shares from total outstanding shares.
2072
+ * Important for understanding liquidity, volatility, and trading dynamics.
2073
+ *
2074
+ * @param symbol - The stock symbol to get shares float for (e.g., 'AAPL', 'TSLA', 'NVDA')
2075
+ *
2076
+ * @returns Promise resolving to shares float data with current float information
2077
+ *
2078
+ * @example
2079
+ * ```typescript
2080
+ * // Get Apple's shares float
2081
+ * const float = await fmp.company.getSharesFloat('AAPL');
2082
+ * console.log(`Float: ${float.data.sharesFloat.toLocaleString()} shares`);
2083
+ * console.log(`Outstanding: ${float.data.sharesOutstanding.toLocaleString()} shares`);
2084
+ * console.log(`Restricted: ${float.data.restrictedShares.toLocaleString()} shares`);
2085
+ *
2086
+ * // Get Tesla's float
2087
+ * const teslaFloat = await fmp.company.getSharesFloat('TSLA');
2088
+ * ```
2089
+ *
2090
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#company-share-float-share-float|FMP Shares Float Documentation}
965
2091
  */
966
- async getSharesFloat({ symbol }) {
967
- const params = { symbol };
968
- return this.client.getSingle(`/shares_float`, "v4", params);
2092
+ async getSharesFloat(symbol) {
2093
+ return this.client.getSingle(`/shares_float`, "v4", { symbol });
969
2094
  }
970
2095
  /**
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.
2096
+ * Get historical shares float data
2097
+ *
2098
+ * Provides historical data on company shares float over time.
2099
+ * Useful for analyzing changes in liquidity, share issuance, and corporate actions
2100
+ * that affect the number of publicly traded shares.
2101
+ *
2102
+ * @param symbol - The stock symbol to get historical shares float for (e.g., 'AAPL', 'TSLA', 'NVDA')
2103
+ *
2104
+ * @returns Promise resolving to array of historical shares float data with date-by-date information
2105
+ *
2106
+ * @example
2107
+ * ```typescript
2108
+ * // Get Apple's historical float
2109
+ * const historicalFloat = await fmp.company.getHistoricalSharesFloat('AAPL');
2110
+ * historicalFloat.data.forEach(entry => {
2111
+ * console.log(`${entry.date}: ${entry.sharesFloat.toLocaleString()} shares`);
2112
+ * });
2113
+ *
2114
+ * // Get Tesla's float history
2115
+ * const teslaHistory = await fmp.company.getHistoricalSharesFloat('TSLA');
2116
+ * ```
2117
+ *
2118
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#company-historical-share-float|FMP Historical Shares Float Documentation}
975
2119
  */
976
- async getHistoricalSharesFloat({
977
- symbol
978
- }) {
979
- const params = { symbol };
980
- return this.client.get(`/historical/shares_float`, "v4", params);
2120
+ async getHistoricalSharesFloat(symbol) {
2121
+ return this.client.get(`/historical/shares_float`, "v4", { symbol });
981
2122
  }
982
2123
  /**
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
- }
2124
+ * Get earnings call transcript for specific quarter
2125
+ *
2126
+ * Provides the full transcript of a company's earnings conference call.
2127
+ * Contains detailed Q&A sessions, management commentary, and insights into
2128
+ * company performance, strategy, and future outlook.
2129
+ *
2130
+ * @param params - Earnings call transcript request parameters
2131
+ * @param params.symbol - The stock symbol to get transcript for (e.g., 'AAPL', 'MSFT', 'TSLA')
2132
+ * @param params.year - The year of the earnings call (e.g., 2024)
2133
+ * @param params.quarter - The quarter of the earnings call (1, 2, 3, or 4)
2134
+ *
2135
+ * @returns Promise resolving to earnings call transcript with full text content
2136
+ *
2137
+ * @example
2138
+ * ```typescript
2139
+ * // Get Apple's Q1 2024 earnings call
2140
+ * const transcript = await fmp.company.getEarningsCallTranscript({
2141
+ * symbol: 'AAPL',
2142
+ * year: 2024,
2143
+ * quarter: 1
2144
+ * });
2145
+ * console.log(`Transcript: ${transcript.data[0].content.substring(0, 200)}...`);
2146
+ *
2147
+ * // Get Tesla's Q4 2023 earnings call
2148
+ * const teslaTranscript = await fmp.company.getEarningsCallTranscript({
2149
+ * symbol: 'TSLA',
2150
+ * year: 2023,
2151
+ * quarter: 4
2152
+ * });
2153
+ * ```
2154
+ *
2155
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#earnings-transcript-earnings-transcripts|FMP Earnings Call Transcript Documentation}
2156
+ */
2157
+ async getEarningsCallTranscript(params) {
2158
+ const { symbol, year, quarter } = params;
2159
+ return this.client.getSingle(`/earning_call_transcript/${symbol}`, "v3", { year, quarter });
2160
+ }
998
2161
  /**
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.
2162
+ * Get available earnings call transcript dates
2163
+ *
2164
+ * Provides a list of all available earnings call transcript dates for a company.
2165
+ * Useful for discovering which quarters have transcripts available before
2166
+ * requesting the full transcript content.
2167
+ *
2168
+ * @param symbol - The stock symbol to get transcript dates for (e.g., 'AAPL', 'MSFT', 'TSLA')
2169
+ *
2170
+ * @returns Promise resolving to array of available transcript dates with quarter information
2171
+ *
2172
+ * @example
2173
+ * ```typescript
2174
+ * // Get Apple's available transcript dates
2175
+ * const transcriptDates = await fmp.company.getCompanyTranscriptData('AAPL');
2176
+ * transcriptDates.data.forEach(date => {
2177
+ * console.log(`Q${date.quarter} ${date.year}: ${date.date}`);
2178
+ * });
2179
+ *
2180
+ * // Get Microsoft's transcript availability
2181
+ * const msftDates = await fmp.company.getCompanyTranscriptData('MSFT');
2182
+ * ```
2183
+ *
2184
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#transcript-dates-earnings-transcripts|FMP Company Transcript Data Documentation}
1003
2185
  */
1004
- async getCompanyTranscriptData({
1005
- symbol
1006
- }) {
1007
- const params = { symbol };
1008
- return this.client.getSingle(`/earning_call_transcript`, "v4", params);
2186
+ async getCompanyTranscriptData(symbol) {
2187
+ return this.client.getSingle(`/earning_call_transcript`, "v4", { symbol });
1009
2188
  }
1010
2189
  };
1011
2190
 
@@ -1015,18 +2194,58 @@ var QuoteEndpoints = class {
1015
2194
  this.client = client;
1016
2195
  }
1017
2196
  /**
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
2197
+ * Get real-time quote data for any asset type (stocks, crypto, forex, commodities, ETFs)
2198
+ *
2199
+ * This endpoint provides current market data including price, volume, market cap, and key metrics.
2200
+ * Works with any valid symbol across all supported asset classes.
2201
+ *
2202
+ * @param symbol - The trading symbol (e.g., 'AAPL', 'BTCUSD', 'EURUSD', 'GCUSD', 'SPY')
2203
+ *
2204
+ * @returns Promise resolving to quote data with current price, volume, market cap, and performance metrics
2205
+ *
2206
+ * @example
2207
+ * ```typescript
2208
+ * // Get stock quote
2209
+ * const aaplQuote = await fmp.quote.getQuote('AAPL');
2210
+ *
2211
+ * // Get crypto quote
2212
+ * const btcQuote = await fmp.quote.getQuote('BTCUSD');
2213
+ *
2214
+ * // Get forex quote
2215
+ * const eurQuote = await fmp.quote.getQuote('EURUSD');
2216
+ * ```
1021
2217
  */
1022
- async getQuote(params) {
1023
- const { symbol } = params;
2218
+ async getQuote(symbol) {
1024
2219
  return this.client.getSingle(`/quote/${symbol}`, "v3");
1025
2220
  }
1026
2221
  /**
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
2222
+ * Get historical price data for any asset type with customizable date range
2223
+ *
2224
+ * Retrieves daily OHLCV (Open, High, Low, Close, Volume) data for the specified symbol.
2225
+ * Data includes adjusted close prices, volume, and percentage changes.
2226
+ *
2227
+ * @param params - Historical price request parameters
2228
+ * @param params.symbol - The trading symbol to get historical data for
2229
+ * @param params.from - Start date in YYYY-MM-DD format (optional, defaults to 1 year ago)
2230
+ * @param params.to - End date in YYYY-MM-DD format (optional, defaults to today)
2231
+ *
2232
+ * @returns Promise resolving to historical price data with daily OHLCV information
2233
+ *
2234
+ * @example
2235
+ * ```typescript
2236
+ * // Get last year's data
2237
+ * const history = await fmp.quote.getHistoricalPrice({
2238
+ * symbol: 'AAPL',
2239
+ * from: '2023-01-01',
2240
+ * to: '2023-12-31'
2241
+ * });
2242
+ *
2243
+ * // Get recent data (last 30 days)
2244
+ * const recent = await fmp.quote.getHistoricalPrice({
2245
+ * symbol: 'BTCUSD',
2246
+ * from: '2024-01-01'
2247
+ * });
2248
+ * ```
1030
2249
  */
1031
2250
  async getHistoricalPrice(params) {
1032
2251
  const { symbol, from, to } = params;
@@ -1036,18 +2255,66 @@ var QuoteEndpoints = class {
1036
2255
  return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", queryParams);
1037
2256
  }
1038
2257
  /**
1039
- * Get multiple quotes for any asset type
1040
- * @param symbols - Array of symbols to get quotes for
1041
- * @returns Array of quote data
2258
+ * Get real-time quotes for multiple symbols in a single request
2259
+ *
2260
+ * Efficiently retrieve quote data for multiple assets across different asset classes.
2261
+ * Useful for portfolio tracking, market monitoring, or batch data collection.
2262
+ *
2263
+ * @param symbols - Array of trading symbols to get quotes for
2264
+ *
2265
+ * @returns Promise resolving to an array of quote data for all requested symbols
2266
+ *
2267
+ * @example
2268
+ * ```typescript
2269
+ * // Get quotes for a mixed portfolio
2270
+ * const quotes = await fmp.quote.getQuotes([
2271
+ * 'AAPL', // Stock
2272
+ * 'BTCUSD', // Crypto
2273
+ * 'EURUSD', // Forex
2274
+ * 'SPY' // ETF
2275
+ * ]);
2276
+ *
2277
+ * // Get quotes for tech stocks
2278
+ * const techQuotes = await fmp.quote.getQuotes([
2279
+ * 'AAPL', 'MSFT', 'GOOGL', 'AMZN', 'TSLA'
2280
+ * ]);
2281
+ * ```
1042
2282
  */
1043
2283
  async getQuotes(symbols) {
1044
2284
  const symbolsParam = symbols.join(",");
1045
2285
  return this.client.get(`/quote/${symbolsParam}`, "v3");
1046
2286
  }
1047
2287
  /**
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
2288
+ * Get intraday price data with customizable time intervals
2289
+ *
2290
+ * Retrieves intraday OHLCV data at specified intervals (1min to 4hour).
2291
+ * Perfect for technical analysis, day trading, or short-term price monitoring.
2292
+ *
2293
+ * @param params - Intraday request parameters
2294
+ * @param params.symbol - The trading symbol to get intraday data for
2295
+ * @param params.interval - Time interval: '1min', '5min', '15min', '30min', '1hour', or '4hour'
2296
+ * @param params.from - Start date in YYYY-MM-DD format (optional)
2297
+ * @param params.to - End date in YYYY-MM-DD format (optional)
2298
+ *
2299
+ * @returns Promise resolving to intraday price data with OHLCV information at specified intervals
2300
+ *
2301
+ * @example
2302
+ * ```typescript
2303
+ * // Get 5-minute intraday data for today
2304
+ * const intraday = await fmp.quote.getIntraday({
2305
+ * symbol: 'AAPL',
2306
+ * interval: '5min',
2307
+ * from: '2024-01-15'
2308
+ * });
2309
+ *
2310
+ * // Get 1-hour data for crypto
2311
+ * const cryptoIntraday = await fmp.quote.getIntraday({
2312
+ * symbol: 'BTCUSD',
2313
+ * interval: '1hour',
2314
+ * from: '2024-01-10',
2315
+ * to: '2024-01-15'
2316
+ * });
2317
+ * ```
1051
2318
  */
1052
2319
  async getIntraday(params) {
1053
2320
  const { symbol, interval, from, to } = params;
@@ -1064,56 +2331,202 @@ var SenateHouseEndpoints = class {
1064
2331
  this.client = client;
1065
2332
  }
1066
2333
  /**
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
2334
+ * Get senate trading data for a specific stock symbol
2335
+ *
2336
+ * Provides detailed information about senate members' trading activities for a specific stock.
2337
+ * Includes transaction details, amounts, dates, and ownership information for transparency
2338
+ * and compliance with the STOCK Act (Stop Trading on Congressional Knowledge).
2339
+ *
2340
+ * @param params - Senate trading request parameters
2341
+ * @param params.symbol - The stock symbol to get senate trading data for (e.g., 'AAPL', 'MSFT', 'TSLA')
2342
+ *
2343
+ * @returns Promise resolving to array of senate trading data with transaction details
2344
+ *
2345
+ * @example
2346
+ * ```typescript
2347
+ * // Get senate trading data for Apple
2348
+ * const appleSenateTrading = await fmp.senateHouse.getSenateTrading({ symbol: 'AAPL' });
2349
+ * appleSenateTrading.data.forEach(trade => {
2350
+ * console.log(`${trade.firstName} ${trade.lastName} (${trade.office}):`);
2351
+ * console.log(` ${trade.type} ${trade.amount} of ${trade.assetDescription}`);
2352
+ * console.log(` Transaction Date: ${trade.transactionDate}`);
2353
+ * });
2354
+ *
2355
+ * // Get senate trading data for Tesla
2356
+ * const teslaSenateTrading = await fmp.senateHouse.getSenateTrading({ symbol: 'TSLA' });
2357
+ * ```
2358
+ *
2359
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#senate-trading|FMP Senate Trading Documentation}
1071
2360
  */
1072
2361
  async getSenateTrading(params) {
1073
2362
  const { symbol } = params;
1074
2363
  return this.client.get(`/senate-trading`, "v4", { symbol });
1075
2364
  }
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
2365
+ /**
2366
+ * Get senate trading RSS feed with pagination
2367
+ *
2368
+ * Provides a paginated RSS feed of all senate trading activities across all stocks.
2369
+ * Useful for monitoring congressional trading activities, compliance tracking,
2370
+ * and transparency reporting. Returns recent trading disclosures from senate members.
2371
+ *
2372
+ * @param params - Senate trading RSS feed request parameters
2373
+ * @param params.page - The page number to retrieve (starts from 0)
2374
+ *
2375
+ * @returns Promise resolving to array of senate trading data from RSS feed
2376
+ *
2377
+ * @example
2378
+ * ```typescript
2379
+ * // Get first page of senate trading RSS feed
2380
+ * const firstPage = await fmp.senateHouse.getSenateTradingRSSFeed({ page: 0 });
2381
+ * console.log(`First page: ${firstPage.data.length} trading activities`);
2382
+ *
2383
+ * // Get second page of senate trading RSS feed
2384
+ * const secondPage = await fmp.senateHouse.getSenateTradingRSSFeed({ page: 1 });
2385
+ * console.log(`Second page: ${secondPage.data.length} trading activities`);
2386
+ *
2387
+ * // Get recent senate trading activities
2388
+ * const recentTrades = await fmp.senateHouse.getSenateTradingRSSFeed({ page: 0 });
2389
+ * recentTrades.data.forEach(trade => {
2390
+ * console.log(`${trade.firstName} ${trade.lastName}: ${trade.type} ${trade.amount}`);
2391
+ * });
2392
+ * ```
2393
+ *
2394
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#senate-trading-rss-feed-senate|FMP Senate Trading RSS Feed Documentation}
1080
2395
  */
1081
2396
  async getSenateTradingRSSFeed(params) {
1082
2397
  const { page } = params;
1083
2398
  return this.client.get("/senate-trading-rss-feed", "v4", { page });
1084
2399
  }
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
2400
+ /**
2401
+ * Get senate trading data for a specific senator by name
2402
+ *
2403
+ * Provides detailed trading activities for a specific senate member across all stocks.
2404
+ * Useful for tracking individual senator's trading patterns, compliance monitoring,
2405
+ * and transparency reporting. Returns all trading disclosures for the specified senator.
2406
+ *
2407
+ * @param params - Senate trading by name request parameters
2408
+ * @param params.name - The name of the senator to get trading data for (e.g., 'John Smith', 'Jane Doe')
2409
+ *
2410
+ * @returns Promise resolving to array of senate trading data for the specified senator
2411
+ *
2412
+ * @example
2413
+ * ```typescript
2414
+ * // Get trading data for Senator John Smith
2415
+ * const johnSmithTrades = await fmp.senateHouse.getSenateTradingByName({ name: 'John Smith' });
2416
+ * johnSmithTrades.data.forEach(trade => {
2417
+ * console.log(`${trade.symbol}: ${trade.type} ${trade.amount}`);
2418
+ * console.log(` Transaction Date: ${trade.transactionDate}`);
2419
+ * console.log(` Asset: ${trade.assetDescription}`);
2420
+ * });
2421
+ *
2422
+ * // Get trading data for Senator Jane Doe
2423
+ * const janeDoeTrades = await fmp.senateHouse.getSenateTradingByName({ name: 'Jane Doe' });
2424
+ * console.log(`Jane Doe has ${janeDoeTrades.data.length} trading activities`);
2425
+ * ```
2426
+ *
2427
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#senate-trading-by-name|FMP Senate Trading by Name Documentation}
1089
2428
  */
1090
2429
  async getSenateTradingByName(params) {
1091
2430
  const { name } = params;
1092
2431
  return this.client.get("/senate-trades-by-name", "stable", { name });
1093
2432
  }
1094
2433
  /**
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
2434
+ * Get house trading data for a specific stock symbol
2435
+ *
2436
+ * Provides detailed information about house representatives' trading activities for a specific stock.
2437
+ * Includes transaction details, amounts, dates, and district information for transparency
2438
+ * and compliance with the STOCK Act (Stop Trading on Congressional Knowledge).
2439
+ *
2440
+ * @param params - House trading request parameters
2441
+ * @param params.symbol - The stock symbol to get house trading data for (e.g., 'AAPL', 'MSFT', 'TSLA')
2442
+ *
2443
+ * @returns Promise resolving to array of house trading data with transaction details
2444
+ *
2445
+ * @example
2446
+ * ```typescript
2447
+ * // Get house trading data for Apple
2448
+ * const appleHouseTrading = await fmp.senateHouse.getHouseTrading({ symbol: 'AAPL' });
2449
+ * appleHouseTrading.data.forEach(trade => {
2450
+ * console.log(`${trade.representative} (District ${trade.district}):`);
2451
+ * console.log(` ${trade.type} ${trade.amount} of ${trade.assetDescription}`);
2452
+ * console.log(` Transaction Date: ${trade.transactionDate}`);
2453
+ * });
2454
+ *
2455
+ * // Get house trading data for Microsoft
2456
+ * const msftHouseTrading = await fmp.senateHouse.getHouseTrading({ symbol: 'MSFT' });
2457
+ * console.log(`Microsoft house trading activities: ${msftHouseTrading.data.length}`);
2458
+ * ```
2459
+ *
2460
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#house-disclosure|FMP House Trading Documentation}
1099
2461
  */
1100
2462
  async getHouseTrading(params) {
1101
2463
  const { symbol } = params;
1102
2464
  return this.client.get("/senate-disclosure", "v4", { symbol });
1103
2465
  }
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
2466
+ /**
2467
+ * Get house trading RSS feed with pagination
2468
+ *
2469
+ * Provides a paginated RSS feed of all house trading activities across all stocks.
2470
+ * Useful for monitoring congressional trading activities, compliance tracking,
2471
+ * and transparency reporting. Returns recent trading disclosures from house representatives.
2472
+ *
2473
+ * @param params - House trading RSS feed request parameters
2474
+ * @param params.page - The page number to retrieve (starts from 0)
2475
+ *
2476
+ * @returns Promise resolving to array of house trading data from RSS feed
2477
+ *
2478
+ * @example
2479
+ * ```typescript
2480
+ * // Get first page of house trading RSS feed
2481
+ * const firstPage = await fmp.senateHouse.getHouseTradingRSSFeed({ page: 0 });
2482
+ * console.log(`First page: ${firstPage.data.length} trading activities`);
2483
+ *
2484
+ * // Get second page of house trading RSS feed
2485
+ * const secondPage = await fmp.senateHouse.getHouseTradingRSSFeed({ page: 1 });
2486
+ * console.log(`Second page: ${secondPage.data.length} trading activities`);
2487
+ *
2488
+ * // Get recent house trading activities
2489
+ * const recentTrades = await fmp.senateHouse.getHouseTradingRSSFeed({ page: 0 });
2490
+ * recentTrades.data.forEach(trade => {
2491
+ * console.log(`${trade.representative} (District ${trade.district}): ${trade.type} ${trade.amount}`);
2492
+ * });
2493
+ * ```
2494
+ *
2495
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#house-disclosure-rss-feed-senate|FMP House Trading RSS Feed Documentation}
1108
2496
  */
1109
2497
  async getHouseTradingRSSFeed(params) {
1110
2498
  const { page } = params;
1111
2499
  return this.client.get("/senate-disclosure-rss-feed", "v4", { page });
1112
2500
  }
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
2501
+ /**
2502
+ * Get house trading data for a specific representative by name
2503
+ *
2504
+ * Provides detailed trading activities for a specific house representative across all stocks.
2505
+ * Useful for tracking individual representative's trading patterns, compliance monitoring,
2506
+ * and transparency reporting. Returns all trading disclosures for the specified representative.
2507
+ *
2508
+ * @param params - House trading by name request parameters
2509
+ * @param params.name - The name of the representative to get trading data for (e.g., 'John Smith', 'Jane Doe')
2510
+ *
2511
+ * @returns Promise resolving to array of house trading data for the specified representative
2512
+ *
2513
+ * @example
2514
+ * ```typescript
2515
+ * // Get trading data for Representative John Smith
2516
+ * const johnSmithTrades = await fmp.senateHouse.getHouseTradingByName({ name: 'John Smith' });
2517
+ * johnSmithTrades.data.forEach(trade => {
2518
+ * console.log(`${trade.symbol}: ${trade.type} ${trade.amount}`);
2519
+ * console.log(` Transaction Date: ${trade.transactionDate}`);
2520
+ * console.log(` Asset: ${trade.assetDescription}`);
2521
+ * console.log(` District: ${trade.district}`);
2522
+ * });
2523
+ *
2524
+ * // Get trading data for Representative Jane Doe
2525
+ * const janeDoeTrades = await fmp.senateHouse.getHouseTradingByName({ name: 'Jane Doe' });
2526
+ * console.log(`Jane Doe has ${janeDoeTrades.data.length} trading activities`);
2527
+ * ```
2528
+ *
2529
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#house-trading-by-name|FMP House Trading by Name Documentation}
1117
2530
  */
1118
2531
  async getHouseTradingByName(params) {
1119
2532
  const { name } = params;
@@ -1128,10 +2541,40 @@ var InstitutionalEndpoints = class {
1128
2541
  }
1129
2542
  /**
1130
2543
  * 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
2544
+ *
2545
+ * Provides Form 13F institutional stock ownership data for investment
2546
+ * managers with over $100 million in assets under management. Essential
2547
+ * for analyzing institutional investment patterns and holdings.
2548
+ *
2549
+ * @param params - Form 13F request parameters
2550
+ * @param params.cik - Central Index Key (CIK) of the investment manager
2551
+ * @param params.date - Specific date in YYYY-MM-DD format (optional, defaults to most recent filing)
2552
+ *
2553
+ * @returns Promise resolving to array of Form 13F institutional ownership data
2554
+ *
2555
+ * @example
2556
+ * ```typescript
2557
+ * // Get Berkshire Hathaway's Form 13F data
2558
+ * const berkshire13F = await fmp.institutional.getForm13F({
2559
+ * cik: '0001067983'
2560
+ * });
2561
+ * berkshire13F.data.forEach(holding => {
2562
+ * console.log(`${holding.issuerName}: ${holding.value.toLocaleString()} shares, $${holding.value.toLocaleString()}`);
2563
+ * });
2564
+ *
2565
+ * // Get Form 13F data for specific date
2566
+ * const historical13F = await fmp.institutional.getForm13F({
2567
+ * cik: '0001067983',
2568
+ * date: '2023-12-31'
2569
+ * });
2570
+ *
2571
+ * // Get BlackRock's Form 13F data
2572
+ * const blackrock13F = await fmp.institutional.getForm13F({
2573
+ * cik: '0001364742'
2574
+ * });
2575
+ * ```
2576
+ *
2577
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#form-13f-13f---institutional-stock-ownership|FMP Form 13F Documentation}
1135
2578
  */
1136
2579
  async getForm13F(params) {
1137
2580
  const { cik, date } = params;
@@ -1140,20 +2583,73 @@ var InstitutionalEndpoints = class {
1140
2583
  return this.client.get(`/form-thirteen/${cik}`, "v3", queryParams);
1141
2584
  }
1142
2585
  /**
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
2586
+ * Get Form 13F filing dates for an investment manager
2587
+ *
2588
+ * Provides available filing dates for Form 13F submissions by a specific
2589
+ * investment manager. Essential for discovering historical filing dates
2590
+ * before requesting detailed Form 13F data.
2591
+ *
2592
+ * @param params - Form 13F dates request parameters
2593
+ * @param params.cik - Central Index Key (CIK) of the investment manager
2594
+ *
2595
+ * @returns Promise resolving to array of available Form 13F filing dates
2596
+ *
2597
+ * @example
2598
+ * ```typescript
2599
+ * // Get Berkshire Hathaway's Form 13F filing dates
2600
+ * const berkshireDates = await fmp.institutional.getForm13FDates({
2601
+ * cik: '0001067983'
2602
+ * });
2603
+ * berkshireDates.data.forEach(date => {
2604
+ * console.log(`Filing date: ${date}`);
2605
+ * });
2606
+ *
2607
+ * // Get BlackRock's filing dates
2608
+ * const blackrockDates = await fmp.institutional.getForm13FDates({
2609
+ * cik: '0001364742'
2610
+ * });
2611
+ * ```
2612
+ *
2613
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#form-13f-dates-13f---institutional-stock-ownership|FMP Form 13F Dates Documentation}
1147
2614
  */
1148
2615
  async getForm13FDates(params) {
1149
2616
  const { cik } = params;
1150
2617
  return this.client.get(`/form-thirteen-date/${cik}`, "v3");
1151
2618
  }
1152
2619
  /**
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
2620
+ * Get institutional holders for a company
2621
+ *
2622
+ * Provides data on institutional investors holding shares in a specific
2623
+ * company. Essential for understanding institutional ownership patterns,
2624
+ * major shareholders, and investment sentiment.
2625
+ *
2626
+ * @param params - Institutional holders request parameters
2627
+ * @param params.symbol - Stock symbol to get institutional holders for
2628
+ *
2629
+ * @returns Promise resolving to array of institutional holders data
2630
+ *
2631
+ * @example
2632
+ * ```typescript
2633
+ * // Get Apple's institutional holders
2634
+ * const appleHolders = await fmp.institutional.getInstitutionalHolders({
2635
+ * symbol: 'AAPL'
2636
+ * });
2637
+ * appleHolders.data.forEach(holder => {
2638
+ * console.log(`${holder.holder}: ${holder.shares.toLocaleString()} shares (${holder.weight}%)`);
2639
+ * });
2640
+ *
2641
+ * // Get Microsoft's institutional holders
2642
+ * const msftHolders = await fmp.institutional.getInstitutionalHolders({
2643
+ * symbol: 'MSFT'
2644
+ * });
2645
+ *
2646
+ * // Get Tesla's institutional holders
2647
+ * const teslaHolders = await fmp.institutional.getInstitutionalHolders({
2648
+ * symbol: 'TSLA'
2649
+ * });
2650
+ * ```
2651
+ *
2652
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#institutional-holder-13f---institutional-stock-ownership|FMP Institutional Holders Documentation}
1157
2653
  */
1158
2654
  async getInstitutionalHolders(params) {
1159
2655
  const { symbol } = params;
@@ -1167,121 +2663,331 @@ var InsiderEndpoints = class {
1167
2663
  this.client = client;
1168
2664
  }
1169
2665
  /**
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
2666
+ * Get insider trading RSS feed data
2667
+ *
2668
+ * Provides real-time RSS feed of insider trading activities across all
2669
+ * publicly traded companies. Essential for monitoring insider trading
2670
+ * patterns, corporate governance, and potential market-moving events.
2671
+ *
2672
+ * @param params - RSS feed request parameters
2673
+ * @param params.page - Page number for pagination (default: 0)
2674
+ *
2675
+ * @returns Promise resolving to array of insider trading RSS feed data
2676
+ *
2677
+ * @example
2678
+ * ```typescript
2679
+ * // Get first page of insider trading RSS feed
2680
+ * const rssFeed = await fmp.insider.getInsiderTradingRSS({ page: 0 });
2681
+ * rssFeed.data.forEach(trade => {
2682
+ * console.log(`${trade.date}: ${trade.symbol} - ${trade.insiderName} ${trade.transactionType}`);
2683
+ * });
2684
+ *
2685
+ * // Get second page of RSS feed
2686
+ * const nextPage = await fmp.insider.getInsiderTradingRSS({ page: 1 });
2687
+ * ```
2688
+ *
2689
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#insider-trades-rss-insider-trading|FMP Insider Trading RSS Documentation}
1174
2690
  */
1175
- async getInsiderTradingRSS({
1176
- page
1177
- }) {
2691
+ async getInsiderTradingRSS(params) {
2692
+ const { page = 0 } = params;
1178
2693
  return this.client.get(`/insider-trading-rss-feed`, "v4", { page });
1179
2694
  }
1180
2695
  /**
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
2696
+ * Search for insider trades with advanced filtering
2697
+ *
2698
+ * Provides comprehensive insider trading data with multiple filtering options
2699
+ * including symbol, CIK numbers, and transaction types. Essential for detailed
2700
+ * analysis of insider trading patterns and corporate governance.
2701
+ *
2702
+ * @param params - Insider trading search parameters
2703
+ * @param params.symbol - Stock symbol to filter by (optional)
2704
+ * @param params.reportingCik - Reporting CIK to filter by (optional)
2705
+ * @param params.companyCik - Company CIK to filter by (optional)
2706
+ * @param params.transactionType - Transaction type to filter by (optional)
2707
+ * @param params.page - Page number for pagination (default: 0)
2708
+ *
2709
+ * @returns Promise resolving to array of insider trading search results
2710
+ *
2711
+ * @example
2712
+ * ```typescript
2713
+ * // Search for Apple insider trades
2714
+ * const appleTrades = await fmp.insider.searchInsiderTrading({
2715
+ * symbol: 'AAPL',
2716
+ * page: 0
2717
+ * });
2718
+ * appleTrades.data.forEach(trade => {
2719
+ * console.log(`${trade.date}: ${trade.insiderName} - ${trade.transactionType} ${trade.sharesTraded} shares`);
2720
+ * });
2721
+ *
2722
+ * // Search by transaction type
2723
+ * const purchases = await fmp.insider.searchInsiderTrading({
2724
+ * transactionType: 'P-Purchase',
2725
+ * page: 0
2726
+ * });
2727
+ *
2728
+ * // Search by CIK
2729
+ * const cikTrades = await fmp.insider.searchInsiderTrading({
2730
+ * companyCik: '0000320193',
2731
+ * page: 0
2732
+ * });
2733
+ * ```
2734
+ *
2735
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#insider-trades-search-insider-trading|FMP Insider Trading Search Documentation}
1185
2736
  */
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);
2737
+ async searchInsiderTrading(params) {
2738
+ const { symbol, reportingCik, companyCik, transactionType, page = 0 } = params;
2739
+ const queryParams = { page };
2740
+ if (symbol) queryParams.symbol = symbol;
2741
+ if (reportingCik) queryParams.reportingCik = reportingCik;
2742
+ if (companyCik) queryParams.companyCik = companyCik;
2743
+ if (transactionType) queryParams.transactionType = transactionType;
2744
+ return this.client.get(`/insider-trading`, "v4", queryParams);
1199
2745
  }
1200
2746
  /**
1201
- * Get transaction types
1202
- * https://site.financialmodelingprep.com/developer/docs#transaction-types-insider-trading
1203
- * @returns A list of all insider transaction types
2747
+ * Get all available transaction types
2748
+ *
2749
+ * Provides a comprehensive list of all insider trading transaction types
2750
+ * used in SEC filings. Essential for understanding different types of
2751
+ * insider trading activities and filtering search results.
2752
+ *
2753
+ * @returns Promise resolving to array of transaction types with descriptions
2754
+ *
2755
+ * @example
2756
+ * ```typescript
2757
+ * // Get all transaction types
2758
+ * const transactionTypes = await fmp.insider.getTransactionTypes();
2759
+ * transactionTypes.data.forEach(type => {
2760
+ * console.log(`${type.code}: ${type.description}`);
2761
+ * });
2762
+ * ```
2763
+ *
2764
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#transaction-types-insider-trading|FMP Transaction Types Documentation}
1204
2765
  */
1205
2766
  async getTransactionTypes() {
1206
2767
  return this.client.get(`/insider-trading-transaction-type`, "v4");
1207
2768
  }
1208
2769
  /**
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
2770
+ * Get insiders roster for a specific company
2771
+ *
2772
+ * Provides a list of all insiders (officers, directors, and beneficial owners)
2773
+ * for a specific company. Essential for understanding corporate governance
2774
+ * structure and identifying key personnel.
2775
+ *
2776
+ * @param params - Insiders request parameters
2777
+ * @param params.symbol - Stock symbol to get insiders for
2778
+ *
2779
+ * @returns Promise resolving to array of insiders data for the company
2780
+ *
2781
+ * @example
2782
+ * ```typescript
2783
+ * // Get Apple's insiders roster
2784
+ * const appleInsiders = await fmp.insider.getInsidersBySymbol({ symbol: 'AAPL' });
2785
+ * appleInsiders.data.forEach(insider => {
2786
+ * console.log(`${insider.name} - ${insider.title} (${insider.cik})`);
2787
+ * });
2788
+ *
2789
+ * // Get Microsoft's insiders
2790
+ * const msftInsiders = await fmp.insider.getInsidersBySymbol({ symbol: 'MSFT' });
2791
+ * ```
2792
+ *
2793
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#insiders-by-symbol-insider-trading|FMP Insiders by Symbol Documentation}
1213
2794
  */
1214
- async getInsidersBySymbol({
1215
- symbol
1216
- }) {
2795
+ async getInsidersBySymbol(params) {
2796
+ const { symbol } = params;
1217
2797
  return this.client.get(`/insider-roaster`, "v4", { symbol });
1218
2798
  }
1219
2799
  /**
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
2800
+ * Get insider trade statistics for a company
2801
+ *
2802
+ * Provides comprehensive statistics on insider trading activity for a
2803
+ * specific company including total trades, volume, and value metrics.
2804
+ * Essential for analyzing insider trading patterns and sentiment.
2805
+ *
2806
+ * @param params - Statistics request parameters
2807
+ * @param params.symbol - Stock symbol to get statistics for
2808
+ *
2809
+ * @returns Promise resolving to array of insider trade statistics data
2810
+ *
2811
+ * @example
2812
+ * ```typescript
2813
+ * // Get Apple's insider trade statistics
2814
+ * const appleStats = await fmp.insider.getInsiderTradeStatistics({ symbol: 'AAPL' });
2815
+ * appleStats.data.forEach(stat => {
2816
+ * console.log(`${stat.insiderName}: ${stat.totalTrades} trades, ${stat.totalShares} shares`);
2817
+ * });
2818
+ *
2819
+ * // Get Microsoft's statistics
2820
+ * const msftStats = await fmp.insider.getInsiderTradeStatistics({ symbol: 'MSFT' });
2821
+ * ```
2822
+ *
2823
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#insider-trade-statistics-insider-trading|FMP Insider Trade Statistics Documentation}
1224
2824
  */
1225
- async getInsiderTradeStatistics({
1226
- symbol
1227
- }) {
2825
+ async getInsiderTradeStatistics(params) {
2826
+ const { symbol } = params;
1228
2827
  return this.client.get(`/insider-roaster-statistic`, "v4", { symbol });
1229
2828
  }
1230
2829
  /**
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
2830
+ * Get CIK mapper data
2831
+ *
2832
+ * Provides a mapping between CIK (Central Index Key) numbers and company
2833
+ * names. Essential for converting between CIK numbers and company
2834
+ * identifiers in insider trading analysis.
2835
+ *
2836
+ * @param params - CIK mapper request parameters
2837
+ * @param params.page - Page number for pagination (default: 0)
2838
+ *
2839
+ * @returns Promise resolving to array of CIK mapper data
2840
+ *
2841
+ * @example
2842
+ * ```typescript
2843
+ * // Get first page of CIK mapper
2844
+ * const cikMapper = await fmp.insider.getCikMapper({ page: 0 });
2845
+ * cikMapper.data.forEach(mapping => {
2846
+ * console.log(`CIK: ${mapping.cik} - Company: ${mapping.name}`);
2847
+ * });
2848
+ *
2849
+ * // Get second page
2850
+ * const nextPage = await fmp.insider.getCikMapper({ page: 1 });
2851
+ * ```
2852
+ *
2853
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#cik-mapper-insider-trading|FMP CIK Mapper Documentation}
1235
2854
  */
1236
- async getCikMapper({ page }) {
2855
+ async getCikMapper(params) {
2856
+ const { page = 0 } = params;
1237
2857
  return this.client.get(`/mapper-cik-name`, "v4", { page });
1238
2858
  }
1239
2859
  /**
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
2860
+ * Get CIK mapper by name search
2861
+ *
2862
+ * Provides CIK numbers and company names matching a search term.
2863
+ * Useful for finding companies by partial name matches and
2864
+ * converting company names to CIK numbers.
2865
+ *
2866
+ * @param params - CIK mapper by name request parameters
2867
+ * @param params.name - Company name or partial name to search for
2868
+ * @param params.page - Page number for pagination (default: 0)
2869
+ *
2870
+ * @returns Promise resolving to array of CIK mapper data matching the search
2871
+ *
2872
+ * @example
2873
+ * ```typescript
2874
+ * // Search for Apple by name
2875
+ * const appleCik = await fmp.insider.getCikMapperByName({
2876
+ * name: 'Apple',
2877
+ * page: 0
2878
+ * });
2879
+ * appleCik.data.forEach(mapping => {
2880
+ * console.log(`CIK: ${mapping.cik} - Company: ${mapping.name}`);
2881
+ * });
2882
+ *
2883
+ * // Search for Microsoft
2884
+ * const msftCik = await fmp.insider.getCikMapperByName({
2885
+ * name: 'Microsoft',
2886
+ * page: 0
2887
+ * });
2888
+ * ```
2889
+ *
2890
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#cik-mapper-by-name-insider-trading|FMP CIK Mapper by Name Documentation}
1244
2891
  */
1245
- async getCikMapperByName({
1246
- name,
1247
- page = 0
1248
- }) {
2892
+ async getCikMapperByName(params) {
2893
+ const { name, page = 0 } = params;
1249
2894
  return this.client.get(`/mapper-cik-name`, "v4", { name, page });
1250
2895
  }
1251
2896
  /**
1252
2897
  * 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
2898
+ *
2899
+ * Provides CIK number and company name for a specific stock symbol.
2900
+ * Essential for converting stock symbols to CIK numbers for use
2901
+ * in insider trading searches and analysis.
2902
+ *
2903
+ * @param params - CIK mapper by symbol request parameters
2904
+ * @param params.symbol - Stock symbol to get CIK for
2905
+ *
2906
+ * @returns Promise resolving to CIK mapper data for the symbol
2907
+ *
2908
+ * @example
2909
+ * ```typescript
2910
+ * // Get Apple's CIK by symbol
2911
+ * const appleCik = await fmp.insider.getCikMapperBySymbol({ symbol: 'AAPL' });
2912
+ * console.log(`Apple CIK: ${appleCik.data.cik} - ${appleCik.data.name}`);
2913
+ *
2914
+ * // Get Microsoft's CIK
2915
+ * const msftCik = await fmp.insider.getCikMapperBySymbol({ symbol: 'MSFT' });
2916
+ * ```
2917
+ *
2918
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#cik-mapper-company-insider-trading|FMP CIK Mapper by Symbol Documentation}
1256
2919
  */
1257
- async getCikMapperBySymbol({
1258
- symbol
1259
- }) {
2920
+ async getCikMapperBySymbol(params) {
2921
+ const { symbol } = params;
1260
2922
  return this.client.getSingle(`/mapper-cik-company/${symbol}`, "v4");
1261
2923
  }
1262
2924
  /**
1263
2925
  * 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
2926
+ *
2927
+ * Provides data on acquisitions of beneficial ownership for a specific
2928
+ * company. Essential for tracking significant ownership changes and
2929
+ * corporate governance events.
2930
+ *
2931
+ * @param params - Beneficial ownership request parameters
2932
+ * @param params.symbol - Stock symbol to get beneficial ownership data for
2933
+ *
2934
+ * @returns Promise resolving to array of beneficial ownership acquisition data
2935
+ *
2936
+ * @example
2937
+ * ```typescript
2938
+ * // Get Apple's beneficial ownership acquisitions
2939
+ * const appleOwnership = await fmp.insider.getBeneficialOwnership({ symbol: 'AAPL' });
2940
+ * appleOwnership.data.forEach(acquisition => {
2941
+ * console.log(`${acquisition.date}: ${acquisition.insiderName} acquired ${acquisition.sharesAcquired} shares`);
2942
+ * });
2943
+ *
2944
+ * // Get Microsoft's beneficial ownership
2945
+ * const msftOwnership = await fmp.insider.getBeneficialOwnership({ symbol: 'MSFT' });
2946
+ * ```
2947
+ *
2948
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#acquisition-of-beneficial-ownership|FMP Beneficial Ownership Documentation}
1267
2949
  */
1268
- async getBeneficialOwnership({
1269
- symbol
1270
- }) {
2950
+ async getBeneficialOwnership(params) {
2951
+ const { symbol } = params;
1271
2952
  return this.client.get(`/insider/ownership/acquisition_of_beneficial_ownership`, "v4", {
1272
2953
  symbol
1273
2954
  });
1274
2955
  }
1275
2956
  /**
1276
2957
  * 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
2958
+ *
2959
+ * Provides fail to deliver data for a specific company, which indicates
2960
+ * when market participants fail to deliver securities on settlement date.
2961
+ * Important for understanding market mechanics and potential short interest.
2962
+ *
2963
+ * @param params - Fail to deliver request parameters
2964
+ * @param params.symbol - Stock symbol to get fail to deliver data for
2965
+ * @param params.page - Page number for pagination (default: 0)
2966
+ *
2967
+ * @returns Promise resolving to array of fail to deliver data
2968
+ *
2969
+ * @example
2970
+ * ```typescript
2971
+ * // Get Apple's fail to deliver data
2972
+ * const appleFailToDeliver = await fmp.insider.getFailToDeliver({
2973
+ * symbol: 'AAPL',
2974
+ * page: 0
2975
+ * });
2976
+ * appleFailToDeliver.data.forEach(entry => {
2977
+ * console.log(`${entry.date}: ${entry.shares} shares failed to deliver`);
2978
+ * });
2979
+ *
2980
+ * // Get Microsoft's fail to deliver data
2981
+ * const msftFailToDeliver = await fmp.insider.getFailToDeliver({
2982
+ * symbol: 'MSFT',
2983
+ * page: 0
2984
+ * });
2985
+ * ```
2986
+ *
2987
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#fail-to-deliver|FMP Fail to Deliver Documentation}
1280
2988
  */
1281
- async getFailToDeliver({
1282
- symbol,
1283
- page = 0
1284
- }) {
2989
+ async getFailToDeliver(params) {
2990
+ const { symbol, page = 0 } = params;
1285
2991
  return this.client.get(`/fail_to_deliver`, "v4", { symbol, page });
1286
2992
  }
1287
2993
  /**
@@ -1329,46 +3035,167 @@ var SECEndpoints = class {
1329
3035
  }
1330
3036
  /**
1331
3037
  * 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.
3038
+ *
3039
+ * Provides a real-time feed of SEC filings from publicly traded companies,
3040
+ * including filing types, links to SEC pages, and direct links to filings.
3041
+ * Essential for staying up-to-date on the latest SEC filings for all companies
3042
+ * or for monitoring specific companies' regulatory activities.
3043
+ *
3044
+ * @param params - RSS feed parameters (optional)
3045
+ * @returns Promise resolving to array of RSS feed items with SEC filing information
3046
+ *
3047
+ * @example
3048
+ * ```typescript
3049
+ * // Get all recent SEC filings
3050
+ * const allFilings = await fmp.sec.getRSSFeed();
3051
+ * console.log(`Recent SEC filings: ${allFilings.data.length}`);
3052
+ *
3053
+ * // Get specific filing type
3054
+ * const form4Filings = await fmp.sec.getRSSFeed({ type: '4' });
3055
+ * console.log(`Form 4 filings: ${form4Filings.data.length}`);
3056
+ *
3057
+ * // Get filings with date range
3058
+ * const recentFilings = await fmp.sec.getRSSFeed({
3059
+ * from: '2024-01-01',
3060
+ * to: '2024-01-31'
3061
+ * });
3062
+ * console.log(`Recent filings: ${recentFilings.data.length}`);
3063
+ *
3064
+ * // Get limited results
3065
+ * const limitedFilings = await fmp.sec.getRSSFeed({ limit: 10 });
3066
+ * console.log(`Limited filings: ${limitedFilings.data.length}`);
3067
+ * ```
3068
+ *
3069
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#rss-feed-securities-and-exchange-commission-(s.e.c)|FMP RSS Feed Documentation}
1335
3070
  */
1336
3071
  async getRSSFeed(params) {
1337
3072
  return this.client.get("/rss_feed", "v4", params);
1338
3073
  }
1339
3074
  /**
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.
3075
+ * Get comprehensive RSS feed of all SEC filings
3076
+ *
3077
+ * Provides a comprehensive real-time feed of all SEC filings from publicly
3078
+ * traded companies in the latest RSS feed format. This endpoint offers the
3079
+ * most complete overview of SEC filings with enhanced metadata and formatting.
3080
+ *
3081
+ * @param params - RSS feed all parameters (optional)
3082
+ * @returns Promise resolving to array of comprehensive RSS feed items with enhanced SEC filing information
3083
+ *
3084
+ * @example
3085
+ * ```typescript
3086
+ * // Get all comprehensive SEC filings
3087
+ * const allFilings = await fmp.sec.getRSSFeedAll();
3088
+ * console.log(`Comprehensive SEC filings: ${allFilings.data.length}`);
3089
+ *
3090
+ * // Get paginated results
3091
+ * const page2Filings = await fmp.sec.getRSSFeedAll({ page: 1 });
3092
+ * console.log(`Page 2 filings: ${page2Filings.data.length}`);
3093
+ *
3094
+ * // Get specific data type
3095
+ * const specificData = await fmp.sec.getRSSFeedAll({ datatype: 'json' });
3096
+ * console.log(`Specific data type filings: ${specificData.data.length}`);
3097
+ * ```
3098
+ *
3099
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#rss-feed-all-securities-and-exchange-commission-(s.e.c)|FMP RSS Feed All Documentation}
1344
3100
  */
1345
3101
  async getRSSFeedAll(params) {
1346
3102
  return this.client.get("/rss_feed_all", "v4", params);
1347
3103
  }
1348
3104
  /**
1349
3105
  * 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)
3106
+ *
3107
+ * Provides a real-time feed of SEC filings from publicly traded companies
3108
+ * in the V3 RSS feed format. This version offers enhanced metadata and
3109
+ * improved structure for better parsing and analysis of SEC filings.
3110
+ *
3111
+ * @param params - RSS feed V3 parameters (optional)
3112
+ * @returns Promise resolving to array of V3 RSS feed items with enhanced SEC filing information
3113
+ *
3114
+ * @example
3115
+ * ```typescript
3116
+ * // Get V3 format SEC filings
3117
+ * const v3Filings = await fmp.sec.getRSSFeedV3();
3118
+ * console.log(`V3 SEC filings: ${v3Filings.data.length}`);
3119
+ *
3120
+ * // Get paginated V3 results
3121
+ * const page2V3 = await fmp.sec.getRSSFeedV3({ page: 1 });
3122
+ * console.log(`Page 2 V3 filings: ${page2V3.data.length}`);
3123
+ *
3124
+ * // Get specific data type
3125
+ * const specificV3 = await fmp.sec.getRSSFeedV3({ datatype: 'json' });
3126
+ * console.log(`Specific V3 data type: ${specificV3.data.length}`);
3127
+ * ```
3128
+ *
3129
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#rss-feed-v3-securities-and-exchange-commission-(s.e.c)|FMP RSS Feed V3 Documentation}
1353
3130
  */
1354
3131
  async getRSSFeedV3(params) {
1355
3132
  return this.client.get("/rss_feed", "v3", params);
1356
3133
  }
1357
3134
  /**
1358
3135
  * 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
3136
+ *
3137
+ * Provides a real-time feed specifically for 8-K SEC filings from publicly
3138
+ * traded companies. 8-K filings are used to announce major events that
3139
+ * shareholders should know about, such as earnings releases, mergers,
3140
+ * acquisitions, and other material events.
3141
+ *
3142
+ * @param params - RSS feed 8-K parameters (optional)
3143
+ * @returns Promise resolving to array of 8-K RSS feed items with material event information
3144
+ *
3145
+ * @example
3146
+ * ```typescript
3147
+ * // Get all 8-K filings
3148
+ * const form8KFilings = await fmp.sec.getRSSFeed8K();
3149
+ * console.log(`8-K filings: ${form8KFilings.data.length}`);
3150
+ *
3151
+ * // Get 8-K filings with date range
3152
+ * const recent8K = await fmp.sec.getRSSFeed8K({
3153
+ * from: '2024-01-01',
3154
+ * to: '2024-01-31'
3155
+ * });
3156
+ * console.log(`Recent 8-K filings: ${recent8K.data.length}`);
3157
+ *
3158
+ * // Get 8-K filings with financials
3159
+ * const financial8K = await fmp.sec.getRSSFeed8K({ hasFinancial: true });
3160
+ * console.log(`8-K filings with financials: ${financial8K.data.length}`);
3161
+ *
3162
+ * // Get limited 8-K results
3163
+ * const limited8K = await fmp.sec.getRSSFeed8K({ limit: 10 });
3164
+ * console.log(`Limited 8-K filings: ${limited8K.data.length}`);
3165
+ * ```
3166
+ *
3167
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#rss-feed-8-k-securities-and-exchange-commission-(s.e.c)|FMP RSS Feed 8-K Documentation}
1362
3168
  */
1363
3169
  async getRSSFeed8K(params) {
1364
3170
  return this.client.get("/rss_feed_8k", "v4", params);
1365
3171
  }
1366
3172
  /**
1367
3173
  * 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
3174
+ *
3175
+ * Provides direct access to SEC filings for a specific company, including
3176
+ * filing types, links to SEC pages, and direct links to specific filings.
3177
+ * Essential for monitoring a company's regulatory compliance and staying
3178
+ * informed about important corporate events and disclosures.
3179
+ *
3180
+ * @param symbol - The stock symbol to get SEC filings for (e.g., 'AAPL', 'MSFT', 'GOOGL')
3181
+ * @param params - SEC filings parameters (optional)
3182
+ * @returns Promise resolving to array of SEC filings with detailed filing information
3183
+ *
3184
+ * @example
3185
+ * ```typescript
3186
+ * // Get all SEC filings for Apple
3187
+ * const appleFilings = await fmp.sec.getSECFilings({ symbol: 'AAPL' });
3188
+ * console.log(`Apple SEC filings: ${appleFilings.data.length}`);
3189
+ *
3190
+ * // Get specific filing type for Microsoft
3191
+ * const msftForm4 = await fmp.sec.getSECFilings({
3192
+ * symbol: 'MSFT',
3193
+ * params: { type: '4' }
3194
+ * });
3195
+ * console.log(`Microsoft Form 4 filings: ${msftForm4.data.length}`);
3196
+ * ```
3197
+ *
3198
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#sec-filings-securities-and-exchange-commission-(s.e.c)|FMP SEC Filings Documentation}
1372
3199
  */
1373
3200
  async getSECFilings({
1374
3201
  symbol,
@@ -1377,42 +3204,177 @@ var SECEndpoints = class {
1377
3204
  return this.client.get(`/sec_filings/${symbol}`, "v3", params);
1378
3205
  }
1379
3206
  /**
1380
- * Get individual industry classification
1381
- * https://site.financialmodelingprep.com/developer/docs#individual-industry-classification-standard-industrial-classification
3207
+ * Get individual industry classification for a company
3208
+ *
3209
+ * Provides the industry classification for a specific company based on the
3210
+ * Standard Industrial Classification (SIC) system. Essential for understanding
3211
+ * a company's business sector, industry peers, and market positioning.
3212
+ *
1382
3213
  * @param params - Industry classification parameters
1383
- * @returns Identify the industry in which a particular company operates, based on the Standard Industrial Classification (SIC) system
3214
+ * @returns Promise resolving to industry classification data with SIC code and description
3215
+ *
3216
+ * @example
3217
+ * ```typescript
3218
+ * // Get Apple's industry classification by symbol
3219
+ * const appleIndustry = await fmp.sec.getIndividualIndustryClassification({ symbol: 'AAPL' });
3220
+ * console.log(`Apple Industry: ${appleIndustry.data.industryTitle}`);
3221
+ * console.log(`SIC Code: ${appleIndustry.data.sicCode}`);
3222
+ *
3223
+ * // Get industry classification by CIK
3224
+ * const cikIndustry = await fmp.sec.getIndividualIndustryClassification({ cik: 320193 });
3225
+ * console.log(`CIK Industry: ${cikIndustry.data.industryTitle}`);
3226
+ *
3227
+ * // Get industry classification by SIC code
3228
+ * const sicIndustry = await fmp.sec.getIndividualIndustryClassification({ sicCode: 3571 });
3229
+ * console.log(`SIC Industry: ${sicIndustry.data.industryTitle}`);
3230
+ * ```
3231
+ *
3232
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#individual-industry-classification-standard-industrial-classification|FMP Individual Industry Classification Documentation}
1384
3233
  */
1385
3234
  async getIndividualIndustryClassification(params) {
1386
3235
  return this.client.getSingle("/standard_industrial_classification", "v4", params);
1387
3236
  }
1388
3237
  /**
1389
3238
  * 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
3239
+ *
3240
+ * Provides a comprehensive overview of all industries classified according
3241
+ * to the Standard Industrial Classification (SIC) system. Essential for
3242
+ * understanding industry categories, sector analysis, and market research.
3243
+ *
3244
+ * @returns Promise resolving to array of all industry classifications with SIC codes and descriptions
3245
+ *
3246
+ * @example
3247
+ * ```typescript
3248
+ * // Get all industry classifications
3249
+ * const allIndustries = await fmp.sec.getAllIndustryClassifications();
3250
+ * console.log(`Total industries: ${allIndustries.data.length}`);
3251
+ *
3252
+ * allIndustries.data.forEach((industry, index) => {
3253
+ * console.log(`${index + 1}. ${industry.industryTitle}`);
3254
+ * console.log(` SIC Code: ${industry.sicCode}`);
3255
+ * });
3256
+ *
3257
+ * // Find specific industry
3258
+ * const techIndustry = allIndustries.data.find(industry =>
3259
+ * industry.industryTitle.toLowerCase().includes('computer')
3260
+ * );
3261
+ * console.log(`Tech Industry: ${techIndustry?.industryTitle}`);
3262
+ * ```
3263
+ *
3264
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#all-industry-classification-standard-industrial-classification|FMP All Industry Classifications Documentation}
1392
3265
  */
1393
3266
  async getAllIndustryClassifications() {
1394
3267
  return this.client.get("/standard_industrial_classification/all", "v4");
1395
3268
  }
1396
3269
  /**
1397
3270
  * Get industry classification codes
1398
- * https://site.financialmodelingprep.com/developer/docs#industry-classification-codes-standard-industrial-classification
3271
+ *
3272
+ * Provides detailed information about the Standard Industrial Classification
3273
+ * (SIC) system and helps identify SIC codes for specific industries.
3274
+ * Essential for understanding industry categorization and sector analysis.
3275
+ *
1399
3276
  * @param params - Industry classification codes parameters
1400
- * @returns Learn more about the SIC system and identify the SIC code for a particular industry
3277
+ * @returns Promise resolving to array of industry classification codes with detailed information
3278
+ *
3279
+ * @example
3280
+ * ```typescript
3281
+ * // Get all industry classification codes
3282
+ * const allCodes = await fmp.sec.getIndustryClassificationCodes({});
3283
+ * console.log(`Total SIC codes: ${allCodes.data.length}`);
3284
+ *
3285
+ * // Search for specific SIC code
3286
+ * const code3571 = await fmp.sec.getIndustryClassificationCodes({ sicCode: 3571 });
3287
+ * console.log(`SIC 3571: ${code3571.data[0]?.industryTitle}`);
3288
+ *
3289
+ * // Search for industry by title
3290
+ * const computerIndustry = await fmp.sec.getIndustryClassificationCodes({ industryTitle: 'Computer' });
3291
+ * console.log(`Computer-related industries: ${computerIndustry.data.length}`);
3292
+ * ```
3293
+ *
3294
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#industry-classification-codes-standard-industrial-classification|FMP Industry Classification Codes Documentation}
1401
3295
  */
1402
3296
  async getIndustryClassificationCodes(params) {
1403
3297
  return this.client.get("/standard_industrial_classification_list", "v4", params);
1404
3298
  }
1405
3299
  };
1406
3300
 
3301
+ // src/endpoints/mutual-fund.ts
3302
+ var MutualFundEndpoints = class {
3303
+ constructor(client) {
3304
+ this.client = client;
3305
+ }
3306
+ /**
3307
+ * Get mutual fund holders of a specific stock
3308
+ *
3309
+ * Provides data on mutual funds that hold shares in a specific stock.
3310
+ * Essential for understanding mutual fund ownership patterns and
3311
+ * which mutual funds are invested in particular companies.
3312
+ *
3313
+ * @param symbol - The stock symbol to get mutual fund holders for (e.g., 'AAPL', 'MSFT', 'GOOGL')
3314
+ *
3315
+ * @returns Promise resolving to array of mutual fund holders with position details
3316
+ *
3317
+ * @example
3318
+ * ```typescript
3319
+ * // Get mutual funds that hold Apple stock
3320
+ * const appleHolders = await fmp.mutualFund.getHolders('AAPL');
3321
+ * console.log(`${appleHolders.data.length} mutual funds hold AAPL`);
3322
+ *
3323
+ * appleHolders.data.forEach((holder, index) => {
3324
+ * console.log(`${index + 1}. ${holder.holder}`);
3325
+ * console.log(` Shares: ${holder.shares?.toLocaleString() || 'N/A'}`);
3326
+ * console.log(` Weight: ${holder.weightPercent}% | Change: ${holder.change}`);
3327
+ * });
3328
+ *
3329
+ * // Get mutual funds that hold Microsoft stock
3330
+ * const msftHolders = await fmp.mutualFund.getHolders('MSFT');
3331
+ *
3332
+ * // Find top mutual fund holders by shares
3333
+ * const topHolders = msftHolders.data
3334
+ * .sort((a, b) => (b.shares || 0) - (a.shares || 0))
3335
+ * .slice(0, 10);
3336
+ * console.log('Top 10 mutual fund holders by shares:');
3337
+ * topHolders.forEach((holder, index) => {
3338
+ * console.log(`${index + 1}. ${holder.holder}: ${holder.shares.toLocaleString()} shares`);
3339
+ * });
3340
+ *
3341
+ * // Get mutual funds that hold Google stock
3342
+ * const googlHolders = await fmp.mutualFund.getHolders('GOOGL');
3343
+ *
3344
+ * // Analyze mutual fund concentration
3345
+ * const totalShares = googlHolders.data.reduce((sum, holder) => sum + (holder.shares || 0), 0);
3346
+ * console.log(`Total shares held by mutual funds: ${totalShares.toLocaleString()}`);
3347
+ *
3348
+ * googlHolders.data.forEach(holder => {
3349
+ * const percentage = ((holder.shares || 0) / totalShares * 100).toFixed(2);
3350
+ * console.log(`${holder.holder}: ${percentage}% of total mutual fund holdings`);
3351
+ * });
3352
+ * ```
3353
+ *
3354
+ * @see {@link https://site.financialmodelingprep.com/developer/docs#mutual-fund-holder-mutual-funds-holdings|FMP Mutual Fund Holders Documentation}
3355
+ */
3356
+ async getHolders(symbol) {
3357
+ return this.client.get(`/mutual-fund-holder/${symbol}`, "v3");
3358
+ }
3359
+ };
3360
+
1407
3361
  // src/fmp.ts
1408
3362
  var FMP = class {
1409
- constructor(config) {
1410
- validateApiKey(config.apiKey);
1411
- const client = new FMPClient(config);
3363
+ constructor(config = {}) {
3364
+ const apiKey = config.apiKey || process.env.FMP_API_KEY;
3365
+ if (!apiKey) {
3366
+ throw new Error(
3367
+ "FMP API key is required. Please provide it in the config or set the FMP_API_KEY environment variable."
3368
+ );
3369
+ }
3370
+ if (!FMPValidation.isValidApiKey(apiKey)) {
3371
+ throw new Error("Invalid API key format");
3372
+ }
3373
+ const client = new FMPClient({ ...config, apiKey });
1412
3374
  this.stock = new StockEndpoints(client);
1413
3375
  this.financial = new FinancialEndpoints(client);
1414
- this.crypto = new CryptoEndpoints(client);
1415
3376
  this.etf = new ETFEndpoints(client);
3377
+ this.economic = new EconomicEndpoints(client);
1416
3378
  this.market = new MarketEndpoints(client);
1417
3379
  this.list = new ListEndpoints(client);
1418
3380
  this.calendar = new CalendarEndpoints(client);
@@ -1422,8 +3384,6 @@ var FMP = class {
1422
3384
  this.institutional = new InstitutionalEndpoints(client);
1423
3385
  this.insider = new InsiderEndpoints(client);
1424
3386
  this.sec = new SECEndpoints(client);
1425
- this.forex = new ForexEndpoints(client);
1426
- this.economic = new EconomicEndpoints(client);
1427
3387
  this.mutualFund = new MutualFundEndpoints(client);
1428
3388
  }
1429
3389
  /**
@@ -1475,58 +3435,6 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
1475
3435
  return TransactionType2;
1476
3436
  })(TransactionType || {});
1477
3437
 
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
3438
  // src/utils/constants.ts
1531
3439
  var DEFAULT_TIMEOUT = 1e4;
1532
3440
  var DEFAULT_LIMIT = 100;
@@ -1594,6 +3502,636 @@ var HTTP_STATUS = {
1594
3502
  INTERNAL_SERVER_ERROR: 500
1595
3503
  };
1596
3504
 
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 };
3505
+ // src/utils/formatting.ts
3506
+ function formatCurrency(value, currency = "USD") {
3507
+ return new Intl.NumberFormat("en-US", {
3508
+ style: "currency",
3509
+ currency
3510
+ }).format(value);
3511
+ }
3512
+ function formatPercentage(value, decimals = 2) {
3513
+ return `${value.toFixed(decimals)}%`;
3514
+ }
3515
+ function formatLargeNumber(value) {
3516
+ if (value >= 1e12) {
3517
+ return `${(value / 1e12).toFixed(2)}T`;
3518
+ } else if (value >= 1e9) {
3519
+ return `${(value / 1e9).toFixed(2)}B`;
3520
+ } else if (value >= 1e6) {
3521
+ return `${(value / 1e6).toFixed(2)}M`;
3522
+ } else if (value >= 1e3) {
3523
+ return `${(value / 1e3).toFixed(2)}K`;
3524
+ }
3525
+ return value.toString();
3526
+ }
3527
+ function formatDate(date) {
3528
+ const d = typeof date === "string" ? new Date(date) : date;
3529
+ return d.toISOString().split("T")[0];
3530
+ }
3531
+ function formatReadableDate(date) {
3532
+ const d = typeof date === "string" ? new Date(date) : date;
3533
+ return d.toLocaleDateString("en-US", {
3534
+ year: "numeric",
3535
+ month: "long",
3536
+ day: "numeric"
3537
+ });
3538
+ }
3539
+ function formatTimestamp(timestamp) {
3540
+ const date = new Date(timestamp * 1e3);
3541
+ return date.toLocaleString("en-US");
3542
+ }
3543
+ function formatNumber(value, decimals = 2) {
3544
+ return value.toFixed(decimals);
3545
+ }
3546
+ function formatVolume(volume) {
3547
+ if (volume >= 1e9) {
3548
+ return `${(volume / 1e9).toFixed(2)}B`;
3549
+ } else if (volume >= 1e6) {
3550
+ return `${(volume / 1e6).toFixed(2)}M`;
3551
+ } else if (volume >= 1e3) {
3552
+ return `${(volume / 1e3).toFixed(2)}K`;
3553
+ }
3554
+ return volume.toString();
3555
+ }
3556
+
3557
+ // src/utils/helpers.ts
3558
+ var FMPHelpers = class {
3559
+ /**
3560
+ * Get all available endpoint categories from the FMP client
3561
+ * @param fmp - The FMP client instance
3562
+ * @returns Array of endpoint category names
3563
+ */
3564
+ static getEndpointCategories(fmp) {
3565
+ return Object.keys(fmp).filter(
3566
+ (key) => typeof fmp[key] === "object" && fmp[key] !== null && key !== "constructor"
3567
+ );
3568
+ }
3569
+ /**
3570
+ * Get all methods for a specific endpoint category
3571
+ * @param fmp - The FMP client instance
3572
+ * @param endpoint - The endpoint category name
3573
+ * @returns Array of method names
3574
+ */
3575
+ static getEndpointMethods(fmp, endpoint) {
3576
+ const endpointObj = fmp[endpoint];
3577
+ if (!endpointObj || typeof endpointObj !== "object") {
3578
+ return [];
3579
+ }
3580
+ return Object.getOwnPropertyNames(endpointObj).filter(
3581
+ (name) => typeof endpointObj[name] === "function" && name !== "constructor"
3582
+ );
3583
+ }
3584
+ /**
3585
+ * Get all available methods across all endpoint categories
3586
+ * @param fmp - The FMP client instance
3587
+ * @returns Object mapping endpoint categories to their methods
3588
+ */
3589
+ static getAllMethods(fmp) {
3590
+ const methods = {};
3591
+ const categories = this.getEndpointCategories(fmp);
3592
+ categories.forEach((category) => {
3593
+ methods[category] = this.getEndpointMethods(fmp, category);
3594
+ });
3595
+ return methods;
3596
+ }
3597
+ /**
3598
+ * Get a summary of the API structure
3599
+ * @param fmp - The FMP client instance
3600
+ * @returns Summary object with endpoint and method counts
3601
+ */
3602
+ static getApiSummary(fmp) {
3603
+ const categories = this.getEndpointCategories(fmp);
3604
+ const allMethods = this.getAllMethods(fmp);
3605
+ const totalMethods = Object.values(allMethods).reduce(
3606
+ (sum, methods) => sum + methods.length,
3607
+ 0
3608
+ );
3609
+ const methodCounts = {};
3610
+ categories.forEach((category) => {
3611
+ methodCounts[category] = allMethods[category]?.length || 0;
3612
+ });
3613
+ return {
3614
+ totalEndpoints: categories.length,
3615
+ totalMethods,
3616
+ categories,
3617
+ methodCounts
3618
+ };
3619
+ }
3620
+ /**
3621
+ * Check if a specific method exists on an endpoint
3622
+ * @param fmp - The FMP client instance
3623
+ * @param endpoint - The endpoint category name
3624
+ * @param method - The method name
3625
+ * @returns True if the method exists
3626
+ */
3627
+ static hasMethod(fmp, endpoint, method) {
3628
+ const methods = this.getEndpointMethods(fmp, endpoint);
3629
+ return methods.includes(method);
3630
+ }
3631
+ /**
3632
+ * Get method signature information (basic introspection)
3633
+ * @param fmp - The FMP client instance
3634
+ * @param endpoint - The endpoint category name
3635
+ * @param method - The method name
3636
+ * @returns Method information or null if not found
3637
+ */
3638
+ static getMethodInfo(fmp, endpoint, method) {
3639
+ const endpointObj = fmp[endpoint];
3640
+ if (!endpointObj || typeof endpointObj !== "object") {
3641
+ return null;
3642
+ }
3643
+ const methodFn = endpointObj[method];
3644
+ if (typeof methodFn !== "function") {
3645
+ return null;
3646
+ }
3647
+ return {
3648
+ name: method,
3649
+ type: "function",
3650
+ async: methodFn.constructor.name === "AsyncFunction"
3651
+ };
3652
+ }
3653
+ };
3654
+
3655
+ // src/utils/utils.ts
3656
+ var FMPUtils = class {
3657
+ /**
3658
+ * Format currency values
3659
+ * @param value - The numeric value to format
3660
+ * @param currency - The currency code (default: USD)
3661
+ * @param locale - The locale for formatting (default: en-US)
3662
+ * @returns Formatted currency string
3663
+ */
3664
+ static formatCurrency(value, currency = "USD", locale = "en-US") {
3665
+ if (typeof value !== "number" || isNaN(value)) {
3666
+ return "N/A";
3667
+ }
3668
+ try {
3669
+ return new Intl.NumberFormat(locale, {
3670
+ style: "currency",
3671
+ currency,
3672
+ minimumFractionDigits: 2,
3673
+ maximumFractionDigits: 2
3674
+ }).format(value);
3675
+ } catch (error) {
3676
+ return `${currency} ${value.toFixed(2)}`;
3677
+ }
3678
+ }
3679
+ /**
3680
+ * Format percentages
3681
+ * @param value - The percentage value (as decimal, e.g., 0.15 for 15%)
3682
+ * @param decimals - Number of decimal places (default: 2)
3683
+ * @returns Formatted percentage string
3684
+ */
3685
+ static formatPercentage(value, decimals = 2) {
3686
+ if (typeof value !== "number" || isNaN(value)) {
3687
+ return "N/A";
3688
+ }
3689
+ return `${value.toFixed(decimals)}%`;
3690
+ }
3691
+ /**
3692
+ * Format large numbers with abbreviations (K, M, B, T)
3693
+ * @param value - The numeric value to format
3694
+ * @param decimals - Number of decimal places (default: 1)
3695
+ * @returns Formatted number string
3696
+ */
3697
+ static formatLargeNumber(value, decimals = 1) {
3698
+ if (typeof value !== "number" || isNaN(value)) {
3699
+ return "N/A";
3700
+ }
3701
+ const absValue = Math.abs(value);
3702
+ const sign = value < 0 ? "-" : "";
3703
+ if (absValue >= 1e12) {
3704
+ return `${sign}${(absValue / 1e12).toFixed(decimals)}T`;
3705
+ } else if (absValue >= 1e9) {
3706
+ return `${sign}${(absValue / 1e9).toFixed(decimals)}B`;
3707
+ } else if (absValue >= 1e6) {
3708
+ return `${sign}${(absValue / 1e6).toFixed(decimals)}M`;
3709
+ } else if (absValue >= 1e3) {
3710
+ return `${sign}${(absValue / 1e3).toFixed(decimals)}K`;
3711
+ } else {
3712
+ return `${sign}${absValue.toFixed(decimals)}`;
3713
+ }
3714
+ }
3715
+ /**
3716
+ * Convert date string to Date object
3717
+ * @param dateString - The date string in YYYY-MM-DD format
3718
+ * @returns Date object or null if invalid
3719
+ */
3720
+ static parseDate(dateString) {
3721
+ if (!dateString || typeof dateString !== "string") {
3722
+ return null;
3723
+ }
3724
+ const [year, month, day] = dateString.split("-").map(Number);
3725
+ if (isNaN(year) || isNaN(month) || isNaN(day)) {
3726
+ return null;
3727
+ }
3728
+ if (month < 1 || month > 12) {
3729
+ return null;
3730
+ }
3731
+ const date = new Date(Date.UTC(year, month - 1, day));
3732
+ if (isNaN(date.getTime())) {
3733
+ return null;
3734
+ }
3735
+ const parsedYear = date.getUTCFullYear();
3736
+ const parsedMonth = date.getUTCMonth() + 1;
3737
+ const parsedDay = date.getUTCDate();
3738
+ if (parsedYear !== year || parsedMonth !== month || parsedDay !== day) {
3739
+ return null;
3740
+ }
3741
+ return date;
3742
+ }
3743
+ /**
3744
+ * Format date to readable string
3745
+ * @param date - Date object or date string
3746
+ * @param format - Format style ('short', 'long', 'iso')
3747
+ * @returns Formatted date string
3748
+ */
3749
+ static formatDate(date, format = "short") {
3750
+ const dateObj = typeof date === "string" ? this.parseDate(date) : date;
3751
+ if (!dateObj) {
3752
+ return "Invalid Date";
3753
+ }
3754
+ switch (format) {
3755
+ case "long":
3756
+ return dateObj.toLocaleDateString("en-US", {
3757
+ weekday: "long",
3758
+ year: "numeric",
3759
+ month: "long",
3760
+ day: "numeric"
3761
+ });
3762
+ case "iso":
3763
+ return dateObj.toISOString().split("T")[0];
3764
+ case "short":
3765
+ default:
3766
+ return dateObj.toLocaleDateString("en-US", {
3767
+ year: "numeric",
3768
+ month: "short",
3769
+ day: "numeric"
3770
+ });
3771
+ }
3772
+ }
3773
+ /**
3774
+ * Calculate working days between two dates (excluding weekends)
3775
+ * @param from - Start date
3776
+ * @param to - End date
3777
+ * @returns Number of working days
3778
+ */
3779
+ static getWorkingDays(from, to) {
3780
+ const startDate = typeof from === "string" ? this.parseDate(from) : from;
3781
+ const endDate = typeof to === "string" ? this.parseDate(to) : to;
3782
+ if (!startDate || !endDate) {
3783
+ return 0;
3784
+ }
3785
+ let workingDays = 0;
3786
+ const currentDate = new Date(startDate);
3787
+ const endDateNormalized = new Date(
3788
+ Date.UTC(endDate.getUTCFullYear(), endDate.getUTCMonth(), endDate.getUTCDate())
3789
+ );
3790
+ while (currentDate <= endDateNormalized) {
3791
+ const dayOfWeek = currentDate.getUTCDay();
3792
+ if (dayOfWeek !== 0 && dayOfWeek !== 6) {
3793
+ workingDays++;
3794
+ }
3795
+ currentDate.setUTCDate(currentDate.getUTCDate() + 1);
3796
+ }
3797
+ return workingDays;
3798
+ }
3799
+ /**
3800
+ * Calculate percentage change between two values
3801
+ * @param oldValue - The original value
3802
+ * @param newValue - The new value
3803
+ * @param decimals - Number of decimal places (default: 2)
3804
+ * @returns Percentage change as a number
3805
+ */
3806
+ static calculatePercentageChange(oldValue, newValue, decimals = 2) {
3807
+ if (typeof oldValue !== "number" || typeof newValue !== "number" || isNaN(oldValue) || isNaN(newValue) || oldValue === 0) {
3808
+ return 0;
3809
+ }
3810
+ const change = (newValue - oldValue) / oldValue * 100;
3811
+ return Number(change.toFixed(decimals));
3812
+ }
3813
+ /**
3814
+ * Batch API calls with rate limiting
3815
+ * @param calls - Array of async functions to execute
3816
+ * @param delayMs - Delay between calls in milliseconds (default: 100)
3817
+ * @param maxConcurrent - Maximum concurrent calls (default: 1)
3818
+ * @returns Array of results
3819
+ */
3820
+ static async batchCalls(calls, delayMs = 100, maxConcurrent = 1) {
3821
+ const results = [];
3822
+ if (maxConcurrent === 1) {
3823
+ for (const call of calls) {
3824
+ results.push(await call());
3825
+ if (delayMs > 0) {
3826
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
3827
+ }
3828
+ }
3829
+ } else {
3830
+ const chunks = this.chunkArray(calls, maxConcurrent);
3831
+ for (const chunk of chunks) {
3832
+ const chunkResults = await Promise.all(chunk.map((call) => call()));
3833
+ results.push(...chunkResults);
3834
+ if (delayMs > 0) {
3835
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
3836
+ }
3837
+ }
3838
+ }
3839
+ return results;
3840
+ }
3841
+ /**
3842
+ * Split array into chunks
3843
+ * @param array - The array to split
3844
+ * @param chunkSize - Size of each chunk
3845
+ * @returns Array of chunks
3846
+ */
3847
+ static chunkArray(array, chunkSize) {
3848
+ const chunks = [];
3849
+ for (let i = 0; i < array.length; i += chunkSize) {
3850
+ chunks.push(array.slice(i, i + chunkSize));
3851
+ }
3852
+ return chunks;
3853
+ }
3854
+ /**
3855
+ * Retry a function with exponential backoff
3856
+ * @param fn - The function to retry
3857
+ * @param maxRetries - Maximum number of retries (default: 3)
3858
+ * @param baseDelay - Base delay in milliseconds (default: 1000)
3859
+ * @returns Function result
3860
+ */
3861
+ static async retryWithBackoff(fn, maxRetries = 3, baseDelay = 1e3) {
3862
+ let lastError;
3863
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
3864
+ try {
3865
+ return await fn();
3866
+ } catch (error) {
3867
+ lastError = error;
3868
+ if (attempt === maxRetries) {
3869
+ throw lastError;
3870
+ }
3871
+ const delay = baseDelay * Math.pow(2, attempt);
3872
+ await new Promise((resolve) => setTimeout(resolve, delay));
3873
+ }
3874
+ }
3875
+ throw lastError;
3876
+ }
3877
+ /**
3878
+ * Debounce a function
3879
+ * @param func - The function to debounce
3880
+ * @param wait - Wait time in milliseconds
3881
+ * @returns Debounced function
3882
+ */
3883
+ static debounce(func, wait) {
3884
+ let timeout;
3885
+ return (...args) => {
3886
+ clearTimeout(timeout);
3887
+ timeout = setTimeout(() => func(...args), wait);
3888
+ };
3889
+ }
3890
+ /**
3891
+ * Throttle a function
3892
+ * @param func - The function to throttle
3893
+ * @param limit - Time limit in milliseconds
3894
+ * @returns Throttled function
3895
+ */
3896
+ static throttle(func, limit) {
3897
+ let inThrottle;
3898
+ return (...args) => {
3899
+ if (!inThrottle) {
3900
+ func(...args);
3901
+ inThrottle = true;
3902
+ setTimeout(() => inThrottle = false, limit);
3903
+ }
3904
+ };
3905
+ }
3906
+ };
3907
+
3908
+ // src/utils/debug.ts
3909
+ var _FMPDebug = class _FMPDebug {
3910
+ /**
3911
+ * Log API calls for debugging (only in development)
3912
+ * @param endpoint - The endpoint being called
3913
+ * @param params - The parameters passed to the endpoint
3914
+ * @param response - The response received
3915
+ * @param duration - The duration of the call in milliseconds
3916
+ */
3917
+ static logApiCall(endpoint, params, response, duration) {
3918
+ if (!this.isDevelopment && !this.isDebugEnabled) {
3919
+ return;
3920
+ }
3921
+ const logData = {
3922
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3923
+ endpoint,
3924
+ params,
3925
+ success: response?.success,
3926
+ status: response?.status,
3927
+ duration: duration ? `${duration}ms` : void 0
3928
+ };
3929
+ console.log("\u{1F50D} FMP API Call:", logData);
3930
+ }
3931
+ /**
3932
+ * Log API errors for debugging
3933
+ * @param endpoint - The endpoint that failed
3934
+ * @param params - The parameters that were passed
3935
+ * @param error - The error that occurred
3936
+ */
3937
+ static logApiError(endpoint, params, error) {
3938
+ if (!this.isDevelopment && !this.isDebugEnabled) {
3939
+ return;
3940
+ }
3941
+ console.error("\u274C FMP API Error:", {
3942
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3943
+ endpoint,
3944
+ params,
3945
+ error: error?.message || error,
3946
+ stack: error?.stack
3947
+ });
3948
+ }
3949
+ /**
3950
+ * Get comprehensive API usage statistics
3951
+ * @param fmp - The FMP client instance
3952
+ * @returns Detailed API statistics
3953
+ */
3954
+ static getApiStats(fmp) {
3955
+ const summary = FMPHelpers.getApiSummary(fmp);
3956
+ const estimatedApiCalls = Object.values(summary.methodCounts).reduce(
3957
+ (total, count) => total + count * 2,
3958
+ // Assume 2 calls per method on average
3959
+ 0
3960
+ );
3961
+ return {
3962
+ ...summary,
3963
+ estimatedApiCalls
3964
+ };
3965
+ }
3966
+ /**
3967
+ * Validate API key format and provide feedback
3968
+ * @param apiKey - The API key to validate
3969
+ * @returns Validation result with details
3970
+ */
3971
+ static validateApiKey(apiKey) {
3972
+ const length = apiKey?.length || 0;
3973
+ const format = apiKey?.match(/^[a-zA-Z0-9]+$/) ? "alphanumeric" : "invalid";
3974
+ const isValid = length >= 32 && format === "alphanumeric";
3975
+ const suggestions = [];
3976
+ if (length < 32) {
3977
+ suggestions.push("API key should be at least 32 characters long");
3978
+ }
3979
+ if (format !== "alphanumeric") {
3980
+ suggestions.push("API key should contain only letters and numbers");
3981
+ }
3982
+ if (!apiKey) {
3983
+ suggestions.push("API key is required");
3984
+ }
3985
+ return {
3986
+ isValid,
3987
+ length,
3988
+ format,
3989
+ suggestions
3990
+ };
3991
+ }
3992
+ /**
3993
+ * Check API key environment variable
3994
+ * @returns Environment check result
3995
+ */
3996
+ static checkApiKeyEnvironment() {
3997
+ const envVarName = "FMP_API_KEY";
3998
+ const apiKey = process.env[envVarName];
3999
+ const hasEnvVar = !!apiKey;
4000
+ const validation = this.validateApiKey(apiKey || "");
4001
+ const suggestions = [];
4002
+ if (!hasEnvVar) {
4003
+ suggestions.push(`Set ${envVarName} environment variable`);
4004
+ suggestions.push("Add to your .env file: FMP_API_KEY=your_api_key_here");
4005
+ } else if (!validation.isValid) {
4006
+ suggestions.push(...validation.suggestions);
4007
+ }
4008
+ return {
4009
+ hasEnvVar,
4010
+ envVarName,
4011
+ isValid: validation.isValid,
4012
+ suggestions
4013
+ };
4014
+ }
4015
+ /**
4016
+ * Get performance metrics for API calls
4017
+ * @param fmp - The FMP client instance
4018
+ * @returns Performance information
4019
+ */
4020
+ static getPerformanceInfo() {
4021
+ return {
4022
+ nodeVersion: process.version,
4023
+ platform: process.platform,
4024
+ memoryUsage: process.memoryUsage(),
4025
+ uptime: process.uptime()
4026
+ };
4027
+ }
4028
+ /**
4029
+ * Create a debug configuration object
4030
+ * @param fmp - The FMP client instance
4031
+ * @returns Debug configuration
4032
+ */
4033
+ static createDebugConfig(fmp) {
4034
+ return {
4035
+ apiStats: this.getApiStats(fmp),
4036
+ envCheck: this.checkApiKeyEnvironment(),
4037
+ performance: this.getPerformanceInfo(),
4038
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
4039
+ };
4040
+ }
4041
+ /**
4042
+ * Print debug information to console
4043
+ * @param fmp - The FMP client instance
4044
+ */
4045
+ static printDebugInfo(fmp) {
4046
+ if (!this.isDevelopment && !this.isDebugEnabled) {
4047
+ return;
4048
+ }
4049
+ const config = this.createDebugConfig(fmp);
4050
+ console.log("\u{1F527} FMP Debug Information:");
4051
+ console.log("\u{1F4CA} API Stats:", config.apiStats);
4052
+ console.log("\u{1F511} Environment Check:", config.envCheck);
4053
+ console.log("\u26A1 Performance:", config.performance);
4054
+ console.log("\u{1F552} Timestamp:", config.timestamp);
4055
+ }
4056
+ /**
4057
+ * Enable debug mode programmatically
4058
+ */
4059
+ static enableDebugMode() {
4060
+ process.env.FMP_DEBUG = "true";
4061
+ this.isDebugEnabled = true;
4062
+ console.log("\u{1F527} FMP Debug mode enabled");
4063
+ }
4064
+ /**
4065
+ * Disable debug mode programmatically
4066
+ */
4067
+ static disableDebugMode() {
4068
+ process.env.FMP_DEBUG = "false";
4069
+ this.isDebugEnabled = false;
4070
+ console.log("\u{1F527} FMP Debug mode disabled");
4071
+ }
4072
+ /**
4073
+ * Check if debug mode is enabled
4074
+ * @returns True if debug mode is enabled
4075
+ */
4076
+ static isDebugMode() {
4077
+ return this.isDevelopment || this.isDebugEnabled;
4078
+ }
4079
+ /**
4080
+ * Create a debug wrapper for API calls
4081
+ * @param fmp - The FMP client instance
4082
+ * @returns FMP client with debug logging
4083
+ */
4084
+ static createDebugWrapper(fmp) {
4085
+ if (!this.isDebugMode()) {
4086
+ return fmp;
4087
+ }
4088
+ return new Proxy(fmp, {
4089
+ get(target, prop) {
4090
+ const value = target[prop];
4091
+ if (typeof value === "object" && value !== null) {
4092
+ return new Proxy(value, {
4093
+ get(endpointTarget, methodName) {
4094
+ const method = endpointTarget[methodName];
4095
+ if (typeof method === "function") {
4096
+ return async (...args) => {
4097
+ const startTime = Date.now();
4098
+ const endpoint = `${String(prop)}.${String(methodName)}`;
4099
+ let params;
4100
+ if (methodName === "getQuote" && args.length === 1 && typeof args[0] === "string") {
4101
+ params = { symbol: args[0] };
4102
+ } else if (args.length === 1 && typeof args[0] === "object" && args[0] !== null) {
4103
+ params = args[0];
4104
+ } else {
4105
+ params = args;
4106
+ }
4107
+ try {
4108
+ _FMPDebug.logApiCall(endpoint, params, null);
4109
+ const result = await method.apply(
4110
+ endpointTarget,
4111
+ args
4112
+ );
4113
+ const duration = Date.now() - startTime;
4114
+ _FMPDebug.logApiCall(endpoint, params, result, duration);
4115
+ return result;
4116
+ } catch (error) {
4117
+ _FMPDebug.logApiError(endpoint, params, error);
4118
+ throw error;
4119
+ }
4120
+ };
4121
+ }
4122
+ return method;
4123
+ }
4124
+ });
4125
+ }
4126
+ return value;
4127
+ }
4128
+ });
4129
+ }
4130
+ };
4131
+ _FMPDebug.isDevelopment = process.env.NODE_ENV === "development";
4132
+ _FMPDebug.isDebugEnabled = process.env.FMP_DEBUG === "true";
4133
+ var FMPDebug = _FMPDebug;
4134
+
4135
+ export { COUNTRIES, CalendarEndpoints, CompanyEndpoints, DEFAULT_LIMIT, DEFAULT_TIMEOUT, ERROR_MESSAGES, ETFEndpoints, EXCHANGES, EconomicEndpoints, Exchange, FMP, FMPClient, FMPDebug, FMPHelpers, FMPUtils, FMPValidation, FinancialEndpoints, 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 };
1598
4136
  //# sourceMappingURL=index.mjs.map
1599
4137
  //# sourceMappingURL=index.mjs.map