fmp-node-api 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/index.d.mts +379 -242
- package/dist/index.d.ts +379 -242
- package/dist/index.js +242 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +242 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -1
package/dist/index.js
CHANGED
|
@@ -35,8 +35,26 @@ var FMPClient = class {
|
|
|
35
35
|
});
|
|
36
36
|
return client;
|
|
37
37
|
}
|
|
38
|
-
//
|
|
38
|
+
// Standard get method - returns raw API response
|
|
39
39
|
async get(endpoint, version = "v3", params) {
|
|
40
|
+
const client = this.getClientForVersion(version);
|
|
41
|
+
try {
|
|
42
|
+
const response = await client.get(endpoint, { params });
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
data: response.data,
|
|
46
|
+
status: response.status
|
|
47
|
+
};
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return {
|
|
50
|
+
success: false,
|
|
51
|
+
error: error.message || "Unknown error occurred",
|
|
52
|
+
status: error.response?.status || 500
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Get method for single-object endpoints - unwraps single-item arrays
|
|
57
|
+
async getSingle(endpoint, version = "v3", params) {
|
|
40
58
|
const client = this.getClientForVersion(version);
|
|
41
59
|
try {
|
|
42
60
|
const response = await client.get(endpoint, { params });
|
|
@@ -130,16 +148,19 @@ var StockEndpoints = class {
|
|
|
130
148
|
}
|
|
131
149
|
/**
|
|
132
150
|
* Get real-time stock quote
|
|
133
|
-
*
|
|
151
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
134
152
|
* @param symbol - The stock symbol to get the quote for
|
|
135
153
|
* @returns This endpoint gives you the latest bid and ask prices for a stock, as well as the volume and last trade price in real time.
|
|
136
154
|
*/
|
|
137
155
|
async getQuote({ symbol }) {
|
|
138
|
-
|
|
156
|
+
console.warn(
|
|
157
|
+
"\u26A0\uFE0F StockEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
|
|
158
|
+
);
|
|
159
|
+
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
139
160
|
}
|
|
140
161
|
/**
|
|
141
162
|
* Get historical stock prices
|
|
142
|
-
*
|
|
163
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
143
164
|
* @param symbol - The stock symbol to get the historical prices for
|
|
144
165
|
* @param from - The start date to get the historical prices for
|
|
145
166
|
* @param to - The end date to get the historical prices for
|
|
@@ -150,10 +171,13 @@ var StockEndpoints = class {
|
|
|
150
171
|
from,
|
|
151
172
|
to
|
|
152
173
|
}) {
|
|
174
|
+
console.warn(
|
|
175
|
+
"\u26A0\uFE0F StockEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
|
|
176
|
+
);
|
|
153
177
|
const params = {};
|
|
154
178
|
if (from) params.from = from;
|
|
155
179
|
if (to) params.to = to;
|
|
156
|
-
return this.client.
|
|
180
|
+
return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", params);
|
|
157
181
|
}
|
|
158
182
|
/**
|
|
159
183
|
* Get market cap
|
|
@@ -161,10 +185,8 @@ var StockEndpoints = class {
|
|
|
161
185
|
* @param symbol - The stock symbol to get the market cap for
|
|
162
186
|
* @returns The FMP Market Cap endpoint provides the current market capitalization of a company. Market cap is a measure of the size and relative importance of a company in the stock market. It is calculated by multiplying the current share price by the number of outstanding shares.
|
|
163
187
|
*/
|
|
164
|
-
async getMarketCap({
|
|
165
|
-
symbol
|
|
166
|
-
}) {
|
|
167
|
-
return this.client.get(`/market-capitalization/${symbol}`, "v3");
|
|
188
|
+
async getMarketCap({ symbol }) {
|
|
189
|
+
return this.client.getSingle(`/market-capitalization/${symbol}`, "v3");
|
|
168
190
|
}
|
|
169
191
|
/**
|
|
170
192
|
* Get stock splits
|
|
@@ -172,10 +194,8 @@ var StockEndpoints = class {
|
|
|
172
194
|
* @param symbol - The stock symbol to get the splits for
|
|
173
195
|
* @returns A list of historical stock splits for publicly traded companies, including the date of the stock split, the split ratio, and the type of stock split.
|
|
174
196
|
*/
|
|
175
|
-
async getStockSplits({
|
|
176
|
-
symbol
|
|
177
|
-
}) {
|
|
178
|
-
return this.client.get(`/stock-split-calendar/${symbol}`, "v3");
|
|
197
|
+
async getStockSplits({ symbol }) {
|
|
198
|
+
return this.client.get(`/historical-price-full/stock_split/${symbol}`, "v3");
|
|
179
199
|
}
|
|
180
200
|
/**
|
|
181
201
|
* Get dividend history
|
|
@@ -186,7 +206,7 @@ var StockEndpoints = class {
|
|
|
186
206
|
async getDividendHistory({
|
|
187
207
|
symbol
|
|
188
208
|
}) {
|
|
189
|
-
return this.client.
|
|
209
|
+
return this.client.getSingle(`/historical-price-full/stock_dividend/${symbol}`, "v3");
|
|
190
210
|
}
|
|
191
211
|
};
|
|
192
212
|
|
|
@@ -216,7 +236,7 @@ var FinancialEndpoints = class {
|
|
|
216
236
|
* @param symbol - The stock symbol to get the balance sheet for
|
|
217
237
|
* @param period - The period to get the balance sheet for (annual or quarter)
|
|
218
238
|
* @param limit - The number of periods to get
|
|
219
|
-
* @returns The balance sheet is a financial statement that displays a company
|
|
239
|
+
* @returns The balance sheet is a financial statement that displays a company's total assets, liabilities, and shareholder equity over a specific timeframe (quarterly or yearly). Investors can use this statement to determine if the company can fund its operations, meet its debt obligations, and pay a dividend.
|
|
220
240
|
*/
|
|
221
241
|
async getBalanceSheet({
|
|
222
242
|
symbol,
|
|
@@ -234,7 +254,7 @@ var FinancialEndpoints = class {
|
|
|
234
254
|
* @param symbol - The stock symbol to get the cash flow statement for
|
|
235
255
|
* @param period - The period to get the cash flow statement for (annual or quarter)
|
|
236
256
|
* @param limit - The number of periods to get
|
|
237
|
-
* @returns The cash flow statement is a financial statement that highlights how cash moves through the company, including both cash inflows and outflows. This statement shows the cash flows in 3 main categories
|
|
257
|
+
* @returns The cash flow statement is a financial statement that highlights how cash moves through the company, including both cash inflows and outflows. This statement shows the cash flows in 3 main categories "Operating Cash Flows", "Investing Cash Flows", and "Financing Cash Flows", which help investors to understand if the company is making money or losing money by conducting business.
|
|
238
258
|
*/
|
|
239
259
|
async getCashFlowStatement({
|
|
240
260
|
symbol,
|
|
@@ -357,6 +377,31 @@ var FinancialEndpoints = class {
|
|
|
357
377
|
}) {
|
|
358
378
|
return this.client.get(`/financial-growth/${symbol}?period=${period}&limit=${limit}`, "v3");
|
|
359
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Get earnings historical
|
|
382
|
+
* https://site.financialmodelingprep.com/developer/docs#earnings-historical-earnings
|
|
383
|
+
* @param symbol - The stock symbol to get the earnings historical for
|
|
384
|
+
* @param limit - The number of periods to get
|
|
385
|
+
* @returns A list of historical & upcoming earnings announcements for a specific company, including the date, estimated EPS, and actual EPS.
|
|
386
|
+
*/
|
|
387
|
+
async getEarningsHistorical({
|
|
388
|
+
symbol,
|
|
389
|
+
limit = 5
|
|
390
|
+
}) {
|
|
391
|
+
return this.client.get(`/historical/earning_calendar/${symbol}?limit=${limit}`, "v3");
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Get earnings surprises
|
|
395
|
+
* https://site.financialmodelingprep.com/developer/docs#earnings-surprises-earnings
|
|
396
|
+
* @param symbol - The stock symbol to get the earnings surprises for
|
|
397
|
+
* @param limit - The number of periods to get
|
|
398
|
+
* @returns A list of earnings announcements for publicly traded companies that were either positive or negative surprises. This endpoint includes the date of the earnings announcement, the estimated EPS, the actual EPS, and the earnings surprise.
|
|
399
|
+
*/
|
|
400
|
+
async getEarningsSurprises({
|
|
401
|
+
symbol
|
|
402
|
+
}) {
|
|
403
|
+
return this.client.get(`/earnings-surprises/${symbol}`, "v3");
|
|
404
|
+
}
|
|
360
405
|
};
|
|
361
406
|
|
|
362
407
|
// src/endpoints/forex.ts
|
|
@@ -366,18 +411,32 @@ var ForexEndpoints = class {
|
|
|
366
411
|
}
|
|
367
412
|
/**
|
|
368
413
|
* Get forex quote
|
|
414
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
415
|
+
* @param params - Parameters for the forex quote request
|
|
416
|
+
* @returns Forex quote data
|
|
369
417
|
*/
|
|
370
418
|
async getQuote(params) {
|
|
419
|
+
console.warn(
|
|
420
|
+
"\u26A0\uFE0F ForexEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
|
|
421
|
+
);
|
|
371
422
|
return this.client.get("/quote", "v3", params);
|
|
372
423
|
}
|
|
373
424
|
/**
|
|
374
425
|
* Get historical forex prices
|
|
426
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
427
|
+
* @param symbol - The forex symbol to get the historical prices for
|
|
428
|
+
* @param from - The start date to get the historical prices for
|
|
429
|
+
* @param to - The end date to get the historical prices for
|
|
430
|
+
* @returns Historical forex price data
|
|
375
431
|
*/
|
|
376
432
|
async getHistoricalPrice({
|
|
377
433
|
symbol,
|
|
378
434
|
from,
|
|
379
435
|
to
|
|
380
436
|
}) {
|
|
437
|
+
console.warn(
|
|
438
|
+
"\u26A0\uFE0F ForexEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
|
|
439
|
+
);
|
|
381
440
|
const params = {};
|
|
382
441
|
if (from) params.from = from;
|
|
383
442
|
if (to) params.to = to;
|
|
@@ -385,12 +444,15 @@ var ForexEndpoints = class {
|
|
|
385
444
|
}
|
|
386
445
|
/**
|
|
387
446
|
* Get forex rates for a specific base currency
|
|
447
|
+
* @param baseCurrency - The base currency to get forex rates for
|
|
448
|
+
* @returns Forex rates data
|
|
388
449
|
*/
|
|
389
450
|
async getForexRates(baseCurrency = "USD") {
|
|
390
451
|
return this.client.get(`/forex/${baseCurrency}`, "v3");
|
|
391
452
|
}
|
|
392
453
|
/**
|
|
393
454
|
* Get all forex rates
|
|
455
|
+
* @returns All forex rates data
|
|
394
456
|
*/
|
|
395
457
|
async getAllForexRates() {
|
|
396
458
|
return this.client.get("/forex", "v3");
|
|
@@ -404,22 +466,36 @@ var CryptoEndpoints = class {
|
|
|
404
466
|
}
|
|
405
467
|
/**
|
|
406
468
|
* Get crypto quote
|
|
469
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
470
|
+
* @param symbol - The crypto symbol to get the quote for
|
|
471
|
+
* @returns Crypto quote data
|
|
407
472
|
*/
|
|
408
|
-
async getQuote(
|
|
409
|
-
|
|
473
|
+
async getQuote({ symbol }) {
|
|
474
|
+
console.warn(
|
|
475
|
+
"\u26A0\uFE0F CryptoEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
|
|
476
|
+
);
|
|
477
|
+
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
410
478
|
}
|
|
411
479
|
/**
|
|
412
480
|
* Get historical crypto prices
|
|
481
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
482
|
+
* @param symbol - The crypto symbol to get the historical prices for
|
|
483
|
+
* @param from - The start date to get the historical prices for
|
|
484
|
+
* @param to - The end date to get the historical prices for
|
|
485
|
+
* @returns Provides daily price data for all cryptocurrencies that are traded on exchanges around the world.
|
|
413
486
|
*/
|
|
414
487
|
async getHistoricalPrice({
|
|
415
488
|
symbol,
|
|
416
489
|
from,
|
|
417
490
|
to
|
|
418
491
|
}) {
|
|
492
|
+
console.warn(
|
|
493
|
+
"\u26A0\uFE0F CryptoEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
|
|
494
|
+
);
|
|
419
495
|
const params = {};
|
|
420
496
|
if (from) params.from = from;
|
|
421
497
|
if (to) params.to = to;
|
|
422
|
-
return this.client.
|
|
498
|
+
return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", params);
|
|
423
499
|
}
|
|
424
500
|
};
|
|
425
501
|
|
|
@@ -429,22 +505,78 @@ var ETFEndpoints = class {
|
|
|
429
505
|
this.client = client;
|
|
430
506
|
}
|
|
431
507
|
/**
|
|
432
|
-
* Get ETF
|
|
508
|
+
* Get ETF holding dates
|
|
509
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-holding-dates-etf-holdings
|
|
510
|
+
* @param symbol - The symbol of the ETF to get the holding dates for
|
|
511
|
+
* @returns The FMP ETF Holding Dates endpoint provides a list of the dates on which ETF holdings are updated. For example, an investor may want to know when an ETF's holdings are updated in order to make sure that they are still aligned with their investment goals.
|
|
433
512
|
*/
|
|
434
|
-
async
|
|
435
|
-
|
|
513
|
+
async getHoldingDates({ symbol }) {
|
|
514
|
+
const params = {};
|
|
515
|
+
if (symbol) params.symbol = symbol;
|
|
516
|
+
return this.client.get("/etf-holdings/portfolio-date", "v4", params);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Get ETF holdings
|
|
520
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-holdings-etf-holdings
|
|
521
|
+
* @param symbol - The symbol of the ETF to get the holdings for
|
|
522
|
+
* @param date - The date to get the holdings for
|
|
523
|
+
* @returns The FMP ETF Holdings endpoint provides a list of all the institutional investors that own shares of an ETF. For example, an investor may want to know which ETF has the highest exposure to a particular industry or sector.
|
|
524
|
+
*/
|
|
525
|
+
async getHoldings({
|
|
526
|
+
symbol,
|
|
527
|
+
date
|
|
528
|
+
}) {
|
|
529
|
+
const params = {};
|
|
530
|
+
if (symbol) params.symbol = symbol;
|
|
531
|
+
if (date) params.date = date;
|
|
532
|
+
return this.client.get("/etf-holdings", "v4", params);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Get ETF holder
|
|
536
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-holder-etf-holdings
|
|
537
|
+
* @param symbol - The symbol of the ETF to get the holder for
|
|
538
|
+
* @returns This endpoint returns all stocks held by a specific ETF. Assets, share number, and weight are among the fields returned. For example you can get components of SPY, VOO and more.
|
|
539
|
+
*/
|
|
540
|
+
async getHolder({ symbol }) {
|
|
541
|
+
return this.client.get(`/etf-holder/${symbol}`, "v3");
|
|
436
542
|
}
|
|
437
543
|
/**
|
|
438
544
|
* Get ETF profile
|
|
545
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-information-etf-holdings
|
|
546
|
+
* @param symbol - The symbol of the ETF to get the profile for
|
|
547
|
+
* @returns The FMP ETF Information endpoint provides basic information about an ETF, such as its ticker symbol, name, expense ratio, and asset under management. For example, an investor may want to compare the expense ratios of different ETFs to find the one that is most cost-effective.
|
|
439
548
|
*/
|
|
440
|
-
async getProfile(
|
|
441
|
-
|
|
549
|
+
async getProfile({ symbol }) {
|
|
550
|
+
const params = {};
|
|
551
|
+
if (symbol) params.symbol = symbol;
|
|
552
|
+
return this.client.getSingle("/etf-info", "v4", params);
|
|
442
553
|
}
|
|
443
554
|
/**
|
|
444
|
-
* Get ETF
|
|
555
|
+
* Get ETF sector weighting
|
|
556
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-sector-weighting-etf-holdings
|
|
557
|
+
* @param symbol - The symbol of the ETF to get the sector exposure for
|
|
558
|
+
* @returns The FMP ETF Sector Weighting endpoint provides a breakdown of the percentage of an ETF's assets that are invested in each sector. For example, an investor may want to invest in an ETF that has a high exposure to the technology sector if they believe that the technology sector is poised for growth.
|
|
445
559
|
*/
|
|
446
|
-
async
|
|
447
|
-
return this.client.get(
|
|
560
|
+
async getSectorWeighting({ symbol }) {
|
|
561
|
+
return this.client.get(`/etf-sector-weightings/${symbol}`, "v3");
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Get ETF country weighting
|
|
565
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-country-weighting-etf-holdings
|
|
566
|
+
* @param symbol - The symbol of the ETF to get the country weighting for
|
|
567
|
+
* @returns The FMP ETF Country Weighting endpoint provides a breakdown of the percentage of an ETF's assets that are invested in each country. For example, an investor may want to invest in an ETF that has a high exposure to China if they believe that the Chinese economy is poised for growth.
|
|
568
|
+
*/
|
|
569
|
+
async getCountryWeighting({ symbol }) {
|
|
570
|
+
return this.client.get(`/etf-country-weightings/${symbol}`, "v3");
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Get ETF Stock exposure
|
|
574
|
+
* https://site.financialmodelingprep.com/developer/docs#etf-sector-exposure-etf-holdings
|
|
575
|
+
* @param symbol - The symbol of the ETF to get the stock exposure for
|
|
576
|
+
* @returns This endpoint returns asset exposure from all ETFs that have it in their holdings. It has properties like market value, share number or weight percentage. It can be useful for looking up stock you like to check what ETF has it on their portfolio.
|
|
577
|
+
*/
|
|
578
|
+
async getStockExposure({ symbol }) {
|
|
579
|
+
return this.client.get(`/etf-stock-exposure/${symbol}`, "v3");
|
|
448
580
|
}
|
|
449
581
|
};
|
|
450
582
|
|
|
@@ -455,6 +587,9 @@ var MutualFundEndpoints = class {
|
|
|
455
587
|
}
|
|
456
588
|
/**
|
|
457
589
|
* Get mutual fund quote
|
|
590
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in a future release.
|
|
591
|
+
* @param params - Parameters for the mutual fund quote request
|
|
592
|
+
* @returns Mutual fund quote data
|
|
458
593
|
*/
|
|
459
594
|
async getQuote(params) {
|
|
460
595
|
return this.client.get("/quote", "v3", params);
|
|
@@ -480,12 +615,20 @@ var BondEndpoints = class {
|
|
|
480
615
|
}
|
|
481
616
|
/**
|
|
482
617
|
* Get bond quote
|
|
618
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in a future release.
|
|
619
|
+
* @param params - Parameters for the bond quote request
|
|
620
|
+
* @returns Bond quote data
|
|
483
621
|
*/
|
|
484
622
|
async getQuote(params) {
|
|
485
623
|
return this.client.get("/quote", "v3", params);
|
|
486
624
|
}
|
|
487
625
|
/**
|
|
488
626
|
* Get historical bond prices
|
|
627
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in a future release.
|
|
628
|
+
* @param symbol - The bond symbol to get the historical prices for
|
|
629
|
+
* @param from - The start date to get the historical prices for
|
|
630
|
+
* @param to - The end date to get the historical prices for
|
|
631
|
+
* @returns Historical bond price data
|
|
489
632
|
*/
|
|
490
633
|
async getHistoricalPrice({
|
|
491
634
|
symbol,
|
|
@@ -555,33 +698,41 @@ var MarketEndpoints = class {
|
|
|
555
698
|
}
|
|
556
699
|
/**
|
|
557
700
|
* Get top gainers
|
|
701
|
+
* https://site.financialmodelingprep.com/developer/docs#market-biggest-gainers-market-overview
|
|
702
|
+
* @returns The FMP Market Biggest Gainers endpoint provides a list of the stocks that have gained the most value on a given day. This information can be used by investors to identify stocks that are momentum and to potential investment opportunities.
|
|
558
703
|
*/
|
|
559
704
|
async getGainers() {
|
|
560
|
-
return this.client.get("/gainers", "v3");
|
|
705
|
+
return this.client.get("/stock_market/gainers", "v3");
|
|
561
706
|
}
|
|
562
707
|
/**
|
|
563
708
|
* Get top losers
|
|
709
|
+
* https://site.financialmodelingprep.com/developer/docs#market-biggest-losers-market-overview
|
|
710
|
+
* @returns The FMP Market Biggest Losers endpoint provides a list of the stocks that have lost the most value on a given day. This information can be used by investors to identify stocks that are underperforming and to potential trading opportunities.
|
|
564
711
|
*/
|
|
565
712
|
async getLosers() {
|
|
566
|
-
return this.client.get("/losers", "v3");
|
|
713
|
+
return this.client.get("/stock_market/losers", "v3");
|
|
567
714
|
}
|
|
568
715
|
/**
|
|
569
716
|
* Get most active stocks
|
|
570
717
|
*/
|
|
571
718
|
async getMostActive() {
|
|
572
|
-
return this.client.get("/
|
|
719
|
+
return this.client.get("/stock_market/actives", "v3");
|
|
573
720
|
}
|
|
574
721
|
/**
|
|
575
722
|
* Get sector performance
|
|
723
|
+
* https://site.financialmodelingprep.com/developer/docs#sector-performance-market-overview
|
|
724
|
+
* @returns The FMP Sector Performance endpoint provides the performance of each sector of the stock market over a specified period of time. This information can be used by investors to identify sectors that are outperforming or underperforming the market.
|
|
576
725
|
*/
|
|
577
726
|
async getSectorPerformance() {
|
|
578
727
|
return this.client.get("/sector-performance", "v3");
|
|
579
728
|
}
|
|
580
729
|
/**
|
|
581
730
|
* Get market indices
|
|
731
|
+
* https://site.financialmodelingprep.com/developer/docs#market-index-market-overview
|
|
732
|
+
* @returns The FMP Market Index endpoint provides a list of all the major stock market indices, such as the S&P 500, the Dow Jones Industrial Average, and the Nasdaq Composite Index. This information can be used by investors to track the performance of the overall stock market and to identify sectors and industries that are outperforming or underperforming the market.
|
|
582
733
|
*/
|
|
583
|
-
async getMarketIndex(
|
|
584
|
-
return this.client.get("/
|
|
734
|
+
async getMarketIndex() {
|
|
735
|
+
return this.client.get("/quotes/index", "v3");
|
|
585
736
|
}
|
|
586
737
|
};
|
|
587
738
|
|
|
@@ -718,7 +869,7 @@ var CompanyEndpoints = class {
|
|
|
718
869
|
async getCompanyProfile({
|
|
719
870
|
symbol
|
|
720
871
|
}) {
|
|
721
|
-
return this.client.
|
|
872
|
+
return this.client.getSingle(`/profile/${symbol}`, "v3");
|
|
722
873
|
}
|
|
723
874
|
/**
|
|
724
875
|
* Get executive compensation
|
|
@@ -762,11 +913,9 @@ var CompanyEndpoints = class {
|
|
|
762
913
|
* @param symbol - The stock symbol to get the shares float for
|
|
763
914
|
* @returns The FMP Company Share Float endpoint provides the total number of shares that are publicly traded for a given company. This is also known as the company's float. The float is calculated by subtracting the number of restricted shares from the total number of outstanding shares.
|
|
764
915
|
*/
|
|
765
|
-
async getSharesFloat({
|
|
766
|
-
symbol
|
|
767
|
-
}) {
|
|
916
|
+
async getSharesFloat({ symbol }) {
|
|
768
917
|
const params = { symbol };
|
|
769
|
-
return this.client.
|
|
918
|
+
return this.client.getSingle(`/shares_float`, "v4", params);
|
|
770
919
|
}
|
|
771
920
|
/**
|
|
772
921
|
* Get historical shares float
|
|
@@ -794,7 +943,56 @@ var CompanyEndpoints = class {
|
|
|
794
943
|
quarter
|
|
795
944
|
}) {
|
|
796
945
|
const params = { year, quarter };
|
|
797
|
-
return this.client.
|
|
946
|
+
return this.client.getSingle(`/earning_call_transcript/${symbol}`, "v3", params);
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
// src/endpoints/quote.ts
|
|
951
|
+
var QuoteEndpoints = class {
|
|
952
|
+
constructor(client) {
|
|
953
|
+
this.client = client;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Get quote for any asset type (stock, crypto, forex, commodity, ETF)
|
|
957
|
+
* @param params - Parameters for the quote request
|
|
958
|
+
* @returns Quote data for the specified asset
|
|
959
|
+
*/
|
|
960
|
+
async getQuote(params) {
|
|
961
|
+
const { symbol } = params;
|
|
962
|
+
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Get historical prices for any asset type
|
|
966
|
+
* @param params - Parameters for the historical price request
|
|
967
|
+
* @returns Historical price data for the specified asset
|
|
968
|
+
*/
|
|
969
|
+
async getHistoricalPrice(params) {
|
|
970
|
+
const { symbol, from, to } = params;
|
|
971
|
+
const queryParams = {};
|
|
972
|
+
if (from) queryParams.from = from;
|
|
973
|
+
if (to) queryParams.to = to;
|
|
974
|
+
return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", queryParams);
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Get multiple quotes for any asset type
|
|
978
|
+
* @param symbols - Array of symbols to get quotes for
|
|
979
|
+
* @returns Array of quote data
|
|
980
|
+
*/
|
|
981
|
+
async getQuotes(symbols) {
|
|
982
|
+
const symbolsParam = symbols.join(",");
|
|
983
|
+
return this.client.get(`/quote/${symbolsParam}`, "v3");
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Get intraday data for any asset type
|
|
987
|
+
* @param params - Parameters for the intraday request
|
|
988
|
+
* @returns Intraday price data for the specified asset
|
|
989
|
+
*/
|
|
990
|
+
async getIntraday(params) {
|
|
991
|
+
const { symbol, interval, from, to } = params;
|
|
992
|
+
const queryParams = {};
|
|
993
|
+
if (from) queryParams.from = from;
|
|
994
|
+
if (to) queryParams.to = to;
|
|
995
|
+
return this.client.get(`/historical-chart/${interval}/${symbol}`, "v3", queryParams);
|
|
798
996
|
}
|
|
799
997
|
};
|
|
800
998
|
|
|
@@ -805,16 +1003,17 @@ var FMP = class {
|
|
|
805
1003
|
const client = new FMPClient(config);
|
|
806
1004
|
this.stock = new StockEndpoints(client);
|
|
807
1005
|
this.financial = new FinancialEndpoints(client);
|
|
808
|
-
this.forex = new ForexEndpoints(client);
|
|
809
1006
|
this.crypto = new CryptoEndpoints(client);
|
|
810
1007
|
this.etf = new ETFEndpoints(client);
|
|
811
|
-
this.mutualFund = new MutualFundEndpoints(client);
|
|
812
|
-
this.bond = new BondEndpoints(client);
|
|
813
|
-
this.economic = new EconomicEndpoints(client);
|
|
814
1008
|
this.market = new MarketEndpoints(client);
|
|
815
1009
|
this.list = new ListEndpoints(client);
|
|
816
1010
|
this.calendar = new CalendarEndpoints(client);
|
|
817
1011
|
this.company = new CompanyEndpoints(client);
|
|
1012
|
+
this.quote = new QuoteEndpoints(client);
|
|
1013
|
+
this.forex = new ForexEndpoints(client);
|
|
1014
|
+
this.economic = new EconomicEndpoints(client);
|
|
1015
|
+
this.bond = new BondEndpoints(client);
|
|
1016
|
+
this.mutualFund = new MutualFundEndpoints(client);
|
|
818
1017
|
}
|
|
819
1018
|
/**
|
|
820
1019
|
* Get the underlying client instance for advanced usage
|
|
@@ -984,6 +1183,7 @@ exports.MarketEndpoints = MarketEndpoints;
|
|
|
984
1183
|
exports.MutualFundEndpoints = MutualFundEndpoints;
|
|
985
1184
|
exports.PERIODS = PERIODS;
|
|
986
1185
|
exports.Period = Period;
|
|
1186
|
+
exports.QuoteEndpoints = QuoteEndpoints;
|
|
987
1187
|
exports.SECTORS = SECTORS;
|
|
988
1188
|
exports.StockEndpoints = StockEndpoints;
|
|
989
1189
|
exports.formatCurrency = formatCurrency;
|