fmp-node-api 0.2.0-beta.3 → 0.2.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { FMPConfig, APIResponse, EarningsCalendar, EarningsConfirmed, DividendsCalendar, EconomicsCalendar, IPOCalendar, SplitsCalendar, CompanyProfile, ExecutiveCompensation, CompanyNotes, HistoricalEmployeeCount, SharesFloat, HistoricalSharesFloat, EarningsCallTranscript, CompanyTranscriptData, TreasuryRate, EconomicIndicator, ETFHoldingDates, ETFHolding, ETFHolder, ETFProfile, ETFWeighting, ETFCountryWeighting, ETFStockExposure, IncomeStatement, BalanceSheet, CashFlowStatement, KeyMetrics, FinancialRatios, EnterpriseValue, CashflowGrowth, IncomeGrowth, BalanceSheetGrowth, FinancialGrowth, EarningsHistorical, EarningsSurprises, InsiderTradingRSSResponse, InsiderTradingSearchResponse, TransactionTypesResponse, InsidersBySymbolResponse, InsiderTradeStatisticsResponse, CikMapperResponse, CikMapperBySymbolResponse, BeneficialOwnershipResponse, FailToDeliverResponse, TransactionType, Form13FResponse, InstitutionalHolderResponse, StockList, ETFList, CryptoList, ForexList, AvailableIndexesList, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundHolding, Article, News, Quote, HistoricalPriceResponse, IntradayPrice, ScreenerParams, Screener, AvailableExchanges, AvailableSectors, AvailableIndustries, AvailableCountries, SearchResult, AnalystEstimate, PriceTargetConsensus, PriceTargetSummary, StockGrade, DCFValuation, CompanyRating, TechnicalIndicator, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull, FMPErrorType } from './types-only.mjs';
2
- export { AnalystEstimateSchema, ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyRatingSchema, CompanyTranscriptDataSchema, CryptoListSchema, DCFValuationSchema, DateRangeParams, DividendsCalendarSchema, ETFCountryWeightingSchema, ETFHolderSchema, ETFHoldingDatesSchema, ETFHoldingSchema, ETFListSchema, ETFProfileSchema, ETFStockExposureSchema, ETFWeightingSchema, EarningsCalendarSchema, EarningsCallTranscriptSchema, EarningsConfirmedSchema, EarningsHistoricalSchema, EarningsSurprisesSchema, EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, EconomicsCalendarSchema, EnterpriseValueSchema, Exchange, ExecutiveCompensationSchema, FailToDeliverResponseSchema, FinancialGrowthSchema, FinancialRatiosSchema, ForexListSchema, Form13FResponseSchema, HistoricalEmployeeCountSchema, HistoricalPriceData, HistoricalPriceDataSchema, HistoricalPriceResponseSchema, HistoricalSharesFloatSchema, HouseTradingResponseSchema, IPOCalendarSchema, IncomeGrowthSchema, IncomeStatementSchema, IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, IndustryClassificationCodeSchema, IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, InsiderTradeStatisticsResponseSchema, InsiderTradingRSSResponseSchema, InsiderTradingSearchResponseSchema, InsidersBySymbolResponseSchema, InstitutionalHolderResponseSchema, IntradayPriceSchema, KeyMetricsSchema, MarketCapSchema, MarketHoliday, MarketHolidaySchema, MarketHoursSchema, MarketIndexSchema, MarketPerformanceSchema, MarketSectorPerformanceSchema, MutualFundHoldingSchema, NewsSchema, PaginationParams, Period, PeriodParams, PriceTargetConsensusSchema, PriceTargetSummarySchema, QueryParams, QuoteSchema, RSSFeed8KItemSchema, RSSFeed8KParams, RSSFeed8KParamsSchema, RSSFeedAllItemSchema, RSSFeedItemSchema, RSSFeedParams, RSSFeedParamsSchema, RSSFeedV3ItemSchema, RSSFeedV3Params, RSSFeedV3ParamsSchema, SECFilingSchema, SECFilingsParams, SECFilingsParamsSchema, ScreenerParamsSchema, ScreenerSchema, SearchResultSchema, SenateHouseTradingByNameResponseSchema, SenateTradingResponseSchema, SharesFloatSchema, SplitsCalendarSchema, StockDividend, StockDividendResponseSchema, StockDividendSchema, StockGradeSchema, StockListResponse, StockListSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TechnicalIndicatorSchema, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.mjs';
1
+ import { FMPConfig, APIResponse, EarningsCalendar, EarningsConfirmed, DividendsCalendar, EconomicsCalendar, IPOCalendar, SplitsCalendar, CompanyProfile, ExecutiveCompensation, CompanyNotes, HistoricalEmployeeCount, SharesFloat, HistoricalSharesFloat, EarningsCallTranscript, CompanyTranscriptData, StockPeer, TreasuryRate, EconomicIndicator, ETFHoldingDates, ETFHolding, ETFHolder, ETFProfile, ETFWeighting, ETFCountryWeighting, ETFStockExposure, IncomeStatement, BalanceSheet, CashFlowStatement, KeyMetrics, FinancialRatios, EnterpriseValue, CashflowGrowth, IncomeGrowth, BalanceSheetGrowth, FinancialGrowth, EarningsHistorical, EarningsSurprises, FinancialScores, KeyMetricsTTM, FinancialRatiosTTM, RevenueProductSegmentation, RevenueGeographicSegmentation, InsiderTradingRSSResponse, InsiderTradingSearchResponse, TransactionTypesResponse, InsidersBySymbolResponse, InsiderTradeStatisticsResponse, CikMapperResponse, CikMapperBySymbolResponse, BeneficialOwnershipResponse, FailToDeliverResponse, TransactionType, Form13FResponse, InstitutionalHolderResponse, StockList, ETFList, CryptoList, ForexList, AvailableIndexesList, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundHolding, Article, News, Quote, HistoricalPriceResponse, IntradayPrice, ScreenerParams, Screener, AvailableExchanges, AvailableSectors, AvailableIndustries, AvailableCountries, SearchResult, AnalystEstimate, PriceTargetConsensus, PriceTargetSummary, StockGrade, GradesConsensus, DCFValuation, CompanyRating, TechnicalIndicator, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull, FMPErrorType } from './types-only.mjs';
2
+ export { AnalystEstimateSchema, ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyRatingSchema, CompanyTranscriptDataSchema, CryptoListSchema, DCFValuationSchema, DateRangeParams, DividendsCalendarSchema, ETFCountryWeightingSchema, ETFHolderSchema, ETFHoldingDatesSchema, ETFHoldingSchema, ETFListSchema, ETFProfileSchema, ETFStockExposureSchema, ETFWeightingSchema, EarningsCalendarSchema, EarningsCallTranscriptSchema, EarningsConfirmedSchema, EarningsHistoricalSchema, EarningsSurprisesSchema, EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, EconomicsCalendarSchema, EnterpriseValueSchema, Exchange, ExecutiveCompensationSchema, FailToDeliverResponseSchema, FinancialGrowthSchema, FinancialRatiosSchema, FinancialRatiosTTMSchema, FinancialScoresSchema, ForexListSchema, Form13FResponseSchema, GradesConsensusSchema, HistoricalEmployeeCountSchema, HistoricalPriceData, HistoricalPriceDataSchema, HistoricalPriceResponseSchema, HistoricalSharesFloatSchema, HouseTradingResponseSchema, IPOCalendarSchema, IncomeGrowthSchema, IncomeStatementSchema, IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, IndustryClassificationCodeSchema, IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, InsiderTradeStatisticsResponseSchema, InsiderTradingRSSResponseSchema, InsiderTradingSearchResponseSchema, InsidersBySymbolResponseSchema, InstitutionalHolderResponseSchema, IntradayPriceSchema, KeyMetricsSchema, KeyMetricsTTMSchema, MarketCapSchema, MarketHoliday, MarketHolidaySchema, MarketHoursSchema, MarketIndexSchema, MarketPerformanceSchema, MarketSectorPerformanceSchema, MutualFundHoldingSchema, NewsSchema, PaginationParams, Period, PeriodParams, PriceTargetConsensusSchema, PriceTargetSummarySchema, QueryParams, QuoteSchema, RSSFeed8KItemSchema, RSSFeed8KParams, RSSFeed8KParamsSchema, RSSFeedAllItemSchema, RSSFeedItemSchema, RSSFeedParams, RSSFeedParamsSchema, RSSFeedV3ItemSchema, RSSFeedV3Params, RSSFeedV3ParamsSchema, RevenueGeographicSegmentationSchema, RevenueProductSegmentationSchema, RevenueSegmentationSchema, SECFilingSchema, SECFilingsParams, SECFilingsParamsSchema, ScreenerParamsSchema, ScreenerSchema, SearchResultSchema, SenateHouseTradingByNameResponseSchema, SenateTradingResponseSchema, SharesFloatSchema, SplitsCalendarSchema, StockDividend, StockDividendResponseSchema, StockDividendSchema, StockGradeSchema, StockListResponse, StockListSchema, StockPeerSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TechnicalIndicatorSchema, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.mjs';
3
3
  export { FMPValidation } from './utils/validation.mjs';
4
4
  import 'zod';
5
5
 
@@ -490,6 +490,26 @@ declare class CompanyEndpoints {
490
490
  * @see {@link https://site.financialmodelingprep.com/developer/docs#transcript-dates-earnings-transcripts|FMP Company Transcript Data Documentation}
491
491
  */
492
492
  getCompanyTranscriptData(symbol: string): Promise<APIResponse<CompanyTranscriptData[]>>;
493
+ /**
494
+ * Get peer companies for a stock
495
+ *
496
+ * Provides a list of comparable companies (peers) for a stock, each with its
497
+ * current price and market cap. Useful for relative valuation and "compare X to
498
+ * its peers" analysis.
499
+ *
500
+ * @param symbol - The stock symbol to get peers for (e.g., 'AAPL', 'MSFT', 'GOOGL')
501
+ *
502
+ * @returns Promise resolving to an array of peer companies with price and market cap
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const peers = await fmp.company.getStockPeers('AAPL');
507
+ * peers.data.forEach(p => console.log(`${p.symbol} (${p.companyName}): $${p.price}`));
508
+ * ```
509
+ *
510
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#stock-peers|FMP Stock Peers Documentation}
511
+ */
512
+ getStockPeers(symbol: string): Promise<APIResponse<StockPeer[]>>;
493
513
  }
494
514
 
495
515
  declare class EconomicEndpoints {
@@ -1163,6 +1183,120 @@ declare class FinancialEndpoints {
1163
1183
  * @see {@link https://site.financialmodelingprep.com/developer/docs#earnings-surprises-earnings|FMP Earnings Surprises Documentation}
1164
1184
  */
1165
1185
  getEarningsSurprises(symbol: string): Promise<APIResponse<EarningsSurprises[]>>;
1186
+ /**
1187
+ * Get financial health scores for a company
1188
+ *
1189
+ * Provides the Altman Z-Score (bankruptcy-risk indicator) and Piotroski Score
1190
+ * (fundamental-strength score, 0-9) along with the underlying components.
1191
+ * A single, high-signal snapshot of a company's financial health.
1192
+ *
1193
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1194
+ *
1195
+ * @returns Promise resolving to the company's financial scores
1196
+ *
1197
+ * @example
1198
+ * ```typescript
1199
+ * const scores = await fmp.financial.getFinancialScores({ symbol: 'AAPL' });
1200
+ * console.log(`Altman Z: ${scores.data.altmanZScore}, Piotroski: ${scores.data.piotroskiScore}`);
1201
+ * ```
1202
+ *
1203
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#financial-scores|FMP Financial Scores Documentation}
1204
+ */
1205
+ getFinancialScores(params: {
1206
+ symbol: string;
1207
+ }): Promise<APIResponse<FinancialScores>>;
1208
+ /**
1209
+ * Get trailing-twelve-month (TTM) key metrics for a company
1210
+ *
1211
+ * Provides a single current snapshot of key valuation and performance metrics
1212
+ * (EV multiples, returns, per-share figures) computed over the trailing twelve
1213
+ * months. More token-efficient than the multi-period key-metrics statement when
1214
+ * you only need the company's latest standing.
1215
+ *
1216
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1217
+ *
1218
+ * @returns Promise resolving to the company's TTM key metrics
1219
+ *
1220
+ * @example
1221
+ * ```typescript
1222
+ * const ttm = await fmp.financial.getKeyMetricsTTM({ symbol: 'AAPL' });
1223
+ * console.log(`EV/EBITDA: ${ttm.data.evToEBITDATTM}, ROE: ${ttm.data.returnOnEquityTTM}`);
1224
+ * ```
1225
+ *
1226
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#key-metrics-ttm|FMP Key Metrics TTM Documentation}
1227
+ */
1228
+ getKeyMetricsTTM(params: {
1229
+ symbol: string;
1230
+ }): Promise<APIResponse<KeyMetricsTTM>>;
1231
+ /**
1232
+ * Get trailing-twelve-month (TTM) financial ratios for a company
1233
+ *
1234
+ * Provides a single current snapshot of profitability, liquidity, leverage, and
1235
+ * per-share ratios computed over the trailing twelve months. Ideal for "what is
1236
+ * this company's current P/E / margins / ROE" questions.
1237
+ *
1238
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1239
+ *
1240
+ * @returns Promise resolving to the company's TTM financial ratios
1241
+ *
1242
+ * @example
1243
+ * ```typescript
1244
+ * const ratios = await fmp.financial.getFinancialRatiosTTM({ symbol: 'AAPL' });
1245
+ * console.log(`P/E: ${ratios.data.priceToEarningsRatioTTM}, Net margin: ${ratios.data.netProfitMarginTTM}`);
1246
+ * ```
1247
+ *
1248
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#ratios-ttm|FMP Financial Ratios TTM Documentation}
1249
+ */
1250
+ getFinancialRatiosTTM(params: {
1251
+ symbol: string;
1252
+ }): Promise<APIResponse<FinancialRatiosTTM>>;
1253
+ /**
1254
+ * Get revenue broken down by product line for a company
1255
+ *
1256
+ * Provides per-period revenue segmented by product/service line. Useful for
1257
+ * understanding which products drive a company's revenue and how the mix shifts
1258
+ * over time.
1259
+ *
1260
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1261
+ * @param params.period - The reporting period: 'annual' or 'quarter' (optional)
1262
+ *
1263
+ * @returns Promise resolving to an array of per-period product revenue breakdowns
1264
+ *
1265
+ * @example
1266
+ * ```typescript
1267
+ * const seg = await fmp.financial.getRevenueProductSegmentation({ symbol: 'AAPL' });
1268
+ * console.log(seg.data[0].data); // { iPhone: ..., Mac: ..., Service: ..., ... }
1269
+ * ```
1270
+ *
1271
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#revenue-product-segmentation|FMP Revenue Product Segmentation Documentation}
1272
+ */
1273
+ getRevenueProductSegmentation(params: {
1274
+ symbol: string;
1275
+ period?: 'annual' | 'quarter';
1276
+ }): Promise<APIResponse<RevenueProductSegmentation[]>>;
1277
+ /**
1278
+ * Get revenue broken down by geographic region for a company
1279
+ *
1280
+ * Provides per-period revenue segmented by geographic region. Useful for
1281
+ * understanding a company's regional exposure and how it shifts over time.
1282
+ *
1283
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1284
+ * @param params.period - The reporting period: 'annual' or 'quarter' (optional)
1285
+ *
1286
+ * @returns Promise resolving to an array of per-period geographic revenue breakdowns
1287
+ *
1288
+ * @example
1289
+ * ```typescript
1290
+ * const seg = await fmp.financial.getRevenueGeographicSegmentation({ symbol: 'AAPL' });
1291
+ * console.log(seg.data[0].data); // { 'Americas Segment': ..., 'Europe Segment': ..., ... }
1292
+ * ```
1293
+ *
1294
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#revenue-geographic-segmentation|FMP Revenue Geographic Segmentation Documentation}
1295
+ */
1296
+ getRevenueGeographicSegmentation(params: {
1297
+ symbol: string;
1298
+ period?: 'annual' | 'quarter';
1299
+ }): Promise<APIResponse<RevenueGeographicSegmentation[]>>;
1166
1300
  }
1167
1301
 
1168
1302
  declare class InsiderEndpoints {
@@ -2770,6 +2904,13 @@ declare class AnalystEndpoints {
2770
2904
  getGrades(params: {
2771
2905
  symbol: string;
2772
2906
  }): Promise<APIResponse<StockGrade[]>>;
2907
+ /**
2908
+ * Get the analyst rating consensus for a company: the count of analysts at each
2909
+ * rating (strongBuy/buy/hold/sell/strongSell) plus the overall consensus label.
2910
+ */
2911
+ getGradesConsensus(params: {
2912
+ symbol: string;
2913
+ }): Promise<APIResponse<GradesConsensus>>;
2773
2914
  }
2774
2915
 
2775
2916
  declare class ValuationEndpoints {
@@ -3565,4 +3706,4 @@ declare class FMPError extends Error {
3565
3706
  constructor(message: string, status?: number | undefined, code?: string | undefined);
3566
3707
  }
3567
3708
 
3568
- export { APIResponse, AnalystEndpoints, AnalystEstimate, Article, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, type ClassifiedError, CompanyEndpoints, CompanyNotes, CompanyProfile, CompanyRating, CompanyTranscriptData, CryptoList, DCFValuation, DEFAULT_LIMIT, DEFAULT_TIMEOUT, DividendsCalendar, ETFCountryWeighting, ETFEndpoints, ETFHolder, ETFHolding, ETFHoldingDates, ETFList, ETFProfile, ETFStockExposure, ETFWeighting, EXCHANGES, EarningsCalendar, EarningsCallTranscript, EarningsConfirmed, EarningsHistorical, EarningsSurprises, EconomicEndpoints, EconomicIndicator, EconomicsCalendar, EnterpriseValue, ExecutiveCompensation, FMP, FMPClient, FMPConfig, FMPError, FMPErrorType, FailToDeliverResponse, FinancialEndpoints, FinancialGrowth, FinancialRatios, ForexList, Form13FResponse, HistoricalEmployeeCount, HistoricalPriceResponse, HistoricalSharesFloat, HouseTradingResponse, IPOCalendar, IncomeGrowth, IncomeStatement, IndustryClassification, IndustryClassificationCode, InsiderEndpoints, InsiderTradeStatisticsResponse, InsiderTradingRSSResponse, InsiderTradingSearchResponse, InsidersBySymbolResponse, InstitutionalEndpoints, InstitutionalHolderResponse, IntradayPrice, KeyMetrics, ListEndpoints, MAX_LIMIT, MarketCap, MarketEndpoints, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundEndpoints, MutualFundHolding, News, NewsEndpoints, PERIODS, PriceTargetConsensus, PriceTargetSummary, Quote, QuoteEndpoints, RSSFeed8KItem, RSSFeedAllItem, RSSFeedItem, RSSFeedV3Item, SECEndpoints, SECFiling, SECTORS, Screener, ScreenerEndpoints, ScreenerParams, SearchEndpoints, SearchResult, SenateHouseEndpoints, SenateHouseTradingByNameResponse, SenateTradingResponse, SharesFloat, SplitsCalendar, StockDividendResponse, StockEndpoints, StockGrade, StockList, StockRealTimePrice, StockRealTimePriceFull, StockSplitResponse, TechnicalEndpoints, TechnicalIndicator, TransactionType, TransactionTypesResponse, TreasuryRate, ValuationEndpoints, classifyError, formatCurrency, formatDate, formatLargeNumber, formatPercentage, formatVolume };
3709
+ export { APIResponse, AnalystEndpoints, AnalystEstimate, Article, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, type ClassifiedError, CompanyEndpoints, CompanyNotes, CompanyProfile, CompanyRating, CompanyTranscriptData, CryptoList, DCFValuation, DEFAULT_LIMIT, DEFAULT_TIMEOUT, DividendsCalendar, ETFCountryWeighting, ETFEndpoints, ETFHolder, ETFHolding, ETFHoldingDates, ETFList, ETFProfile, ETFStockExposure, ETFWeighting, EXCHANGES, EarningsCalendar, EarningsCallTranscript, EarningsConfirmed, EarningsHistorical, EarningsSurprises, EconomicEndpoints, EconomicIndicator, EconomicsCalendar, EnterpriseValue, ExecutiveCompensation, FMP, FMPClient, FMPConfig, FMPError, FMPErrorType, FailToDeliverResponse, FinancialEndpoints, FinancialGrowth, FinancialRatios, FinancialRatiosTTM, FinancialScores, ForexList, Form13FResponse, GradesConsensus, HistoricalEmployeeCount, HistoricalPriceResponse, HistoricalSharesFloat, HouseTradingResponse, IPOCalendar, IncomeGrowth, IncomeStatement, IndustryClassification, IndustryClassificationCode, InsiderEndpoints, InsiderTradeStatisticsResponse, InsiderTradingRSSResponse, InsiderTradingSearchResponse, InsidersBySymbolResponse, InstitutionalEndpoints, InstitutionalHolderResponse, IntradayPrice, KeyMetrics, KeyMetricsTTM, ListEndpoints, MAX_LIMIT, MarketCap, MarketEndpoints, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundEndpoints, MutualFundHolding, News, NewsEndpoints, PERIODS, PriceTargetConsensus, PriceTargetSummary, Quote, QuoteEndpoints, RSSFeed8KItem, RSSFeedAllItem, RSSFeedItem, RSSFeedV3Item, RevenueGeographicSegmentation, RevenueProductSegmentation, SECEndpoints, SECFiling, SECTORS, Screener, ScreenerEndpoints, ScreenerParams, SearchEndpoints, SearchResult, SenateHouseEndpoints, SenateHouseTradingByNameResponse, SenateTradingResponse, SharesFloat, SplitsCalendar, StockDividendResponse, StockEndpoints, StockGrade, StockList, StockPeer, StockRealTimePrice, StockRealTimePriceFull, StockSplitResponse, TechnicalEndpoints, TechnicalIndicator, TransactionType, TransactionTypesResponse, TreasuryRate, ValuationEndpoints, classifyError, formatCurrency, formatDate, formatLargeNumber, formatPercentage, formatVolume };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { FMPConfig, APIResponse, EarningsCalendar, EarningsConfirmed, DividendsCalendar, EconomicsCalendar, IPOCalendar, SplitsCalendar, CompanyProfile, ExecutiveCompensation, CompanyNotes, HistoricalEmployeeCount, SharesFloat, HistoricalSharesFloat, EarningsCallTranscript, CompanyTranscriptData, TreasuryRate, EconomicIndicator, ETFHoldingDates, ETFHolding, ETFHolder, ETFProfile, ETFWeighting, ETFCountryWeighting, ETFStockExposure, IncomeStatement, BalanceSheet, CashFlowStatement, KeyMetrics, FinancialRatios, EnterpriseValue, CashflowGrowth, IncomeGrowth, BalanceSheetGrowth, FinancialGrowth, EarningsHistorical, EarningsSurprises, InsiderTradingRSSResponse, InsiderTradingSearchResponse, TransactionTypesResponse, InsidersBySymbolResponse, InsiderTradeStatisticsResponse, CikMapperResponse, CikMapperBySymbolResponse, BeneficialOwnershipResponse, FailToDeliverResponse, TransactionType, Form13FResponse, InstitutionalHolderResponse, StockList, ETFList, CryptoList, ForexList, AvailableIndexesList, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundHolding, Article, News, Quote, HistoricalPriceResponse, IntradayPrice, ScreenerParams, Screener, AvailableExchanges, AvailableSectors, AvailableIndustries, AvailableCountries, SearchResult, AnalystEstimate, PriceTargetConsensus, PriceTargetSummary, StockGrade, DCFValuation, CompanyRating, TechnicalIndicator, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull, FMPErrorType } from './types-only.js';
2
- export { AnalystEstimateSchema, ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyRatingSchema, CompanyTranscriptDataSchema, CryptoListSchema, DCFValuationSchema, DateRangeParams, DividendsCalendarSchema, ETFCountryWeightingSchema, ETFHolderSchema, ETFHoldingDatesSchema, ETFHoldingSchema, ETFListSchema, ETFProfileSchema, ETFStockExposureSchema, ETFWeightingSchema, EarningsCalendarSchema, EarningsCallTranscriptSchema, EarningsConfirmedSchema, EarningsHistoricalSchema, EarningsSurprisesSchema, EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, EconomicsCalendarSchema, EnterpriseValueSchema, Exchange, ExecutiveCompensationSchema, FailToDeliverResponseSchema, FinancialGrowthSchema, FinancialRatiosSchema, ForexListSchema, Form13FResponseSchema, HistoricalEmployeeCountSchema, HistoricalPriceData, HistoricalPriceDataSchema, HistoricalPriceResponseSchema, HistoricalSharesFloatSchema, HouseTradingResponseSchema, IPOCalendarSchema, IncomeGrowthSchema, IncomeStatementSchema, IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, IndustryClassificationCodeSchema, IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, InsiderTradeStatisticsResponseSchema, InsiderTradingRSSResponseSchema, InsiderTradingSearchResponseSchema, InsidersBySymbolResponseSchema, InstitutionalHolderResponseSchema, IntradayPriceSchema, KeyMetricsSchema, MarketCapSchema, MarketHoliday, MarketHolidaySchema, MarketHoursSchema, MarketIndexSchema, MarketPerformanceSchema, MarketSectorPerformanceSchema, MutualFundHoldingSchema, NewsSchema, PaginationParams, Period, PeriodParams, PriceTargetConsensusSchema, PriceTargetSummarySchema, QueryParams, QuoteSchema, RSSFeed8KItemSchema, RSSFeed8KParams, RSSFeed8KParamsSchema, RSSFeedAllItemSchema, RSSFeedItemSchema, RSSFeedParams, RSSFeedParamsSchema, RSSFeedV3ItemSchema, RSSFeedV3Params, RSSFeedV3ParamsSchema, SECFilingSchema, SECFilingsParams, SECFilingsParamsSchema, ScreenerParamsSchema, ScreenerSchema, SearchResultSchema, SenateHouseTradingByNameResponseSchema, SenateTradingResponseSchema, SharesFloatSchema, SplitsCalendarSchema, StockDividend, StockDividendResponseSchema, StockDividendSchema, StockGradeSchema, StockListResponse, StockListSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TechnicalIndicatorSchema, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.js';
1
+ import { FMPConfig, APIResponse, EarningsCalendar, EarningsConfirmed, DividendsCalendar, EconomicsCalendar, IPOCalendar, SplitsCalendar, CompanyProfile, ExecutiveCompensation, CompanyNotes, HistoricalEmployeeCount, SharesFloat, HistoricalSharesFloat, EarningsCallTranscript, CompanyTranscriptData, StockPeer, TreasuryRate, EconomicIndicator, ETFHoldingDates, ETFHolding, ETFHolder, ETFProfile, ETFWeighting, ETFCountryWeighting, ETFStockExposure, IncomeStatement, BalanceSheet, CashFlowStatement, KeyMetrics, FinancialRatios, EnterpriseValue, CashflowGrowth, IncomeGrowth, BalanceSheetGrowth, FinancialGrowth, EarningsHistorical, EarningsSurprises, FinancialScores, KeyMetricsTTM, FinancialRatiosTTM, RevenueProductSegmentation, RevenueGeographicSegmentation, InsiderTradingRSSResponse, InsiderTradingSearchResponse, TransactionTypesResponse, InsidersBySymbolResponse, InsiderTradeStatisticsResponse, CikMapperResponse, CikMapperBySymbolResponse, BeneficialOwnershipResponse, FailToDeliverResponse, TransactionType, Form13FResponse, InstitutionalHolderResponse, StockList, ETFList, CryptoList, ForexList, AvailableIndexesList, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundHolding, Article, News, Quote, HistoricalPriceResponse, IntradayPrice, ScreenerParams, Screener, AvailableExchanges, AvailableSectors, AvailableIndustries, AvailableCountries, SearchResult, AnalystEstimate, PriceTargetConsensus, PriceTargetSummary, StockGrade, GradesConsensus, DCFValuation, CompanyRating, TechnicalIndicator, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull, FMPErrorType } from './types-only.js';
2
+ export { AnalystEstimateSchema, ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyRatingSchema, CompanyTranscriptDataSchema, CryptoListSchema, DCFValuationSchema, DateRangeParams, DividendsCalendarSchema, ETFCountryWeightingSchema, ETFHolderSchema, ETFHoldingDatesSchema, ETFHoldingSchema, ETFListSchema, ETFProfileSchema, ETFStockExposureSchema, ETFWeightingSchema, EarningsCalendarSchema, EarningsCallTranscriptSchema, EarningsConfirmedSchema, EarningsHistoricalSchema, EarningsSurprisesSchema, EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, EconomicsCalendarSchema, EnterpriseValueSchema, Exchange, ExecutiveCompensationSchema, FailToDeliverResponseSchema, FinancialGrowthSchema, FinancialRatiosSchema, FinancialRatiosTTMSchema, FinancialScoresSchema, ForexListSchema, Form13FResponseSchema, GradesConsensusSchema, HistoricalEmployeeCountSchema, HistoricalPriceData, HistoricalPriceDataSchema, HistoricalPriceResponseSchema, HistoricalSharesFloatSchema, HouseTradingResponseSchema, IPOCalendarSchema, IncomeGrowthSchema, IncomeStatementSchema, IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, IndustryClassificationCodeSchema, IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, InsiderTradeStatisticsResponseSchema, InsiderTradingRSSResponseSchema, InsiderTradingSearchResponseSchema, InsidersBySymbolResponseSchema, InstitutionalHolderResponseSchema, IntradayPriceSchema, KeyMetricsSchema, KeyMetricsTTMSchema, MarketCapSchema, MarketHoliday, MarketHolidaySchema, MarketHoursSchema, MarketIndexSchema, MarketPerformanceSchema, MarketSectorPerformanceSchema, MutualFundHoldingSchema, NewsSchema, PaginationParams, Period, PeriodParams, PriceTargetConsensusSchema, PriceTargetSummarySchema, QueryParams, QuoteSchema, RSSFeed8KItemSchema, RSSFeed8KParams, RSSFeed8KParamsSchema, RSSFeedAllItemSchema, RSSFeedItemSchema, RSSFeedParams, RSSFeedParamsSchema, RSSFeedV3ItemSchema, RSSFeedV3Params, RSSFeedV3ParamsSchema, RevenueGeographicSegmentationSchema, RevenueProductSegmentationSchema, RevenueSegmentationSchema, SECFilingSchema, SECFilingsParams, SECFilingsParamsSchema, ScreenerParamsSchema, ScreenerSchema, SearchResultSchema, SenateHouseTradingByNameResponseSchema, SenateTradingResponseSchema, SharesFloatSchema, SplitsCalendarSchema, StockDividend, StockDividendResponseSchema, StockDividendSchema, StockGradeSchema, StockListResponse, StockListSchema, StockPeerSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TechnicalIndicatorSchema, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.js';
3
3
  export { FMPValidation } from './utils/validation.js';
4
4
  import 'zod';
5
5
 
@@ -490,6 +490,26 @@ declare class CompanyEndpoints {
490
490
  * @see {@link https://site.financialmodelingprep.com/developer/docs#transcript-dates-earnings-transcripts|FMP Company Transcript Data Documentation}
491
491
  */
492
492
  getCompanyTranscriptData(symbol: string): Promise<APIResponse<CompanyTranscriptData[]>>;
493
+ /**
494
+ * Get peer companies for a stock
495
+ *
496
+ * Provides a list of comparable companies (peers) for a stock, each with its
497
+ * current price and market cap. Useful for relative valuation and "compare X to
498
+ * its peers" analysis.
499
+ *
500
+ * @param symbol - The stock symbol to get peers for (e.g., 'AAPL', 'MSFT', 'GOOGL')
501
+ *
502
+ * @returns Promise resolving to an array of peer companies with price and market cap
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const peers = await fmp.company.getStockPeers('AAPL');
507
+ * peers.data.forEach(p => console.log(`${p.symbol} (${p.companyName}): $${p.price}`));
508
+ * ```
509
+ *
510
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#stock-peers|FMP Stock Peers Documentation}
511
+ */
512
+ getStockPeers(symbol: string): Promise<APIResponse<StockPeer[]>>;
493
513
  }
494
514
 
495
515
  declare class EconomicEndpoints {
@@ -1163,6 +1183,120 @@ declare class FinancialEndpoints {
1163
1183
  * @see {@link https://site.financialmodelingprep.com/developer/docs#earnings-surprises-earnings|FMP Earnings Surprises Documentation}
1164
1184
  */
1165
1185
  getEarningsSurprises(symbol: string): Promise<APIResponse<EarningsSurprises[]>>;
1186
+ /**
1187
+ * Get financial health scores for a company
1188
+ *
1189
+ * Provides the Altman Z-Score (bankruptcy-risk indicator) and Piotroski Score
1190
+ * (fundamental-strength score, 0-9) along with the underlying components.
1191
+ * A single, high-signal snapshot of a company's financial health.
1192
+ *
1193
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1194
+ *
1195
+ * @returns Promise resolving to the company's financial scores
1196
+ *
1197
+ * @example
1198
+ * ```typescript
1199
+ * const scores = await fmp.financial.getFinancialScores({ symbol: 'AAPL' });
1200
+ * console.log(`Altman Z: ${scores.data.altmanZScore}, Piotroski: ${scores.data.piotroskiScore}`);
1201
+ * ```
1202
+ *
1203
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#financial-scores|FMP Financial Scores Documentation}
1204
+ */
1205
+ getFinancialScores(params: {
1206
+ symbol: string;
1207
+ }): Promise<APIResponse<FinancialScores>>;
1208
+ /**
1209
+ * Get trailing-twelve-month (TTM) key metrics for a company
1210
+ *
1211
+ * Provides a single current snapshot of key valuation and performance metrics
1212
+ * (EV multiples, returns, per-share figures) computed over the trailing twelve
1213
+ * months. More token-efficient than the multi-period key-metrics statement when
1214
+ * you only need the company's latest standing.
1215
+ *
1216
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1217
+ *
1218
+ * @returns Promise resolving to the company's TTM key metrics
1219
+ *
1220
+ * @example
1221
+ * ```typescript
1222
+ * const ttm = await fmp.financial.getKeyMetricsTTM({ symbol: 'AAPL' });
1223
+ * console.log(`EV/EBITDA: ${ttm.data.evToEBITDATTM}, ROE: ${ttm.data.returnOnEquityTTM}`);
1224
+ * ```
1225
+ *
1226
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#key-metrics-ttm|FMP Key Metrics TTM Documentation}
1227
+ */
1228
+ getKeyMetricsTTM(params: {
1229
+ symbol: string;
1230
+ }): Promise<APIResponse<KeyMetricsTTM>>;
1231
+ /**
1232
+ * Get trailing-twelve-month (TTM) financial ratios for a company
1233
+ *
1234
+ * Provides a single current snapshot of profitability, liquidity, leverage, and
1235
+ * per-share ratios computed over the trailing twelve months. Ideal for "what is
1236
+ * this company's current P/E / margins / ROE" questions.
1237
+ *
1238
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1239
+ *
1240
+ * @returns Promise resolving to the company's TTM financial ratios
1241
+ *
1242
+ * @example
1243
+ * ```typescript
1244
+ * const ratios = await fmp.financial.getFinancialRatiosTTM({ symbol: 'AAPL' });
1245
+ * console.log(`P/E: ${ratios.data.priceToEarningsRatioTTM}, Net margin: ${ratios.data.netProfitMarginTTM}`);
1246
+ * ```
1247
+ *
1248
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#ratios-ttm|FMP Financial Ratios TTM Documentation}
1249
+ */
1250
+ getFinancialRatiosTTM(params: {
1251
+ symbol: string;
1252
+ }): Promise<APIResponse<FinancialRatiosTTM>>;
1253
+ /**
1254
+ * Get revenue broken down by product line for a company
1255
+ *
1256
+ * Provides per-period revenue segmented by product/service line. Useful for
1257
+ * understanding which products drive a company's revenue and how the mix shifts
1258
+ * over time.
1259
+ *
1260
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1261
+ * @param params.period - The reporting period: 'annual' or 'quarter' (optional)
1262
+ *
1263
+ * @returns Promise resolving to an array of per-period product revenue breakdowns
1264
+ *
1265
+ * @example
1266
+ * ```typescript
1267
+ * const seg = await fmp.financial.getRevenueProductSegmentation({ symbol: 'AAPL' });
1268
+ * console.log(seg.data[0].data); // { iPhone: ..., Mac: ..., Service: ..., ... }
1269
+ * ```
1270
+ *
1271
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#revenue-product-segmentation|FMP Revenue Product Segmentation Documentation}
1272
+ */
1273
+ getRevenueProductSegmentation(params: {
1274
+ symbol: string;
1275
+ period?: 'annual' | 'quarter';
1276
+ }): Promise<APIResponse<RevenueProductSegmentation[]>>;
1277
+ /**
1278
+ * Get revenue broken down by geographic region for a company
1279
+ *
1280
+ * Provides per-period revenue segmented by geographic region. Useful for
1281
+ * understanding a company's regional exposure and how it shifts over time.
1282
+ *
1283
+ * @param params.symbol - The stock symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')
1284
+ * @param params.period - The reporting period: 'annual' or 'quarter' (optional)
1285
+ *
1286
+ * @returns Promise resolving to an array of per-period geographic revenue breakdowns
1287
+ *
1288
+ * @example
1289
+ * ```typescript
1290
+ * const seg = await fmp.financial.getRevenueGeographicSegmentation({ symbol: 'AAPL' });
1291
+ * console.log(seg.data[0].data); // { 'Americas Segment': ..., 'Europe Segment': ..., ... }
1292
+ * ```
1293
+ *
1294
+ * @see {@link https://site.financialmodelingprep.com/developer/docs/stable#revenue-geographic-segmentation|FMP Revenue Geographic Segmentation Documentation}
1295
+ */
1296
+ getRevenueGeographicSegmentation(params: {
1297
+ symbol: string;
1298
+ period?: 'annual' | 'quarter';
1299
+ }): Promise<APIResponse<RevenueGeographicSegmentation[]>>;
1166
1300
  }
1167
1301
 
1168
1302
  declare class InsiderEndpoints {
@@ -2770,6 +2904,13 @@ declare class AnalystEndpoints {
2770
2904
  getGrades(params: {
2771
2905
  symbol: string;
2772
2906
  }): Promise<APIResponse<StockGrade[]>>;
2907
+ /**
2908
+ * Get the analyst rating consensus for a company: the count of analysts at each
2909
+ * rating (strongBuy/buy/hold/sell/strongSell) plus the overall consensus label.
2910
+ */
2911
+ getGradesConsensus(params: {
2912
+ symbol: string;
2913
+ }): Promise<APIResponse<GradesConsensus>>;
2773
2914
  }
2774
2915
 
2775
2916
  declare class ValuationEndpoints {
@@ -3565,4 +3706,4 @@ declare class FMPError extends Error {
3565
3706
  constructor(message: string, status?: number | undefined, code?: string | undefined);
3566
3707
  }
3567
3708
 
3568
- export { APIResponse, AnalystEndpoints, AnalystEstimate, Article, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, type ClassifiedError, CompanyEndpoints, CompanyNotes, CompanyProfile, CompanyRating, CompanyTranscriptData, CryptoList, DCFValuation, DEFAULT_LIMIT, DEFAULT_TIMEOUT, DividendsCalendar, ETFCountryWeighting, ETFEndpoints, ETFHolder, ETFHolding, ETFHoldingDates, ETFList, ETFProfile, ETFStockExposure, ETFWeighting, EXCHANGES, EarningsCalendar, EarningsCallTranscript, EarningsConfirmed, EarningsHistorical, EarningsSurprises, EconomicEndpoints, EconomicIndicator, EconomicsCalendar, EnterpriseValue, ExecutiveCompensation, FMP, FMPClient, FMPConfig, FMPError, FMPErrorType, FailToDeliverResponse, FinancialEndpoints, FinancialGrowth, FinancialRatios, ForexList, Form13FResponse, HistoricalEmployeeCount, HistoricalPriceResponse, HistoricalSharesFloat, HouseTradingResponse, IPOCalendar, IncomeGrowth, IncomeStatement, IndustryClassification, IndustryClassificationCode, InsiderEndpoints, InsiderTradeStatisticsResponse, InsiderTradingRSSResponse, InsiderTradingSearchResponse, InsidersBySymbolResponse, InstitutionalEndpoints, InstitutionalHolderResponse, IntradayPrice, KeyMetrics, ListEndpoints, MAX_LIMIT, MarketCap, MarketEndpoints, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundEndpoints, MutualFundHolding, News, NewsEndpoints, PERIODS, PriceTargetConsensus, PriceTargetSummary, Quote, QuoteEndpoints, RSSFeed8KItem, RSSFeedAllItem, RSSFeedItem, RSSFeedV3Item, SECEndpoints, SECFiling, SECTORS, Screener, ScreenerEndpoints, ScreenerParams, SearchEndpoints, SearchResult, SenateHouseEndpoints, SenateHouseTradingByNameResponse, SenateTradingResponse, SharesFloat, SplitsCalendar, StockDividendResponse, StockEndpoints, StockGrade, StockList, StockRealTimePrice, StockRealTimePriceFull, StockSplitResponse, TechnicalEndpoints, TechnicalIndicator, TransactionType, TransactionTypesResponse, TreasuryRate, ValuationEndpoints, classifyError, formatCurrency, formatDate, formatLargeNumber, formatPercentage, formatVolume };
3709
+ export { APIResponse, AnalystEndpoints, AnalystEstimate, Article, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, type ClassifiedError, CompanyEndpoints, CompanyNotes, CompanyProfile, CompanyRating, CompanyTranscriptData, CryptoList, DCFValuation, DEFAULT_LIMIT, DEFAULT_TIMEOUT, DividendsCalendar, ETFCountryWeighting, ETFEndpoints, ETFHolder, ETFHolding, ETFHoldingDates, ETFList, ETFProfile, ETFStockExposure, ETFWeighting, EXCHANGES, EarningsCalendar, EarningsCallTranscript, EarningsConfirmed, EarningsHistorical, EarningsSurprises, EconomicEndpoints, EconomicIndicator, EconomicsCalendar, EnterpriseValue, ExecutiveCompensation, FMP, FMPClient, FMPConfig, FMPError, FMPErrorType, FailToDeliverResponse, FinancialEndpoints, FinancialGrowth, FinancialRatios, FinancialRatiosTTM, FinancialScores, ForexList, Form13FResponse, GradesConsensus, HistoricalEmployeeCount, HistoricalPriceResponse, HistoricalSharesFloat, HouseTradingResponse, IPOCalendar, IncomeGrowth, IncomeStatement, IndustryClassification, IndustryClassificationCode, InsiderEndpoints, InsiderTradeStatisticsResponse, InsiderTradingRSSResponse, InsiderTradingSearchResponse, InsidersBySymbolResponse, InstitutionalEndpoints, InstitutionalHolderResponse, IntradayPrice, KeyMetrics, KeyMetricsTTM, ListEndpoints, MAX_LIMIT, MarketCap, MarketEndpoints, MarketHours, MarketIndex, MarketPerformance, MarketSectorPerformance, MutualFundEndpoints, MutualFundHolding, News, NewsEndpoints, PERIODS, PriceTargetConsensus, PriceTargetSummary, Quote, QuoteEndpoints, RSSFeed8KItem, RSSFeedAllItem, RSSFeedItem, RSSFeedV3Item, RevenueGeographicSegmentation, RevenueProductSegmentation, SECEndpoints, SECFiling, SECTORS, Screener, ScreenerEndpoints, ScreenerParams, SearchEndpoints, SearchResult, SenateHouseEndpoints, SenateHouseTradingByNameResponse, SenateTradingResponse, SharesFloat, SplitsCalendar, StockDividendResponse, StockEndpoints, StockGrade, StockList, StockPeer, StockRealTimePrice, StockRealTimePriceFull, StockSplitResponse, TechnicalEndpoints, TechnicalIndicator, TransactionType, TransactionTypesResponse, TreasuryRate, ValuationEndpoints, classifyError, formatCurrency, formatDate, formatLargeNumber, formatPercentage, formatVolume };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var w=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);var $=[/exclusive endpoint/i,/not available under your current/i,/premium/i,/special endpoint/i,/upgrade your plan/i];function k(n,e){let t=e?.trim()||"Unknown error occurred",s=$.some(r=>r.test(t));return n===429?{errorType:"rate-limit",message:`FMP rate limit reached: ${t}`}:n===401?{errorType:"auth",message:`FMP authentication failed (check your FMP_API_KEY): ${t}`}:n===402||n===403||s?{errorType:"plan-restricted",message:`This endpoint is not available on your current FMP plan. (${n}: ${t})`}:n===404?{errorType:"not-found",message:`Not found: ${t}`}:n===400?{errorType:"bad-request",message:`Invalid request: ${t}`}:n===0?{errorType:"network",message:`Network error: ${t}`}:{errorType:"unknown",message:t}}function N(n){return Array.isArray(n)&&n.length===1?n[0]:n}function _(n){return Array.isArray(n)?n:n??[]}function q(n){return n==null?{}:Array.isArray(n)&&n.length===0?{}:n}var c=class{constructor(e){if(!e.apiKey)throw new Error("API key is required for FMPClient");this.apiKey=e.apiKey,this.v3Client=w__default.default.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=w__default.default.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=w__default.default.create({baseURL:"https://financialmodelingprep.com/stable",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),[this.v3Client,this.v4Client,this.stableClient].forEach(t=>{t.interceptors.request.use(s=>(s.params={...s.params,apikey:this.apiKey},s));});}async get(e,t="v3",s){let r=this.getClientForVersion(t);try{let i=await r.get(e,{params:s}),o=i.data;return (Array.isArray(o)||o==null)&&(o=_(o)),{success:!0,data:o,error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}async getSingle(e,t="v3",s){let r=this.getClientForVersion(t);try{let i=await r.get(e,{params:s});return {success:!0,data:q(N(i.data)),error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}buildErrorResponse(e){let t=e?.response?.data,s=t&&typeof t=="object"?t["Error Message"]??t.message??null:typeof t=="string"?t:null,r=e?.response?.status??0,{errorType:i,message:o}=k(r,s||e?.message||"");return {success:false,data:null,error:o,errorType:i,status:r||500}}getClientForVersion(e){switch(e){case "v3":return this.v3Client;case "v4":return this.v4Client;case "stable":return this.stableClient;default:return this.v3Client}}};var m=class{static isValidSymbol(e){return !e||typeof e!="string"?false:/^[A-Z]{1,5}$/.test(e)}static isValidCryptoSymbol(e){return !e||typeof e!="string"?false:/^[A-Z]{2,10}(USD|EUR|GBP|JPY|CAD|AUD|CHF|CNY)$/.test(e)}static isValidForexPair(e){return !e||typeof e!="string"?false:/^[A-Z]{3}[A-Z]{3}$/.test(e)}static isValidDate(e){if(!e||typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return false;let s=new Date(e);return !isNaN(s.getTime())&&s.toISOString().split("T")[0]===e}static isValidDateRange(e,t){if(!this.isValidDate(e)||!this.isValidDate(t))return false;let s=new Date(e),r=new Date(t);return s<=r}static isValidResponse(e){return !!(e&&typeof e=="object"&&typeof e.success=="boolean")}static isValidApiKey(e){return !e||typeof e!="string"?false:/^[a-zA-Z0-9]{32,}$/.test(e)}static isValidPeriod(e){return !e||typeof e!="string"?false:["annual","quarter","fy"].includes(e.toLowerCase())}static isValidLimit(e){return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<=1e3}static validateQuoteParams(e){let t=[];return e?(e.symbol?!this.isValidSymbol(e.symbol)&&!this.isValidCryptoSymbol(e.symbol)&&!this.isValidForexPair(e.symbol)&&t.push("Invalid symbol format"):t.push("Symbol is required"),e.from&&!this.isValidDate(e.from)&&t.push("Invalid from date format (expected YYYY-MM-DD)"),e.to&&!this.isValidDate(e.to)&&t.push("Invalid to date format (expected YYYY-MM-DD)"),e.from&&e.to&&!this.isValidDateRange(e.from,e.to)&&t.push("From date must be before or equal to to date"),t):(t.push("Parameters object is required"),t)}static validateFinancialParams(e){let t=[];return e?(e.symbol?this.isValidSymbol(e.symbol)||t.push("Invalid symbol format"):t.push("Symbol is required"),e.period&&!this.isValidPeriod(e.period)&&t.push('Invalid period (must be "annual", "quarter", or "FY")'),e.limit&&!this.isValidLimit(e.limit)&&t.push("Invalid limit (must be a positive integer <= 1000)"),t):(t.push("Parameters object is required"),t)}static validateDateRangeParams(e){let t=[];return e?(e.from&&!this.isValidDate(e.from)&&t.push("Invalid from date format (expected YYYY-MM-DD)"),e.to&&!this.isValidDate(e.to)&&t.push("Invalid to date format (expected YYYY-MM-DD)"),e.from&&e.to&&!this.isValidDateRange(e.from,e.to)&&t.push("From date must be before or equal to to date"),t):(t.push("Parameters object is required"),t)}static throwIfInvalid(e,t="Validation"){if(e.length>0)throw new Error(`${t} failed: ${e.join(", ")}`)}};var p=class{constructor(e){this._client=e;}async getEarningsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/earning_calendar","v3",r)}async getEarningsConfirmed(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/earning-calendar-confirmed","v4",r)}async getDividendsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/stock_dividend_calendar","v3",r)}async getEconomicsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/economic_calendar","v3",r)}async getIPOCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/ipo_calendar","v3",r)}async getSplitsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/stock_split_calendar","v3",r)}};var g=class{constructor(e){this.client=e;}async getCompanyProfile(e){return this.client.getSingle("/profile","stable",{symbol:e})}async getExecutiveCompensation(e){return this.client.get("/governance-executive-compensation","stable",{symbol:e})}async getCompanyNotes(e){return this.client.get("/company-notes","stable",{symbol:e})}async getHistoricalEmployeeCount(e){return this.client.get("/historical-employee-count","stable",{symbol:e})}async getSharesFloat(e){return this.client.getSingle("/shares-float","stable",{symbol:e})}async getHistoricalSharesFloat(e){return this.client.get("/historical/shares_float","v4",{symbol:e})}async getEarningsCallTranscript(e){let{symbol:t,year:s,quarter:r}=e;return this.client.getSingle(`/earning_call_transcript/${t}`,"v3",{year:s,quarter:r})}async getCompanyTranscriptData(e){return this.client.getSingle("/earning_call_transcript","v4",{symbol:e})}};var u=class{constructor(e){this.client=e;}async getTreasuryRates(e){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this.client.get("/treasury-rates","stable",r)}async getEconomicIndicators(e){let{name:t,from:s,to:r}=e,i={name:t};return s&&(i.from=s),r&&(i.to=r),this.client.get("/economic-indicators","stable",i)}};var d=class{constructor(e){this.client=e;}async getHoldingDates(e){return this.client.get("/etf-holdings/portfolio-date","v4",{symbol:e})}async getHoldings(e){let{symbol:t,date:s}=e,r={};return t&&(r.symbol=t),s&&(r.date=s),this.client.get("/etf-holdings","v4",r)}async getHolder(e){return this.client.get(`/etf-holder/${e}`,"v3")}async getProfile(e){return this.client.getSingle("/etf/info","stable",{symbol:e})}async getSectorWeighting(e){return this.client.get("/etf/sector-weightings","stable",{symbol:e})}async getCountryWeighting(e){return this.client.get("/etf/country-weightings","stable",{symbol:e})}async getStockExposure(e){return this.client.get(`/etf-stock-exposure/${e}`,"v3")}};var y=class{constructor(e){this.client=e;}async getIncomeStatement(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/income-statement?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getBalanceSheet(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/balance-sheet-statement?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getCashFlowStatement(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/cash-flow-statement?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getKeyMetrics(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/key-metrics?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getFinancialRatios(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/ratios?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getEnterpriseValue(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/enterprise-values?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getCashflowGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/cash-flow-statement-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getIncomeGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/income-statement-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getBalanceSheetGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/balance-sheet-statement-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getFinancialGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/financial-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getEarningsHistorical(e){let{symbol:t,limit:s=5}=e;return this.client.get(`/earnings?symbol=${t}&limit=${s}`,"stable")}async getEarningsSurprises(e){return this.client.get(`/earnings-surprises/${e}`,"v3")}};var f=class{constructor(e){this.client=e;}async getInsiderTradingRSS(e){let{page:t=0,limit:s=100}=e;return this.client.get("/insider-trading/latest","stable",{page:t,limit:s})}async searchInsiderTrading(e){let{symbol:t,reportingCik:s,companyCik:r,transactionType:i,page:o=0,limit:a=100}=e,l={page:o,limit:a};return t&&(l.symbol=t),s&&(l.reportingCik=s),r&&(l.companyCik=r),i&&(l.transactionType=i),this.client.get("/insider-trading/search","stable",l)}async getTransactionTypes(){return this.client.get("/insider-trading-transaction-type","stable")}async getInsidersBySymbol(e){let{symbol:t}=e;return this.client.get("/insider-roaster","v4",{symbol:t})}async getInsiderTradeStatistics(e){let{symbol:t}=e;return this.client.get("/insider-trading/statistics","stable",{symbol:t})}async getCikMapper(e){let{page:t=0}=e;return this.client.get("/mapper-cik-name","v4",{page:t})}async getCikMapperByName(e){let{name:t,page:s=0}=e;return this.client.get("/mapper-cik-name","v4",{name:t,page:s})}async getCikMapperBySymbol(e){let{symbol:t}=e;return this.client.getSingle(`/mapper-cik-company/${t}`,"v4")}async getBeneficialOwnership(e){let{symbol:t,limit:s=100}=e;return this.client.get("/acquisition-of-beneficial-ownership","stable",{symbol:t,limit:s})}async getFailToDeliver(e){let{symbol:t,page:s=0}=e;return this.client.get("/fail_to_deliver","v4",{symbol:t,page:s})}async getInsiderTradesBySymbol(e,t=0){return this.searchInsiderTrading({symbol:e,page:t})}async getInsiderTradesByType(e,t=0){return this.searchInsiderTrading({transactionType:e,page:t})}async getInsiderTradesByReportingCik(e,t=0){return this.searchInsiderTrading({reportingCik:e,page:t})}async getInsiderTradesByCompanyCik(e,t=0){return this.searchInsiderTrading({companyCik:e,page:t})}};var P=class{constructor(e){this.client=e;}async getForm13F(e){let{cik:t,date:s}=e,r={};return s&&(r.date=s),this.client.get(`/form-thirteen/${t}`,"v3",r)}async getForm13FDates(e){let{cik:t}=e;return this.client.get(`/form-thirteen-date/${t}`,"v3")}async getInstitutionalHolders(e){let{symbol:t}=e;return this.client.get(`/institutional-holder/${t}`,"v3")}};var b=class{constructor(e){this.client=e;}async getStockList(){return this.client.get("/stock/list")}async getETFList(){return this.client.get("/etf/list")}async getCryptoList(){return this.client.get("/symbol/available-cryptocurrencies")}async getForexList(){return this.client.get("/symbol/available-forex-currency-pairs")}async getAvailableIndexes(){return this.client.get("/symbol/available-indexes")}};var h=class{constructor(e){this.client=e;}async getMarketHours(){return this.client.get("/market-hours","v3")}async getMarketPerformance(){return this.client.get("/quotes/index","v3")}async getGainers(){return this.client.get("/biggest-gainers","stable")}async getLosers(){return this.client.get("/biggest-losers","stable")}async getMostActive(){return this.client.get("/most-actives","stable")}async getSectorPerformance(){return this.client.get("/sector-performance","v3")}async getMarketIndex(){return this.client.get("/quotes/index","v3")}};var R=class{constructor(e){this.client=e;}async getHolders(e){return this.client.get(`/mutual-fund-holder/${e}`,"v3")}};var I=class{constructor(e){this.client=e;}async getArticles(e={}){let{page:t=1,limit:s=100}=e;return this.client.get("/fmp-articles","stable",{page:t,limit:s})}async getStockNews(e={}){let{from:t,to:s,page:r=1,limit:i=100}=e,o={page:r,limit:i};return t&&(o.from=t),s&&(o.to=s),this.client.get("/news/stock-latest","stable",o)}async getCryptoNews(e={}){let{from:t,to:s,page:r=1,limit:i=100}=e,o={page:r,limit:i};return t&&(o.from=t),s&&(o.to=s),this.client.get("/news/crypto-latest","stable",o)}async getForexNews(e={}){let{from:t,to:s,page:r=1,limit:i=100}=e,o={page:r,limit:i};return t&&(o.from=t),s&&(o.to=s),this.client.get("/news/forex-latest","stable",o)}async getStockNewsBySymbol(e){let{symbols:t,from:s,to:r,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return s&&(l.from=s),r&&(l.to=r),this.client.get(`/news/stock?symbols=${a}`,"stable",l)}async getCryptoNewsBySymbol(e){let{symbols:t,from:s,to:r,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return s&&(l.from=s),r&&(l.to=r),this.client.get(`/news/crypto?symbols=${a}`,"stable",l)}async getForexNewsBySymbol(e){let{symbols:t,from:s,to:r,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return s&&(l.from=s),r&&(l.to=r),this.client.get(`/news/forex?symbols=${a}`,"stable",l)}};var A=class{constructor(e){this.client=e;}async getQuote(e){return this.client.getSingle(`/quote/${e}`,"v3")}async getHistoricalPrice(e){let{symbol:t,from:s,to:r}=e,i={};return s&&(i.from=s),r&&(i.to=r),this.client.getSingle(`/historical-price-full/${t}`,"v3",i)}async getQuotes(e){let t=e.join(",");return this.client.get(`/quote/${t}`,"v3")}async getIntraday(e){let{symbol:t,interval:s,from:r,to:i}=e,o={};return r&&(o.from=r),i&&(o.to=i),this.client.get(`/historical-chart/${s}/${t}`,"v3",o)}};var S=class{constructor(e){this.client=e;}async getScreener(e){return this.client.get("/company-screener","stable",e)}async getAvailableExchanges(){return this.client.get("/available-exchanges","stable")}async getAvailableSectors(){return this.client.get("/available-sectors","stable")}async getAvailableIndustries(){return this.client.get("/available-industries","stable")}async getAvailableCountries(){return this.client.get("/available-countries","stable")}};var C=class{constructor(e){this.client=e;}async search(e){let{query:t,limit:s,exchange:r}=e;return this.client.get("/search","v3",{query:t,limit:s,exchange:r})}};var T=class{constructor(e){this.client=e;}async getEstimates(e){let{symbol:t,period:s,limit:r}=e;return this.client.get("/analyst-estimates","stable",{symbol:t,period:s,limit:r})}async getPriceTargetConsensus(e){return this.client.getSingle("/price-target-consensus","stable",{symbol:e.symbol})}async getPriceTargetSummary(e){return this.client.getSingle("/price-target-summary","stable",{symbol:e.symbol})}async getGrades(e){return this.client.get("/grades","stable",{symbol:e.symbol})}};var E=class{constructor(e){this.client=e;}async getDiscountedCashFlow(e){return this.client.getSingle("/discounted-cash-flow","stable",{symbol:e.symbol})}async getRatingSnapshot(e){return this.client.getSingle("/ratings-snapshot","stable",{symbol:e.symbol})}async getHistoricalRating(e){let{symbol:t,limit:s}=e;return this.client.get("/ratings-historical","stable",{symbol:t,limit:s})}};var F=class{constructor(e){this.client=e;}async getTechnicalIndicator(e){let{symbol:t,type:s,periodLength:r,timeframe:i}=e;return this.client.get(`/technical-indicators/${s}`,"stable",{symbol:t,periodLength:r,timeframe:i})}};var v=class{constructor(e){this.client=e;}async getRSSFeed(e){return this.client.get("/rss_feed","v4",e)}async getRSSFeedAll(e){return this.client.get("/rss_feed_all","v4",e)}async getRSSFeedV3(e){return this.client.get("/rss_feed","v3",e)}async getRSSFeed8K(e){return this.client.get("/rss_feed_8k","v4",e)}async getSECFilings({symbol:e,params:t}){return this.client.get(`/sec_filings/${e}`,"v3",t)}async getIndividualIndustryClassification(e){return this.client.getSingle("/standard_industrial_classification","v4",e)}async getAllIndustryClassifications(){return this.client.get("/standard_industrial_classification/all","v4")}async getIndustryClassificationCodes(e){return this.client.get("/standard_industrial_classification_list","v4",e)}};var x=class{constructor(e){this.client=e;}async getSenateTrading(e){let{symbol:t}=e;return this.client.get("/senate-trades","stable",{symbol:t})}async getSenateTradingRSSFeed(e){let{page:t,limit:s}=e;return this.client.get("/senate-latest","stable",{page:t,limit:s??100})}async getSenateTradingByName(e){let{name:t}=e;return this.client.get("/senate-trades-by-name","stable",{name:t})}async getHouseTrading(e){let{symbol:t}=e;return this.client.get("/house-trades","stable",{symbol:t})}async getHouseTradingRSSFeed(e){let{page:t,limit:s}=e;return this.client.get("/house-latest","stable",{page:t,limit:s??100})}async getHouseTradingByName(e){let{name:t}=e;return this.client.get("/house-trades-by-name","stable",{name:t})}};var M=class{constructor(e){this.client=e;}async getMarketCap(e){return this.client.getSingle(`/market-capitalization/${e}`,"v3")}async getStockSplits(e){return this.client.get(`/historical-price-full/stock_split/${e}`,"v3")}async getDividendHistory(e){return this.client.getSingle(`/historical-price-full/stock_dividend/${e}`,"v3")}async getRealTimePrice(e){let t=`stock/real-time-price/${e.join(",")}`,s=await this.client.get(t,"v3");if(s.success&&s.data&&!Array.isArray(s.data)){let i=s.data;if(typeof i=="object"&&i!==null&&"companiesPriceList"in i&&Array.isArray(i.companiesPriceList)){let o=i.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof i=="object"&&i!==null&&"stockList"in i&&Array.isArray(i.stockList)){let o=i.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return i.symbol?{...s,data:[i]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let r=s.data.filter(i=>i&&i.symbol);return {...s,data:r}}async getRealTimePriceForMultipleStocks(e){let t=`stock/full/real-time-price/${e.join(",")}`,s=await this.client.get(t,"v3");if(s.success&&s.data&&!Array.isArray(s.data)){let i=s.data;if(typeof i=="object"&&i!==null&&"companiesPriceList"in i&&Array.isArray(i.companiesPriceList)){let o=i.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof i=="object"&&i!==null&&"stockList"in i&&Array.isArray(i.stockList)){let o=i.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return i.symbol?{...s,data:[i]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let r=s.data.filter(i=>i&&i.symbol);return {...s,data:r}}};var D=class{constructor(e={}){let t=e.apiKey||process.env.FMP_API_KEY;if(!t)throw new Error("FMP API key is required. Please provide it in the config or set the FMP_API_KEY environment variable.");if(!m.isValidApiKey(t))throw new Error("Invalid API key format");let s=new c({...e,apiKey:t});this.calendar=new p(s),this.company=new g(s),this.economic=new u(s),this.etf=new d(s),this.financial=new y(s),this.insider=new f(s),this.institutional=new P(s),this.list=new b(s),this.market=new h(s),this.mutualFund=new R(s),this.news=new I(s),this.quote=new A(s),this.screener=new S(s),this.search=new C(s),this.analyst=new T(s),this.valuation=new E(s),this.technical=new F(s),this.sec=new v(s),this.senateHouse=new x(s),this.stock=new M(s);}getClient(){return this.stock.client}};function H(n,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(n)}function V(n,e=2){return `${n.toFixed(e)}%`}function U(n){return n>=1e12?`${(n/1e12).toFixed(2)}T`:n>=1e9?`${(n/1e9).toFixed(2)}B`:n>=1e6?`${(n/1e6).toFixed(2)}M`:n>=1e3?`${(n/1e3).toFixed(2)}K`:n.toString()}function O(n){return (typeof n=="string"?new Date(n):n).toISOString().split("T")[0]}function B(n){return n>=1e9?`${(n/1e9).toFixed(2)}B`:n>=1e6?`${(n/1e6).toFixed(2)}M`:n>=1e3?`${(n/1e3).toFixed(2)}K`:n.toString()}var Y=1e4,G=100,j=1e3,K={ANNUAL:"annual",QUARTER:"quarter"},Q={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},X={TECHNOLOGY:"Technology",HEALTHCARE:"Healthcare",FINANCIAL:"Financial",CONSUMER_DISCRETIONARY:"Consumer Discretionary",CONSUMER_STAPLES:"Consumer Staples",INDUSTRIALS:"Industrials",ENERGY:"Energy",MATERIALS:"Materials",UTILITIES:"Utilities",REAL_ESTATE:"Real Estate",COMMUNICATION_SERVICES:"Communication Services"};var L=class extends Error{constructor(t,s,r){super(t);this.status=s;this.code=r;this.name="FMPError";}};
2
- exports.AnalystEndpoints=T;exports.CalendarEndpoints=p;exports.CompanyEndpoints=g;exports.DEFAULT_LIMIT=G;exports.DEFAULT_TIMEOUT=Y;exports.ETFEndpoints=d;exports.EXCHANGES=Q;exports.EconomicEndpoints=u;exports.FMP=D;exports.FMPClient=c;exports.FMPError=L;exports.FMPValidation=m;exports.FinancialEndpoints=y;exports.InsiderEndpoints=f;exports.InstitutionalEndpoints=P;exports.ListEndpoints=b;exports.MAX_LIMIT=j;exports.MarketEndpoints=h;exports.MutualFundEndpoints=R;exports.NewsEndpoints=I;exports.PERIODS=K;exports.QuoteEndpoints=A;exports.SECEndpoints=v;exports.SECTORS=X;exports.ScreenerEndpoints=S;exports.SearchEndpoints=C;exports.SenateHouseEndpoints=x;exports.StockEndpoints=M;exports.TechnicalEndpoints=F;exports.ValuationEndpoints=E;exports.classifyError=k;exports.formatCurrency=H;exports.formatDate=O;exports.formatLargeNumber=U;exports.formatPercentage=V;exports.formatVolume=B;
1
+ 'use strict';var w=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);var $=[/exclusive endpoint/i,/not available under your current/i,/premium/i,/special endpoint/i,/upgrade your plan/i];function k(n,e){let t=e?.trim()||"Unknown error occurred",s=$.some(r=>r.test(t));return n===429?{errorType:"rate-limit",message:`FMP rate limit reached: ${t}`}:n===401?{errorType:"auth",message:`FMP authentication failed (check your FMP_API_KEY): ${t}`}:n===402||n===403||s?{errorType:"plan-restricted",message:`This endpoint is not available on your current FMP plan. (${n}: ${t})`}:n===404?{errorType:"not-found",message:`Not found: ${t}`}:n===400?{errorType:"bad-request",message:`Invalid request: ${t}`}:n===0?{errorType:"network",message:`Network error: ${t}`}:{errorType:"unknown",message:t}}function N(n){return Array.isArray(n)&&n.length===1?n[0]:n}function _(n){return Array.isArray(n)?n:n??[]}function q(n){return n==null?{}:Array.isArray(n)&&n.length===0?{}:n}var c=class{constructor(e){if(!e.apiKey)throw new Error("API key is required for FMPClient");this.apiKey=e.apiKey,this.v3Client=w__default.default.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=w__default.default.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=w__default.default.create({baseURL:"https://financialmodelingprep.com/stable",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),[this.v3Client,this.v4Client,this.stableClient].forEach(t=>{t.interceptors.request.use(s=>(s.params={...s.params,apikey:this.apiKey},s));});}async get(e,t="v3",s){let r=this.getClientForVersion(t);try{let i=await r.get(e,{params:s}),o=i.data;return (Array.isArray(o)||o==null)&&(o=_(o)),{success:!0,data:o,error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}async getSingle(e,t="v3",s){let r=this.getClientForVersion(t);try{let i=await r.get(e,{params:s});return {success:!0,data:q(N(i.data)),error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}buildErrorResponse(e){let t=e?.response?.data,s=t&&typeof t=="object"?t["Error Message"]??t.message??null:typeof t=="string"?t:null,r=e?.response?.status??0,{errorType:i,message:o}=k(r,s||e?.message||"");return {success:false,data:null,error:o,errorType:i,status:r||500}}getClientForVersion(e){switch(e){case "v3":return this.v3Client;case "v4":return this.v4Client;case "stable":return this.stableClient;default:return this.v3Client}}};var m=class{static isValidSymbol(e){return !e||typeof e!="string"?false:/^[A-Z]{1,5}$/.test(e)}static isValidCryptoSymbol(e){return !e||typeof e!="string"?false:/^[A-Z]{2,10}(USD|EUR|GBP|JPY|CAD|AUD|CHF|CNY)$/.test(e)}static isValidForexPair(e){return !e||typeof e!="string"?false:/^[A-Z]{3}[A-Z]{3}$/.test(e)}static isValidDate(e){if(!e||typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return false;let s=new Date(e);return !isNaN(s.getTime())&&s.toISOString().split("T")[0]===e}static isValidDateRange(e,t){if(!this.isValidDate(e)||!this.isValidDate(t))return false;let s=new Date(e),r=new Date(t);return s<=r}static isValidResponse(e){return !!(e&&typeof e=="object"&&typeof e.success=="boolean")}static isValidApiKey(e){return !e||typeof e!="string"?false:/^[a-zA-Z0-9]{32,}$/.test(e)}static isValidPeriod(e){return !e||typeof e!="string"?false:["annual","quarter","fy"].includes(e.toLowerCase())}static isValidLimit(e){return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<=1e3}static validateQuoteParams(e){let t=[];return e?(e.symbol?!this.isValidSymbol(e.symbol)&&!this.isValidCryptoSymbol(e.symbol)&&!this.isValidForexPair(e.symbol)&&t.push("Invalid symbol format"):t.push("Symbol is required"),e.from&&!this.isValidDate(e.from)&&t.push("Invalid from date format (expected YYYY-MM-DD)"),e.to&&!this.isValidDate(e.to)&&t.push("Invalid to date format (expected YYYY-MM-DD)"),e.from&&e.to&&!this.isValidDateRange(e.from,e.to)&&t.push("From date must be before or equal to to date"),t):(t.push("Parameters object is required"),t)}static validateFinancialParams(e){let t=[];return e?(e.symbol?this.isValidSymbol(e.symbol)||t.push("Invalid symbol format"):t.push("Symbol is required"),e.period&&!this.isValidPeriod(e.period)&&t.push('Invalid period (must be "annual", "quarter", or "FY")'),e.limit&&!this.isValidLimit(e.limit)&&t.push("Invalid limit (must be a positive integer <= 1000)"),t):(t.push("Parameters object is required"),t)}static validateDateRangeParams(e){let t=[];return e?(e.from&&!this.isValidDate(e.from)&&t.push("Invalid from date format (expected YYYY-MM-DD)"),e.to&&!this.isValidDate(e.to)&&t.push("Invalid to date format (expected YYYY-MM-DD)"),e.from&&e.to&&!this.isValidDateRange(e.from,e.to)&&t.push("From date must be before or equal to to date"),t):(t.push("Parameters object is required"),t)}static throwIfInvalid(e,t="Validation"){if(e.length>0)throw new Error(`${t} failed: ${e.join(", ")}`)}};var p=class{constructor(e){this._client=e;}async getEarningsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/earning_calendar","v3",r)}async getEarningsConfirmed(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/earning-calendar-confirmed","v4",r)}async getDividendsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/stock_dividend_calendar","v3",r)}async getEconomicsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/economic_calendar","v3",r)}async getIPOCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/ipo_calendar","v3",r)}async getSplitsCalendar(e={}){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this._client.get("/stock_split_calendar","v3",r)}};var g=class{constructor(e){this.client=e;}async getCompanyProfile(e){return this.client.getSingle("/profile","stable",{symbol:e})}async getExecutiveCompensation(e){return this.client.get("/governance-executive-compensation","stable",{symbol:e})}async getCompanyNotes(e){return this.client.get("/company-notes","stable",{symbol:e})}async getHistoricalEmployeeCount(e){return this.client.get("/historical-employee-count","stable",{symbol:e})}async getSharesFloat(e){return this.client.getSingle("/shares-float","stable",{symbol:e})}async getHistoricalSharesFloat(e){return this.client.get("/historical/shares_float","v4",{symbol:e})}async getEarningsCallTranscript(e){let{symbol:t,year:s,quarter:r}=e;return this.client.getSingle(`/earning_call_transcript/${t}`,"v3",{year:s,quarter:r})}async getCompanyTranscriptData(e){return this.client.getSingle("/earning_call_transcript","v4",{symbol:e})}async getStockPeers(e){return this.client.get("/stock-peers","stable",{symbol:e})}};var u=class{constructor(e){this.client=e;}async getTreasuryRates(e){let{from:t,to:s}=e,r={};return t&&(r.from=t),s&&(r.to=s),this.client.get("/treasury-rates","stable",r)}async getEconomicIndicators(e){let{name:t,from:s,to:r}=e,i={name:t};return s&&(i.from=s),r&&(i.to=r),this.client.get("/economic-indicators","stable",i)}};var y=class{constructor(e){this.client=e;}async getHoldingDates(e){return this.client.get("/etf-holdings/portfolio-date","v4",{symbol:e})}async getHoldings(e){let{symbol:t,date:s}=e,r={};return t&&(r.symbol=t),s&&(r.date=s),this.client.get("/etf-holdings","v4",r)}async getHolder(e){return this.client.get(`/etf-holder/${e}`,"v3")}async getProfile(e){return this.client.getSingle("/etf/info","stable",{symbol:e})}async getSectorWeighting(e){return this.client.get("/etf/sector-weightings","stable",{symbol:e})}async getCountryWeighting(e){return this.client.get("/etf/country-weightings","stable",{symbol:e})}async getStockExposure(e){return this.client.get(`/etf-stock-exposure/${e}`,"v3")}};var d=class{constructor(e){this.client=e;}async getIncomeStatement(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/income-statement?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getBalanceSheet(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/balance-sheet-statement?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getCashFlowStatement(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/cash-flow-statement?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getKeyMetrics(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/key-metrics?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getFinancialRatios(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/ratios?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getEnterpriseValue(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/enterprise-values?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getCashflowGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/cash-flow-statement-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getIncomeGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/income-statement-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getBalanceSheetGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/balance-sheet-statement-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getFinancialGrowth(e){let{symbol:t,period:s="annual",limit:r=5}=e;return this.client.get(`/financial-growth?symbol=${t}&period=${s}&limit=${r}`,"stable")}async getEarningsHistorical(e){let{symbol:t,limit:s=5}=e;return this.client.get(`/earnings?symbol=${t}&limit=${s}`,"stable")}async getEarningsSurprises(e){return this.client.get(`/earnings-surprises/${e}`,"v3")}async getFinancialScores(e){return this.client.getSingle("/financial-scores","stable",{symbol:e.symbol})}async getKeyMetricsTTM(e){return this.client.getSingle("/key-metrics-ttm","stable",{symbol:e.symbol})}async getFinancialRatiosTTM(e){return this.client.getSingle("/ratios-ttm","stable",{symbol:e.symbol})}async getRevenueProductSegmentation(e){let{symbol:t,period:s}=e;return this.client.get("/revenue-product-segmentation","stable",{symbol:t,period:s})}async getRevenueGeographicSegmentation(e){let{symbol:t,period:s}=e;return this.client.get("/revenue-geographic-segmentation","stable",{symbol:t,period:s})}};var f=class{constructor(e){this.client=e;}async getInsiderTradingRSS(e){let{page:t=0,limit:s=100}=e;return this.client.get("/insider-trading/latest","stable",{page:t,limit:s})}async searchInsiderTrading(e){let{symbol:t,reportingCik:s,companyCik:r,transactionType:i,page:o=0,limit:a=100}=e,l={page:o,limit:a};return t&&(l.symbol=t),s&&(l.reportingCik=s),r&&(l.companyCik=r),i&&(l.transactionType=i),this.client.get("/insider-trading/search","stable",l)}async getTransactionTypes(){return this.client.get("/insider-trading-transaction-type","stable")}async getInsidersBySymbol(e){let{symbol:t}=e;return this.client.get("/insider-roaster","v4",{symbol:t})}async getInsiderTradeStatistics(e){let{symbol:t}=e;return this.client.get("/insider-trading/statistics","stable",{symbol:t})}async getCikMapper(e){let{page:t=0}=e;return this.client.get("/mapper-cik-name","v4",{page:t})}async getCikMapperByName(e){let{name:t,page:s=0}=e;return this.client.get("/mapper-cik-name","v4",{name:t,page:s})}async getCikMapperBySymbol(e){let{symbol:t}=e;return this.client.getSingle(`/mapper-cik-company/${t}`,"v4")}async getBeneficialOwnership(e){let{symbol:t,limit:s=100}=e;return this.client.get("/acquisition-of-beneficial-ownership","stable",{symbol:t,limit:s})}async getFailToDeliver(e){let{symbol:t,page:s=0}=e;return this.client.get("/fail_to_deliver","v4",{symbol:t,page:s})}async getInsiderTradesBySymbol(e,t=0){return this.searchInsiderTrading({symbol:e,page:t})}async getInsiderTradesByType(e,t=0){return this.searchInsiderTrading({transactionType:e,page:t})}async getInsiderTradesByReportingCik(e,t=0){return this.searchInsiderTrading({reportingCik:e,page:t})}async getInsiderTradesByCompanyCik(e,t=0){return this.searchInsiderTrading({companyCik:e,page:t})}};var P=class{constructor(e){this.client=e;}async getForm13F(e){let{cik:t,date:s}=e,r={};return s&&(r.date=s),this.client.get(`/form-thirteen/${t}`,"v3",r)}async getForm13FDates(e){let{cik:t}=e;return this.client.get(`/form-thirteen-date/${t}`,"v3")}async getInstitutionalHolders(e){let{symbol:t}=e;return this.client.get(`/institutional-holder/${t}`,"v3")}};var b=class{constructor(e){this.client=e;}async getStockList(){return this.client.get("/stock/list")}async getETFList(){return this.client.get("/etf/list")}async getCryptoList(){return this.client.get("/symbol/available-cryptocurrencies")}async getForexList(){return this.client.get("/symbol/available-forex-currency-pairs")}async getAvailableIndexes(){return this.client.get("/symbol/available-indexes")}};var h=class{constructor(e){this.client=e;}async getMarketHours(){return this.client.get("/market-hours","v3")}async getMarketPerformance(){return this.client.get("/quotes/index","v3")}async getGainers(){return this.client.get("/biggest-gainers","stable")}async getLosers(){return this.client.get("/biggest-losers","stable")}async getMostActive(){return this.client.get("/most-actives","stable")}async getSectorPerformance(){return this.client.get("/sector-performance","v3")}async getMarketIndex(){return this.client.get("/quotes/index","v3")}};var R=class{constructor(e){this.client=e;}async getHolders(e){return this.client.get(`/mutual-fund-holder/${e}`,"v3")}};var I=class{constructor(e){this.client=e;}async getArticles(e={}){let{page:t=1,limit:s=100}=e;return this.client.get("/fmp-articles","stable",{page:t,limit:s})}async getStockNews(e={}){let{from:t,to:s,page:r=1,limit:i=100}=e,o={page:r,limit:i};return t&&(o.from=t),s&&(o.to=s),this.client.get("/news/stock-latest","stable",o)}async getCryptoNews(e={}){let{from:t,to:s,page:r=1,limit:i=100}=e,o={page:r,limit:i};return t&&(o.from=t),s&&(o.to=s),this.client.get("/news/crypto-latest","stable",o)}async getForexNews(e={}){let{from:t,to:s,page:r=1,limit:i=100}=e,o={page:r,limit:i};return t&&(o.from=t),s&&(o.to=s),this.client.get("/news/forex-latest","stable",o)}async getStockNewsBySymbol(e){let{symbols:t,from:s,to:r,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return s&&(l.from=s),r&&(l.to=r),this.client.get(`/news/stock?symbols=${a}`,"stable",l)}async getCryptoNewsBySymbol(e){let{symbols:t,from:s,to:r,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return s&&(l.from=s),r&&(l.to=r),this.client.get(`/news/crypto?symbols=${a}`,"stable",l)}async getForexNewsBySymbol(e){let{symbols:t,from:s,to:r,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return s&&(l.from=s),r&&(l.to=r),this.client.get(`/news/forex?symbols=${a}`,"stable",l)}};var A=class{constructor(e){this.client=e;}async getQuote(e){return this.client.getSingle(`/quote/${e}`,"v3")}async getHistoricalPrice(e){let{symbol:t,from:s,to:r}=e,i={};return s&&(i.from=s),r&&(i.to=r),this.client.getSingle(`/historical-price-full/${t}`,"v3",i)}async getQuotes(e){let t=e.join(",");return this.client.get(`/quote/${t}`,"v3")}async getIntraday(e){let{symbol:t,interval:s,from:r,to:i}=e,o={};return r&&(o.from=r),i&&(o.to=i),this.client.get(`/historical-chart/${s}/${t}`,"v3",o)}};var S=class{constructor(e){this.client=e;}async getScreener(e){return this.client.get("/company-screener","stable",e)}async getAvailableExchanges(){return this.client.get("/available-exchanges","stable")}async getAvailableSectors(){return this.client.get("/available-sectors","stable")}async getAvailableIndustries(){return this.client.get("/available-industries","stable")}async getAvailableCountries(){return this.client.get("/available-countries","stable")}};var T=class{constructor(e){this.client=e;}async search(e){let{query:t,limit:s,exchange:r}=e;return this.client.get("/search","v3",{query:t,limit:s,exchange:r})}};var C=class{constructor(e){this.client=e;}async getEstimates(e){let{symbol:t,period:s="annual",limit:r}=e;return this.client.get("/analyst-estimates","stable",{symbol:t,period:s,limit:r})}async getPriceTargetConsensus(e){return this.client.getSingle("/price-target-consensus","stable",{symbol:e.symbol})}async getPriceTargetSummary(e){return this.client.getSingle("/price-target-summary","stable",{symbol:e.symbol})}async getGrades(e){return this.client.get("/grades","stable",{symbol:e.symbol})}async getGradesConsensus(e){return this.client.getSingle("/grades-consensus","stable",{symbol:e.symbol})}};var E=class{constructor(e){this.client=e;}async getDiscountedCashFlow(e){return this.client.getSingle("/discounted-cash-flow","stable",{symbol:e.symbol})}async getRatingSnapshot(e){return this.client.getSingle("/ratings-snapshot","stable",{symbol:e.symbol})}async getHistoricalRating(e){let{symbol:t,limit:s}=e;return this.client.get("/ratings-historical","stable",{symbol:t,limit:s})}};var F=class{constructor(e){this.client=e;}async getTechnicalIndicator(e){let{symbol:t,type:s,periodLength:r,timeframe:i}=e;return this.client.get(`/technical-indicators/${s}`,"stable",{symbol:t,periodLength:r,timeframe:i})}};var v=class{constructor(e){this.client=e;}async getRSSFeed(e){return this.client.get("/rss_feed","v4",e)}async getRSSFeedAll(e){return this.client.get("/rss_feed_all","v4",e)}async getRSSFeedV3(e){return this.client.get("/rss_feed","v3",e)}async getRSSFeed8K(e){return this.client.get("/rss_feed_8k","v4",e)}async getSECFilings({symbol:e,params:t}){return this.client.get(`/sec_filings/${e}`,"v3",t)}async getIndividualIndustryClassification(e){return this.client.getSingle("/standard_industrial_classification","v4",e)}async getAllIndustryClassifications(){return this.client.get("/standard_industrial_classification/all","v4")}async getIndustryClassificationCodes(e){return this.client.get("/standard_industrial_classification_list","v4",e)}};var M=class{constructor(e){this.client=e;}async getSenateTrading(e){let{symbol:t}=e;return this.client.get("/senate-trades","stable",{symbol:t})}async getSenateTradingRSSFeed(e){let{page:t,limit:s}=e;return this.client.get("/senate-latest","stable",{page:t,limit:s??100})}async getSenateTradingByName(e){let{name:t}=e;return this.client.get("/senate-trades-by-name","stable",{name:t})}async getHouseTrading(e){let{symbol:t}=e;return this.client.get("/house-trades","stable",{symbol:t})}async getHouseTradingRSSFeed(e){let{page:t,limit:s}=e;return this.client.get("/house-latest","stable",{page:t,limit:s??100})}async getHouseTradingByName(e){let{name:t}=e;return this.client.get("/house-trades-by-name","stable",{name:t})}};var x=class{constructor(e){this.client=e;}async getMarketCap(e){return this.client.getSingle(`/market-capitalization/${e}`,"v3")}async getStockSplits(e){return this.client.get(`/historical-price-full/stock_split/${e}`,"v3")}async getDividendHistory(e){return this.client.getSingle(`/historical-price-full/stock_dividend/${e}`,"v3")}async getRealTimePrice(e){let t=`stock/real-time-price/${e.join(",")}`,s=await this.client.get(t,"v3");if(s.success&&s.data&&!Array.isArray(s.data)){let i=s.data;if(typeof i=="object"&&i!==null&&"companiesPriceList"in i&&Array.isArray(i.companiesPriceList)){let o=i.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof i=="object"&&i!==null&&"stockList"in i&&Array.isArray(i.stockList)){let o=i.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return i.symbol?{...s,data:[i]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let r=s.data.filter(i=>i&&i.symbol);return {...s,data:r}}async getRealTimePriceForMultipleStocks(e){let t=`stock/full/real-time-price/${e.join(",")}`,s=await this.client.get(t,"v3");if(s.success&&s.data&&!Array.isArray(s.data)){let i=s.data;if(typeof i=="object"&&i!==null&&"companiesPriceList"in i&&Array.isArray(i.companiesPriceList)){let o=i.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof i=="object"&&i!==null&&"stockList"in i&&Array.isArray(i.stockList)){let o=i.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return i.symbol?{...s,data:[i]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let r=s.data.filter(i=>i&&i.symbol);return {...s,data:r}}};var D=class{constructor(e={}){let t=e.apiKey||process.env.FMP_API_KEY;if(!t)throw new Error("FMP API key is required. Please provide it in the config or set the FMP_API_KEY environment variable.");if(!m.isValidApiKey(t))throw new Error("Invalid API key format");let s=new c({...e,apiKey:t});this.calendar=new p(s),this.company=new g(s),this.economic=new u(s),this.etf=new y(s),this.financial=new d(s),this.insider=new f(s),this.institutional=new P(s),this.list=new b(s),this.market=new h(s),this.mutualFund=new R(s),this.news=new I(s),this.quote=new A(s),this.screener=new S(s),this.search=new T(s),this.analyst=new C(s),this.valuation=new E(s),this.technical=new F(s),this.sec=new v(s),this.senateHouse=new M(s),this.stock=new x(s);}getClient(){return this.stock.client}};function H(n,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(n)}function V(n,e=2){return `${n.toFixed(e)}%`}function U(n){return n>=1e12?`${(n/1e12).toFixed(2)}T`:n>=1e9?`${(n/1e9).toFixed(2)}B`:n>=1e6?`${(n/1e6).toFixed(2)}M`:n>=1e3?`${(n/1e3).toFixed(2)}K`:n.toString()}function O(n){return (typeof n=="string"?new Date(n):n).toISOString().split("T")[0]}function B(n){return n>=1e9?`${(n/1e9).toFixed(2)}B`:n>=1e6?`${(n/1e6).toFixed(2)}M`:n>=1e3?`${(n/1e3).toFixed(2)}K`:n.toString()}var Y=1e4,G=100,K=1e3,j={ANNUAL:"annual",QUARTER:"quarter"},Q={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},X={TECHNOLOGY:"Technology",HEALTHCARE:"Healthcare",FINANCIAL:"Financial",CONSUMER_DISCRETIONARY:"Consumer Discretionary",CONSUMER_STAPLES:"Consumer Staples",INDUSTRIALS:"Industrials",ENERGY:"Energy",MATERIALS:"Materials",UTILITIES:"Utilities",REAL_ESTATE:"Real Estate",COMMUNICATION_SERVICES:"Communication Services"};var L=class extends Error{constructor(t,s,r){super(t);this.status=s;this.code=r;this.name="FMPError";}};
2
+ exports.AnalystEndpoints=C;exports.CalendarEndpoints=p;exports.CompanyEndpoints=g;exports.DEFAULT_LIMIT=G;exports.DEFAULT_TIMEOUT=Y;exports.ETFEndpoints=y;exports.EXCHANGES=Q;exports.EconomicEndpoints=u;exports.FMP=D;exports.FMPClient=c;exports.FMPError=L;exports.FMPValidation=m;exports.FinancialEndpoints=d;exports.InsiderEndpoints=f;exports.InstitutionalEndpoints=P;exports.ListEndpoints=b;exports.MAX_LIMIT=K;exports.MarketEndpoints=h;exports.MutualFundEndpoints=R;exports.NewsEndpoints=I;exports.PERIODS=j;exports.QuoteEndpoints=A;exports.SECEndpoints=v;exports.SECTORS=X;exports.ScreenerEndpoints=S;exports.SearchEndpoints=T;exports.SenateHouseEndpoints=M;exports.StockEndpoints=x;exports.TechnicalEndpoints=F;exports.ValuationEndpoints=E;exports.classifyError=k;exports.formatCurrency=H;exports.formatDate=O;exports.formatLargeNumber=U;exports.formatPercentage=V;exports.formatVolume=B;