fmp-node-api 0.1.8 → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +747 -719
- package/dist/index.d.mts +298 -9
- package/dist/index.d.ts +298 -9
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/types-only.d.mts +3071 -385
- package/dist/types-only.d.ts +3071 -385
- package/dist/utils/validation.d.mts +1 -0
- package/dist/utils/validation.d.ts +1 -0
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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, MarketPerformance, MarketSectorPerformance,
|
|
2
|
-
export { CompaniesPriceListResponse, DateRangeParams, EconomicIndicatorName, Exchange, IndividualIndustryClassificationParams, IndustryClassificationCodesParams, MarketHoliday, PaginationParams, Period, PeriodParams, QueryParams, RSSFeed8KParams, RSSFeedParams, RSSFeedV3Params, SECFilingsParams, StockDividend, StockListResponse, StockSplit, SymbolParams } 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, 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';
|
|
3
3
|
export { FMPValidation } from './utils/validation.js';
|
|
4
|
+
import 'zod';
|
|
4
5
|
|
|
5
6
|
declare class FMPClient {
|
|
6
7
|
private v3Client;
|
|
@@ -1167,6 +1168,7 @@ declare class InsiderEndpoints {
|
|
|
1167
1168
|
*
|
|
1168
1169
|
* @param params - RSS feed request parameters
|
|
1169
1170
|
* @param params.page - Page number for pagination (default: 0)
|
|
1171
|
+
* @param params.limit - Limit number of results (default: 100)
|
|
1170
1172
|
*
|
|
1171
1173
|
* @returns Promise resolving to array of insider trading RSS feed data
|
|
1172
1174
|
*
|
|
@@ -1182,10 +1184,11 @@ declare class InsiderEndpoints {
|
|
|
1182
1184
|
* const nextPage = await fmp.insider.getInsiderTradingRSS({ page: 1 });
|
|
1183
1185
|
* ```
|
|
1184
1186
|
*
|
|
1185
|
-
* @see {@link https://site.financialmodelingprep.com/developer/docs#
|
|
1187
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#latest-insider-trade|FMP Insider Trading RSS Documentation}
|
|
1186
1188
|
*/
|
|
1187
1189
|
getInsiderTradingRSS(params: {
|
|
1188
1190
|
page?: number;
|
|
1191
|
+
limit?: number;
|
|
1189
1192
|
}): Promise<APIResponse<InsiderTradingRSSResponse[]>>;
|
|
1190
1193
|
/**
|
|
1191
1194
|
* Search for insider trades with advanced filtering
|
|
@@ -1200,6 +1203,7 @@ declare class InsiderEndpoints {
|
|
|
1200
1203
|
* @param params.companyCik - Company CIK to filter by (optional)
|
|
1201
1204
|
* @param params.transactionType - Transaction type to filter by (optional)
|
|
1202
1205
|
* @param params.page - Page number for pagination (default: 0)
|
|
1206
|
+
* @param params.limit - Limit number of results (default: 100)
|
|
1203
1207
|
*
|
|
1204
1208
|
* @returns Promise resolving to array of insider trading search results
|
|
1205
1209
|
*
|
|
@@ -1227,7 +1231,7 @@ declare class InsiderEndpoints {
|
|
|
1227
1231
|
* });
|
|
1228
1232
|
* ```
|
|
1229
1233
|
*
|
|
1230
|
-
* @see {@link https://site.financialmodelingprep.com/developer/docs#
|
|
1234
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#search-insider-trades|FMP Insider Trading Search Documentation}
|
|
1231
1235
|
*/
|
|
1232
1236
|
searchInsiderTrading(params: {
|
|
1233
1237
|
symbol?: string;
|
|
@@ -1235,6 +1239,7 @@ declare class InsiderEndpoints {
|
|
|
1235
1239
|
companyCik?: string;
|
|
1236
1240
|
transactionType?: string;
|
|
1237
1241
|
page?: number;
|
|
1242
|
+
limit?: number;
|
|
1238
1243
|
}): Promise<APIResponse<InsiderTradingSearchResponse[]>>;
|
|
1239
1244
|
/**
|
|
1240
1245
|
* Get all available transaction types
|
|
@@ -1254,7 +1259,7 @@ declare class InsiderEndpoints {
|
|
|
1254
1259
|
* });
|
|
1255
1260
|
* ```
|
|
1256
1261
|
*
|
|
1257
|
-
* @see {@link https://site.financialmodelingprep.com/developer/docs#transaction-types
|
|
1262
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#all-transaction-types|FMP Transaction Types Documentation}
|
|
1258
1263
|
*/
|
|
1259
1264
|
getTransactionTypes(): Promise<APIResponse<TransactionTypesResponse>>;
|
|
1260
1265
|
/**
|
|
@@ -1264,6 +1269,8 @@ declare class InsiderEndpoints {
|
|
|
1264
1269
|
* for a specific company. Essential for understanding corporate governance
|
|
1265
1270
|
* structure and identifying key personnel.
|
|
1266
1271
|
*
|
|
1272
|
+
* @deprecated This endpoint uses API version v4 which will be deprecated.
|
|
1273
|
+
*
|
|
1267
1274
|
* @param params - Insiders request parameters
|
|
1268
1275
|
* @param params.symbol - Stock symbol to get insiders for
|
|
1269
1276
|
*
|
|
@@ -1310,7 +1317,7 @@ declare class InsiderEndpoints {
|
|
|
1310
1317
|
* const msftStats = await fmp.insider.getInsiderTradeStatistics({ symbol: 'MSFT' });
|
|
1311
1318
|
* ```
|
|
1312
1319
|
*
|
|
1313
|
-
* @see {@link https://site.financialmodelingprep.com/developer/docs#insider-trade-statistics
|
|
1320
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#insider-trade-statistics|FMP Insider Trade Statistics Documentation}
|
|
1314
1321
|
*/
|
|
1315
1322
|
getInsiderTradeStatistics(params: {
|
|
1316
1323
|
symbol: string;
|
|
@@ -1322,6 +1329,8 @@ declare class InsiderEndpoints {
|
|
|
1322
1329
|
* names. Essential for converting between CIK numbers and company
|
|
1323
1330
|
* identifiers in insider trading analysis.
|
|
1324
1331
|
*
|
|
1332
|
+
* @deprecated This endpoint uses API version v4 which will be deprecated.
|
|
1333
|
+
*
|
|
1325
1334
|
* @param params - CIK mapper request parameters
|
|
1326
1335
|
* @param params.page - Page number for pagination (default: 0)
|
|
1327
1336
|
*
|
|
@@ -1351,6 +1360,8 @@ declare class InsiderEndpoints {
|
|
|
1351
1360
|
* Useful for finding companies by partial name matches and
|
|
1352
1361
|
* converting company names to CIK numbers.
|
|
1353
1362
|
*
|
|
1363
|
+
* @deprecated This endpoint uses API version v4 which will be deprecated.
|
|
1364
|
+
*
|
|
1354
1365
|
* @param params - CIK mapper by name request parameters
|
|
1355
1366
|
* @param params.name - Company name or partial name to search for
|
|
1356
1367
|
* @param params.page - Page number for pagination (default: 0)
|
|
@@ -1388,6 +1399,8 @@ declare class InsiderEndpoints {
|
|
|
1388
1399
|
* Essential for converting stock symbols to CIK numbers for use
|
|
1389
1400
|
* in insider trading searches and analysis.
|
|
1390
1401
|
*
|
|
1402
|
+
* @deprecated This endpoint uses API version v4 which will be deprecated.
|
|
1403
|
+
*
|
|
1391
1404
|
* @param params - CIK mapper by symbol request parameters
|
|
1392
1405
|
* @param params.symbol - Stock symbol to get CIK for
|
|
1393
1406
|
*
|
|
@@ -1417,6 +1430,7 @@ declare class InsiderEndpoints {
|
|
|
1417
1430
|
*
|
|
1418
1431
|
* @param params - Beneficial ownership request parameters
|
|
1419
1432
|
* @param params.symbol - Stock symbol to get beneficial ownership data for
|
|
1433
|
+
* @param params.limit - Limit number of results (default: 100)
|
|
1420
1434
|
*
|
|
1421
1435
|
* @returns Promise resolving to array of beneficial ownership acquisition data
|
|
1422
1436
|
*
|
|
@@ -1436,6 +1450,7 @@ declare class InsiderEndpoints {
|
|
|
1436
1450
|
*/
|
|
1437
1451
|
getBeneficialOwnership(params: {
|
|
1438
1452
|
symbol: string;
|
|
1453
|
+
limit?: number;
|
|
1439
1454
|
}): Promise<APIResponse<BeneficialOwnershipResponse[]>>;
|
|
1440
1455
|
/**
|
|
1441
1456
|
* Get fail to deliver data
|
|
@@ -1444,6 +1459,8 @@ declare class InsiderEndpoints {
|
|
|
1444
1459
|
* when market participants fail to deliver securities on settlement date.
|
|
1445
1460
|
* Important for understanding market mechanics and potential short interest.
|
|
1446
1461
|
*
|
|
1462
|
+
* @deprecated This endpoint uses API version v4 which will be deprecated.
|
|
1463
|
+
*
|
|
1447
1464
|
* @param params - Fail to deliver request parameters
|
|
1448
1465
|
* @param params.symbol - Stock symbol to get fail to deliver data for
|
|
1449
1466
|
* @param params.page - Page number for pagination (default: 0)
|
|
@@ -1859,7 +1876,7 @@ declare class MarketEndpoints {
|
|
|
1859
1876
|
*
|
|
1860
1877
|
* @see {@link https://site.financialmodelingprep.com/developer/docs#market-index-market-overview|FMP Market Performance Documentation}
|
|
1861
1878
|
*/
|
|
1862
|
-
getMarketPerformance(): Promise<APIResponse<
|
|
1879
|
+
getMarketPerformance(): Promise<APIResponse<MarketIndex[]>>;
|
|
1863
1880
|
/**
|
|
1864
1881
|
* Get top gaining stocks for the current trading day
|
|
1865
1882
|
*
|
|
@@ -2133,6 +2150,277 @@ declare class MutualFundEndpoints {
|
|
|
2133
2150
|
getHolders(symbol: string): Promise<APIResponse<MutualFundHolding[]>>;
|
|
2134
2151
|
}
|
|
2135
2152
|
|
|
2153
|
+
declare class NewsEndpoints {
|
|
2154
|
+
private client;
|
|
2155
|
+
constructor(client: FMPClient);
|
|
2156
|
+
/**
|
|
2157
|
+
* Get FMP's curated financial articles and market insights
|
|
2158
|
+
*
|
|
2159
|
+
* Retrieves Financial Modeling Prep's own articles covering market analysis,
|
|
2160
|
+
* financial insights, and educational content. These articles provide valuable
|
|
2161
|
+
* context and analysis beyond raw market data.
|
|
2162
|
+
*
|
|
2163
|
+
* @param params - Article request parameters
|
|
2164
|
+
* @param params.page - Page number for pagination (optional, defaults to 1)
|
|
2165
|
+
* @param params.limit - Number of articles per page (optional, defaults to 100)
|
|
2166
|
+
*
|
|
2167
|
+
* @returns Promise resolving to an array of FMP articles with content and metadata
|
|
2168
|
+
*
|
|
2169
|
+
* @example
|
|
2170
|
+
* ```typescript
|
|
2171
|
+
* // Get latest FMP articles
|
|
2172
|
+
* const articles = await fmp.news.getArticles({
|
|
2173
|
+
* page: 1,
|
|
2174
|
+
* limit: 10
|
|
2175
|
+
* });
|
|
2176
|
+
*
|
|
2177
|
+
* // Get first page with default limit
|
|
2178
|
+
* const latestArticles = await fmp.news.getArticles({ page: 1 });
|
|
2179
|
+
* ```
|
|
2180
|
+
*
|
|
2181
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#fmp-articles|FMP Articles Documentation}
|
|
2182
|
+
*/
|
|
2183
|
+
getArticles(params?: {
|
|
2184
|
+
page?: number;
|
|
2185
|
+
limit?: number;
|
|
2186
|
+
}): Promise<APIResponse<Article[]>>;
|
|
2187
|
+
/**
|
|
2188
|
+
* Get latest stock market news from various financial sources
|
|
2189
|
+
*
|
|
2190
|
+
* Retrieves the most recent stock market news articles from multiple financial
|
|
2191
|
+
* news sources. Perfect for staying updated on market movements, earnings
|
|
2192
|
+
* announcements, and corporate developments.
|
|
2193
|
+
*
|
|
2194
|
+
* @param params - Stock news request parameters
|
|
2195
|
+
* @param params.from - Start date in YYYY-MM-DD format (optional)
|
|
2196
|
+
* @param params.to - End date in YYYY-MM-DD format (optional)
|
|
2197
|
+
* @param params.page - Page number for pagination (optional, defaults to 1)
|
|
2198
|
+
* @param params.limit - Number of articles per page (optional, defaults to 100)
|
|
2199
|
+
*
|
|
2200
|
+
* @returns Promise resolving to an array of stock news articles with timestamps and sources
|
|
2201
|
+
*
|
|
2202
|
+
* @example
|
|
2203
|
+
* ```typescript
|
|
2204
|
+
* // Get latest stock news
|
|
2205
|
+
* const stockNews = await fmp.news.getStockNews({
|
|
2206
|
+
* limit: 20
|
|
2207
|
+
* });
|
|
2208
|
+
*
|
|
2209
|
+
* // Get stock news from specific date range
|
|
2210
|
+
* const recentNews = await fmp.news.getStockNews({
|
|
2211
|
+
* from: '2024-01-01',
|
|
2212
|
+
* to: '2024-01-15',
|
|
2213
|
+
* limit: 50
|
|
2214
|
+
* });
|
|
2215
|
+
* ```
|
|
2216
|
+
*
|
|
2217
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#stock-news|Stock News Documentation}
|
|
2218
|
+
*/
|
|
2219
|
+
getStockNews(params?: {
|
|
2220
|
+
from?: string;
|
|
2221
|
+
to?: string;
|
|
2222
|
+
page?: number;
|
|
2223
|
+
limit?: number;
|
|
2224
|
+
}): Promise<APIResponse<News[]>>;
|
|
2225
|
+
/**
|
|
2226
|
+
* Get latest cryptocurrency news from various sources
|
|
2227
|
+
*
|
|
2228
|
+
* Retrieves the most recent cryptocurrency news articles covering market trends,
|
|
2229
|
+
* regulatory updates, technology developments, and major crypto events.
|
|
2230
|
+
* Essential for crypto traders and investors.
|
|
2231
|
+
*
|
|
2232
|
+
* @param params - Crypto news request parameters
|
|
2233
|
+
* @param params.from - Start date in YYYY-MM-DD format (optional)
|
|
2234
|
+
* @param params.to - End date in YYYY-MM-DD format (optional)
|
|
2235
|
+
* @param params.page - Page number for pagination (optional, defaults to 1)
|
|
2236
|
+
* @param params.limit - Number of articles per page (optional, defaults to 100)
|
|
2237
|
+
*
|
|
2238
|
+
* @returns Promise resolving to an array of cryptocurrency news articles
|
|
2239
|
+
*
|
|
2240
|
+
* @example
|
|
2241
|
+
* ```typescript
|
|
2242
|
+
* // Get latest crypto news
|
|
2243
|
+
* const cryptoNews = await fmp.news.getCryptoNews({
|
|
2244
|
+
* limit: 15
|
|
2245
|
+
* });
|
|
2246
|
+
*
|
|
2247
|
+
* // Get crypto news from last week
|
|
2248
|
+
* const weeklyCryptoNews = await fmp.news.getCryptoNews({
|
|
2249
|
+
* from: '2024-01-08',
|
|
2250
|
+
* to: '2024-01-15'
|
|
2251
|
+
* });
|
|
2252
|
+
* ```
|
|
2253
|
+
*
|
|
2254
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#crypto-news|Crypto News Documentation}
|
|
2255
|
+
*/
|
|
2256
|
+
getCryptoNews(params?: {
|
|
2257
|
+
from?: string;
|
|
2258
|
+
to?: string;
|
|
2259
|
+
page?: number;
|
|
2260
|
+
limit?: number;
|
|
2261
|
+
}): Promise<APIResponse<News[]>>;
|
|
2262
|
+
/**
|
|
2263
|
+
* Get latest forex (foreign exchange) market news
|
|
2264
|
+
*
|
|
2265
|
+
* Retrieves the most recent forex market news covering currency movements,
|
|
2266
|
+
* central bank announcements, economic indicators, and geopolitical events
|
|
2267
|
+
* that impact currency markets.
|
|
2268
|
+
*
|
|
2269
|
+
* @param params - Forex news request parameters
|
|
2270
|
+
* @param params.from - Start date in YYYY-MM-DD format (optional)
|
|
2271
|
+
* @param params.to - End date in YYYY-MM-DD format (optional)
|
|
2272
|
+
* @param params.page - Page number for pagination (optional, defaults to 1)
|
|
2273
|
+
* @param params.limit - Number of articles per page (optional, defaults to 100)
|
|
2274
|
+
*
|
|
2275
|
+
* @returns Promise resolving to an array of forex news articles
|
|
2276
|
+
*
|
|
2277
|
+
* @example
|
|
2278
|
+
* ```typescript
|
|
2279
|
+
* // Get latest forex news
|
|
2280
|
+
* const forexNews = await fmp.news.getForexNews({
|
|
2281
|
+
* limit: 25
|
|
2282
|
+
* });
|
|
2283
|
+
*
|
|
2284
|
+
* // Get forex news from specific period
|
|
2285
|
+
* const forexUpdates = await fmp.news.getForexNews({
|
|
2286
|
+
* from: '2024-01-10',
|
|
2287
|
+
* limit: 30
|
|
2288
|
+
* });
|
|
2289
|
+
* ```
|
|
2290
|
+
*
|
|
2291
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#forex-news|Forex News Documentation}
|
|
2292
|
+
*/
|
|
2293
|
+
getForexNews(params?: {
|
|
2294
|
+
from?: string;
|
|
2295
|
+
to?: string;
|
|
2296
|
+
page?: number;
|
|
2297
|
+
limit?: number;
|
|
2298
|
+
}): Promise<APIResponse<News[]>>;
|
|
2299
|
+
/**
|
|
2300
|
+
* Get stock news filtered by specific company symbols
|
|
2301
|
+
*
|
|
2302
|
+
* Retrieves news articles specifically related to the provided stock symbols.
|
|
2303
|
+
* Perfect for monitoring news about specific companies in your portfolio or
|
|
2304
|
+
* watchlist. Supports multiple symbols for efficient batch news retrieval.
|
|
2305
|
+
*
|
|
2306
|
+
* @param params - Symbol-specific stock news request parameters
|
|
2307
|
+
* @param params.symbols - Array of stock symbols to get news for (required)
|
|
2308
|
+
* @param params.from - Start date in YYYY-MM-DD format (optional)
|
|
2309
|
+
* @param params.to - End date in YYYY-MM-DD format (optional)
|
|
2310
|
+
* @param params.page - Page number for pagination (optional, defaults to 1)
|
|
2311
|
+
* @param params.limit - Number of articles per page (optional, defaults to 100)
|
|
2312
|
+
*
|
|
2313
|
+
* @returns Promise resolving to an array of news articles filtered by the specified symbols
|
|
2314
|
+
*
|
|
2315
|
+
* @example
|
|
2316
|
+
* ```typescript
|
|
2317
|
+
* // Get news for specific stocks
|
|
2318
|
+
* const appleNews = await fmp.news.getStockNewsBySymbol({
|
|
2319
|
+
* symbols: ['AAPL'],
|
|
2320
|
+
* limit: 10
|
|
2321
|
+
* });
|
|
2322
|
+
*
|
|
2323
|
+
* // Get news for multiple tech stocks
|
|
2324
|
+
* const techNews = await fmp.news.getStockNewsBySymbol({
|
|
2325
|
+
* symbols: ['AAPL', 'MSFT', 'GOOGL', 'AMZN'],
|
|
2326
|
+
* from: '2024-01-01',
|
|
2327
|
+
* limit: 20
|
|
2328
|
+
* });
|
|
2329
|
+
* ```
|
|
2330
|
+
*
|
|
2331
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#search-stock-news|Search Stock News Documentation}
|
|
2332
|
+
*/
|
|
2333
|
+
getStockNewsBySymbol(params: {
|
|
2334
|
+
symbols: string[];
|
|
2335
|
+
from?: string;
|
|
2336
|
+
to?: string;
|
|
2337
|
+
page?: number;
|
|
2338
|
+
limit?: number;
|
|
2339
|
+
}): Promise<APIResponse<News[]>>;
|
|
2340
|
+
/**
|
|
2341
|
+
* Get cryptocurrency news filtered by specific crypto symbols
|
|
2342
|
+
*
|
|
2343
|
+
* Retrieves news articles specifically related to the provided cryptocurrency
|
|
2344
|
+
* symbols. Ideal for monitoring news about specific cryptocurrencies in your
|
|
2345
|
+
* portfolio or tracking particular digital assets.
|
|
2346
|
+
*
|
|
2347
|
+
* @param params - Symbol-specific crypto news request parameters
|
|
2348
|
+
* @param params.symbols - Array of cryptocurrency symbols to get news for (required)
|
|
2349
|
+
* @param params.from - Start date in YYYY-MM-DD format (optional)
|
|
2350
|
+
* @param params.to - End date in YYYY-MM-DD format (optional)
|
|
2351
|
+
* @param params.page - Page number for pagination (optional, defaults to 1)
|
|
2352
|
+
* @param params.limit - Number of articles per page (optional, defaults to 100)
|
|
2353
|
+
*
|
|
2354
|
+
* @returns Promise resolving to an array of news articles filtered by the specified crypto symbols
|
|
2355
|
+
*
|
|
2356
|
+
* @example
|
|
2357
|
+
* ```typescript
|
|
2358
|
+
* // Get news for Bitcoin
|
|
2359
|
+
* const bitcoinNews = await fmp.news.getCryptoNewsBySymbol({
|
|
2360
|
+
* symbols: ['BTCUSD'],
|
|
2361
|
+
* limit: 15
|
|
2362
|
+
* });
|
|
2363
|
+
*
|
|
2364
|
+
* // Get news for multiple cryptocurrencies
|
|
2365
|
+
* const cryptoNews = await fmp.news.getCryptoNewsBySymbol({
|
|
2366
|
+
* symbols: ['BTCUSD', 'ETHUSD', 'ADAUSD'],
|
|
2367
|
+
* from: '2024-01-01',
|
|
2368
|
+
* limit: 25
|
|
2369
|
+
* });
|
|
2370
|
+
* ```
|
|
2371
|
+
*
|
|
2372
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#search-crypto-news|Search Crypto News Documentation}
|
|
2373
|
+
*/
|
|
2374
|
+
getCryptoNewsBySymbol(params: {
|
|
2375
|
+
symbols: string[];
|
|
2376
|
+
from?: string;
|
|
2377
|
+
to?: string;
|
|
2378
|
+
page?: number;
|
|
2379
|
+
limit?: number;
|
|
2380
|
+
}): Promise<APIResponse<News[]>>;
|
|
2381
|
+
/**
|
|
2382
|
+
* Get forex news filtered by specific currency pair symbols
|
|
2383
|
+
*
|
|
2384
|
+
* Retrieves news articles specifically related to the provided forex currency
|
|
2385
|
+
* pairs. Perfect for monitoring news about specific currency pairs you're
|
|
2386
|
+
* trading or analyzing for forex market movements.
|
|
2387
|
+
*
|
|
2388
|
+
* @param params - Symbol-specific forex news request parameters
|
|
2389
|
+
* @param params.symbols - Array of forex currency pair symbols to get news for (required)
|
|
2390
|
+
* @param params.from - Start date in YYYY-MM-DD format (optional)
|
|
2391
|
+
* @param params.to - End date in YYYY-MM-DD format (optional)
|
|
2392
|
+
* @param params.page - Page number for pagination (optional, defaults to 1)
|
|
2393
|
+
* @param params.limit - Number of articles per page (optional, defaults to 100)
|
|
2394
|
+
*
|
|
2395
|
+
* @returns Promise resolving to an array of news articles filtered by the specified forex symbols
|
|
2396
|
+
*
|
|
2397
|
+
* @example
|
|
2398
|
+
* ```typescript
|
|
2399
|
+
* // Get news for EUR/USD pair
|
|
2400
|
+
* const eurUsdNews = await fmp.news.getForexNewsBySymbol({
|
|
2401
|
+
* symbols: ['EURUSD'],
|
|
2402
|
+
* limit: 10
|
|
2403
|
+
* });
|
|
2404
|
+
*
|
|
2405
|
+
* // Get news for multiple currency pairs
|
|
2406
|
+
* const forexNews = await fmp.news.getForexNewsBySymbol({
|
|
2407
|
+
* symbols: ['EURUSD', 'GBPUSD', 'USDJPY'],
|
|
2408
|
+
* from: '2024-01-01',
|
|
2409
|
+
* limit: 20
|
|
2410
|
+
* });
|
|
2411
|
+
* ```
|
|
2412
|
+
*
|
|
2413
|
+
* @see {@link https://site.financialmodelingprep.com/developer/docs#search-forex-news|Search Forex News Documentation}
|
|
2414
|
+
*/
|
|
2415
|
+
getForexNewsBySymbol(params: {
|
|
2416
|
+
symbols: string[];
|
|
2417
|
+
from?: string;
|
|
2418
|
+
to?: string;
|
|
2419
|
+
page?: number;
|
|
2420
|
+
limit?: number;
|
|
2421
|
+
}): Promise<APIResponse<News[]>>;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2136
2424
|
declare class QuoteEndpoints {
|
|
2137
2425
|
private client;
|
|
2138
2426
|
constructor(client: FMPClient);
|
|
@@ -2257,7 +2545,7 @@ declare class QuoteEndpoints {
|
|
|
2257
2545
|
interval: '1min' | '5min' | '15min' | '30min' | '1hour' | '4hour';
|
|
2258
2546
|
from?: string;
|
|
2259
2547
|
to?: string;
|
|
2260
|
-
}): Promise<APIResponse<
|
|
2548
|
+
}): Promise<APIResponse<IntradayPrice[]>>;
|
|
2261
2549
|
}
|
|
2262
2550
|
|
|
2263
2551
|
declare class ScreenerEndpoints {
|
|
@@ -3080,6 +3368,7 @@ declare class FMP {
|
|
|
3080
3368
|
readonly list: ListEndpoints;
|
|
3081
3369
|
readonly market: MarketEndpoints;
|
|
3082
3370
|
readonly mutualFund: MutualFundEndpoints;
|
|
3371
|
+
readonly news: NewsEndpoints;
|
|
3083
3372
|
readonly quote: QuoteEndpoints;
|
|
3084
3373
|
readonly screener: ScreenerEndpoints;
|
|
3085
3374
|
readonly sec: SECEndpoints;
|
|
@@ -3144,4 +3433,4 @@ declare const SECTORS: {
|
|
|
3144
3433
|
readonly COMMUNICATION_SERVICES: "Communication Services";
|
|
3145
3434
|
};
|
|
3146
3435
|
|
|
3147
|
-
export { APIResponse, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, 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, FailToDeliverResponse, FinancialEndpoints, FinancialGrowth, FinancialRatios, ForexList, Form13FResponse, HistoricalEmployeeCount,
|
|
3436
|
+
export { APIResponse, Article, AvailableCountries, AvailableExchanges, AvailableIndexesList, AvailableIndustries, AvailableSectors, BalanceSheet, BalanceSheetGrowth, BeneficialOwnershipResponse, CalendarEndpoints, CashFlowStatement, CashflowGrowth, CikMapperBySymbolResponse, CikMapperResponse, 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, 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, SenateHouseEndpoints, SenateHouseTradingByNameResponse, SenateTradingResponse, SharesFloat, SplitsCalendar, StockDividendResponse, StockEndpoints, StockList, StockRealTimePrice, StockRealTimePriceFull, StockSplitResponse, TransactionType, TransactionTypesResponse, TreasuryRate, formatCurrency, formatDate, formatLargeNumber, formatPercentage, formatVolume };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var E=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var E__default=/*#__PURE__*/_interopDefault(E);function F(r){return Array.isArray(r)&&r.length===1?r[0]:r}function v(r){return Array.isArray(r)?r:r??[]}function M(r){return r==null?{}:Array.isArray(r)&&r.length===0?{}:r}var l=class{constructor(e){if(!e.apiKey)throw new Error("API key is required for FMPClient");this.apiKey=e.apiKey,this.v3Client=E__default.default.create({baseURL:"https://financialmodelingprep.com/api/v3",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.v4Client=E__default.default.create({baseURL:"https://financialmodelingprep.com/api/v4",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json"}}),this.stableClient=E__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 n=this.getClientForVersion(t);try{let i=await n.get(e,{params:s}),o=i.data;return (Array.isArray(o)||o==null)&&(o=v(o)),{success:!0,data:o,error:null,status:i.status}}catch(i){return {success:false,data:null,error:i.message||"Unknown error occurred",status:i.response?.status||500}}}async getSingle(e,t="v3",s){let n=this.getClientForVersion(t);try{let i=await n.get(e,{params:s});return {success:!0,data:M(F(i.data)),error:null,status:i.status}}catch(i){return {success:false,data:null,error:i.message||"Unknown error occurred",status:i.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 c=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),n=new Date(t);return s<=n}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 m=class{constructor(e){this._client=e;}async getEarningsCalendar(e={}){let{from:t,to:s}=e,n={};return t&&(n.from=t),s&&(n.to=s),this._client.get("/earning_calendar","v3",n)}async getEarningsConfirmed(e={}){let{from:t,to:s}=e,n={};return t&&(n.from=t),s&&(n.to=s),this._client.get("/earning-calendar-confirmed","v4",n)}async getDividendsCalendar(e={}){let{from:t,to:s}=e,n={};return t&&(n.from=t),s&&(n.to=s),this._client.get("/stock_dividend_calendar","v3",n)}async getEconomicsCalendar(e={}){let{from:t,to:s}=e,n={};return t&&(n.from=t),s&&(n.to=s),this._client.get("/economic_calendar","v3",n)}async getIPOCalendar(e={}){let{from:t,to:s}=e,n={};return t&&(n.from=t),s&&(n.to=s),this._client.get("/ipo_calendar","v3",n)}async getSplitsCalendar(e={}){let{from:t,to:s}=e,n={};return t&&(n.from=t),s&&(n.to=s),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:t,year:s,quarter:n}=e;return this.client.getSingle(`/earning_call_transcript/${t}`,"v3",{year:s,quarter:n})}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,n={};return t&&(n.from=t),s&&(n.to=s),this.client.get("/treasury-rates","stable",n)}async getEconomicIndicators(e){let{name:t,from:s,to:n}=e,i={name:t};return s&&(i.from=s),n&&(i.to=n),this.client.get("/economic-indicators","stable",i)}};var g=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,n={};return t&&(n.symbol=t),s&&(n.date=s),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:t,period:s="annual",limit:n=5}=e;return this.client.get(`/income-statement?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getBalanceSheet(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/balance-sheet-statement?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getCashFlowStatement(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/cash-flow-statement?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getKeyMetrics(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/key-metrics?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getFinancialRatios(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/ratios?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getEnterpriseValue(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/enterprise-values?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getCashflowGrowth(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/cash-flow-statement-growth?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getIncomeGrowth(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/income-statement-growth?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getBalanceSheetGrowth(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/balance-sheet-statement-growth?symbol=${t}&period=${s}&limit=${n}`,"stable")}async getFinancialGrowth(e){let{symbol:t,period:s="annual",limit:n=5}=e;return this.client.get(`/financial-growth?symbol=${t}&period=${s}&limit=${n}`,"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 y=class{constructor(e){this.client=e;}async getInsiderTradingRSS(e){let{page:t=0}=e;return this.client.get("/insider-trading-rss-feed","v4",{page:t})}async searchInsiderTrading(e){let{symbol:t,reportingCik:s,companyCik:n,transactionType:i,page:o=0}=e,a={page:o};return t&&(a.symbol=t),s&&(a.reportingCik=s),n&&(a.companyCik=n),i&&(a.transactionType=i),this.client.get("/insider-trading","v4",a)}async getTransactionTypes(){return this.client.get("/insider-trading-transaction-type","v4")}async getInsidersBySymbol(e){let{symbol:t}=e;return this.client.get("/insider-roaster","v4",{symbol:t})}async getInsiderTradeStatistics(e){let{symbol:t}=e;return this.client.get("/insider-roaster-statistic","v4",{symbol:t})}async getCikMapper(e){let{page:t=0}=e;return this.client.get("/mapper-cik-name","v4",{page:t})}async getCikMapperByName(e){let{name:t,page: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}=e;return this.client.get("/insider/ownership/acquisition_of_beneficial_ownership","v4",{symbol:t})}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 f=class{constructor(e){this.client=e;}async getForm13F(e){let{cik:t,date:s}=e,n={};return s&&(n.date=s),this.client.get(`/form-thirteen/${t}`,"v3",n)}async getForm13FDates(e){let{cik:t}=e;return this.client.get(`/form-thirteen-date/${t}`,"v3")}async getInstitutionalHolders(e){let{symbol:t}=e;return this.client.get(`/institutional-holder/${t}`,"v3")}};var P=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 getQuote(e){return this.client.getSingle(`/quote/${e}`,"v3")}async getHistoricalPrice(e){let{symbol:t,from:s,to:n}=e,i={};return s&&(i.from=s),n&&(i.to=n),this.client.getSingle(`/historical-price-full/${t}`,"v3",i)}async getQuotes(e){let t=e.join(",");return this.client.get(`/quote/${t}`,"v3")}async getIntraday(e){let{symbol:t,interval:s,from:n,to:i}=e,o={};return n&&(o.from=n),i&&(o.to=i),this.client.get(`/historical-chart/${s}/${t}`,"v3",o)}};var C=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 b=class{constructor(e){this.client=e;}async getRSSFeed(e){return this.client.get("/rss_feed","v4",e)}async getRSSFeedAll(e){return this.client.get("/rss_feed_all","v4",e)}async getRSSFeedV3(e){return this.client.get("/rss_feed","v3",e)}async getRSSFeed8K(e){return this.client.get("/rss_feed_8k","v4",e)}async getSECFilings({symbol:e,params:t}){return this.client.get(`/sec_filings/${e}`,"v3",t)}async getIndividualIndustryClassification(e){return this.client.getSingle("/standard_industrial_classification","v4",e)}async getAllIndustryClassifications(){return this.client.get("/standard_industrial_classification/all","v4")}async getIndustryClassificationCodes(e){return this.client.get("/standard_industrial_classification_list","v4",e)}};var A=class{constructor(e){this.client=e;}async 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 S=class{constructor(e){this.client=e;}async getMarketCap(e){return this.client.getSingle(`/market-capitalization/${e}`,"v3")}async getStockSplits(e){return this.client.get(`/historical-price-full/stock_split/${e}`,"v3")}async getDividendHistory(e){return this.client.getSingle(`/historical-price-full/stock_dividend/${e}`,"v3")}async getRealTimePrice(e){let t=`stock/real-time-price/${e.join(",")}`,s=await this.client.get(t,"v3");if(s.success&&s.data&&!Array.isArray(s.data)){let i=s.data;if(typeof i=="object"&&i!==null&&"companiesPriceList"in i&&Array.isArray(i.companiesPriceList)){let o=i.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof i=="object"&&i!==null&&"stockList"in i&&Array.isArray(i.stockList)){let o=i.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return i.symbol?{...s,data:[i]}:(e.length===1&&console.warn(`No real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let n=s.data.filter(i=>i&&i.symbol);return {...s,data:n}}async getRealTimePriceForMultipleStocks(e){let t=`stock/full/real-time-price/${e.join(",")}`,s=await this.client.get(t,"v3");if(s.success&&s.data&&!Array.isArray(s.data)){let i=s.data;if(typeof i=="object"&&i!==null&&"companiesPriceList"in i&&Array.isArray(i.companiesPriceList)){let o=i.companiesPriceList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}if(typeof i=="object"&&i!==null&&"stockList"in i&&Array.isArray(i.stockList)){let o=i.stockList.filter(a=>a&&a.symbol);if(o.length>0)return {...s,data:o}}return i.symbol?{...s,data:[i]}:(e.length===1&&console.warn(`No full real-time price data found for symbol: ${e[0]}`),{...s,data:[]})}let n=s.data.filter(i=>i&&i.symbol);return {...s,data:n}}};var T=class{constructor(e={}){let t=e.apiKey||process.env.FMP_API_KEY;if(!t)throw new Error("FMP API key is required. Please provide it in the config or set the FMP_API_KEY environment variable.");if(!c.isValidApiKey(t))throw new Error("Invalid API key format");let s=new l({...e,apiKey:t});this.calendar=new m(s),this.company=new p(s),this.economic=new u(s),this.etf=new g(s),this.financial=new d(s),this.insider=new y(s),this.institutional=new f(s),this.list=new P(s),this.market=new h(s),this.mutualFund=new R(s),this.quote=new I(s),this.screener=new C(s),this.sec=new b(s),this.senateHouse=new A(s),this.stock=new S(s);}getClient(){return this.stock.client}};function k(r,e="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)}function x(r,e=2){return `${r.toFixed(e)}%`}function D(r){return r>=1e12?`${(r/1e12).toFixed(2)}T`:r>=1e9?`${(r/1e9).toFixed(2)}B`:r>=1e6?`${(r/1e6).toFixed(2)}M`:r>=1e3?`${(r/1e3).toFixed(2)}K`:r.toString()}function w(r){return (typeof r=="string"?new Date(r):r).toISOString().split("T")[0]}function L(r){return r>=1e9?`${(r/1e9).toFixed(2)}B`:r>=1e6?`${(r/1e6).toFixed(2)}M`:r>=1e3?`${(r/1e3).toFixed(2)}K`:r.toString()}var _=1e4,$=100,N=1e3,H={ANNUAL:"annual",QUARTER:"quarter"},q={NYSE:"NYSE",NASDAQ:"NASDAQ",AMEX:"AMEX",TSX:"TSX",LSE:"LSE",ASX:"ASX",NSE:"NSE",BSE:"BSE"},U={TECHNOLOGY:"Technology",HEALTHCARE:"Healthcare",FINANCIAL:"Financial",CONSUMER_DISCRETIONARY:"Consumer Discretionary",CONSUMER_STAPLES:"Consumer Staples",INDUSTRIALS:"Industrials",ENERGY:"Energy",MATERIALS:"Materials",UTILITIES:"Utilities",REAL_ESTATE:"Real Estate",COMMUNICATION_SERVICES:"Communication Services"};
|
|
2
|
-
exports.CalendarEndpoints=
|
|
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=q;exports.DEFAULT_TIMEOUT=_;exports.ETFEndpoints=d;exports.EXCHANGES=V;exports.EconomicEndpoints=u;exports.FMP=v;exports.FMPClient=c;exports.FMPValidation=m;exports.FinancialEndpoints=y;exports.InsiderEndpoints=f;exports.InstitutionalEndpoints=P;exports.ListEndpoints=b;exports.MAX_LIMIT=H;exports.MarketEndpoints=h;exports.MutualFundEndpoints=R;exports.NewsEndpoints=I;exports.PERIODS=U;exports.QuoteEndpoints=A;exports.SECEndpoints=C;exports.SECTORS=O;exports.ScreenerEndpoints=S;exports.SenateHouseEndpoints=E;exports.StockEndpoints=T;exports.formatCurrency=w;exports.formatDate=N;exports.formatLargeNumber=L;exports.formatPercentage=D;exports.formatVolume=$;
|