fmp-node-api 0.0.4 → 0.0.6
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 +3 -7
- package/dist/index.d.mts +187 -219
- package/dist/index.d.ts +187 -219
- package/dist/index.js +155 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -89
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -1
package/dist/index.mjs
CHANGED
|
@@ -142,16 +142,19 @@ var StockEndpoints = class {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Get real-time stock quote
|
|
145
|
-
*
|
|
145
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
146
146
|
* @param symbol - The stock symbol to get the quote for
|
|
147
147
|
* @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.
|
|
148
148
|
*/
|
|
149
149
|
async getQuote({ symbol }) {
|
|
150
|
+
console.warn(
|
|
151
|
+
"\u26A0\uFE0F StockEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
|
|
152
|
+
);
|
|
150
153
|
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
151
154
|
}
|
|
152
155
|
/**
|
|
153
156
|
* Get historical stock prices
|
|
154
|
-
*
|
|
157
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
155
158
|
* @param symbol - The stock symbol to get the historical prices for
|
|
156
159
|
* @param from - The start date to get the historical prices for
|
|
157
160
|
* @param to - The end date to get the historical prices for
|
|
@@ -162,6 +165,9 @@ var StockEndpoints = class {
|
|
|
162
165
|
from,
|
|
163
166
|
to
|
|
164
167
|
}) {
|
|
168
|
+
console.warn(
|
|
169
|
+
"\u26A0\uFE0F StockEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
|
|
170
|
+
);
|
|
165
171
|
const params = {};
|
|
166
172
|
if (from) params.from = from;
|
|
167
173
|
if (to) params.to = to;
|
|
@@ -399,14 +405,19 @@ var ForexEndpoints = class {
|
|
|
399
405
|
}
|
|
400
406
|
/**
|
|
401
407
|
* Get forex quote
|
|
408
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
402
409
|
* @param params - Parameters for the forex quote request
|
|
403
410
|
* @returns Forex quote data
|
|
404
411
|
*/
|
|
405
412
|
async getQuote(params) {
|
|
413
|
+
console.warn(
|
|
414
|
+
"\u26A0\uFE0F ForexEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
|
|
415
|
+
);
|
|
406
416
|
return this.client.get("/quote", "v3", params);
|
|
407
417
|
}
|
|
408
418
|
/**
|
|
409
419
|
* Get historical forex prices
|
|
420
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
410
421
|
* @param symbol - The forex symbol to get the historical prices for
|
|
411
422
|
* @param from - The start date to get the historical prices for
|
|
412
423
|
* @param to - The end date to get the historical prices for
|
|
@@ -417,26 +428,14 @@ var ForexEndpoints = class {
|
|
|
417
428
|
from,
|
|
418
429
|
to
|
|
419
430
|
}) {
|
|
431
|
+
console.warn(
|
|
432
|
+
"\u26A0\uFE0F ForexEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
|
|
433
|
+
);
|
|
420
434
|
const params = {};
|
|
421
435
|
if (from) params.from = from;
|
|
422
436
|
if (to) params.to = to;
|
|
423
437
|
return this.client.get(`/historical-price-full/${symbol}`, "v3", params);
|
|
424
438
|
}
|
|
425
|
-
/**
|
|
426
|
-
* Get forex rates for a specific base currency
|
|
427
|
-
* @param baseCurrency - The base currency to get forex rates for
|
|
428
|
-
* @returns Forex rates data
|
|
429
|
-
*/
|
|
430
|
-
async getForexRates(baseCurrency = "USD") {
|
|
431
|
-
return this.client.get(`/forex/${baseCurrency}`, "v3");
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Get all forex rates
|
|
435
|
-
* @returns All forex rates data
|
|
436
|
-
*/
|
|
437
|
-
async getAllForexRates() {
|
|
438
|
-
return this.client.get("/forex", "v3");
|
|
439
|
-
}
|
|
440
439
|
};
|
|
441
440
|
|
|
442
441
|
// src/endpoints/crypto.ts
|
|
@@ -446,16 +445,19 @@ var CryptoEndpoints = class {
|
|
|
446
445
|
}
|
|
447
446
|
/**
|
|
448
447
|
* Get crypto quote
|
|
449
|
-
*
|
|
448
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
450
449
|
* @param symbol - The crypto symbol to get the quote for
|
|
451
450
|
* @returns Crypto quote data
|
|
452
451
|
*/
|
|
453
452
|
async getQuote({ symbol }) {
|
|
453
|
+
console.warn(
|
|
454
|
+
"\u26A0\uFE0F CryptoEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
|
|
455
|
+
);
|
|
454
456
|
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
455
457
|
}
|
|
456
458
|
/**
|
|
457
459
|
* Get historical crypto prices
|
|
458
|
-
*
|
|
460
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
459
461
|
* @param symbol - The crypto symbol to get the historical prices for
|
|
460
462
|
* @param from - The start date to get the historical prices for
|
|
461
463
|
* @param to - The end date to get the historical prices for
|
|
@@ -466,6 +468,9 @@ var CryptoEndpoints = class {
|
|
|
466
468
|
from,
|
|
467
469
|
to
|
|
468
470
|
}) {
|
|
471
|
+
console.warn(
|
|
472
|
+
"\u26A0\uFE0F CryptoEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
|
|
473
|
+
);
|
|
469
474
|
const params = {};
|
|
470
475
|
if (from) params.from = from;
|
|
471
476
|
if (to) params.to = to;
|
|
@@ -561,6 +566,7 @@ var MutualFundEndpoints = class {
|
|
|
561
566
|
}
|
|
562
567
|
/**
|
|
563
568
|
* Get mutual fund quote
|
|
569
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in a future release.
|
|
564
570
|
* @param params - Parameters for the mutual fund quote request
|
|
565
571
|
* @returns Mutual fund quote data
|
|
566
572
|
*/
|
|
@@ -568,48 +574,13 @@ var MutualFundEndpoints = class {
|
|
|
568
574
|
return this.client.get("/quote", "v3", params);
|
|
569
575
|
}
|
|
570
576
|
/**
|
|
571
|
-
* Get mutual fund
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Get mutual fund holdings
|
|
577
|
+
* Get mutual fund holders
|
|
578
|
+
* https://site.financialmodelingprep.com/developer/docs#mutual-fund-holder-mutual-funds-holdings
|
|
579
|
+
* @param symbol - The symbol of the mutual fund to get the holders for
|
|
580
|
+
* @returns Mutual fund holders data
|
|
578
581
|
*/
|
|
579
|
-
async
|
|
580
|
-
return this.client.get(
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
// src/endpoints/bond.ts
|
|
585
|
-
var BondEndpoints = class {
|
|
586
|
-
constructor(client) {
|
|
587
|
-
this.client = client;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Get bond quote
|
|
591
|
-
* @param params - Parameters for the bond quote request
|
|
592
|
-
* @returns Bond quote data
|
|
593
|
-
*/
|
|
594
|
-
async getQuote(params) {
|
|
595
|
-
return this.client.get("/quote", "v3", params);
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Get historical bond prices
|
|
599
|
-
* @param symbol - The bond symbol to get the historical prices for
|
|
600
|
-
* @param from - The start date to get the historical prices for
|
|
601
|
-
* @param to - The end date to get the historical prices for
|
|
602
|
-
* @returns Historical bond price data
|
|
603
|
-
*/
|
|
604
|
-
async getHistoricalPrice({
|
|
605
|
-
symbol,
|
|
606
|
-
from,
|
|
607
|
-
to
|
|
608
|
-
}) {
|
|
609
|
-
const params = {};
|
|
610
|
-
if (from) params.from = from;
|
|
611
|
-
if (to) params.to = to;
|
|
612
|
-
return this.client.get(`/historical-price-full/${symbol}`, "v3", params);
|
|
582
|
+
async getHolders({ symbol }) {
|
|
583
|
+
return this.client.get(`/mutual-fund-holder/${symbol}`, "v3");
|
|
613
584
|
}
|
|
614
585
|
};
|
|
615
586
|
|
|
@@ -620,33 +591,32 @@ var EconomicEndpoints = class {
|
|
|
620
591
|
}
|
|
621
592
|
/**
|
|
622
593
|
* Get treasury rates
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
*
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
return this.client.get("/economic/unemployment", "v3", params);
|
|
594
|
+
* https://site.financialmodelingprep.com/developer/docs#treasury-rates-economics-data
|
|
595
|
+
* @param from - The start date to get the treasury rates for
|
|
596
|
+
* @param to - The end date to get the treasury rates for
|
|
597
|
+
* @returns Treasury rates data
|
|
598
|
+
*/
|
|
599
|
+
async getTreasuryRates(params) {
|
|
600
|
+
const { from, to } = params;
|
|
601
|
+
const queryParams = {};
|
|
602
|
+
if (from) queryParams.from = from;
|
|
603
|
+
if (to) queryParams.to = to;
|
|
604
|
+
return this.client.get("/treasury", "v4", queryParams);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Get economic indicators
|
|
608
|
+
* https://site.financialmodelingprep.com/developer/docs#economic-indicators-economics-data
|
|
609
|
+
* @param name - GDP, realGDP, nominalPotentialGDP, realGDPPerCapita, federalFunds, CPI, inflationRate, inflation, retailSales, consumerSentiment, durableGoods, unemploymentRate, totalNonfarmPayroll, initialClaims, industrialProductionTotalIndex, newPrivatelyOwnedHousingUnitsStartedTotalUnits, totalVehicleSales, retailMoneyFunds, smoothedUSRecessionProbabilities, 3MonthOr90DayRatesAndYieldsCertificatesOfDeposit, commercialBankInterestRateOnCreditCardPlansAllAccounts, 30YearFixedRateMortgageAverage, 15YearFixedRateMortgageAverage
|
|
610
|
+
* @param from - The start date to get the economic indicators for
|
|
611
|
+
* @param to - The end date to get the economic indicators for
|
|
612
|
+
* @returns Provides real-time and historical economic data for a variety of economic indicators, such as GDP, unemployment, and inflation.
|
|
613
|
+
*/
|
|
614
|
+
async getEconomicIndicators(params) {
|
|
615
|
+
const { name, from, to } = params;
|
|
616
|
+
const queryParams = { name };
|
|
617
|
+
if (from) queryParams.from = from;
|
|
618
|
+
if (to) queryParams.to = to;
|
|
619
|
+
return this.client.get(`/economic`, "v4", queryParams);
|
|
650
620
|
}
|
|
651
621
|
};
|
|
652
622
|
|
|
@@ -918,6 +888,100 @@ var CompanyEndpoints = class {
|
|
|
918
888
|
}
|
|
919
889
|
};
|
|
920
890
|
|
|
891
|
+
// src/endpoints/quote.ts
|
|
892
|
+
var QuoteEndpoints = class {
|
|
893
|
+
constructor(client) {
|
|
894
|
+
this.client = client;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Get quote for any asset type (stock, crypto, forex, commodity, ETF)
|
|
898
|
+
* @param params - Parameters for the quote request
|
|
899
|
+
* @returns Quote data for the specified asset
|
|
900
|
+
*/
|
|
901
|
+
async getQuote(params) {
|
|
902
|
+
const { symbol } = params;
|
|
903
|
+
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Get historical prices for any asset type
|
|
907
|
+
* @param params - Parameters for the historical price request
|
|
908
|
+
* @returns Historical price data for the specified asset
|
|
909
|
+
*/
|
|
910
|
+
async getHistoricalPrice(params) {
|
|
911
|
+
const { symbol, from, to } = params;
|
|
912
|
+
const queryParams = {};
|
|
913
|
+
if (from) queryParams.from = from;
|
|
914
|
+
if (to) queryParams.to = to;
|
|
915
|
+
return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", queryParams);
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Get multiple quotes for any asset type
|
|
919
|
+
* @param symbols - Array of symbols to get quotes for
|
|
920
|
+
* @returns Array of quote data
|
|
921
|
+
*/
|
|
922
|
+
async getQuotes(symbols) {
|
|
923
|
+
const symbolsParam = symbols.join(",");
|
|
924
|
+
return this.client.get(`/quote/${symbolsParam}`, "v3");
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Get intraday data for any asset type
|
|
928
|
+
* @param params - Parameters for the intraday request
|
|
929
|
+
* @returns Intraday price data for the specified asset
|
|
930
|
+
*/
|
|
931
|
+
async getIntraday(params) {
|
|
932
|
+
const { symbol, interval, from, to } = params;
|
|
933
|
+
const queryParams = {};
|
|
934
|
+
if (from) queryParams.from = from;
|
|
935
|
+
if (to) queryParams.to = to;
|
|
936
|
+
return this.client.get(`/historical-chart/${interval}/${symbol}`, "v3", queryParams);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
// src/endpoints/senate-house.ts
|
|
941
|
+
var SenateHouseEndpoints = class {
|
|
942
|
+
constructor(client) {
|
|
943
|
+
this.client = client;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Get senate trading data only
|
|
947
|
+
* https://site.financialmodelingprep.com/developer/docs#senate-trading
|
|
948
|
+
* @param symbol - The stock symbol to get the senate trading data for
|
|
949
|
+
* @returns Senate trading data only
|
|
950
|
+
*/
|
|
951
|
+
async getSenateTrading(params) {
|
|
952
|
+
const { symbol } = params;
|
|
953
|
+
return this.client.get(`/senate-trading`, "v4", { symbol });
|
|
954
|
+
}
|
|
955
|
+
/** Get senate trading RSS feed
|
|
956
|
+
* https://site.financialmodelingprep.com/developer/docs#senate-trading-rss-feed-senate
|
|
957
|
+
* @param page - The page number to get
|
|
958
|
+
* @returns Senate trading RSS feed
|
|
959
|
+
*/
|
|
960
|
+
async getSenateTradingRSSFeed(params) {
|
|
961
|
+
const { page } = params;
|
|
962
|
+
return this.client.get("/senate-trading-rss-feed", "v4", { page });
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Get house trading data only
|
|
966
|
+
* https://site.financialmodelingprep.com/developer/docs#house-disclosure
|
|
967
|
+
* @param symbol - The stock symbol to get the house trading data for
|
|
968
|
+
* @returns House trading data only
|
|
969
|
+
*/
|
|
970
|
+
async getHouseTrading(params) {
|
|
971
|
+
const { symbol } = params;
|
|
972
|
+
return this.client.get("/senate-disclosure", "v4", { symbol });
|
|
973
|
+
}
|
|
974
|
+
/** Get house trading RSS feed
|
|
975
|
+
* https://site.financialmodelingprep.com/developer/docs#house-disclosure-rss-feed-senate
|
|
976
|
+
* @param page - The page number to get
|
|
977
|
+
* @returns House trading RSS feed
|
|
978
|
+
*/
|
|
979
|
+
async getHouseTradingRSSFeed(params) {
|
|
980
|
+
const { page } = params;
|
|
981
|
+
return this.client.get("/senate-disclosure-rss-feed", "v4", { page });
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
|
|
921
985
|
// src/fmp.ts
|
|
922
986
|
var FMP = class {
|
|
923
987
|
constructor(config) {
|
|
@@ -931,9 +995,10 @@ var FMP = class {
|
|
|
931
995
|
this.list = new ListEndpoints(client);
|
|
932
996
|
this.calendar = new CalendarEndpoints(client);
|
|
933
997
|
this.company = new CompanyEndpoints(client);
|
|
998
|
+
this.quote = new QuoteEndpoints(client);
|
|
999
|
+
this.senateHouse = new SenateHouseEndpoints(client);
|
|
934
1000
|
this.forex = new ForexEndpoints(client);
|
|
935
1001
|
this.economic = new EconomicEndpoints(client);
|
|
936
|
-
this.bond = new BondEndpoints(client);
|
|
937
1002
|
this.mutualFund = new MutualFundEndpoints(client);
|
|
938
1003
|
}
|
|
939
1004
|
/**
|
|
@@ -1081,6 +1146,6 @@ var HTTP_STATUS = {
|
|
|
1081
1146
|
INTERNAL_SERVER_ERROR: 500
|
|
1082
1147
|
};
|
|
1083
1148
|
|
|
1084
|
-
export {
|
|
1149
|
+
export { COUNTRIES, CalendarEndpoints, CompanyEndpoints, CryptoEndpoints, DEFAULT_LIMIT, DEFAULT_TIMEOUT, ERROR_MESSAGES, ETFEndpoints, EXCHANGES, EconomicEndpoints, Exchange, FMP, FMPClient, FinancialEndpoints, ForexEndpoints, HTTP_STATUS, ListEndpoints, MAX_LIMIT, MarketEndpoints, MutualFundEndpoints, PERIODS, Period, QuoteEndpoints, SECTORS, SenateHouseEndpoints, StockEndpoints, formatCurrency, formatDate, formatLargeNumber, formatNumber, formatPercentage, formatReadableDate, formatTimestamp, formatVolume, validateApiKey, validateDate, validateLimit, validatePage, validatePeriod, validateSymbol };
|
|
1085
1150
|
//# sourceMappingURL=index.mjs.map
|
|
1086
1151
|
//# sourceMappingURL=index.mjs.map
|