fmp-node-api 0.2.0-beta.0 → 0.2.0-beta.2
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 +64 -3
- package/dist/index.d.ts +64 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/types-only.d.mts +25 -1
- package/dist/types-only.d.ts +25 -1
- package/package.json +2 -2
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, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull } from './types-only.mjs';
|
|
2
|
-
export { ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyTranscriptDataSchema, CryptoListSchema, 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, QueryParams, QuoteSchema, RSSFeed8KItemSchema, RSSFeed8KParams, RSSFeed8KParamsSchema, RSSFeedAllItemSchema, RSSFeedItemSchema, RSSFeedParams, RSSFeedParamsSchema, RSSFeedV3ItemSchema, RSSFeedV3Params, RSSFeedV3ParamsSchema, SECFilingSchema, SECFilingsParams, SECFilingsParamsSchema, ScreenerParamsSchema, ScreenerSchema, SenateHouseTradingByNameResponseSchema, SenateTradingResponseSchema, SharesFloatSchema, SplitsCalendarSchema, StockDividend, StockDividendResponseSchema, StockDividendSchema, StockListResponse, StockListSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.mjs';
|
|
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, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull, FMPErrorType } from './types-only.mjs';
|
|
2
|
+
export { ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyTranscriptDataSchema, CryptoListSchema, 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, 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, StockListResponse, StockListSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.mjs';
|
|
3
3
|
export { FMPValidation } from './utils/validation.mjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -22,6 +22,15 @@ declare class FMPClient {
|
|
|
22
22
|
* For endpoints that return single objects, this will always return an object (possibly empty) for `data` when success is true.
|
|
23
23
|
*/
|
|
24
24
|
getSingle<T>(endpoint: string, version?: 'v3' | 'v4' | 'stable', params?: Record<string, any>): Promise<APIResponse<T>>;
|
|
25
|
+
/**
|
|
26
|
+
* Build a classified error response from a caught axios error.
|
|
27
|
+
*
|
|
28
|
+
* FMP returns the real reason in the response *body* (e.g.
|
|
29
|
+
* `{ "Error Message": "Special Endpoint : ..." }`), not in `error.message`
|
|
30
|
+
* (which is axios's generic "Request failed with status code N"). We prefer
|
|
31
|
+
* the body, then classify into a typed `errorType`.
|
|
32
|
+
*/
|
|
33
|
+
private buildErrorResponse;
|
|
25
34
|
private getClientForVersion;
|
|
26
35
|
}
|
|
27
36
|
|
|
@@ -2703,6 +2712,37 @@ declare class ScreenerEndpoints {
|
|
|
2703
2712
|
getAvailableCountries(): Promise<APIResponse<AvailableCountries[]>>;
|
|
2704
2713
|
}
|
|
2705
2714
|
|
|
2715
|
+
declare class SearchEndpoints {
|
|
2716
|
+
private client;
|
|
2717
|
+
constructor(client: FMPClient);
|
|
2718
|
+
/**
|
|
2719
|
+
* Search for stocks, ETFs, and other instruments by ticker symbol or company name.
|
|
2720
|
+
*
|
|
2721
|
+
* Resolves a free-text query (e.g. a company name or partial ticker) to matching
|
|
2722
|
+
* symbols. Useful for turning a name like "Apple" into a ticker like "AAPL".
|
|
2723
|
+
*
|
|
2724
|
+
* @param params - Search parameters
|
|
2725
|
+
* @param params.query - The search query (ticker or company name)
|
|
2726
|
+
* @param params.limit - Maximum number of results to return (optional)
|
|
2727
|
+
* @param params.exchange - Restrict results to a specific exchange (optional, e.g. "NASDAQ")
|
|
2728
|
+
*
|
|
2729
|
+
* @returns Promise resolving to an array of matching instruments
|
|
2730
|
+
*
|
|
2731
|
+
* @example
|
|
2732
|
+
* ```typescript
|
|
2733
|
+
* const results = await fmp.search.search({ query: 'Apple', limit: 5 });
|
|
2734
|
+
* const aapl = results.data?.find(r => r.symbol === 'AAPL');
|
|
2735
|
+
* ```
|
|
2736
|
+
*
|
|
2737
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#general-search|FMP Search Documentation}
|
|
2738
|
+
*/
|
|
2739
|
+
search(params: {
|
|
2740
|
+
query: string;
|
|
2741
|
+
limit?: number;
|
|
2742
|
+
exchange?: string;
|
|
2743
|
+
}): Promise<APIResponse<SearchResult[]>>;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2706
2746
|
declare class SECEndpoints {
|
|
2707
2747
|
private client;
|
|
2708
2748
|
constructor(client: FMPClient);
|
|
@@ -3371,6 +3411,7 @@ declare class FMP {
|
|
|
3371
3411
|
readonly news: NewsEndpoints;
|
|
3372
3412
|
readonly quote: QuoteEndpoints;
|
|
3373
3413
|
readonly screener: ScreenerEndpoints;
|
|
3414
|
+
readonly search: SearchEndpoints;
|
|
3374
3415
|
readonly sec: SECEndpoints;
|
|
3375
3416
|
readonly senateHouse: SenateHouseEndpoints;
|
|
3376
3417
|
readonly stock: StockEndpoints;
|
|
@@ -3433,4 +3474,24 @@ declare const SECTORS: {
|
|
|
3433
3474
|
readonly COMMUNICATION_SERVICES: "Communication Services";
|
|
3434
3475
|
};
|
|
3435
3476
|
|
|
3436
|
-
|
|
3477
|
+
interface ClassifiedError {
|
|
3478
|
+
errorType: FMPErrorType;
|
|
3479
|
+
message: string;
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* Classify a failed request.
|
|
3483
|
+
*
|
|
3484
|
+
* @param status HTTP status code; use `0` when no HTTP response was received
|
|
3485
|
+
* (network error / timeout), which maps to `network`.
|
|
3486
|
+
* @param rawMessage The best available message — prefer FMP's response body over
|
|
3487
|
+
* axios's generic "Request failed with status code N".
|
|
3488
|
+
*/
|
|
3489
|
+
declare function classifyError(status: number, rawMessage: string): ClassifiedError;
|
|
3490
|
+
|
|
3491
|
+
declare class FMPError extends Error {
|
|
3492
|
+
status?: number | undefined;
|
|
3493
|
+
code?: string | undefined;
|
|
3494
|
+
constructor(message: string, status?: number | undefined, code?: string | undefined);
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
export { APIResponse, Article, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, type ClassifiedError, CompanyEndpoints, CompanyNotes, CompanyProfile, CompanyTranscriptData, CryptoList, 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, Quote, QuoteEndpoints, RSSFeed8KItem, RSSFeedAllItem, RSSFeedItem, RSSFeedV3Item, SECEndpoints, SECFiling, SECTORS, Screener, ScreenerEndpoints, ScreenerParams, SearchEndpoints, SearchResult, SenateHouseEndpoints, SenateHouseTradingByNameResponse, SenateTradingResponse, SharesFloat, SplitsCalendar, StockDividendResponse, StockEndpoints, StockList, StockRealTimePrice, StockRealTimePriceFull, StockSplitResponse, TransactionType, TransactionTypesResponse, TreasuryRate, 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, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull } from './types-only.js';
|
|
2
|
-
export { ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyTranscriptDataSchema, CryptoListSchema, 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, QueryParams, QuoteSchema, RSSFeed8KItemSchema, RSSFeed8KParams, RSSFeed8KParamsSchema, RSSFeedAllItemSchema, RSSFeedItemSchema, RSSFeedParams, RSSFeedParamsSchema, RSSFeedV3ItemSchema, RSSFeedV3Params, RSSFeedV3ParamsSchema, SECFilingSchema, SECFilingsParams, SECFilingsParamsSchema, ScreenerParamsSchema, ScreenerSchema, SenateHouseTradingByNameResponseSchema, SenateTradingResponseSchema, SharesFloatSchema, SplitsCalendarSchema, StockDividend, StockDividendResponseSchema, StockDividendSchema, StockListResponse, StockListSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.js';
|
|
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, RSSFeedItem, RSSFeedAllItem, RSSFeedV3Item, RSSFeed8KItem, SECFiling, IndustryClassification, IndustryClassificationCode, SenateTradingResponse, SenateHouseTradingByNameResponse, HouseTradingResponse, MarketCap, StockSplitResponse, StockDividendResponse, StockRealTimePrice, StockRealTimePriceFull, FMPErrorType } from './types-only.js';
|
|
2
|
+
export { ArticleSchema, AvailableCountriesSchema, AvailableExchangesSchema, AvailableIndexesListSchema, AvailableIndustriesSchema, AvailableSectorsSchema, BalanceSheetGrowthSchema, BalanceSheetSchema, BeneficialOwnershipResponseSchema, CashFlowStatementSchema, CashflowGrowthSchema, CikMapperBySymbolResponseSchema, CikMapperResponseSchema, CompaniesPriceListResponse, CompanyNotesSchema, CompanyProfileSchema, CompanyTranscriptDataSchema, CryptoListSchema, 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, 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, StockListResponse, StockListSchema, StockRealTimePriceFullSchema, StockRealTimePriceSchema, StockSplit, StockSplitResponseSchema, StockSplitSchema, SymbolParams, TransactionTypeRecordSchema, TreasuryRateSchema } from './types-only.js';
|
|
3
3
|
export { FMPValidation } from './utils/validation.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -22,6 +22,15 @@ declare class FMPClient {
|
|
|
22
22
|
* For endpoints that return single objects, this will always return an object (possibly empty) for `data` when success is true.
|
|
23
23
|
*/
|
|
24
24
|
getSingle<T>(endpoint: string, version?: 'v3' | 'v4' | 'stable', params?: Record<string, any>): Promise<APIResponse<T>>;
|
|
25
|
+
/**
|
|
26
|
+
* Build a classified error response from a caught axios error.
|
|
27
|
+
*
|
|
28
|
+
* FMP returns the real reason in the response *body* (e.g.
|
|
29
|
+
* `{ "Error Message": "Special Endpoint : ..." }`), not in `error.message`
|
|
30
|
+
* (which is axios's generic "Request failed with status code N"). We prefer
|
|
31
|
+
* the body, then classify into a typed `errorType`.
|
|
32
|
+
*/
|
|
33
|
+
private buildErrorResponse;
|
|
25
34
|
private getClientForVersion;
|
|
26
35
|
}
|
|
27
36
|
|
|
@@ -2703,6 +2712,37 @@ declare class ScreenerEndpoints {
|
|
|
2703
2712
|
getAvailableCountries(): Promise<APIResponse<AvailableCountries[]>>;
|
|
2704
2713
|
}
|
|
2705
2714
|
|
|
2715
|
+
declare class SearchEndpoints {
|
|
2716
|
+
private client;
|
|
2717
|
+
constructor(client: FMPClient);
|
|
2718
|
+
/**
|
|
2719
|
+
* Search for stocks, ETFs, and other instruments by ticker symbol or company name.
|
|
2720
|
+
*
|
|
2721
|
+
* Resolves a free-text query (e.g. a company name or partial ticker) to matching
|
|
2722
|
+
* symbols. Useful for turning a name like "Apple" into a ticker like "AAPL".
|
|
2723
|
+
*
|
|
2724
|
+
* @param params - Search parameters
|
|
2725
|
+
* @param params.query - The search query (ticker or company name)
|
|
2726
|
+
* @param params.limit - Maximum number of results to return (optional)
|
|
2727
|
+
* @param params.exchange - Restrict results to a specific exchange (optional, e.g. "NASDAQ")
|
|
2728
|
+
*
|
|
2729
|
+
* @returns Promise resolving to an array of matching instruments
|
|
2730
|
+
*
|
|
2731
|
+
* @example
|
|
2732
|
+
* ```typescript
|
|
2733
|
+
* const results = await fmp.search.search({ query: 'Apple', limit: 5 });
|
|
2734
|
+
* const aapl = results.data?.find(r => r.symbol === 'AAPL');
|
|
2735
|
+
* ```
|
|
2736
|
+
*
|
|
2737
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#general-search|FMP Search Documentation}
|
|
2738
|
+
*/
|
|
2739
|
+
search(params: {
|
|
2740
|
+
query: string;
|
|
2741
|
+
limit?: number;
|
|
2742
|
+
exchange?: string;
|
|
2743
|
+
}): Promise<APIResponse<SearchResult[]>>;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2706
2746
|
declare class SECEndpoints {
|
|
2707
2747
|
private client;
|
|
2708
2748
|
constructor(client: FMPClient);
|
|
@@ -3371,6 +3411,7 @@ declare class FMP {
|
|
|
3371
3411
|
readonly news: NewsEndpoints;
|
|
3372
3412
|
readonly quote: QuoteEndpoints;
|
|
3373
3413
|
readonly screener: ScreenerEndpoints;
|
|
3414
|
+
readonly search: SearchEndpoints;
|
|
3374
3415
|
readonly sec: SECEndpoints;
|
|
3375
3416
|
readonly senateHouse: SenateHouseEndpoints;
|
|
3376
3417
|
readonly stock: StockEndpoints;
|
|
@@ -3433,4 +3474,24 @@ declare const SECTORS: {
|
|
|
3433
3474
|
readonly COMMUNICATION_SERVICES: "Communication Services";
|
|
3434
3475
|
};
|
|
3435
3476
|
|
|
3436
|
-
|
|
3477
|
+
interface ClassifiedError {
|
|
3478
|
+
errorType: FMPErrorType;
|
|
3479
|
+
message: string;
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* Classify a failed request.
|
|
3483
|
+
*
|
|
3484
|
+
* @param status HTTP status code; use `0` when no HTTP response was received
|
|
3485
|
+
* (network error / timeout), which maps to `network`.
|
|
3486
|
+
* @param rawMessage The best available message — prefer FMP's response body over
|
|
3487
|
+
* axios's generic "Request failed with status code N".
|
|
3488
|
+
*/
|
|
3489
|
+
declare function classifyError(status: number, rawMessage: string): ClassifiedError;
|
|
3490
|
+
|
|
3491
|
+
declare class FMPError extends Error {
|
|
3492
|
+
status?: number | undefined;
|
|
3493
|
+
code?: string | undefined;
|
|
3494
|
+
constructor(message: string, status?: number | undefined, code?: string | undefined);
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
export { APIResponse, Article, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, type ClassifiedError, CompanyEndpoints, CompanyNotes, CompanyProfile, CompanyTranscriptData, CryptoList, 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, Quote, QuoteEndpoints, RSSFeed8KItem, RSSFeedAllItem, RSSFeedItem, RSSFeedV3Item, SECEndpoints, SECFiling, SECTORS, Screener, ScreenerEndpoints, ScreenerParams, SearchEndpoints, SearchResult, SenateHouseEndpoints, SenateHouseTradingByNameResponse, SenateTradingResponse, SharesFloat, SplitsCalendar, StockDividendResponse, StockEndpoints, StockList, StockRealTimePrice, StockRealTimePriceFull, StockSplitResponse, TransactionType, TransactionTypesResponse, TreasuryRate, classifyError, formatCurrency, formatDate, formatLargeNumber, formatPercentage, formatVolume };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var F=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var F__default=/*#__PURE__*/_interopDefault(F);function M(i){return Array.isArray(i)&&i.length===1?i[0]:i}function k(i){return Array.isArray(i)?i:i??[]}function x(i){return i==null?{}:Array.isArray(i)&&i.length===0?{}:i}var c=class{constructor(e){if(!e.apiKey)throw new Error("API key is required for FMPClient");this.apiKey=e.apiKey,this.v3Client=F__default.default.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=F__default.default.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=F__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 n=await r.get(e,{params:s}),o=n.data;return (Array.isArray(o)||o==null)&&(o=k(o)),{success:!0,data:o,error:null,status:n.status}}catch(n){return {success:false,data:null,error:n.message||"Unknown error occurred",status:n.response?.status||500}}}async getSingle(e,t="v3",s){let r=this.getClientForVersion(t);try{let n=await r.get(e,{params:s});return {success:!0,data:x(M(n.data)),error:null,status:n.status}}catch(n){return {success:false,data:null,error:n.message||"Unknown error occurred",status:n.response?.status||500}}}getClientForVersion(e){switch(e){case "v3":return this.v3Client;case "v4":return this.v4Client;case "stable":return this.stableClient;default:return this.v3Client}}};var 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,n={name:t};return s&&(n.from=s),r&&(n.to=r),this.client.get("/economic-indicators","stable",n)}};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:n,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),n&&(l.transactionType=n),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:n=100}=e,o={page:r,limit:n};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:n=100}=e,o={page:r,limit:n};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:n=100}=e,o={page:r,limit:n};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:n=1,limit:o=100}=e,a=t.join(","),l={page:n,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:n=1,limit:o=100}=e,a=t.join(","),l={page:n,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:n=1,limit:o=100}=e,a=t.join(","),l={page:n,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,n={};return s&&(n.from=s),r&&(n.to=r),this.client.getSingle(`/historical-price-full/${t}`,"v3",n)}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:n}=e,o={};return r&&(o.from=r),n&&(o.to=n),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 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 E=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 T=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 n=s.data;if(typeof n=="object"&&n!==null&&"companiesPriceList"in n&&Array.isArray(n.companiesPriceList)){let o=n.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof n=="object"&&n!==null&&"stockList"in n&&Array.isArray(n.stockList)){let o=n.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return n.symbol?{...s,data:[n]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let r=s.data.filter(n=>n&&n.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 n=s.data;if(typeof n=="object"&&n!==null&&"companiesPriceList"in n&&Array.isArray(n.companiesPriceList)){let o=n.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof n=="object"&&n!==null&&"stockList"in n&&Array.isArray(n.stockList)){let o=n.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return n.symbol?{...s,data:[n]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let r=s.data.filter(n=>n&&n.symbol);return {...s,data:r}}};var v=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.sec=new C(s),this.senateHouse=new E(s),this.stock=new T(s);}getClient(){return this.stock.client}};function w(i,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(i)}function D(i,e=2){return `${i.toFixed(e)}%`}function L(i){return i>=1e12?`${(i/1e12).toFixed(2)}T`:i>=1e9?`${(i/1e9).toFixed(2)}B`:i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(2)}K`:i.toString()}function N(i){return (typeof i=="string"?new Date(i):i).toISOString().split("T")[0]}function $(i){return i>=1e9?`${(i/1e9).toFixed(2)}B`:i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(2)}K`:i.toString()}var _=1e4,q=100,H=1e3,U={ANNUAL:"annual",QUARTER:"quarter"},V={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},O={TECHNOLOGY:"Technology",HEALTHCARE:"Healthcare",FINANCIAL:"Financial",CONSUMER_DISCRETIONARY:"Consumer Discretionary",CONSUMER_STAPLES:"Consumer Staples",INDUSTRIALS:"Industrials",ENERGY:"Energy",MATERIALS:"Materials",UTILITIES:"Utilities",REAL_ESTATE:"Real Estate",COMMUNICATION_SERVICES:"Communication Services"};
|
|
2
|
-
exports.CalendarEndpoints=p;exports.CompanyEndpoints=g;exports.DEFAULT_LIMIT=
|
|
1
|
+
'use strict';var M=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var M__default=/*#__PURE__*/_interopDefault(M);var w=[/exclusive endpoint/i,/not available under your current/i,/premium/i,/special endpoint/i,/upgrade your plan/i];function v(n,e){let t=e?.trim()||"Unknown error occurred",r=w.some(s=>s.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||r?{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 D(n){return Array.isArray(n)&&n.length===1?n[0]:n}function N(n){return Array.isArray(n)?n:n??[]}function $(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=M__default.default.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=M__default.default.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=M__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(r=>(r.params={...r.params,apikey:this.apiKey},r));});}async get(e,t="v3",r){let s=this.getClientForVersion(t);try{let i=await s.get(e,{params:r}),o=i.data;return (Array.isArray(o)||o==null)&&(o=N(o)),{success:!0,data:o,error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}async getSingle(e,t="v3",r){let s=this.getClientForVersion(t);try{let i=await s.get(e,{params:r});return {success:!0,data:$(D(i.data)),error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}buildErrorResponse(e){let t=e?.response?.data,r=t&&typeof t=="object"?t["Error Message"]??t.message??null:typeof t=="string"?t:null,s=e?.response?.status??0,{errorType:i,message:o}=v(s,r||e?.message||"");return {success:false,data:null,error:o,errorType:i,status:s||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 r=new Date(e);return !isNaN(r.getTime())&&r.toISOString().split("T")[0]===e}static isValidDateRange(e,t){if(!this.isValidDate(e)||!this.isValidDate(t))return false;let r=new Date(e),s=new Date(t);return r<=s}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:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/earning_calendar","v3",s)}async getEarningsConfirmed(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/earning-calendar-confirmed","v4",s)}async getDividendsCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/stock_dividend_calendar","v3",s)}async getEconomicsCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/economic_calendar","v3",s)}async getIPOCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/ipo_calendar","v3",s)}async getSplitsCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/stock_split_calendar","v3",s)}};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:r,quarter:s}=e;return this.client.getSingle(`/earning_call_transcript/${t}`,"v3",{year:r,quarter:s})}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:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this.client.get("/treasury-rates","stable",s)}async getEconomicIndicators(e){let{name:t,from:r,to:s}=e,i={name:t};return r&&(i.from=r),s&&(i.to=s),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:r}=e,s={};return t&&(s.symbol=t),r&&(s.date=r),this.client.get("/etf-holdings","v4",s)}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:r="annual",limit:s=5}=e;return this.client.get(`/income-statement?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getBalanceSheet(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/balance-sheet-statement?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getCashFlowStatement(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/cash-flow-statement?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getKeyMetrics(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/key-metrics?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getFinancialRatios(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/ratios?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getEnterpriseValue(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/enterprise-values?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getCashflowGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/cash-flow-statement-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getIncomeGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/income-statement-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getBalanceSheetGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/balance-sheet-statement-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getFinancialGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/financial-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getEarningsHistorical(e){let{symbol:t,limit:r=5}=e;return this.client.get(`/earnings?symbol=${t}&limit=${r}`,"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:r=100}=e;return this.client.get("/insider-trading/latest","stable",{page:t,limit:r})}async searchInsiderTrading(e){let{symbol:t,reportingCik:r,companyCik:s,transactionType:i,page:o=0,limit:a=100}=e,l={page:o,limit:a};return t&&(l.symbol=t),r&&(l.reportingCik=r),s&&(l.companyCik=s),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:r=0}=e;return this.client.get("/mapper-cik-name","v4",{name:t,page:r})}async getCikMapperBySymbol(e){let{symbol:t}=e;return this.client.getSingle(`/mapper-cik-company/${t}`,"v4")}async getBeneficialOwnership(e){let{symbol:t,limit:r=100}=e;return this.client.get("/acquisition-of-beneficial-ownership","stable",{symbol:t,limit:r})}async getFailToDeliver(e){let{symbol:t,page:r=0}=e;return this.client.get("/fail_to_deliver","v4",{symbol:t,page:r})}async getInsiderTradesBySymbol(e,t=0){return this.searchInsiderTrading({symbol:e,page:t})}async getInsiderTradesByType(e,t=0){return this.searchInsiderTrading({transactionType:e,page:t})}async getInsiderTradesByReportingCik(e,t=0){return this.searchInsiderTrading({reportingCik:e,page:t})}async getInsiderTradesByCompanyCik(e,t=0){return this.searchInsiderTrading({companyCik:e,page:t})}};var P=class{constructor(e){this.client=e;}async getForm13F(e){let{cik:t,date:r}=e,s={};return r&&(s.date=r),this.client.get(`/form-thirteen/${t}`,"v3",s)}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:r=100}=e;return this.client.get("/fmp-articles","stable",{page:t,limit:r})}async getStockNews(e={}){let{from:t,to:r,page:s=1,limit:i=100}=e,o={page:s,limit:i};return t&&(o.from=t),r&&(o.to=r),this.client.get("/news/stock-latest","stable",o)}async getCryptoNews(e={}){let{from:t,to:r,page:s=1,limit:i=100}=e,o={page:s,limit:i};return t&&(o.from=t),r&&(o.to=r),this.client.get("/news/crypto-latest","stable",o)}async getForexNews(e={}){let{from:t,to:r,page:s=1,limit:i=100}=e,o={page:s,limit:i};return t&&(o.from=t),r&&(o.to=r),this.client.get("/news/forex-latest","stable",o)}async getStockNewsBySymbol(e){let{symbols:t,from:r,to:s,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return r&&(l.from=r),s&&(l.to=s),this.client.get(`/news/stock?symbols=${a}`,"stable",l)}async getCryptoNewsBySymbol(e){let{symbols:t,from:r,to:s,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return r&&(l.from=r),s&&(l.to=s),this.client.get(`/news/crypto?symbols=${a}`,"stable",l)}async getForexNewsBySymbol(e){let{symbols:t,from:r,to:s,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return r&&(l.from=r),s&&(l.to=s),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:r,to:s}=e,i={};return r&&(i.from=r),s&&(i.to=s),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:r,from:s,to:i}=e,o={};return s&&(o.from=s),i&&(o.to=i),this.client.get(`/historical-chart/${r}/${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:r,exchange:s}=e;return this.client.get("/search","v3",{query:t,limit:r,exchange:s})}};var E=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 T=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:r}=e;return this.client.get("/senate-latest","stable",{page:t,limit:r??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:r}=e;return this.client.get("/house-latest","stable",{page:t,limit:r??100})}async getHouseTradingByName(e){let{name:t}=e;return this.client.get("/house-trades-by-name","stable",{name:t})}};var F=class{constructor(e){this.client=e;}async getMarketCap(e){return this.client.getSingle(`/market-capitalization/${e}`,"v3")}async getStockSplits(e){return this.client.get(`/historical-price-full/stock_split/${e}`,"v3")}async getDividendHistory(e){return this.client.getSingle(`/historical-price-full/stock_dividend/${e}`,"v3")}async getRealTimePrice(e){let t=`stock/real-time-price/${e.join(",")}`,r=await this.client.get(t,"v3");if(r.success&&r.data&&!Array.isArray(r.data)){let i=r.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 {...r,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 {...r,data:o}}return i.symbol?{...r,data:[i]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...r,data:[]})}let s=r.data.filter(i=>i&&i.symbol);return {...r,data:s}}async getRealTimePriceForMultipleStocks(e){let t=`stock/full/real-time-price/${e.join(",")}`,r=await this.client.get(t,"v3");if(r.success&&r.data&&!Array.isArray(r.data)){let i=r.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 {...r,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 {...r,data:o}}return i.symbol?{...r,data:[i]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...r,data:[]})}let s=r.data.filter(i=>i&&i.symbol);return {...r,data:s}}};var x=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 r=new c({...e,apiKey:t});this.calendar=new p(r),this.company=new g(r),this.economic=new u(r),this.etf=new d(r),this.financial=new y(r),this.insider=new f(r),this.institutional=new P(r),this.list=new b(r),this.market=new h(r),this.mutualFund=new R(r),this.news=new I(r),this.quote=new A(r),this.screener=new S(r),this.search=new C(r),this.sec=new E(r),this.senateHouse=new T(r),this.stock=new F(r);}getClient(){return this.stock.client}};function L(n,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(n)}function _(n,e=2){return `${n.toFixed(e)}%`}function q(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 H(n){return (typeof n=="string"?new Date(n):n).toISOString().split("T")[0]}function U(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 O=1e4,V=100,B=1e3,Y={ANNUAL:"annual",QUARTER:"quarter"},G={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},j={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 k=class extends Error{constructor(t,r,s){super(t);this.status=r;this.code=s;this.name="FMPError";}};
|
|
2
|
+
exports.CalendarEndpoints=p;exports.CompanyEndpoints=g;exports.DEFAULT_LIMIT=V;exports.DEFAULT_TIMEOUT=O;exports.ETFEndpoints=d;exports.EXCHANGES=G;exports.EconomicEndpoints=u;exports.FMP=x;exports.FMPClient=c;exports.FMPError=k;exports.FMPValidation=m;exports.FinancialEndpoints=y;exports.InsiderEndpoints=f;exports.InstitutionalEndpoints=P;exports.ListEndpoints=b;exports.MAX_LIMIT=B;exports.MarketEndpoints=h;exports.MutualFundEndpoints=R;exports.NewsEndpoints=I;exports.PERIODS=Y;exports.QuoteEndpoints=A;exports.SECEndpoints=E;exports.SECTORS=j;exports.ScreenerEndpoints=S;exports.SearchEndpoints=C;exports.SenateHouseEndpoints=T;exports.StockEndpoints=F;exports.classifyError=v;exports.formatCurrency=L;exports.formatDate=H;exports.formatLargeNumber=q;exports.formatPercentage=_;exports.formatVolume=U;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-RM7ETDL3.mjs';export{a as FMPValidation}from'./chunk-RM7ETDL3.mjs';import F from'axios';function k(i){return Array.isArray(i)&&i.length===1?i[0]:i}function M(i){return Array.isArray(i)?i:i??[]}function x(i){return i==null?{}:Array.isArray(i)&&i.length===0?{}:i}var c=class{constructor(e){if(!e.apiKey)throw new Error("API key is required for FMPClient");this.apiKey=e.apiKey,this.v3Client=F.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=F.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=F.create({baseURL:"https://financialmodelingprep.com/stable",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),[this.v3Client,this.v4Client,this.stableClient].forEach(s=>{s.interceptors.request.use(t=>(t.params={...t.params,apikey:this.apiKey},t));});}async get(e,s="v3",t){let n=this.getClientForVersion(s);try{let r=await n.get(e,{params:t}),o=r.data;return (Array.isArray(o)||o==null)&&(o=M(o)),{success:!0,data:o,error:null,status:r.status}}catch(r){return {success:false,data:null,error:r.message||"Unknown error occurred",status:r.response?.status||500}}}async getSingle(e,s="v3",t){let n=this.getClientForVersion(s);try{let r=await n.get(e,{params:t});return {success:!0,data:x(k(r.data)),error:null,status:r.status}}catch(r){return {success:false,data:null,error:r.message||"Unknown error occurred",status:r.response?.status||500}}}getClientForVersion(e){switch(e){case "v3":return this.v3Client;case "v4":return this.v4Client;case "stable":return this.stableClient;default:return this.v3Client}}};var m=class{constructor(e){this._client=e;}async getEarningsCalendar(e={}){let{from:s,to:t}=e,n={};return s&&(n.from=s),t&&(n.to=t),this._client.get("/earning_calendar","v3",n)}async getEarningsConfirmed(e={}){let{from:s,to:t}=e,n={};return s&&(n.from=s),t&&(n.to=t),this._client.get("/earning-calendar-confirmed","v4",n)}async getDividendsCalendar(e={}){let{from:s,to:t}=e,n={};return s&&(n.from=s),t&&(n.to=t),this._client.get("/stock_dividend_calendar","v3",n)}async getEconomicsCalendar(e={}){let{from:s,to:t}=e,n={};return s&&(n.from=s),t&&(n.to=t),this._client.get("/economic_calendar","v3",n)}async getIPOCalendar(e={}){let{from:s,to:t}=e,n={};return s&&(n.from=s),t&&(n.to=t),this._client.get("/ipo_calendar","v3",n)}async getSplitsCalendar(e={}){let{from:s,to:t}=e,n={};return s&&(n.from=s),t&&(n.to=t),this._client.get("/stock_split_calendar","v3",n)}};var p=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:s,year:t,quarter:n}=e;return this.client.getSingle(`/earning_call_transcript/${s}`,"v3",{year:t,quarter:n})}async getCompanyTranscriptData(e){return this.client.getSingle("/earning_call_transcript","v4",{symbol:e})}};var g=class{constructor(e){this.client=e;}async getTreasuryRates(e){let{from:s,to:t}=e,n={};return s&&(n.from=s),t&&(n.to=t),this.client.get("/treasury-rates","stable",n)}async getEconomicIndicators(e){let{name:s,from:t,to:n}=e,r={name:s};return t&&(r.from=t),n&&(r.to=n),this.client.get("/economic-indicators","stable",r)}};var u=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:s,date:t}=e,n={};return s&&(n.symbol=s),t&&(n.date=t),this.client.get("/etf-holdings","v4",n)}async getHolder(e){return this.client.get(`/etf-holder/${e}`,"v3")}async getProfile(e){return this.client.getSingle("/etf/info","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:s,period:t="annual",limit:n=5}=e;return this.client.get(`/income-statement?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getBalanceSheet(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/balance-sheet-statement?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getCashFlowStatement(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/cash-flow-statement?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getKeyMetrics(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/key-metrics?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getFinancialRatios(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/ratios?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getEnterpriseValue(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/enterprise-values?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getCashflowGrowth(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/cash-flow-statement-growth?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getIncomeGrowth(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/income-statement-growth?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getBalanceSheetGrowth(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/balance-sheet-statement-growth?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getFinancialGrowth(e){let{symbol:s,period:t="annual",limit:n=5}=e;return this.client.get(`/financial-growth?symbol=${s}&period=${t}&limit=${n}`,"stable")}async getEarningsHistorical(e){let{symbol:s,limit:t=5}=e;return this.client.get(`/earnings?symbol=${s}&limit=${t}`,"stable")}async getEarningsSurprises(e){return this.client.get(`/earnings-surprises/${e}`,"v3")}};var y=class{constructor(e){this.client=e;}async getInsiderTradingRSS(e){let{page:s=0,limit:t=100}=e;return this.client.get("/insider-trading/latest","stable",{page:s,limit:t})}async searchInsiderTrading(e){let{symbol:s,reportingCik:t,companyCik:n,transactionType:r,page:o=0,limit:a=100}=e,l={page:o,limit:a};return s&&(l.symbol=s),t&&(l.reportingCik=t),n&&(l.companyCik=n),r&&(l.transactionType=r),this.client.get("/insider-trading/search","stable",l)}async getTransactionTypes(){return this.client.get("/insider-trading-transaction-type","stable")}async getInsidersBySymbol(e){let{symbol:s}=e;return this.client.get("/insider-roaster","v4",{symbol:s})}async getInsiderTradeStatistics(e){let{symbol:s}=e;return this.client.get("/insider-trading/statistics","stable",{symbol:s})}async getCikMapper(e){let{page:s=0}=e;return this.client.get("/mapper-cik-name","v4",{page:s})}async getCikMapperByName(e){let{name:s,page:t=0}=e;return this.client.get("/mapper-cik-name","v4",{name:s,page:t})}async getCikMapperBySymbol(e){let{symbol:s}=e;return this.client.getSingle(`/mapper-cik-company/${s}`,"v4")}async getBeneficialOwnership(e){let{symbol:s,limit:t=100}=e;return this.client.get("/acquisition-of-beneficial-ownership","stable",{symbol:s,limit:t})}async getFailToDeliver(e){let{symbol:s,page:t=0}=e;return this.client.get("/fail_to_deliver","v4",{symbol:s,page:t})}async getInsiderTradesBySymbol(e,s=0){return this.searchInsiderTrading({symbol:e,page:s})}async getInsiderTradesByType(e,s=0){return this.searchInsiderTrading({transactionType:e,page:s})}async getInsiderTradesByReportingCik(e,s=0){return this.searchInsiderTrading({reportingCik:e,page:s})}async getInsiderTradesByCompanyCik(e,s=0){return this.searchInsiderTrading({companyCik:e,page:s})}};var P=class{constructor(e){this.client=e;}async getForm13F(e){let{cik:s,date:t}=e,n={};return t&&(n.date=t),this.client.get(`/form-thirteen/${s}`,"v3",n)}async getForm13FDates(e){let{cik:s}=e;return this.client.get(`/form-thirteen-date/${s}`,"v3")}async getInstitutionalHolders(e){let{symbol:s}=e;return this.client.get(`/institutional-holder/${s}`,"v3")}};var f=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 b=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:s=1,limit:t=100}=e;return this.client.get("/fmp-articles","stable",{page:s,limit:t})}async getStockNews(e={}){let{from:s,to:t,page:n=1,limit:r=100}=e,o={page:n,limit:r};return s&&(o.from=s),t&&(o.to=t),this.client.get("/news/stock-latest","stable",o)}async getCryptoNews(e={}){let{from:s,to:t,page:n=1,limit:r=100}=e,o={page:n,limit:r};return s&&(o.from=s),t&&(o.to=t),this.client.get("/news/crypto-latest","stable",o)}async getForexNews(e={}){let{from:s,to:t,page:n=1,limit:r=100}=e,o={page:n,limit:r};return s&&(o.from=s),t&&(o.to=t),this.client.get("/news/forex-latest","stable",o)}async getStockNewsBySymbol(e){let{symbols:s,from:t,to:n,page:r=1,limit:o=100}=e,a=s.join(","),l={page:r,limit:o};return t&&(l.from=t),n&&(l.to=n),this.client.get(`/news/stock?symbols=${a}`,"stable",l)}async getCryptoNewsBySymbol(e){let{symbols:s,from:t,to:n,page:r=1,limit:o=100}=e,a=s.join(","),l={page:r,limit:o};return t&&(l.from=t),n&&(l.to=n),this.client.get(`/news/crypto?symbols=${a}`,"stable",l)}async getForexNewsBySymbol(e){let{symbols:s,from:t,to:n,page:r=1,limit:o=100}=e,a=s.join(","),l={page:r,limit:o};return t&&(l.from=t),n&&(l.to=n),this.client.get(`/news/forex?symbols=${a}`,"stable",l)}};var h=class{constructor(e){this.client=e;}async getQuote(e){return this.client.getSingle(`/quote/${e}`,"v3")}async getHistoricalPrice(e){let{symbol:s,from:t,to:n}=e,r={};return t&&(r.from=t),n&&(r.to=n),this.client.getSingle(`/historical-price-full/${s}`,"v3",r)}async getQuotes(e){let s=e.join(",");return this.client.get(`/quote/${s}`,"v3")}async getIntraday(e){let{symbol:s,interval:t,from:n,to:r}=e,o={};return n&&(o.from=n),r&&(o.to=r),this.client.get(`/historical-chart/${t}/${s}`,"v3",o)}};var A=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 S=class{constructor(e){this.client=e;}async getRSSFeed(e){return this.client.get("/rss_feed","v4",e)}async getRSSFeedAll(e){return this.client.get("/rss_feed_all","v4",e)}async getRSSFeedV3(e){return this.client.get("/rss_feed","v3",e)}async getRSSFeed8K(e){return this.client.get("/rss_feed_8k","v4",e)}async getSECFilings({symbol:e,params:s}){return this.client.get(`/sec_filings/${e}`,"v3",s)}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 C=class{constructor(e){this.client=e;}async getSenateTrading(e){let{symbol:s}=e;return this.client.get("/senate-trades","stable",{symbol:s})}async getSenateTradingRSSFeed(e){let{page:s,limit:t}=e;return this.client.get("/senate-latest","stable",{page:s,limit:t??100})}async getSenateTradingByName(e){let{name:s}=e;return this.client.get("/senate-trades-by-name","stable",{name:s})}async getHouseTrading(e){let{symbol:s}=e;return this.client.get("/house-trades","stable",{symbol:s})}async getHouseTradingRSSFeed(e){let{page:s,limit:t}=e;return this.client.get("/house-latest","stable",{page:s,limit:t??100})}async getHouseTradingByName(e){let{name:s}=e;return this.client.get("/house-trades-by-name","stable",{name:s})}};var E=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 s=`stock/real-time-price/${e.join(",")}`,t=await this.client.get(s,"v3");if(t.success&&t.data&&!Array.isArray(t.data)){let r=t.data;if(typeof r=="object"&&r!==null&&"companiesPriceList"in r&&Array.isArray(r.companiesPriceList)){let o=r.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...t,data:o}}if(typeof r=="object"&&r!==null&&"stockList"in r&&Array.isArray(r.stockList)){let o=r.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...t,data:o}}return r.symbol?{...t,data:[r]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...t,data:[]})}let n=t.data.filter(r=>r&&r.symbol);return {...t,data:n}}async getRealTimePriceForMultipleStocks(e){let s=`stock/full/real-time-price/${e.join(",")}`,t=await this.client.get(s,"v3");if(t.success&&t.data&&!Array.isArray(t.data)){let r=t.data;if(typeof r=="object"&&r!==null&&"companiesPriceList"in r&&Array.isArray(r.companiesPriceList)){let o=r.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...t,data:o}}if(typeof r=="object"&&r!==null&&"stockList"in r&&Array.isArray(r.stockList)){let o=r.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...t,data:o}}return r.symbol?{...t,data:[r]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...t,data:[]})}let n=t.data.filter(r=>r&&r.symbol);return {...t,data:n}}};var v=class{constructor(e={}){let s=e.apiKey||process.env.FMP_API_KEY;if(!s)throw new Error("FMP API key is required. Please provide it in the config or set the FMP_API_KEY environment variable.");if(!a.isValidApiKey(s))throw new Error("Invalid API key format");let t=new c({...e,apiKey:s});this.calendar=new m(t),this.company=new p(t),this.economic=new g(t),this.etf=new u(t),this.financial=new d(t),this.insider=new y(t),this.institutional=new P(t),this.list=new f(t),this.market=new b(t),this.mutualFund=new R(t),this.news=new I(t),this.quote=new h(t),this.screener=new A(t),this.sec=new S(t),this.senateHouse=new C(t),this.stock=new E(t);}getClient(){return this.stock.client}};function w(i,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(i)}function D(i,e=2){return `${i.toFixed(e)}%`}function L(i){return i>=1e12?`${(i/1e12).toFixed(2)}T`:i>=1e9?`${(i/1e9).toFixed(2)}B`:i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(2)}K`:i.toString()}function N(i){return (typeof i=="string"?new Date(i):i).toISOString().split("T")[0]}function _(i){return i>=1e9?`${(i/1e9).toFixed(2)}B`:i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(2)}K`:i.toString()}var $=1e4,H=100,q=1e3,U={ANNUAL:"annual",QUARTER:"quarter"},O={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},B={TECHNOLOGY:"Technology",HEALTHCARE:"Healthcare",FINANCIAL:"Financial",CONSUMER_DISCRETIONARY:"Consumer Discretionary",CONSUMER_STAPLES:"Consumer Staples",INDUSTRIALS:"Industrials",ENERGY:"Energy",MATERIALS:"Materials",UTILITIES:"Utilities",REAL_ESTATE:"Real Estate",COMMUNICATION_SERVICES:"Communication Services"};
|
|
2
|
-
export{m as CalendarEndpoints,p as CompanyEndpoints,
|
|
1
|
+
import {a}from'./chunk-RM7ETDL3.mjs';export{a as FMPValidation}from'./chunk-RM7ETDL3.mjs';import M from'axios';var w=[/exclusive endpoint/i,/not available under your current/i,/premium/i,/special endpoint/i,/upgrade your plan/i];function v(n,e){let t=e?.trim()||"Unknown error occurred",r=w.some(s=>s.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||r?{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 D(n){return Array.isArray(n)&&n.length===1?n[0]:n}function L(n){return Array.isArray(n)?n:n??[]}function N(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=M.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=M.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=M.create({baseURL:"https://financialmodelingprep.com/stable",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),[this.v3Client,this.v4Client,this.stableClient].forEach(t=>{t.interceptors.request.use(r=>(r.params={...r.params,apikey:this.apiKey},r));});}async get(e,t="v3",r){let s=this.getClientForVersion(t);try{let i=await s.get(e,{params:r}),o=i.data;return (Array.isArray(o)||o==null)&&(o=L(o)),{success:!0,data:o,error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}async getSingle(e,t="v3",r){let s=this.getClientForVersion(t);try{let i=await s.get(e,{params:r});return {success:!0,data:N(D(i.data)),error:null,status:i.status}}catch(i){return this.buildErrorResponse(i)}}buildErrorResponse(e){let t=e?.response?.data,r=t&&typeof t=="object"?t["Error Message"]??t.message??null:typeof t=="string"?t:null,s=e?.response?.status??0,{errorType:i,message:o}=v(s,r||e?.message||"");return {success:false,data:null,error:o,errorType:i,status:s||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{constructor(e){this._client=e;}async getEarningsCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/earning_calendar","v3",s)}async getEarningsConfirmed(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/earning-calendar-confirmed","v4",s)}async getDividendsCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/stock_dividend_calendar","v3",s)}async getEconomicsCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/economic_calendar","v3",s)}async getIPOCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/ipo_calendar","v3",s)}async getSplitsCalendar(e={}){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this._client.get("/stock_split_calendar","v3",s)}};var p=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:r,quarter:s}=e;return this.client.getSingle(`/earning_call_transcript/${t}`,"v3",{year:r,quarter:s})}async getCompanyTranscriptData(e){return this.client.getSingle("/earning_call_transcript","v4",{symbol:e})}};var g=class{constructor(e){this.client=e;}async getTreasuryRates(e){let{from:t,to:r}=e,s={};return t&&(s.from=t),r&&(s.to=r),this.client.get("/treasury-rates","stable",s)}async getEconomicIndicators(e){let{name:t,from:r,to:s}=e,i={name:t};return r&&(i.from=r),s&&(i.to=s),this.client.get("/economic-indicators","stable",i)}};var u=class{constructor(e){this.client=e;}async getHoldingDates(e){return this.client.get("/etf-holdings/portfolio-date","v4",{symbol:e})}async getHoldings(e){let{symbol:t,date:r}=e,s={};return t&&(s.symbol=t),r&&(s.date=r),this.client.get("/etf-holdings","v4",s)}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:r="annual",limit:s=5}=e;return this.client.get(`/income-statement?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getBalanceSheet(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/balance-sheet-statement?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getCashFlowStatement(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/cash-flow-statement?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getKeyMetrics(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/key-metrics?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getFinancialRatios(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/ratios?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getEnterpriseValue(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/enterprise-values?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getCashflowGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/cash-flow-statement-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getIncomeGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/income-statement-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getBalanceSheetGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/balance-sheet-statement-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getFinancialGrowth(e){let{symbol:t,period:r="annual",limit:s=5}=e;return this.client.get(`/financial-growth?symbol=${t}&period=${r}&limit=${s}`,"stable")}async getEarningsHistorical(e){let{symbol:t,limit:r=5}=e;return this.client.get(`/earnings?symbol=${t}&limit=${r}`,"stable")}async getEarningsSurprises(e){return this.client.get(`/earnings-surprises/${e}`,"v3")}};var d=class{constructor(e){this.client=e;}async getInsiderTradingRSS(e){let{page:t=0,limit:r=100}=e;return this.client.get("/insider-trading/latest","stable",{page:t,limit:r})}async searchInsiderTrading(e){let{symbol:t,reportingCik:r,companyCik:s,transactionType:i,page:o=0,limit:a=100}=e,l={page:o,limit:a};return t&&(l.symbol=t),r&&(l.reportingCik=r),s&&(l.companyCik=s),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:r=0}=e;return this.client.get("/mapper-cik-name","v4",{name:t,page:r})}async getCikMapperBySymbol(e){let{symbol:t}=e;return this.client.getSingle(`/mapper-cik-company/${t}`,"v4")}async getBeneficialOwnership(e){let{symbol:t,limit:r=100}=e;return this.client.get("/acquisition-of-beneficial-ownership","stable",{symbol:t,limit:r})}async getFailToDeliver(e){let{symbol:t,page:r=0}=e;return this.client.get("/fail_to_deliver","v4",{symbol:t,page:r})}async getInsiderTradesBySymbol(e,t=0){return this.searchInsiderTrading({symbol:e,page:t})}async getInsiderTradesByType(e,t=0){return this.searchInsiderTrading({transactionType:e,page:t})}async getInsiderTradesByReportingCik(e,t=0){return this.searchInsiderTrading({reportingCik:e,page:t})}async getInsiderTradesByCompanyCik(e,t=0){return this.searchInsiderTrading({companyCik:e,page:t})}};var P=class{constructor(e){this.client=e;}async getForm13F(e){let{cik:t,date:r}=e,s={};return r&&(s.date=r),this.client.get(`/form-thirteen/${t}`,"v3",s)}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 f=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 b=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 h=class{constructor(e){this.client=e;}async getArticles(e={}){let{page:t=1,limit:r=100}=e;return this.client.get("/fmp-articles","stable",{page:t,limit:r})}async getStockNews(e={}){let{from:t,to:r,page:s=1,limit:i=100}=e,o={page:s,limit:i};return t&&(o.from=t),r&&(o.to=r),this.client.get("/news/stock-latest","stable",o)}async getCryptoNews(e={}){let{from:t,to:r,page:s=1,limit:i=100}=e,o={page:s,limit:i};return t&&(o.from=t),r&&(o.to=r),this.client.get("/news/crypto-latest","stable",o)}async getForexNews(e={}){let{from:t,to:r,page:s=1,limit:i=100}=e,o={page:s,limit:i};return t&&(o.from=t),r&&(o.to=r),this.client.get("/news/forex-latest","stable",o)}async getStockNewsBySymbol(e){let{symbols:t,from:r,to:s,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return r&&(l.from=r),s&&(l.to=s),this.client.get(`/news/stock?symbols=${a}`,"stable",l)}async getCryptoNewsBySymbol(e){let{symbols:t,from:r,to:s,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return r&&(l.from=r),s&&(l.to=s),this.client.get(`/news/crypto?symbols=${a}`,"stable",l)}async getForexNewsBySymbol(e){let{symbols:t,from:r,to:s,page:i=1,limit:o=100}=e,a=t.join(","),l={page:i,limit:o};return r&&(l.from=r),s&&(l.to=s),this.client.get(`/news/forex?symbols=${a}`,"stable",l)}};var I=class{constructor(e){this.client=e;}async getQuote(e){return this.client.getSingle(`/quote/${e}`,"v3")}async getHistoricalPrice(e){let{symbol:t,from:r,to:s}=e,i={};return r&&(i.from=r),s&&(i.to=s),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:r,from:s,to:i}=e,o={};return s&&(o.from=s),i&&(o.to=i),this.client.get(`/historical-chart/${r}/${t}`,"v3",o)}};var A=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 S=class{constructor(e){this.client=e;}async search(e){let{query:t,limit:r,exchange:s}=e;return this.client.get("/search","v3",{query:t,limit:r,exchange:s})}};var E=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 C=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:r}=e;return this.client.get("/senate-latest","stable",{page:t,limit:r??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:r}=e;return this.client.get("/house-latest","stable",{page:t,limit:r??100})}async getHouseTradingByName(e){let{name:t}=e;return this.client.get("/house-trades-by-name","stable",{name:t})}};var T=class{constructor(e){this.client=e;}async getMarketCap(e){return this.client.getSingle(`/market-capitalization/${e}`,"v3")}async getStockSplits(e){return this.client.get(`/historical-price-full/stock_split/${e}`,"v3")}async getDividendHistory(e){return this.client.getSingle(`/historical-price-full/stock_dividend/${e}`,"v3")}async getRealTimePrice(e){let t=`stock/real-time-price/${e.join(",")}`,r=await this.client.get(t,"v3");if(r.success&&r.data&&!Array.isArray(r.data)){let i=r.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 {...r,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 {...r,data:o}}return i.symbol?{...r,data:[i]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...r,data:[]})}let s=r.data.filter(i=>i&&i.symbol);return {...r,data:s}}async getRealTimePriceForMultipleStocks(e){let t=`stock/full/real-time-price/${e.join(",")}`,r=await this.client.get(t,"v3");if(r.success&&r.data&&!Array.isArray(r.data)){let i=r.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 {...r,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 {...r,data:o}}return i.symbol?{...r,data:[i]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...r,data:[]})}let s=r.data.filter(i=>i&&i.symbol);return {...r,data:s}}};var k=class{constructor(e={}){let t=e.apiKey||process.env.FMP_API_KEY;if(!t)throw new Error("FMP API key is required. Please provide it in the config or set the FMP_API_KEY environment variable.");if(!a.isValidApiKey(t))throw new Error("Invalid API key format");let r=new c({...e,apiKey:t});this.calendar=new m(r),this.company=new p(r),this.economic=new g(r),this.etf=new u(r),this.financial=new y(r),this.insider=new d(r),this.institutional=new P(r),this.list=new f(r),this.market=new b(r),this.mutualFund=new R(r),this.news=new h(r),this.quote=new I(r),this.screener=new A(r),this.search=new S(r),this.sec=new E(r),this.senateHouse=new C(r),this.stock=new T(r);}getClient(){return this.stock.client}};function _(n,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(n)}function $(n,e=2){return `${n.toFixed(e)}%`}function H(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 q(n){return (typeof n=="string"?new Date(n):n).toISOString().split("T")[0]}function U(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 O=1e4,B=100,G=1e3,K={ANNUAL:"annual",QUARTER:"quarter"},V={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},Y={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 x=class extends Error{constructor(t,r,s){super(t);this.status=r;this.code=s;this.name="FMPError";}};
|
|
2
|
+
export{m as CalendarEndpoints,p as CompanyEndpoints,B as DEFAULT_LIMIT,O as DEFAULT_TIMEOUT,u as ETFEndpoints,V as EXCHANGES,g as EconomicEndpoints,k as FMP,c as FMPClient,x as FMPError,y as FinancialEndpoints,d as InsiderEndpoints,P as InstitutionalEndpoints,f as ListEndpoints,G as MAX_LIMIT,b as MarketEndpoints,R as MutualFundEndpoints,h as NewsEndpoints,K as PERIODS,I as QuoteEndpoints,E as SECEndpoints,Y as SECTORS,A as ScreenerEndpoints,S as SearchEndpoints,C as SenateHouseEndpoints,T as StockEndpoints,v as classifyError,_ as formatCurrency,q as formatDate,H as formatLargeNumber,$ as formatPercentage,U as formatVolume};
|
package/dist/types-only.d.mts
CHANGED
|
@@ -178,10 +178,13 @@ type EconomicsCalendar = z.infer<typeof EconomicsCalendarSchema>;
|
|
|
178
178
|
type IPOCalendar = z.infer<typeof IPOCalendarSchema>;
|
|
179
179
|
type SplitsCalendar = z.infer<typeof SplitsCalendarSchema>;
|
|
180
180
|
|
|
181
|
+
type FMPErrorType = 'plan-restricted' | 'rate-limit' | 'auth' | 'not-found' | 'bad-request' | 'network' | 'unknown';
|
|
181
182
|
interface APIResponse<T = unknown> {
|
|
182
183
|
success: boolean;
|
|
183
184
|
data: T | null;
|
|
184
185
|
error: string | null;
|
|
186
|
+
/** Categorizes the failure. Present only when `success` is false. */
|
|
187
|
+
errorType?: FMPErrorType;
|
|
185
188
|
status: number;
|
|
186
189
|
}
|
|
187
190
|
interface FMPConfig {
|
|
@@ -3632,6 +3635,27 @@ type AvailableSectors = z.infer<typeof AvailableSectorsSchema>;
|
|
|
3632
3635
|
type AvailableIndustries = z.infer<typeof AvailableIndustriesSchema>;
|
|
3633
3636
|
type AvailableCountries = z.infer<typeof AvailableCountriesSchema>;
|
|
3634
3637
|
|
|
3638
|
+
declare const SearchResultSchema: z.ZodObject<{
|
|
3639
|
+
symbol: z.ZodString;
|
|
3640
|
+
name: z.ZodString;
|
|
3641
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
3642
|
+
stockExchange: z.ZodNullable<z.ZodString>;
|
|
3643
|
+
exchangeShortName: z.ZodNullable<z.ZodString>;
|
|
3644
|
+
}, "strip", z.ZodTypeAny, {
|
|
3645
|
+
symbol: string;
|
|
3646
|
+
currency: string | null;
|
|
3647
|
+
name: string;
|
|
3648
|
+
exchangeShortName: string | null;
|
|
3649
|
+
stockExchange: string | null;
|
|
3650
|
+
}, {
|
|
3651
|
+
symbol: string;
|
|
3652
|
+
currency: string | null;
|
|
3653
|
+
name: string;
|
|
3654
|
+
exchangeShortName: string | null;
|
|
3655
|
+
stockExchange: string | null;
|
|
3656
|
+
}>;
|
|
3657
|
+
type SearchResult = z.infer<typeof SearchResultSchema>;
|
|
3658
|
+
|
|
3635
3659
|
declare const SenateTradingResponseSchema: z.ZodObject<{
|
|
3636
3660
|
symbol: z.ZodString;
|
|
3637
3661
|
disclosureDate: z.ZodString;
|
|
@@ -3983,4 +4007,4 @@ interface CompaniesPriceListResponse<T> {
|
|
|
3983
4007
|
companiesPriceList: T[];
|
|
3984
4008
|
}
|
|
3985
4009
|
|
|
3986
|
-
export { type APIResponse, type Article, ArticleSchema, type AvailableCountries, AvailableCountriesSchema, type AvailableExchanges, AvailableExchangesSchema, type AvailableIndexesList, AvailableIndexesListSchema, type AvailableIndustries, AvailableIndustriesSchema, type AvailableSectors, AvailableSectorsSchema, type BalanceSheet, type BalanceSheetGrowth, BalanceSheetGrowthSchema, BalanceSheetSchema, type BeneficialOwnershipResponse, BeneficialOwnershipResponseSchema, type CashFlowStatement, CashFlowStatementSchema, type CashflowGrowth, CashflowGrowthSchema, type CikMapperBySymbolResponse, CikMapperBySymbolResponseSchema, type CikMapperResponse, CikMapperResponseSchema, type CompaniesPriceListResponse, type CompanyNotes, CompanyNotesSchema, type CompanyProfile, CompanyProfileSchema, type CompanyTranscriptData, CompanyTranscriptDataSchema, type CryptoList, CryptoListSchema, type DateRangeParams, type DividendsCalendar, DividendsCalendarSchema, type ETFCountryWeighting, ETFCountryWeightingSchema, type ETFHolder, ETFHolderSchema, type ETFHolding, type ETFHoldingDates, ETFHoldingDatesSchema, ETFHoldingSchema, type ETFList, ETFListSchema, type ETFProfile, ETFProfileSchema, type ETFStockExposure, ETFStockExposureSchema, type ETFWeighting, ETFWeightingSchema, type EarningsCalendar, EarningsCalendarSchema, type EarningsCallTranscript, EarningsCallTranscriptSchema, type EarningsConfirmed, EarningsConfirmedSchema, type EarningsHistorical, EarningsHistoricalSchema, type EarningsSurprises, EarningsSurprisesSchema, type EconomicIndicator, type EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, type EconomicsCalendar, EconomicsCalendarSchema, type EnterpriseValue, EnterpriseValueSchema, Exchange, type ExecutiveCompensation, ExecutiveCompensationSchema, type FMPConfig, type FailToDeliverResponse, FailToDeliverResponseSchema, type FinancialGrowth, FinancialGrowthSchema, type FinancialRatios, FinancialRatiosSchema, type ForexList, ForexListSchema, type Form13FResponse, Form13FResponseSchema, type HistoricalEmployeeCount, HistoricalEmployeeCountSchema, type HistoricalPriceData, HistoricalPriceDataSchema, type HistoricalPriceResponse, HistoricalPriceResponseSchema, type HistoricalSharesFloat, HistoricalSharesFloatSchema, type HouseTradingResponse, HouseTradingResponseSchema, type IPOCalendar, IPOCalendarSchema, type IncomeGrowth, IncomeGrowthSchema, type IncomeStatement, IncomeStatementSchema, type IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, type IndustryClassification, type IndustryClassificationCode, IndustryClassificationCodeSchema, type IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, type InsiderTradeStatisticsResponse, InsiderTradeStatisticsResponseSchema, type InsiderTradingRSSResponse, InsiderTradingRSSResponseSchema, type InsiderTradingSearchResponse, InsiderTradingSearchResponseSchema, type InsidersBySymbolResponse, InsidersBySymbolResponseSchema, type InstitutionalHolderResponse, InstitutionalHolderResponseSchema, type IntradayPrice, IntradayPriceSchema, type KeyMetrics, KeyMetricsSchema, type MarketCap, MarketCapSchema, type MarketHoliday, MarketHolidaySchema, type MarketHours, MarketHoursSchema, type MarketIndex, MarketIndexSchema, type MarketPerformance, MarketPerformanceSchema, type MarketSectorPerformance, MarketSectorPerformanceSchema, type MutualFundHolding, MutualFundHoldingSchema, type News, NewsSchema, type PaginationParams, Period, type PeriodParams, type QueryParams, type Quote, QuoteSchema, type RSSFeed8KItem, RSSFeed8KItemSchema, type RSSFeed8KParams, RSSFeed8KParamsSchema, type RSSFeedAllItem, RSSFeedAllItemSchema, type RSSFeedItem, RSSFeedItemSchema, type RSSFeedParams, RSSFeedParamsSchema, type RSSFeedV3Item, RSSFeedV3ItemSchema, type RSSFeedV3Params, RSSFeedV3ParamsSchema, type SECFiling, SECFilingSchema, type SECFilingsParams, SECFilingsParamsSchema, type Screener, type ScreenerParams, ScreenerParamsSchema, ScreenerSchema, type SenateHouseTradingByNameResponse, SenateHouseTradingByNameResponseSchema, type SenateTradingResponse, SenateTradingResponseSchema, type SharesFloat, SharesFloatSchema, type SplitsCalendar, SplitsCalendarSchema, type StockDividend, type StockDividendResponse, StockDividendResponseSchema, StockDividendSchema, type StockList, type StockListResponse, StockListSchema, type StockRealTimePrice, type StockRealTimePriceFull, StockRealTimePriceFullSchema, StockRealTimePriceSchema, type StockSplit, type StockSplitResponse, StockSplitResponseSchema, StockSplitSchema, type SymbolParams, TransactionType, TransactionTypeRecordSchema, type TransactionTypesResponse, type TreasuryRate, TreasuryRateSchema };
|
|
4010
|
+
export { type APIResponse, type Article, ArticleSchema, type AvailableCountries, AvailableCountriesSchema, type AvailableExchanges, AvailableExchangesSchema, type AvailableIndexesList, AvailableIndexesListSchema, type AvailableIndustries, AvailableIndustriesSchema, type AvailableSectors, AvailableSectorsSchema, type BalanceSheet, type BalanceSheetGrowth, BalanceSheetGrowthSchema, BalanceSheetSchema, type BeneficialOwnershipResponse, BeneficialOwnershipResponseSchema, type CashFlowStatement, CashFlowStatementSchema, type CashflowGrowth, CashflowGrowthSchema, type CikMapperBySymbolResponse, CikMapperBySymbolResponseSchema, type CikMapperResponse, CikMapperResponseSchema, type CompaniesPriceListResponse, type CompanyNotes, CompanyNotesSchema, type CompanyProfile, CompanyProfileSchema, type CompanyTranscriptData, CompanyTranscriptDataSchema, type CryptoList, CryptoListSchema, type DateRangeParams, type DividendsCalendar, DividendsCalendarSchema, type ETFCountryWeighting, ETFCountryWeightingSchema, type ETFHolder, ETFHolderSchema, type ETFHolding, type ETFHoldingDates, ETFHoldingDatesSchema, ETFHoldingSchema, type ETFList, ETFListSchema, type ETFProfile, ETFProfileSchema, type ETFStockExposure, ETFStockExposureSchema, type ETFWeighting, ETFWeightingSchema, type EarningsCalendar, EarningsCalendarSchema, type EarningsCallTranscript, EarningsCallTranscriptSchema, type EarningsConfirmed, EarningsConfirmedSchema, type EarningsHistorical, EarningsHistoricalSchema, type EarningsSurprises, EarningsSurprisesSchema, type EconomicIndicator, type EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, type EconomicsCalendar, EconomicsCalendarSchema, type EnterpriseValue, EnterpriseValueSchema, Exchange, type ExecutiveCompensation, ExecutiveCompensationSchema, type FMPConfig, type FMPErrorType, type FailToDeliverResponse, FailToDeliverResponseSchema, type FinancialGrowth, FinancialGrowthSchema, type FinancialRatios, FinancialRatiosSchema, type ForexList, ForexListSchema, type Form13FResponse, Form13FResponseSchema, type HistoricalEmployeeCount, HistoricalEmployeeCountSchema, type HistoricalPriceData, HistoricalPriceDataSchema, type HistoricalPriceResponse, HistoricalPriceResponseSchema, type HistoricalSharesFloat, HistoricalSharesFloatSchema, type HouseTradingResponse, HouseTradingResponseSchema, type IPOCalendar, IPOCalendarSchema, type IncomeGrowth, IncomeGrowthSchema, type IncomeStatement, IncomeStatementSchema, type IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, type IndustryClassification, type IndustryClassificationCode, IndustryClassificationCodeSchema, type IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, type InsiderTradeStatisticsResponse, InsiderTradeStatisticsResponseSchema, type InsiderTradingRSSResponse, InsiderTradingRSSResponseSchema, type InsiderTradingSearchResponse, InsiderTradingSearchResponseSchema, type InsidersBySymbolResponse, InsidersBySymbolResponseSchema, type InstitutionalHolderResponse, InstitutionalHolderResponseSchema, type IntradayPrice, IntradayPriceSchema, type KeyMetrics, KeyMetricsSchema, type MarketCap, MarketCapSchema, type MarketHoliday, MarketHolidaySchema, type MarketHours, MarketHoursSchema, type MarketIndex, MarketIndexSchema, type MarketPerformance, MarketPerformanceSchema, type MarketSectorPerformance, MarketSectorPerformanceSchema, type MutualFundHolding, MutualFundHoldingSchema, type News, NewsSchema, type PaginationParams, Period, type PeriodParams, type QueryParams, type Quote, QuoteSchema, type RSSFeed8KItem, RSSFeed8KItemSchema, type RSSFeed8KParams, RSSFeed8KParamsSchema, type RSSFeedAllItem, RSSFeedAllItemSchema, type RSSFeedItem, RSSFeedItemSchema, type RSSFeedParams, RSSFeedParamsSchema, type RSSFeedV3Item, RSSFeedV3ItemSchema, type RSSFeedV3Params, RSSFeedV3ParamsSchema, type SECFiling, SECFilingSchema, type SECFilingsParams, SECFilingsParamsSchema, type Screener, type ScreenerParams, ScreenerParamsSchema, ScreenerSchema, type SearchResult, SearchResultSchema, type SenateHouseTradingByNameResponse, SenateHouseTradingByNameResponseSchema, type SenateTradingResponse, SenateTradingResponseSchema, type SharesFloat, SharesFloatSchema, type SplitsCalendar, SplitsCalendarSchema, type StockDividend, type StockDividendResponse, StockDividendResponseSchema, StockDividendSchema, type StockList, type StockListResponse, StockListSchema, type StockRealTimePrice, type StockRealTimePriceFull, StockRealTimePriceFullSchema, StockRealTimePriceSchema, type StockSplit, type StockSplitResponse, StockSplitResponseSchema, StockSplitSchema, type SymbolParams, TransactionType, TransactionTypeRecordSchema, type TransactionTypesResponse, type TreasuryRate, TreasuryRateSchema };
|
package/dist/types-only.d.ts
CHANGED
|
@@ -178,10 +178,13 @@ type EconomicsCalendar = z.infer<typeof EconomicsCalendarSchema>;
|
|
|
178
178
|
type IPOCalendar = z.infer<typeof IPOCalendarSchema>;
|
|
179
179
|
type SplitsCalendar = z.infer<typeof SplitsCalendarSchema>;
|
|
180
180
|
|
|
181
|
+
type FMPErrorType = 'plan-restricted' | 'rate-limit' | 'auth' | 'not-found' | 'bad-request' | 'network' | 'unknown';
|
|
181
182
|
interface APIResponse<T = unknown> {
|
|
182
183
|
success: boolean;
|
|
183
184
|
data: T | null;
|
|
184
185
|
error: string | null;
|
|
186
|
+
/** Categorizes the failure. Present only when `success` is false. */
|
|
187
|
+
errorType?: FMPErrorType;
|
|
185
188
|
status: number;
|
|
186
189
|
}
|
|
187
190
|
interface FMPConfig {
|
|
@@ -3632,6 +3635,27 @@ type AvailableSectors = z.infer<typeof AvailableSectorsSchema>;
|
|
|
3632
3635
|
type AvailableIndustries = z.infer<typeof AvailableIndustriesSchema>;
|
|
3633
3636
|
type AvailableCountries = z.infer<typeof AvailableCountriesSchema>;
|
|
3634
3637
|
|
|
3638
|
+
declare const SearchResultSchema: z.ZodObject<{
|
|
3639
|
+
symbol: z.ZodString;
|
|
3640
|
+
name: z.ZodString;
|
|
3641
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
3642
|
+
stockExchange: z.ZodNullable<z.ZodString>;
|
|
3643
|
+
exchangeShortName: z.ZodNullable<z.ZodString>;
|
|
3644
|
+
}, "strip", z.ZodTypeAny, {
|
|
3645
|
+
symbol: string;
|
|
3646
|
+
currency: string | null;
|
|
3647
|
+
name: string;
|
|
3648
|
+
exchangeShortName: string | null;
|
|
3649
|
+
stockExchange: string | null;
|
|
3650
|
+
}, {
|
|
3651
|
+
symbol: string;
|
|
3652
|
+
currency: string | null;
|
|
3653
|
+
name: string;
|
|
3654
|
+
exchangeShortName: string | null;
|
|
3655
|
+
stockExchange: string | null;
|
|
3656
|
+
}>;
|
|
3657
|
+
type SearchResult = z.infer<typeof SearchResultSchema>;
|
|
3658
|
+
|
|
3635
3659
|
declare const SenateTradingResponseSchema: z.ZodObject<{
|
|
3636
3660
|
symbol: z.ZodString;
|
|
3637
3661
|
disclosureDate: z.ZodString;
|
|
@@ -3983,4 +4007,4 @@ interface CompaniesPriceListResponse<T> {
|
|
|
3983
4007
|
companiesPriceList: T[];
|
|
3984
4008
|
}
|
|
3985
4009
|
|
|
3986
|
-
export { type APIResponse, type Article, ArticleSchema, type AvailableCountries, AvailableCountriesSchema, type AvailableExchanges, AvailableExchangesSchema, type AvailableIndexesList, AvailableIndexesListSchema, type AvailableIndustries, AvailableIndustriesSchema, type AvailableSectors, AvailableSectorsSchema, type BalanceSheet, type BalanceSheetGrowth, BalanceSheetGrowthSchema, BalanceSheetSchema, type BeneficialOwnershipResponse, BeneficialOwnershipResponseSchema, type CashFlowStatement, CashFlowStatementSchema, type CashflowGrowth, CashflowGrowthSchema, type CikMapperBySymbolResponse, CikMapperBySymbolResponseSchema, type CikMapperResponse, CikMapperResponseSchema, type CompaniesPriceListResponse, type CompanyNotes, CompanyNotesSchema, type CompanyProfile, CompanyProfileSchema, type CompanyTranscriptData, CompanyTranscriptDataSchema, type CryptoList, CryptoListSchema, type DateRangeParams, type DividendsCalendar, DividendsCalendarSchema, type ETFCountryWeighting, ETFCountryWeightingSchema, type ETFHolder, ETFHolderSchema, type ETFHolding, type ETFHoldingDates, ETFHoldingDatesSchema, ETFHoldingSchema, type ETFList, ETFListSchema, type ETFProfile, ETFProfileSchema, type ETFStockExposure, ETFStockExposureSchema, type ETFWeighting, ETFWeightingSchema, type EarningsCalendar, EarningsCalendarSchema, type EarningsCallTranscript, EarningsCallTranscriptSchema, type EarningsConfirmed, EarningsConfirmedSchema, type EarningsHistorical, EarningsHistoricalSchema, type EarningsSurprises, EarningsSurprisesSchema, type EconomicIndicator, type EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, type EconomicsCalendar, EconomicsCalendarSchema, type EnterpriseValue, EnterpriseValueSchema, Exchange, type ExecutiveCompensation, ExecutiveCompensationSchema, type FMPConfig, type FailToDeliverResponse, FailToDeliverResponseSchema, type FinancialGrowth, FinancialGrowthSchema, type FinancialRatios, FinancialRatiosSchema, type ForexList, ForexListSchema, type Form13FResponse, Form13FResponseSchema, type HistoricalEmployeeCount, HistoricalEmployeeCountSchema, type HistoricalPriceData, HistoricalPriceDataSchema, type HistoricalPriceResponse, HistoricalPriceResponseSchema, type HistoricalSharesFloat, HistoricalSharesFloatSchema, type HouseTradingResponse, HouseTradingResponseSchema, type IPOCalendar, IPOCalendarSchema, type IncomeGrowth, IncomeGrowthSchema, type IncomeStatement, IncomeStatementSchema, type IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, type IndustryClassification, type IndustryClassificationCode, IndustryClassificationCodeSchema, type IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, type InsiderTradeStatisticsResponse, InsiderTradeStatisticsResponseSchema, type InsiderTradingRSSResponse, InsiderTradingRSSResponseSchema, type InsiderTradingSearchResponse, InsiderTradingSearchResponseSchema, type InsidersBySymbolResponse, InsidersBySymbolResponseSchema, type InstitutionalHolderResponse, InstitutionalHolderResponseSchema, type IntradayPrice, IntradayPriceSchema, type KeyMetrics, KeyMetricsSchema, type MarketCap, MarketCapSchema, type MarketHoliday, MarketHolidaySchema, type MarketHours, MarketHoursSchema, type MarketIndex, MarketIndexSchema, type MarketPerformance, MarketPerformanceSchema, type MarketSectorPerformance, MarketSectorPerformanceSchema, type MutualFundHolding, MutualFundHoldingSchema, type News, NewsSchema, type PaginationParams, Period, type PeriodParams, type QueryParams, type Quote, QuoteSchema, type RSSFeed8KItem, RSSFeed8KItemSchema, type RSSFeed8KParams, RSSFeed8KParamsSchema, type RSSFeedAllItem, RSSFeedAllItemSchema, type RSSFeedItem, RSSFeedItemSchema, type RSSFeedParams, RSSFeedParamsSchema, type RSSFeedV3Item, RSSFeedV3ItemSchema, type RSSFeedV3Params, RSSFeedV3ParamsSchema, type SECFiling, SECFilingSchema, type SECFilingsParams, SECFilingsParamsSchema, type Screener, type ScreenerParams, ScreenerParamsSchema, ScreenerSchema, type SenateHouseTradingByNameResponse, SenateHouseTradingByNameResponseSchema, type SenateTradingResponse, SenateTradingResponseSchema, type SharesFloat, SharesFloatSchema, type SplitsCalendar, SplitsCalendarSchema, type StockDividend, type StockDividendResponse, StockDividendResponseSchema, StockDividendSchema, type StockList, type StockListResponse, StockListSchema, type StockRealTimePrice, type StockRealTimePriceFull, StockRealTimePriceFullSchema, StockRealTimePriceSchema, type StockSplit, type StockSplitResponse, StockSplitResponseSchema, StockSplitSchema, type SymbolParams, TransactionType, TransactionTypeRecordSchema, type TransactionTypesResponse, type TreasuryRate, TreasuryRateSchema };
|
|
4010
|
+
export { type APIResponse, type Article, ArticleSchema, type AvailableCountries, AvailableCountriesSchema, type AvailableExchanges, AvailableExchangesSchema, type AvailableIndexesList, AvailableIndexesListSchema, type AvailableIndustries, AvailableIndustriesSchema, type AvailableSectors, AvailableSectorsSchema, type BalanceSheet, type BalanceSheetGrowth, BalanceSheetGrowthSchema, BalanceSheetSchema, type BeneficialOwnershipResponse, BeneficialOwnershipResponseSchema, type CashFlowStatement, CashFlowStatementSchema, type CashflowGrowth, CashflowGrowthSchema, type CikMapperBySymbolResponse, CikMapperBySymbolResponseSchema, type CikMapperResponse, CikMapperResponseSchema, type CompaniesPriceListResponse, type CompanyNotes, CompanyNotesSchema, type CompanyProfile, CompanyProfileSchema, type CompanyTranscriptData, CompanyTranscriptDataSchema, type CryptoList, CryptoListSchema, type DateRangeParams, type DividendsCalendar, DividendsCalendarSchema, type ETFCountryWeighting, ETFCountryWeightingSchema, type ETFHolder, ETFHolderSchema, type ETFHolding, type ETFHoldingDates, ETFHoldingDatesSchema, ETFHoldingSchema, type ETFList, ETFListSchema, type ETFProfile, ETFProfileSchema, type ETFStockExposure, ETFStockExposureSchema, type ETFWeighting, ETFWeightingSchema, type EarningsCalendar, EarningsCalendarSchema, type EarningsCallTranscript, EarningsCallTranscriptSchema, type EarningsConfirmed, EarningsConfirmedSchema, type EarningsHistorical, EarningsHistoricalSchema, type EarningsSurprises, EarningsSurprisesSchema, type EconomicIndicator, type EconomicIndicatorName, EconomicIndicatorNameSchema, EconomicIndicatorSchema, type EconomicsCalendar, EconomicsCalendarSchema, type EnterpriseValue, EnterpriseValueSchema, Exchange, type ExecutiveCompensation, ExecutiveCompensationSchema, type FMPConfig, type FMPErrorType, type FailToDeliverResponse, FailToDeliverResponseSchema, type FinancialGrowth, FinancialGrowthSchema, type FinancialRatios, FinancialRatiosSchema, type ForexList, ForexListSchema, type Form13FResponse, Form13FResponseSchema, type HistoricalEmployeeCount, HistoricalEmployeeCountSchema, type HistoricalPriceData, HistoricalPriceDataSchema, type HistoricalPriceResponse, HistoricalPriceResponseSchema, type HistoricalSharesFloat, HistoricalSharesFloatSchema, type HouseTradingResponse, HouseTradingResponseSchema, type IPOCalendar, IPOCalendarSchema, type IncomeGrowth, IncomeGrowthSchema, type IncomeStatement, IncomeStatementSchema, type IndividualIndustryClassificationParams, IndividualIndustryClassificationParamsSchema, type IndustryClassification, type IndustryClassificationCode, IndustryClassificationCodeSchema, type IndustryClassificationCodesParams, IndustryClassificationCodesParamsSchema, IndustryClassificationSchema, type InsiderTradeStatisticsResponse, InsiderTradeStatisticsResponseSchema, type InsiderTradingRSSResponse, InsiderTradingRSSResponseSchema, type InsiderTradingSearchResponse, InsiderTradingSearchResponseSchema, type InsidersBySymbolResponse, InsidersBySymbolResponseSchema, type InstitutionalHolderResponse, InstitutionalHolderResponseSchema, type IntradayPrice, IntradayPriceSchema, type KeyMetrics, KeyMetricsSchema, type MarketCap, MarketCapSchema, type MarketHoliday, MarketHolidaySchema, type MarketHours, MarketHoursSchema, type MarketIndex, MarketIndexSchema, type MarketPerformance, MarketPerformanceSchema, type MarketSectorPerformance, MarketSectorPerformanceSchema, type MutualFundHolding, MutualFundHoldingSchema, type News, NewsSchema, type PaginationParams, Period, type PeriodParams, type QueryParams, type Quote, QuoteSchema, type RSSFeed8KItem, RSSFeed8KItemSchema, type RSSFeed8KParams, RSSFeed8KParamsSchema, type RSSFeedAllItem, RSSFeedAllItemSchema, type RSSFeedItem, RSSFeedItemSchema, type RSSFeedParams, RSSFeedParamsSchema, type RSSFeedV3Item, RSSFeedV3ItemSchema, type RSSFeedV3Params, RSSFeedV3ParamsSchema, type SECFiling, SECFilingSchema, type SECFilingsParams, SECFilingsParamsSchema, type Screener, type ScreenerParams, ScreenerParamsSchema, ScreenerSchema, type SearchResult, SearchResultSchema, type SenateHouseTradingByNameResponse, SenateHouseTradingByNameResponseSchema, type SenateTradingResponse, SenateTradingResponseSchema, type SharesFloat, SharesFloatSchema, type SplitsCalendar, SplitsCalendarSchema, type StockDividend, type StockDividendResponse, StockDividendResponseSchema, StockDividendSchema, type StockList, type StockListResponse, StockListSchema, type StockRealTimePrice, type StockRealTimePriceFull, StockRealTimePriceFullSchema, StockRealTimePriceSchema, type StockSplit, type StockSplitResponse, StockSplitResponseSchema, StockSplitSchema, type SymbolParams, TransactionType, TransactionTypeRecordSchema, type TransactionTypesResponse, type TreasuryRate, TreasuryRateSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fmp-node-api",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.2",
|
|
4
4
|
"description": "A comprehensive Node.js wrapper for Financial Modeling Prep API",
|
|
5
5
|
"disclaimer": "This package is not affiliated with, endorsed by, or sponsored by Financial Modeling Prep (FMP). This is an independent, community-developed wrapper.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tsx": "^4.7.0",
|
|
56
56
|
"typescript": "^5.3.3",
|
|
57
57
|
"zod": "^3.25.76",
|
|
58
|
-
"fmp-node-types": "0.2.0-beta.
|
|
58
|
+
"fmp-node-types": "0.2.0-beta.2"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsup",
|