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.js
CHANGED
|
@@ -148,16 +148,19 @@ var StockEndpoints = class {
|
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Get real-time stock quote
|
|
151
|
-
*
|
|
151
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
152
152
|
* @param symbol - The stock symbol to get the quote for
|
|
153
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.
|
|
154
154
|
*/
|
|
155
155
|
async getQuote({ symbol }) {
|
|
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
|
+
);
|
|
156
159
|
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
157
160
|
}
|
|
158
161
|
/**
|
|
159
162
|
* Get historical stock prices
|
|
160
|
-
*
|
|
163
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
161
164
|
* @param symbol - The stock symbol to get the historical prices for
|
|
162
165
|
* @param from - The start date to get the historical prices for
|
|
163
166
|
* @param to - The end date to get the historical prices for
|
|
@@ -168,6 +171,9 @@ var StockEndpoints = class {
|
|
|
168
171
|
from,
|
|
169
172
|
to
|
|
170
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
|
+
);
|
|
171
177
|
const params = {};
|
|
172
178
|
if (from) params.from = from;
|
|
173
179
|
if (to) params.to = to;
|
|
@@ -405,14 +411,19 @@ var ForexEndpoints = class {
|
|
|
405
411
|
}
|
|
406
412
|
/**
|
|
407
413
|
* Get forex quote
|
|
414
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
408
415
|
* @param params - Parameters for the forex quote request
|
|
409
416
|
* @returns Forex quote data
|
|
410
417
|
*/
|
|
411
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
|
+
);
|
|
412
422
|
return this.client.get("/quote", "v3", params);
|
|
413
423
|
}
|
|
414
424
|
/**
|
|
415
425
|
* Get historical forex prices
|
|
426
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
416
427
|
* @param symbol - The forex symbol to get the historical prices for
|
|
417
428
|
* @param from - The start date to get the historical prices for
|
|
418
429
|
* @param to - The end date to get the historical prices for
|
|
@@ -423,26 +434,14 @@ var ForexEndpoints = class {
|
|
|
423
434
|
from,
|
|
424
435
|
to
|
|
425
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
|
+
);
|
|
426
440
|
const params = {};
|
|
427
441
|
if (from) params.from = from;
|
|
428
442
|
if (to) params.to = to;
|
|
429
443
|
return this.client.get(`/historical-price-full/${symbol}`, "v3", params);
|
|
430
444
|
}
|
|
431
|
-
/**
|
|
432
|
-
* Get forex rates for a specific base currency
|
|
433
|
-
* @param baseCurrency - The base currency to get forex rates for
|
|
434
|
-
* @returns Forex rates data
|
|
435
|
-
*/
|
|
436
|
-
async getForexRates(baseCurrency = "USD") {
|
|
437
|
-
return this.client.get(`/forex/${baseCurrency}`, "v3");
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Get all forex rates
|
|
441
|
-
* @returns All forex rates data
|
|
442
|
-
*/
|
|
443
|
-
async getAllForexRates() {
|
|
444
|
-
return this.client.get("/forex", "v3");
|
|
445
|
-
}
|
|
446
445
|
};
|
|
447
446
|
|
|
448
447
|
// src/endpoints/crypto.ts
|
|
@@ -452,16 +451,19 @@ var CryptoEndpoints = class {
|
|
|
452
451
|
}
|
|
453
452
|
/**
|
|
454
453
|
* Get crypto quote
|
|
455
|
-
*
|
|
454
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in version 0.1.0.
|
|
456
455
|
* @param symbol - The crypto symbol to get the quote for
|
|
457
456
|
* @returns Crypto quote data
|
|
458
457
|
*/
|
|
459
458
|
async getQuote({ symbol }) {
|
|
459
|
+
console.warn(
|
|
460
|
+
"\u26A0\uFE0F CryptoEndpoints.getQuote() is deprecated. Use fmp.quote.getQuote() instead. This method will be removed in version 0.1.0."
|
|
461
|
+
);
|
|
460
462
|
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
461
463
|
}
|
|
462
464
|
/**
|
|
463
465
|
* Get historical crypto prices
|
|
464
|
-
*
|
|
466
|
+
* @deprecated Use `fmp.quote.getHistoricalPrice()` instead. This method will be removed in version 0.1.0.
|
|
465
467
|
* @param symbol - The crypto symbol to get the historical prices for
|
|
466
468
|
* @param from - The start date to get the historical prices for
|
|
467
469
|
* @param to - The end date to get the historical prices for
|
|
@@ -472,6 +474,9 @@ var CryptoEndpoints = class {
|
|
|
472
474
|
from,
|
|
473
475
|
to
|
|
474
476
|
}) {
|
|
477
|
+
console.warn(
|
|
478
|
+
"\u26A0\uFE0F CryptoEndpoints.getHistoricalPrice() is deprecated. Use fmp.quote.getHistoricalPrice() instead. This method will be removed in version 0.1.0."
|
|
479
|
+
);
|
|
475
480
|
const params = {};
|
|
476
481
|
if (from) params.from = from;
|
|
477
482
|
if (to) params.to = to;
|
|
@@ -567,6 +572,7 @@ var MutualFundEndpoints = class {
|
|
|
567
572
|
}
|
|
568
573
|
/**
|
|
569
574
|
* Get mutual fund quote
|
|
575
|
+
* @deprecated Use `fmp.quote.getQuote()` instead. This method will be removed in a future release.
|
|
570
576
|
* @param params - Parameters for the mutual fund quote request
|
|
571
577
|
* @returns Mutual fund quote data
|
|
572
578
|
*/
|
|
@@ -574,48 +580,13 @@ var MutualFundEndpoints = class {
|
|
|
574
580
|
return this.client.get("/quote", "v3", params);
|
|
575
581
|
}
|
|
576
582
|
/**
|
|
577
|
-
* Get mutual fund
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Get mutual fund holdings
|
|
583
|
+
* Get mutual fund holders
|
|
584
|
+
* https://site.financialmodelingprep.com/developer/docs#mutual-fund-holder-mutual-funds-holdings
|
|
585
|
+
* @param symbol - The symbol of the mutual fund to get the holders for
|
|
586
|
+
* @returns Mutual fund holders data
|
|
584
587
|
*/
|
|
585
|
-
async
|
|
586
|
-
return this.client.get(
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
|
|
590
|
-
// src/endpoints/bond.ts
|
|
591
|
-
var BondEndpoints = class {
|
|
592
|
-
constructor(client) {
|
|
593
|
-
this.client = client;
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Get bond quote
|
|
597
|
-
* @param params - Parameters for the bond quote request
|
|
598
|
-
* @returns Bond quote data
|
|
599
|
-
*/
|
|
600
|
-
async getQuote(params) {
|
|
601
|
-
return this.client.get("/quote", "v3", params);
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* Get historical bond prices
|
|
605
|
-
* @param symbol - The bond symbol to get the historical prices for
|
|
606
|
-
* @param from - The start date to get the historical prices for
|
|
607
|
-
* @param to - The end date to get the historical prices for
|
|
608
|
-
* @returns Historical bond price data
|
|
609
|
-
*/
|
|
610
|
-
async getHistoricalPrice({
|
|
611
|
-
symbol,
|
|
612
|
-
from,
|
|
613
|
-
to
|
|
614
|
-
}) {
|
|
615
|
-
const params = {};
|
|
616
|
-
if (from) params.from = from;
|
|
617
|
-
if (to) params.to = to;
|
|
618
|
-
return this.client.get(`/historical-price-full/${symbol}`, "v3", params);
|
|
588
|
+
async getHolders({ symbol }) {
|
|
589
|
+
return this.client.get(`/mutual-fund-holder/${symbol}`, "v3");
|
|
619
590
|
}
|
|
620
591
|
};
|
|
621
592
|
|
|
@@ -626,33 +597,32 @@ var EconomicEndpoints = class {
|
|
|
626
597
|
}
|
|
627
598
|
/**
|
|
628
599
|
* Get treasury rates
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
*
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
return this.client.get("/economic/unemployment", "v3", params);
|
|
600
|
+
* https://site.financialmodelingprep.com/developer/docs#treasury-rates-economics-data
|
|
601
|
+
* @param from - The start date to get the treasury rates for
|
|
602
|
+
* @param to - The end date to get the treasury rates for
|
|
603
|
+
* @returns Treasury rates data
|
|
604
|
+
*/
|
|
605
|
+
async getTreasuryRates(params) {
|
|
606
|
+
const { from, to } = params;
|
|
607
|
+
const queryParams = {};
|
|
608
|
+
if (from) queryParams.from = from;
|
|
609
|
+
if (to) queryParams.to = to;
|
|
610
|
+
return this.client.get("/treasury", "v4", queryParams);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Get economic indicators
|
|
614
|
+
* https://site.financialmodelingprep.com/developer/docs#economic-indicators-economics-data
|
|
615
|
+
* @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
|
|
616
|
+
* @param from - The start date to get the economic indicators for
|
|
617
|
+
* @param to - The end date to get the economic indicators for
|
|
618
|
+
* @returns Provides real-time and historical economic data for a variety of economic indicators, such as GDP, unemployment, and inflation.
|
|
619
|
+
*/
|
|
620
|
+
async getEconomicIndicators(params) {
|
|
621
|
+
const { name, from, to } = params;
|
|
622
|
+
const queryParams = { name };
|
|
623
|
+
if (from) queryParams.from = from;
|
|
624
|
+
if (to) queryParams.to = to;
|
|
625
|
+
return this.client.get(`/economic`, "v4", queryParams);
|
|
656
626
|
}
|
|
657
627
|
};
|
|
658
628
|
|
|
@@ -924,6 +894,100 @@ var CompanyEndpoints = class {
|
|
|
924
894
|
}
|
|
925
895
|
};
|
|
926
896
|
|
|
897
|
+
// src/endpoints/quote.ts
|
|
898
|
+
var QuoteEndpoints = class {
|
|
899
|
+
constructor(client) {
|
|
900
|
+
this.client = client;
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Get quote for any asset type (stock, crypto, forex, commodity, ETF)
|
|
904
|
+
* @param params - Parameters for the quote request
|
|
905
|
+
* @returns Quote data for the specified asset
|
|
906
|
+
*/
|
|
907
|
+
async getQuote(params) {
|
|
908
|
+
const { symbol } = params;
|
|
909
|
+
return this.client.getSingle(`/quote/${symbol}`, "v3");
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Get historical prices for any asset type
|
|
913
|
+
* @param params - Parameters for the historical price request
|
|
914
|
+
* @returns Historical price data for the specified asset
|
|
915
|
+
*/
|
|
916
|
+
async getHistoricalPrice(params) {
|
|
917
|
+
const { symbol, from, to } = params;
|
|
918
|
+
const queryParams = {};
|
|
919
|
+
if (from) queryParams.from = from;
|
|
920
|
+
if (to) queryParams.to = to;
|
|
921
|
+
return this.client.getSingle(`/historical-price-full/${symbol}`, "v3", queryParams);
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Get multiple quotes for any asset type
|
|
925
|
+
* @param symbols - Array of symbols to get quotes for
|
|
926
|
+
* @returns Array of quote data
|
|
927
|
+
*/
|
|
928
|
+
async getQuotes(symbols) {
|
|
929
|
+
const symbolsParam = symbols.join(",");
|
|
930
|
+
return this.client.get(`/quote/${symbolsParam}`, "v3");
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Get intraday data for any asset type
|
|
934
|
+
* @param params - Parameters for the intraday request
|
|
935
|
+
* @returns Intraday price data for the specified asset
|
|
936
|
+
*/
|
|
937
|
+
async getIntraday(params) {
|
|
938
|
+
const { symbol, interval, from, to } = params;
|
|
939
|
+
const queryParams = {};
|
|
940
|
+
if (from) queryParams.from = from;
|
|
941
|
+
if (to) queryParams.to = to;
|
|
942
|
+
return this.client.get(`/historical-chart/${interval}/${symbol}`, "v3", queryParams);
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
// src/endpoints/senate-house.ts
|
|
947
|
+
var SenateHouseEndpoints = class {
|
|
948
|
+
constructor(client) {
|
|
949
|
+
this.client = client;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Get senate trading data only
|
|
953
|
+
* https://site.financialmodelingprep.com/developer/docs#senate-trading
|
|
954
|
+
* @param symbol - The stock symbol to get the senate trading data for
|
|
955
|
+
* @returns Senate trading data only
|
|
956
|
+
*/
|
|
957
|
+
async getSenateTrading(params) {
|
|
958
|
+
const { symbol } = params;
|
|
959
|
+
return this.client.get(`/senate-trading`, "v4", { symbol });
|
|
960
|
+
}
|
|
961
|
+
/** Get senate trading RSS feed
|
|
962
|
+
* https://site.financialmodelingprep.com/developer/docs#senate-trading-rss-feed-senate
|
|
963
|
+
* @param page - The page number to get
|
|
964
|
+
* @returns Senate trading RSS feed
|
|
965
|
+
*/
|
|
966
|
+
async getSenateTradingRSSFeed(params) {
|
|
967
|
+
const { page } = params;
|
|
968
|
+
return this.client.get("/senate-trading-rss-feed", "v4", { page });
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Get house trading data only
|
|
972
|
+
* https://site.financialmodelingprep.com/developer/docs#house-disclosure
|
|
973
|
+
* @param symbol - The stock symbol to get the house trading data for
|
|
974
|
+
* @returns House trading data only
|
|
975
|
+
*/
|
|
976
|
+
async getHouseTrading(params) {
|
|
977
|
+
const { symbol } = params;
|
|
978
|
+
return this.client.get("/senate-disclosure", "v4", { symbol });
|
|
979
|
+
}
|
|
980
|
+
/** Get house trading RSS feed
|
|
981
|
+
* https://site.financialmodelingprep.com/developer/docs#house-disclosure-rss-feed-senate
|
|
982
|
+
* @param page - The page number to get
|
|
983
|
+
* @returns House trading RSS feed
|
|
984
|
+
*/
|
|
985
|
+
async getHouseTradingRSSFeed(params) {
|
|
986
|
+
const { page } = params;
|
|
987
|
+
return this.client.get("/senate-disclosure-rss-feed", "v4", { page });
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
|
|
927
991
|
// src/fmp.ts
|
|
928
992
|
var FMP = class {
|
|
929
993
|
constructor(config) {
|
|
@@ -937,9 +1001,10 @@ var FMP = class {
|
|
|
937
1001
|
this.list = new ListEndpoints(client);
|
|
938
1002
|
this.calendar = new CalendarEndpoints(client);
|
|
939
1003
|
this.company = new CompanyEndpoints(client);
|
|
1004
|
+
this.quote = new QuoteEndpoints(client);
|
|
1005
|
+
this.senateHouse = new SenateHouseEndpoints(client);
|
|
940
1006
|
this.forex = new ForexEndpoints(client);
|
|
941
1007
|
this.economic = new EconomicEndpoints(client);
|
|
942
|
-
this.bond = new BondEndpoints(client);
|
|
943
1008
|
this.mutualFund = new MutualFundEndpoints(client);
|
|
944
1009
|
}
|
|
945
1010
|
/**
|
|
@@ -1087,7 +1152,6 @@ var HTTP_STATUS = {
|
|
|
1087
1152
|
INTERNAL_SERVER_ERROR: 500
|
|
1088
1153
|
};
|
|
1089
1154
|
|
|
1090
|
-
exports.BondEndpoints = BondEndpoints;
|
|
1091
1155
|
exports.COUNTRIES = COUNTRIES;
|
|
1092
1156
|
exports.CalendarEndpoints = CalendarEndpoints;
|
|
1093
1157
|
exports.CompanyEndpoints = CompanyEndpoints;
|
|
@@ -1110,7 +1174,9 @@ exports.MarketEndpoints = MarketEndpoints;
|
|
|
1110
1174
|
exports.MutualFundEndpoints = MutualFundEndpoints;
|
|
1111
1175
|
exports.PERIODS = PERIODS;
|
|
1112
1176
|
exports.Period = Period;
|
|
1177
|
+
exports.QuoteEndpoints = QuoteEndpoints;
|
|
1113
1178
|
exports.SECTORS = SECTORS;
|
|
1179
|
+
exports.SenateHouseEndpoints = SenateHouseEndpoints;
|
|
1114
1180
|
exports.StockEndpoints = StockEndpoints;
|
|
1115
1181
|
exports.formatCurrency = formatCurrency;
|
|
1116
1182
|
exports.formatDate = formatDate;
|