fmp-node-api 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -55,11 +55,13 @@ var FMPClient = class {
55
55
  return {
56
56
  success: true,
57
57
  data,
58
+ error: null,
58
59
  status: response.status
59
60
  };
60
61
  } catch (error) {
61
62
  return {
62
63
  success: false,
64
+ data: null,
63
65
  error: error.message || "Unknown error occurred",
64
66
  status: error.response?.status || 500
65
67
  };
@@ -78,11 +80,13 @@ var FMPClient = class {
78
80
  return {
79
81
  success: true,
80
82
  data,
83
+ error: null,
81
84
  status: response.status
82
85
  };
83
86
  } catch (error) {
84
87
  return {
85
88
  success: false,
89
+ data: null,
86
90
  error: error.message || "Unknown error occurred",
87
91
  status: error.response?.status || 500
88
92
  };
@@ -1117,6 +1121,289 @@ var SenateHouseEndpoints = class {
1117
1121
  }
1118
1122
  };
1119
1123
 
1124
+ // src/endpoints/institutional.ts
1125
+ var InstitutionalEndpoints = class {
1126
+ constructor(client) {
1127
+ this.client = client;
1128
+ }
1129
+ /**
1130
+ * Get Form 13F institutional stock ownership data
1131
+ * https://site.financialmodelingprep.com/developer/docs#form-13f-13f---institutional-stock-ownership
1132
+ * @param symbol - The stock symbol to get the Form 13F data for
1133
+ * @param date - The date to get the Form 13F data for (optional)
1134
+ * @returns Form 13F institutional stock ownership data
1135
+ */
1136
+ async getForm13F(params) {
1137
+ const { cik, date } = params;
1138
+ const queryParams = {};
1139
+ if (date) queryParams.date = date;
1140
+ return this.client.get(`/form-thirteen/${cik}`, "v3", queryParams);
1141
+ }
1142
+ /**
1143
+ * Get Form 13F dates for institutional stock ownership
1144
+ * https://site.financialmodelingprep.com/developer/docs#form-13f-dates-13f---institutional-stock-ownership
1145
+ * @param symbol - The stock symbol to get the Form 13F dates for
1146
+ * @returns Form 13F dates for institutional stock ownership
1147
+ */
1148
+ async getForm13FDates(params) {
1149
+ const { cik } = params;
1150
+ return this.client.get(`/form-thirteen-date/${cik}`, "v3");
1151
+ }
1152
+ /**
1153
+ * Get institutional holders data
1154
+ * https://site.financialmodelingprep.com/developer/docs#institutional-holder-13f---institutional-stock-ownership
1155
+ * @param symbol - The stock symbol to get the institutional holders for
1156
+ * @returns Institutional holders data
1157
+ */
1158
+ async getInstitutionalHolders(params) {
1159
+ const { symbol } = params;
1160
+ return this.client.get(`/institutional-holder/${symbol}`, "v3");
1161
+ }
1162
+ };
1163
+
1164
+ // src/endpoints/insider.ts
1165
+ var InsiderEndpoints = class {
1166
+ constructor(client) {
1167
+ this.client = client;
1168
+ }
1169
+ /**
1170
+ * Get insider trading RSS feed
1171
+ * https://site.financialmodelingprep.com/developer/docs#insider-trades-rss-insider-trading
1172
+ * @param params - Parameters for the RSS feed request
1173
+ * @returns An RSS feed of insider trades, updated in real time
1174
+ */
1175
+ async getInsiderTradingRSS({
1176
+ page
1177
+ }) {
1178
+ return this.client.get(`/insider-trading-rss-feed`, "v4", { page });
1179
+ }
1180
+ /**
1181
+ * Search for insider trades
1182
+ * https://site.financialmodelingprep.com/developer/docs#insider-trades-search-insider-trading
1183
+ * @param params - Parameters for the insider trading search
1184
+ * @returns A list of insider trades filtered by the provided parameters
1185
+ */
1186
+ async searchInsiderTrading({
1187
+ symbol,
1188
+ reportingCik,
1189
+ companyCik,
1190
+ transactionType,
1191
+ page
1192
+ }) {
1193
+ const params = { page };
1194
+ if (symbol) params.symbol = symbol;
1195
+ if (reportingCik) params.reportingCik = reportingCik;
1196
+ if (companyCik) params.companyCik = companyCik;
1197
+ if (transactionType) params.transactionType = transactionType;
1198
+ return this.client.get(`/insider-trading`, "v4", params);
1199
+ }
1200
+ /**
1201
+ * Get transaction types
1202
+ * https://site.financialmodelingprep.com/developer/docs#transaction-types-insider-trading
1203
+ * @returns A list of all insider transaction types
1204
+ */
1205
+ async getTransactionTypes() {
1206
+ return this.client.get(`/insider-trading-transaction-type`, "v4");
1207
+ }
1208
+ /**
1209
+ * Get insiders by symbol
1210
+ * https://site.financialmodelingprep.com/developer/docs#insiders-by-symbol-insider-trading
1211
+ * @param params - Parameters for the insiders request
1212
+ * @returns A list of insiders for a specific company
1213
+ */
1214
+ async getInsidersBySymbol({
1215
+ symbol
1216
+ }) {
1217
+ return this.client.get(`/insider-roaster`, "v4", { symbol });
1218
+ }
1219
+ /**
1220
+ * Get insider trade statistics
1221
+ * https://site.financialmodelingprep.com/developer/docs#insider-trade-statistics-insider-trading
1222
+ * @param params - Parameters for the statistics request
1223
+ * @returns Statistics on insider trading activity for a specific company
1224
+ */
1225
+ async getInsiderTradeStatistics({
1226
+ symbol
1227
+ }) {
1228
+ return this.client.get(`/insider-roaster-statistic`, "v4", { symbol });
1229
+ }
1230
+ /**
1231
+ * Get CIK mapper
1232
+ * https://site.financialmodelingprep.com/developer/docs#cik-mapper-insider-trading
1233
+ * @param params - Parameters for the CIK mapper request
1234
+ * @returns A list of CIK numbers and corresponding company names
1235
+ */
1236
+ async getCikMapper({ page }) {
1237
+ return this.client.get(`/mapper-cik-name`, "v4", { page });
1238
+ }
1239
+ /**
1240
+ * Get CIK mapper by name
1241
+ * https://site.financialmodelingprep.com/developer/docs#cik-mapper-by-name-insider-trading
1242
+ * @param params - Parameters for the CIK mapper by name request
1243
+ * @returns A list of CIK numbers and corresponding names matching the search term
1244
+ */
1245
+ async getCikMapperByName({
1246
+ name,
1247
+ page = 0
1248
+ }) {
1249
+ return this.client.get(`/mapper-cik-name`, "v4", { name, page });
1250
+ }
1251
+ /**
1252
+ * Get CIK mapper by symbol
1253
+ * https://site.financialmodelingprep.com/developer/docs#cik-mapper-company-insider-trading
1254
+ * @param params - Parameters for the CIK mapper by symbol request
1255
+ * @returns CIK number and corresponding company name for a specific symbol
1256
+ */
1257
+ async getCikMapperBySymbol({
1258
+ symbol
1259
+ }) {
1260
+ return this.client.getSingle(`/mapper-cik-company/${symbol}`, "v4");
1261
+ }
1262
+ /**
1263
+ * Get beneficial ownership acquisitions
1264
+ * https://site.financialmodelingprep.com/developer/docs#acquisition-of-beneficial-ownership
1265
+ * @param params - Parameters for the beneficial ownership request
1266
+ * @returns A list of acquisitions of beneficial ownership for a specific company
1267
+ */
1268
+ async getBeneficialOwnership({
1269
+ symbol
1270
+ }) {
1271
+ return this.client.get(`/insider/ownership/acquisition_of_beneficial_ownership`, "v4", {
1272
+ symbol
1273
+ });
1274
+ }
1275
+ /**
1276
+ * Get fail to deliver data
1277
+ * https://site.financialmodelingprep.com/developer/docs#fail-to-deliver
1278
+ * @param params - Parameters for the fail to deliver request
1279
+ * @returns A list of fail to deliver data for a specific company
1280
+ */
1281
+ async getFailToDeliver({
1282
+ symbol,
1283
+ page = 0
1284
+ }) {
1285
+ return this.client.get(`/fail_to_deliver`, "v4", { symbol, page });
1286
+ }
1287
+ /**
1288
+ * Get all insider trades for a symbol (convenience method)
1289
+ * @param symbol - The stock symbol to get insider trades for
1290
+ * @param page - Page number for pagination (default: 0)
1291
+ * @returns A list of insider trades for the specified symbol
1292
+ */
1293
+ async getInsiderTradesBySymbol(symbol, page = 0) {
1294
+ return this.searchInsiderTrading({ symbol, page });
1295
+ }
1296
+ /**
1297
+ * Get insider trades by transaction type (convenience method)
1298
+ * @param transactionType - The transaction type to filter by
1299
+ * @param page - Page number for pagination (default: 0)
1300
+ * @returns A list of insider trades filtered by transaction type
1301
+ */
1302
+ async getInsiderTradesByType(transactionType, page = 0) {
1303
+ return this.searchInsiderTrading({ transactionType, page });
1304
+ }
1305
+ /**
1306
+ * Get insider trades by reporting CIK (convenience method)
1307
+ * @param reportingCik - The reporting CIK to filter by
1308
+ * @param page - Page number for pagination (default: 0)
1309
+ * @returns A list of insider trades filtered by reporting CIK
1310
+ */
1311
+ async getInsiderTradesByReportingCik(reportingCik, page = 0) {
1312
+ return this.searchInsiderTrading({ reportingCik, page });
1313
+ }
1314
+ /**
1315
+ * Get insider trades by company CIK (convenience method)
1316
+ * @param companyCik - The company CIK to filter by
1317
+ * @param page - Page number for pagination (default: 0)
1318
+ * @returns A list of insider trades filtered by company CIK
1319
+ */
1320
+ async getInsiderTradesByCompanyCik(companyCik, page = 0) {
1321
+ return this.searchInsiderTrading({ companyCik, page });
1322
+ }
1323
+ };
1324
+
1325
+ // src/endpoints/sec.ts
1326
+ var SECEndpoints = class {
1327
+ constructor(client) {
1328
+ this.client = client;
1329
+ }
1330
+ /**
1331
+ * Get RSS feed of SEC filings
1332
+ * https://site.financialmodelingprep.com/developer/docs#rss-feed-securities-and-exchange-commission-(s.e.c)
1333
+ * @param params - RSS feed parameters
1334
+ * @returns A real-time feed of SEC filings from publicly traded companies, including the filing type, link to SEC page, and direct link to the filing. This endpoint can be used to stay up-to-date on the latest SEC filings for all companies or for a specific set of companies.
1335
+ */
1336
+ async getRSSFeed(params) {
1337
+ return this.client.get("/rss_feed", "v4", params);
1338
+ }
1339
+ /**
1340
+ * Get RSS feed of all SEC filings
1341
+ * https://site.financialmodelingprep.com/developer/docs#rss-feed-all-securities-and-exchange-commission-(s.e.c)
1342
+ * @param params - RSS feed all parameters
1343
+ * @returns A real-time feed of all SEC filings from publicly traded companies in the latest RSS feed format. This endpoint provides a comprehensive overview of all SEC filings, including the filing type, link to SEC page, and direct link to the filing.
1344
+ */
1345
+ async getRSSFeedAll(params) {
1346
+ return this.client.get("/rss_feed_all", "v4", params);
1347
+ }
1348
+ /**
1349
+ * Get RSS feed V3 of SEC filings
1350
+ * https://site.financialmodelingprep.com/developer/docs#rss-feed-v3-securities-and-exchange-commission-(s.e.c)
1351
+ * @param params - RSS feed V3 parameters
1352
+ * @returns A real-time feed of SEC filings from publicly traded companies in the latest RSS feed format (V3)
1353
+ */
1354
+ async getRSSFeedV3(params) {
1355
+ return this.client.get("/rss_feed", "v3", params);
1356
+ }
1357
+ /**
1358
+ * Get RSS feed of 8-K SEC filings
1359
+ * https://site.financialmodelingprep.com/developer/docs#rss-feed-8-k-securities-and-exchange-commission-(s.e.c)
1360
+ * @param params - RSS feed 8-K parameters
1361
+ * @returns A real-time feed of 8-K SEC filings from publicly traded companies
1362
+ */
1363
+ async getRSSFeed8K(params) {
1364
+ return this.client.get("/rss_feed_8k", "v4", params);
1365
+ }
1366
+ /**
1367
+ * Get SEC filings for a specific company
1368
+ * https://site.financialmodelingprep.com/developer/docs#sec-filings-securities-and-exchange-commission-(s.e.c)
1369
+ * @param symbol - The stock symbol to get SEC filings for
1370
+ * @param params - SEC filings parameters
1371
+ * @returns Access direct links to SEC filings, including the filing type, link to the SEC page, and direct link to the specific filing
1372
+ */
1373
+ async getSECFilings({
1374
+ symbol,
1375
+ params
1376
+ }) {
1377
+ return this.client.get(`/sec_filings/${symbol}`, "v3", params);
1378
+ }
1379
+ /**
1380
+ * Get individual industry classification
1381
+ * https://site.financialmodelingprep.com/developer/docs#individual-industry-classification-standard-industrial-classification
1382
+ * @param params - Industry classification parameters
1383
+ * @returns Identify the industry in which a particular company operates, based on the Standard Industrial Classification (SIC) system
1384
+ */
1385
+ async getIndividualIndustryClassification(params) {
1386
+ return this.client.getSingle("/standard_industrial_classification", "v4", params);
1387
+ }
1388
+ /**
1389
+ * Get all industry classifications
1390
+ * https://site.financialmodelingprep.com/developer/docs#all-industry-classification-standard-industrial-classification
1391
+ * @returns Get a comprehensive overview of all industries, classified according to the SIC system
1392
+ */
1393
+ async getAllIndustryClassifications() {
1394
+ return this.client.get("/standard_industrial_classification/all", "v4");
1395
+ }
1396
+ /**
1397
+ * Get industry classification codes
1398
+ * https://site.financialmodelingprep.com/developer/docs#industry-classification-codes-standard-industrial-classification
1399
+ * @param params - Industry classification codes parameters
1400
+ * @returns Learn more about the SIC system and identify the SIC code for a particular industry
1401
+ */
1402
+ async getIndustryClassificationCodes(params) {
1403
+ return this.client.get("/standard_industrial_classification_list", "v4", params);
1404
+ }
1405
+ };
1406
+
1120
1407
  // src/fmp.ts
1121
1408
  var FMP = class {
1122
1409
  constructor(config) {
@@ -1132,6 +1419,9 @@ var FMP = class {
1132
1419
  this.company = new CompanyEndpoints(client);
1133
1420
  this.quote = new QuoteEndpoints(client);
1134
1421
  this.senateHouse = new SenateHouseEndpoints(client);
1422
+ this.institutional = new InstitutionalEndpoints(client);
1423
+ this.insider = new InsiderEndpoints(client);
1424
+ this.sec = new SECEndpoints(client);
1135
1425
  this.forex = new ForexEndpoints(client);
1136
1426
  this.economic = new EconomicEndpoints(client);
1137
1427
  this.mutualFund = new MutualFundEndpoints(client);
@@ -1162,6 +1452,29 @@ var Exchange = /* @__PURE__ */ ((Exchange2) => {
1162
1452
  return Exchange2;
1163
1453
  })(Exchange || {});
1164
1454
 
1455
+ // src/types/insider.ts
1456
+ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
1457
+ TransactionType2["AWARD"] = "A-Award";
1458
+ TransactionType2["CONVERSION"] = "C-Conversion";
1459
+ TransactionType2["RETURN"] = "D-Return";
1460
+ TransactionType2["EXPIRE_SHORT"] = "E-ExpireShort";
1461
+ TransactionType2["IN_KIND"] = "F-InKind";
1462
+ TransactionType2["GIFT"] = "G-Gift";
1463
+ TransactionType2["EXPIRE_LONG"] = "H-ExpireLong";
1464
+ TransactionType2["DISCRETIONARY"] = "I-Discretionary";
1465
+ TransactionType2["OTHER"] = "J-Other";
1466
+ TransactionType2["SMALL"] = "L-Small";
1467
+ TransactionType2["EXEMPT"] = "M-Exempt";
1468
+ TransactionType2["OUT_OF_THE_MONEY"] = "O-OutOfTheMoney";
1469
+ TransactionType2["PURCHASE"] = "P-Purchase";
1470
+ TransactionType2["SALE"] = "S-Sale";
1471
+ TransactionType2["TENDER"] = "U-Tender";
1472
+ TransactionType2["WILL"] = "W-Will";
1473
+ TransactionType2["IN_THE_MONEY"] = "X-InTheMoney";
1474
+ TransactionType2["TRUST"] = "Z-Trust";
1475
+ return TransactionType2;
1476
+ })(TransactionType || {});
1477
+
1165
1478
  // src/utils/formatting.ts
1166
1479
  function formatCurrency(value, currency = "USD") {
1167
1480
  return new Intl.NumberFormat("en-US", {
@@ -1281,6 +1594,6 @@ var HTTP_STATUS = {
1281
1594
  INTERNAL_SERVER_ERROR: 500
1282
1595
  };
1283
1596
 
1284
- 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 };
1597
+ export { COUNTRIES, CalendarEndpoints, CompanyEndpoints, CryptoEndpoints, DEFAULT_LIMIT, DEFAULT_TIMEOUT, ERROR_MESSAGES, ETFEndpoints, EXCHANGES, EconomicEndpoints, Exchange, FMP, FMPClient, FinancialEndpoints, ForexEndpoints, HTTP_STATUS, InsiderEndpoints, InstitutionalEndpoints, ListEndpoints, MAX_LIMIT, MarketEndpoints, MutualFundEndpoints, PERIODS, Period, QuoteEndpoints, SECEndpoints, SECTORS, SenateHouseEndpoints, StockEndpoints, TransactionType, formatCurrency, formatDate, formatLargeNumber, formatNumber, formatPercentage, formatReadableDate, formatTimestamp, formatVolume, validateApiKey, validateDate, validateLimit, validatePage, validatePeriod, validateSymbol };
1285
1598
  //# sourceMappingURL=index.mjs.map
1286
1599
  //# sourceMappingURL=index.mjs.map