fmp-node-api 0.0.6 → 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.d.mts +581 -28
- package/dist/index.d.ts +581 -28
- package/dist/index.js +463 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +460 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -13,13 +13,22 @@ function unwrapSingleObject(data) {
|
|
|
13
13
|
}
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
|
+
function normalizeArrayResponse(data) {
|
|
17
|
+
if (Array.isArray(data)) return data;
|
|
18
|
+
if (data == null) return [];
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function normalizeObjectResponse(data) {
|
|
22
|
+
if (data == null) return {};
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
16
25
|
var FMPClient = class {
|
|
17
26
|
constructor(config) {
|
|
18
27
|
this.apiKey = config.apiKey;
|
|
19
28
|
this.v3Client = this.createClient("https://financialmodelingprep.com/api/v3", config.timeout);
|
|
20
29
|
this.v4Client = this.createClient("https://financialmodelingprep.com/api/v4", config.timeout);
|
|
21
30
|
this.stableClient = this.createClient(
|
|
22
|
-
"https://financialmodelingprep.com/
|
|
31
|
+
"https://financialmodelingprep.com/stable",
|
|
23
32
|
config.timeout
|
|
24
33
|
);
|
|
25
34
|
}
|
|
@@ -35,37 +44,55 @@ var FMPClient = class {
|
|
|
35
44
|
});
|
|
36
45
|
return client;
|
|
37
46
|
}
|
|
38
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Standard get method - returns raw API response
|
|
49
|
+
*
|
|
50
|
+
* For endpoints that return arrays, this will always return an array (possibly empty) for `data` when success is true.
|
|
51
|
+
* For endpoints that return objects, data is returned as-is.
|
|
52
|
+
*/
|
|
39
53
|
async get(endpoint, version = "v3", params) {
|
|
40
54
|
const client = this.getClientForVersion(version);
|
|
41
55
|
try {
|
|
42
56
|
const response = await client.get(endpoint, { params });
|
|
57
|
+
let data = response.data;
|
|
58
|
+
if (Array.isArray(data) || data == null) {
|
|
59
|
+
data = normalizeArrayResponse(data);
|
|
60
|
+
}
|
|
43
61
|
return {
|
|
44
62
|
success: true,
|
|
45
|
-
data
|
|
63
|
+
data,
|
|
64
|
+
error: null,
|
|
46
65
|
status: response.status
|
|
47
66
|
};
|
|
48
67
|
} catch (error) {
|
|
49
68
|
return {
|
|
50
69
|
success: false,
|
|
70
|
+
data: null,
|
|
51
71
|
error: error.message || "Unknown error occurred",
|
|
52
72
|
status: error.response?.status || 500
|
|
53
73
|
};
|
|
54
74
|
}
|
|
55
75
|
}
|
|
56
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Get method for single-object endpoints - unwraps single-item arrays
|
|
78
|
+
*
|
|
79
|
+
* For endpoints that return single objects, this will always return an object (possibly empty) for `data` when success is true.
|
|
80
|
+
*/
|
|
57
81
|
async getSingle(endpoint, version = "v3", params) {
|
|
58
82
|
const client = this.getClientForVersion(version);
|
|
59
83
|
try {
|
|
60
84
|
const response = await client.get(endpoint, { params });
|
|
85
|
+
const data = normalizeObjectResponse(unwrapSingleObject(response.data));
|
|
61
86
|
return {
|
|
62
87
|
success: true,
|
|
63
|
-
data
|
|
88
|
+
data,
|
|
89
|
+
error: null,
|
|
64
90
|
status: response.status
|
|
65
91
|
};
|
|
66
92
|
} catch (error) {
|
|
67
93
|
return {
|
|
68
94
|
success: false,
|
|
95
|
+
data: null,
|
|
69
96
|
error: error.message || "Unknown error occurred",
|
|
70
97
|
status: error.response?.status || 500
|
|
71
98
|
};
|
|
@@ -208,6 +235,79 @@ var StockEndpoints = class {
|
|
|
208
235
|
}) {
|
|
209
236
|
return this.client.getSingle(`/historical-price-full/stock_dividend/${symbol}`, "v3");
|
|
210
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Get stock real time price
|
|
240
|
+
* @param symbol - The stock symbol to get the real time price for
|
|
241
|
+
* @returns The real time price for the stock
|
|
242
|
+
*/
|
|
243
|
+
async getRealTimePrice({
|
|
244
|
+
symbols
|
|
245
|
+
}) {
|
|
246
|
+
const url = `stock/real-time-price/${symbols.join(",")}`;
|
|
247
|
+
const result = await this.client.get(url, "v3");
|
|
248
|
+
if (result.success && result.data && !Array.isArray(result.data)) {
|
|
249
|
+
const data = result.data;
|
|
250
|
+
if (typeof data === "object" && data !== null && "companiesPriceList" in data && Array.isArray(data.companiesPriceList)) {
|
|
251
|
+
const filteredData2 = data.companiesPriceList.filter((item) => item && item.symbol);
|
|
252
|
+
if (filteredData2.length > 0) {
|
|
253
|
+
return { ...result, data: filteredData2 };
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (typeof data === "object" && data !== null && "stockList" in data && Array.isArray(data.stockList)) {
|
|
257
|
+
const filteredData2 = data.stockList.filter((item) => item && item.symbol);
|
|
258
|
+
if (filteredData2.length > 0) {
|
|
259
|
+
return { ...result, data: filteredData2 };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (data.symbol) {
|
|
263
|
+
return { ...result, data: [data] };
|
|
264
|
+
}
|
|
265
|
+
if (symbols.length === 1) {
|
|
266
|
+
console.warn(`No real-time price data found for symbol: ${symbols[0]}`);
|
|
267
|
+
}
|
|
268
|
+
return { ...result, data: [] };
|
|
269
|
+
}
|
|
270
|
+
const filteredData = result.data.filter((item) => item && item.symbol);
|
|
271
|
+
return { ...result, data: filteredData };
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Get stock real time price full
|
|
275
|
+
* https://site.financialmodelingprep.com/developer/docs#real-time-full-price-quote
|
|
276
|
+
* @param symbols - The stock symbols to get the real time price for
|
|
277
|
+
* @returns The real time price for the stocks
|
|
278
|
+
*/
|
|
279
|
+
async getRealTimePriceForMultipleStocks({
|
|
280
|
+
symbols
|
|
281
|
+
}) {
|
|
282
|
+
const url = `stock/full/real-time-price/${symbols.join(",")}`;
|
|
283
|
+
const result = await this.client.get(url, "v3");
|
|
284
|
+
if (result.success && result.data && !Array.isArray(result.data)) {
|
|
285
|
+
const data = result.data;
|
|
286
|
+
if (typeof data === "object" && data !== null && "companiesPriceList" in data && Array.isArray(data.companiesPriceList)) {
|
|
287
|
+
const filteredData2 = data.companiesPriceList.filter((item) => item && item.symbol);
|
|
288
|
+
if (filteredData2.length > 0) {
|
|
289
|
+
return { ...result, data: filteredData2 };
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (typeof data === "object" && data !== null && "stockList" in data && Array.isArray(data.stockList)) {
|
|
293
|
+
const filteredData2 = data.stockList.filter((item) => item && item.symbol);
|
|
294
|
+
if (filteredData2.length > 0) {
|
|
295
|
+
return { ...result, data: filteredData2 };
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (data.symbol) {
|
|
299
|
+
return { ...result, data: [data] };
|
|
300
|
+
}
|
|
301
|
+
if (symbols.length === 1) {
|
|
302
|
+
console.warn(`No full real-time price data found for symbol: ${symbols[0]}`);
|
|
303
|
+
}
|
|
304
|
+
return { ...result, data: [] };
|
|
305
|
+
}
|
|
306
|
+
const filteredData = result.data.filter(
|
|
307
|
+
(item) => item && item.symbol
|
|
308
|
+
);
|
|
309
|
+
return { ...result, data: filteredData };
|
|
310
|
+
}
|
|
211
311
|
};
|
|
212
312
|
|
|
213
313
|
// src/endpoints/financial.ts
|
|
@@ -748,6 +848,19 @@ var CalendarEndpoints = class {
|
|
|
748
848
|
if (to) params.to = to;
|
|
749
849
|
return this.client.get("/earning_calendar", "v3", params);
|
|
750
850
|
}
|
|
851
|
+
/**
|
|
852
|
+
* Get earnings confirmed
|
|
853
|
+
* https://site.financialmodelingprep.com/developer/docs#earnings-confirmed-earnings
|
|
854
|
+
* @param from - The start date to get the earnings confirmed for
|
|
855
|
+
* @param to - The end date to get the earnings confirmed for
|
|
856
|
+
* @returns The earnings confirmed
|
|
857
|
+
*/
|
|
858
|
+
async getEarningsConfirmed({ from, to } = {}) {
|
|
859
|
+
const params = {};
|
|
860
|
+
if (from) params.from = from;
|
|
861
|
+
if (to) params.to = to;
|
|
862
|
+
return this.client.get("/earning-calendar-confirmed", "v4", params);
|
|
863
|
+
}
|
|
751
864
|
/**
|
|
752
865
|
* Get dividends calendar
|
|
753
866
|
* https://site.financialmodelingprep.com/developer/docs#dividends-calendar-dividends
|
|
@@ -813,9 +926,7 @@ var CompanyEndpoints = class {
|
|
|
813
926
|
* @param symbol - The stock symbol to get the profile for
|
|
814
927
|
* @returns Get a comprehensive overview of a company with our Company Profile endpoint. This endpoint provides key information such as price, beta, market capitalization, description, headquarters, and more.
|
|
815
928
|
*/
|
|
816
|
-
async getCompanyProfile({
|
|
817
|
-
symbol
|
|
818
|
-
}) {
|
|
929
|
+
async getCompanyProfile({ symbol }) {
|
|
819
930
|
return this.client.getSingle(`/profile/${symbol}`, "v3");
|
|
820
931
|
}
|
|
821
932
|
/**
|
|
@@ -836,9 +947,7 @@ var CompanyEndpoints = class {
|
|
|
836
947
|
* @param symbol - The stock symbol to get the notes for
|
|
837
948
|
* @returns Stay up-to-date on a company's financial condition, operations, and risks with our Company Notes endpoint. This endpoint provides information about notes reported by a company in their financial statements.
|
|
838
949
|
*/
|
|
839
|
-
async getCompanyNotes({
|
|
840
|
-
symbol
|
|
841
|
-
}) {
|
|
950
|
+
async getCompanyNotes({ symbol }) {
|
|
842
951
|
const params = { symbol };
|
|
843
952
|
return this.client.get(`/company-notes`, "v4", params);
|
|
844
953
|
}
|
|
@@ -892,6 +1001,18 @@ var CompanyEndpoints = class {
|
|
|
892
1001
|
const params = { year, quarter };
|
|
893
1002
|
return this.client.getSingle(`/earning_call_transcript/${symbol}`, "v3", params);
|
|
894
1003
|
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Get company transcript dates
|
|
1006
|
+
* https://site.financialmodelingprep.com/developer/docs#transcript-dates-earnings-transcripts
|
|
1007
|
+
* @param symbol - The stock symbol to get the transcript data for
|
|
1008
|
+
* @returns The FMP Company Transcript Data endpoint provides the transcript data for a company's earnings call.
|
|
1009
|
+
*/
|
|
1010
|
+
async getCompanyTranscriptData({
|
|
1011
|
+
symbol
|
|
1012
|
+
}) {
|
|
1013
|
+
const params = { symbol };
|
|
1014
|
+
return this.client.getSingle(`/earning_call_transcript`, "v4", params);
|
|
1015
|
+
}
|
|
895
1016
|
};
|
|
896
1017
|
|
|
897
1018
|
// src/endpoints/quote.ts
|
|
@@ -967,6 +1088,15 @@ var SenateHouseEndpoints = class {
|
|
|
967
1088
|
const { page } = params;
|
|
968
1089
|
return this.client.get("/senate-trading-rss-feed", "v4", { page });
|
|
969
1090
|
}
|
|
1091
|
+
/** Get Senate trades by name
|
|
1092
|
+
* https://site.financialmodelingprep.com/developer/docs/stable#senate-trading-by-name
|
|
1093
|
+
* @param name - The name of the senator to get the trades for
|
|
1094
|
+
* @returns Senate trades by name
|
|
1095
|
+
*/
|
|
1096
|
+
async getSenateTradingByName(params) {
|
|
1097
|
+
const { name } = params;
|
|
1098
|
+
return this.client.get("/senate-trades-by-name", "stable", { name });
|
|
1099
|
+
}
|
|
970
1100
|
/**
|
|
971
1101
|
* Get house trading data only
|
|
972
1102
|
* https://site.financialmodelingprep.com/developer/docs#house-disclosure
|
|
@@ -986,6 +1116,298 @@ var SenateHouseEndpoints = class {
|
|
|
986
1116
|
const { page } = params;
|
|
987
1117
|
return this.client.get("/senate-disclosure-rss-feed", "v4", { page });
|
|
988
1118
|
}
|
|
1119
|
+
/** Get house trading by name
|
|
1120
|
+
* https://site.financialmodelingprep.com/developer/docs/stable#house-trading-by-name
|
|
1121
|
+
* @param name - The name of the representative to get the trades for
|
|
1122
|
+
* @returns House trading by name
|
|
1123
|
+
*/
|
|
1124
|
+
async getHouseTradingByName(params) {
|
|
1125
|
+
const { name } = params;
|
|
1126
|
+
return this.client.get("/house-trades-by-name", "stable", { name });
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
// src/endpoints/institutional.ts
|
|
1131
|
+
var InstitutionalEndpoints = class {
|
|
1132
|
+
constructor(client) {
|
|
1133
|
+
this.client = client;
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Get Form 13F institutional stock ownership data
|
|
1137
|
+
* https://site.financialmodelingprep.com/developer/docs#form-13f-13f---institutional-stock-ownership
|
|
1138
|
+
* @param symbol - The stock symbol to get the Form 13F data for
|
|
1139
|
+
* @param date - The date to get the Form 13F data for (optional)
|
|
1140
|
+
* @returns Form 13F institutional stock ownership data
|
|
1141
|
+
*/
|
|
1142
|
+
async getForm13F(params) {
|
|
1143
|
+
const { cik, date } = params;
|
|
1144
|
+
const queryParams = {};
|
|
1145
|
+
if (date) queryParams.date = date;
|
|
1146
|
+
return this.client.get(`/form-thirteen/${cik}`, "v3", queryParams);
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Get Form 13F dates for institutional stock ownership
|
|
1150
|
+
* https://site.financialmodelingprep.com/developer/docs#form-13f-dates-13f---institutional-stock-ownership
|
|
1151
|
+
* @param symbol - The stock symbol to get the Form 13F dates for
|
|
1152
|
+
* @returns Form 13F dates for institutional stock ownership
|
|
1153
|
+
*/
|
|
1154
|
+
async getForm13FDates(params) {
|
|
1155
|
+
const { cik } = params;
|
|
1156
|
+
return this.client.get(`/form-thirteen-date/${cik}`, "v3");
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Get institutional holders data
|
|
1160
|
+
* https://site.financialmodelingprep.com/developer/docs#institutional-holder-13f---institutional-stock-ownership
|
|
1161
|
+
* @param symbol - The stock symbol to get the institutional holders for
|
|
1162
|
+
* @returns Institutional holders data
|
|
1163
|
+
*/
|
|
1164
|
+
async getInstitutionalHolders(params) {
|
|
1165
|
+
const { symbol } = params;
|
|
1166
|
+
return this.client.get(`/institutional-holder/${symbol}`, "v3");
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
// src/endpoints/insider.ts
|
|
1171
|
+
var InsiderEndpoints = class {
|
|
1172
|
+
constructor(client) {
|
|
1173
|
+
this.client = client;
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Get insider trading RSS feed
|
|
1177
|
+
* https://site.financialmodelingprep.com/developer/docs#insider-trades-rss-insider-trading
|
|
1178
|
+
* @param params - Parameters for the RSS feed request
|
|
1179
|
+
* @returns An RSS feed of insider trades, updated in real time
|
|
1180
|
+
*/
|
|
1181
|
+
async getInsiderTradingRSS({
|
|
1182
|
+
page
|
|
1183
|
+
}) {
|
|
1184
|
+
return this.client.get(`/insider-trading-rss-feed`, "v4", { page });
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Search for insider trades
|
|
1188
|
+
* https://site.financialmodelingprep.com/developer/docs#insider-trades-search-insider-trading
|
|
1189
|
+
* @param params - Parameters for the insider trading search
|
|
1190
|
+
* @returns A list of insider trades filtered by the provided parameters
|
|
1191
|
+
*/
|
|
1192
|
+
async searchInsiderTrading({
|
|
1193
|
+
symbol,
|
|
1194
|
+
reportingCik,
|
|
1195
|
+
companyCik,
|
|
1196
|
+
transactionType,
|
|
1197
|
+
page
|
|
1198
|
+
}) {
|
|
1199
|
+
const params = { page };
|
|
1200
|
+
if (symbol) params.symbol = symbol;
|
|
1201
|
+
if (reportingCik) params.reportingCik = reportingCik;
|
|
1202
|
+
if (companyCik) params.companyCik = companyCik;
|
|
1203
|
+
if (transactionType) params.transactionType = transactionType;
|
|
1204
|
+
return this.client.get(`/insider-trading`, "v4", params);
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Get transaction types
|
|
1208
|
+
* https://site.financialmodelingprep.com/developer/docs#transaction-types-insider-trading
|
|
1209
|
+
* @returns A list of all insider transaction types
|
|
1210
|
+
*/
|
|
1211
|
+
async getTransactionTypes() {
|
|
1212
|
+
return this.client.get(`/insider-trading-transaction-type`, "v4");
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Get insiders by symbol
|
|
1216
|
+
* https://site.financialmodelingprep.com/developer/docs#insiders-by-symbol-insider-trading
|
|
1217
|
+
* @param params - Parameters for the insiders request
|
|
1218
|
+
* @returns A list of insiders for a specific company
|
|
1219
|
+
*/
|
|
1220
|
+
async getInsidersBySymbol({
|
|
1221
|
+
symbol
|
|
1222
|
+
}) {
|
|
1223
|
+
return this.client.get(`/insider-roaster`, "v4", { symbol });
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Get insider trade statistics
|
|
1227
|
+
* https://site.financialmodelingprep.com/developer/docs#insider-trade-statistics-insider-trading
|
|
1228
|
+
* @param params - Parameters for the statistics request
|
|
1229
|
+
* @returns Statistics on insider trading activity for a specific company
|
|
1230
|
+
*/
|
|
1231
|
+
async getInsiderTradeStatistics({
|
|
1232
|
+
symbol
|
|
1233
|
+
}) {
|
|
1234
|
+
return this.client.get(`/insider-roaster-statistic`, "v4", { symbol });
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Get CIK mapper
|
|
1238
|
+
* https://site.financialmodelingprep.com/developer/docs#cik-mapper-insider-trading
|
|
1239
|
+
* @param params - Parameters for the CIK mapper request
|
|
1240
|
+
* @returns A list of CIK numbers and corresponding company names
|
|
1241
|
+
*/
|
|
1242
|
+
async getCikMapper({ page }) {
|
|
1243
|
+
return this.client.get(`/mapper-cik-name`, "v4", { page });
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Get CIK mapper by name
|
|
1247
|
+
* https://site.financialmodelingprep.com/developer/docs#cik-mapper-by-name-insider-trading
|
|
1248
|
+
* @param params - Parameters for the CIK mapper by name request
|
|
1249
|
+
* @returns A list of CIK numbers and corresponding names matching the search term
|
|
1250
|
+
*/
|
|
1251
|
+
async getCikMapperByName({
|
|
1252
|
+
name,
|
|
1253
|
+
page = 0
|
|
1254
|
+
}) {
|
|
1255
|
+
return this.client.get(`/mapper-cik-name`, "v4", { name, page });
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Get CIK mapper by symbol
|
|
1259
|
+
* https://site.financialmodelingprep.com/developer/docs#cik-mapper-company-insider-trading
|
|
1260
|
+
* @param params - Parameters for the CIK mapper by symbol request
|
|
1261
|
+
* @returns CIK number and corresponding company name for a specific symbol
|
|
1262
|
+
*/
|
|
1263
|
+
async getCikMapperBySymbol({
|
|
1264
|
+
symbol
|
|
1265
|
+
}) {
|
|
1266
|
+
return this.client.getSingle(`/mapper-cik-company/${symbol}`, "v4");
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Get beneficial ownership acquisitions
|
|
1270
|
+
* https://site.financialmodelingprep.com/developer/docs#acquisition-of-beneficial-ownership
|
|
1271
|
+
* @param params - Parameters for the beneficial ownership request
|
|
1272
|
+
* @returns A list of acquisitions of beneficial ownership for a specific company
|
|
1273
|
+
*/
|
|
1274
|
+
async getBeneficialOwnership({
|
|
1275
|
+
symbol
|
|
1276
|
+
}) {
|
|
1277
|
+
return this.client.get(`/insider/ownership/acquisition_of_beneficial_ownership`, "v4", {
|
|
1278
|
+
symbol
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Get fail to deliver data
|
|
1283
|
+
* https://site.financialmodelingprep.com/developer/docs#fail-to-deliver
|
|
1284
|
+
* @param params - Parameters for the fail to deliver request
|
|
1285
|
+
* @returns A list of fail to deliver data for a specific company
|
|
1286
|
+
*/
|
|
1287
|
+
async getFailToDeliver({
|
|
1288
|
+
symbol,
|
|
1289
|
+
page = 0
|
|
1290
|
+
}) {
|
|
1291
|
+
return this.client.get(`/fail_to_deliver`, "v4", { symbol, page });
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Get all insider trades for a symbol (convenience method)
|
|
1295
|
+
* @param symbol - The stock symbol to get insider trades for
|
|
1296
|
+
* @param page - Page number for pagination (default: 0)
|
|
1297
|
+
* @returns A list of insider trades for the specified symbol
|
|
1298
|
+
*/
|
|
1299
|
+
async getInsiderTradesBySymbol(symbol, page = 0) {
|
|
1300
|
+
return this.searchInsiderTrading({ symbol, page });
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Get insider trades by transaction type (convenience method)
|
|
1304
|
+
* @param transactionType - The transaction type to filter by
|
|
1305
|
+
* @param page - Page number for pagination (default: 0)
|
|
1306
|
+
* @returns A list of insider trades filtered by transaction type
|
|
1307
|
+
*/
|
|
1308
|
+
async getInsiderTradesByType(transactionType, page = 0) {
|
|
1309
|
+
return this.searchInsiderTrading({ transactionType, page });
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Get insider trades by reporting CIK (convenience method)
|
|
1313
|
+
* @param reportingCik - The reporting CIK to filter by
|
|
1314
|
+
* @param page - Page number for pagination (default: 0)
|
|
1315
|
+
* @returns A list of insider trades filtered by reporting CIK
|
|
1316
|
+
*/
|
|
1317
|
+
async getInsiderTradesByReportingCik(reportingCik, page = 0) {
|
|
1318
|
+
return this.searchInsiderTrading({ reportingCik, page });
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Get insider trades by company CIK (convenience method)
|
|
1322
|
+
* @param companyCik - The company CIK to filter by
|
|
1323
|
+
* @param page - Page number for pagination (default: 0)
|
|
1324
|
+
* @returns A list of insider trades filtered by company CIK
|
|
1325
|
+
*/
|
|
1326
|
+
async getInsiderTradesByCompanyCik(companyCik, page = 0) {
|
|
1327
|
+
return this.searchInsiderTrading({ companyCik, page });
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
// src/endpoints/sec.ts
|
|
1332
|
+
var SECEndpoints = class {
|
|
1333
|
+
constructor(client) {
|
|
1334
|
+
this.client = client;
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Get RSS feed of SEC filings
|
|
1338
|
+
* https://site.financialmodelingprep.com/developer/docs#rss-feed-securities-and-exchange-commission-(s.e.c)
|
|
1339
|
+
* @param params - RSS feed parameters
|
|
1340
|
+
* @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.
|
|
1341
|
+
*/
|
|
1342
|
+
async getRSSFeed(params) {
|
|
1343
|
+
return this.client.get("/rss_feed", "v4", params);
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Get RSS feed of all SEC filings
|
|
1347
|
+
* https://site.financialmodelingprep.com/developer/docs#rss-feed-all-securities-and-exchange-commission-(s.e.c)
|
|
1348
|
+
* @param params - RSS feed all parameters
|
|
1349
|
+
* @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.
|
|
1350
|
+
*/
|
|
1351
|
+
async getRSSFeedAll(params) {
|
|
1352
|
+
return this.client.get("/rss_feed_all", "v4", params);
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Get RSS feed V3 of SEC filings
|
|
1356
|
+
* https://site.financialmodelingprep.com/developer/docs#rss-feed-v3-securities-and-exchange-commission-(s.e.c)
|
|
1357
|
+
* @param params - RSS feed V3 parameters
|
|
1358
|
+
* @returns A real-time feed of SEC filings from publicly traded companies in the latest RSS feed format (V3)
|
|
1359
|
+
*/
|
|
1360
|
+
async getRSSFeedV3(params) {
|
|
1361
|
+
return this.client.get("/rss_feed", "v3", params);
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Get RSS feed of 8-K SEC filings
|
|
1365
|
+
* https://site.financialmodelingprep.com/developer/docs#rss-feed-8-k-securities-and-exchange-commission-(s.e.c)
|
|
1366
|
+
* @param params - RSS feed 8-K parameters
|
|
1367
|
+
* @returns A real-time feed of 8-K SEC filings from publicly traded companies
|
|
1368
|
+
*/
|
|
1369
|
+
async getRSSFeed8K(params) {
|
|
1370
|
+
return this.client.get("/rss_feed_8k", "v4", params);
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Get SEC filings for a specific company
|
|
1374
|
+
* https://site.financialmodelingprep.com/developer/docs#sec-filings-securities-and-exchange-commission-(s.e.c)
|
|
1375
|
+
* @param symbol - The stock symbol to get SEC filings for
|
|
1376
|
+
* @param params - SEC filings parameters
|
|
1377
|
+
* @returns Access direct links to SEC filings, including the filing type, link to the SEC page, and direct link to the specific filing
|
|
1378
|
+
*/
|
|
1379
|
+
async getSECFilings({
|
|
1380
|
+
symbol,
|
|
1381
|
+
params
|
|
1382
|
+
}) {
|
|
1383
|
+
return this.client.get(`/sec_filings/${symbol}`, "v3", params);
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Get individual industry classification
|
|
1387
|
+
* https://site.financialmodelingprep.com/developer/docs#individual-industry-classification-standard-industrial-classification
|
|
1388
|
+
* @param params - Industry classification parameters
|
|
1389
|
+
* @returns Identify the industry in which a particular company operates, based on the Standard Industrial Classification (SIC) system
|
|
1390
|
+
*/
|
|
1391
|
+
async getIndividualIndustryClassification(params) {
|
|
1392
|
+
return this.client.getSingle("/standard_industrial_classification", "v4", params);
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* Get all industry classifications
|
|
1396
|
+
* https://site.financialmodelingprep.com/developer/docs#all-industry-classification-standard-industrial-classification
|
|
1397
|
+
* @returns Get a comprehensive overview of all industries, classified according to the SIC system
|
|
1398
|
+
*/
|
|
1399
|
+
async getAllIndustryClassifications() {
|
|
1400
|
+
return this.client.get("/standard_industrial_classification/all", "v4");
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Get industry classification codes
|
|
1404
|
+
* https://site.financialmodelingprep.com/developer/docs#industry-classification-codes-standard-industrial-classification
|
|
1405
|
+
* @param params - Industry classification codes parameters
|
|
1406
|
+
* @returns Learn more about the SIC system and identify the SIC code for a particular industry
|
|
1407
|
+
*/
|
|
1408
|
+
async getIndustryClassificationCodes(params) {
|
|
1409
|
+
return this.client.get("/standard_industrial_classification_list", "v4", params);
|
|
1410
|
+
}
|
|
989
1411
|
};
|
|
990
1412
|
|
|
991
1413
|
// src/fmp.ts
|
|
@@ -1003,6 +1425,9 @@ var FMP = class {
|
|
|
1003
1425
|
this.company = new CompanyEndpoints(client);
|
|
1004
1426
|
this.quote = new QuoteEndpoints(client);
|
|
1005
1427
|
this.senateHouse = new SenateHouseEndpoints(client);
|
|
1428
|
+
this.institutional = new InstitutionalEndpoints(client);
|
|
1429
|
+
this.insider = new InsiderEndpoints(client);
|
|
1430
|
+
this.sec = new SECEndpoints(client);
|
|
1006
1431
|
this.forex = new ForexEndpoints(client);
|
|
1007
1432
|
this.economic = new EconomicEndpoints(client);
|
|
1008
1433
|
this.mutualFund = new MutualFundEndpoints(client);
|
|
@@ -1033,6 +1458,29 @@ var Exchange = /* @__PURE__ */ ((Exchange2) => {
|
|
|
1033
1458
|
return Exchange2;
|
|
1034
1459
|
})(Exchange || {});
|
|
1035
1460
|
|
|
1461
|
+
// src/types/insider.ts
|
|
1462
|
+
var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
1463
|
+
TransactionType2["AWARD"] = "A-Award";
|
|
1464
|
+
TransactionType2["CONVERSION"] = "C-Conversion";
|
|
1465
|
+
TransactionType2["RETURN"] = "D-Return";
|
|
1466
|
+
TransactionType2["EXPIRE_SHORT"] = "E-ExpireShort";
|
|
1467
|
+
TransactionType2["IN_KIND"] = "F-InKind";
|
|
1468
|
+
TransactionType2["GIFT"] = "G-Gift";
|
|
1469
|
+
TransactionType2["EXPIRE_LONG"] = "H-ExpireLong";
|
|
1470
|
+
TransactionType2["DISCRETIONARY"] = "I-Discretionary";
|
|
1471
|
+
TransactionType2["OTHER"] = "J-Other";
|
|
1472
|
+
TransactionType2["SMALL"] = "L-Small";
|
|
1473
|
+
TransactionType2["EXEMPT"] = "M-Exempt";
|
|
1474
|
+
TransactionType2["OUT_OF_THE_MONEY"] = "O-OutOfTheMoney";
|
|
1475
|
+
TransactionType2["PURCHASE"] = "P-Purchase";
|
|
1476
|
+
TransactionType2["SALE"] = "S-Sale";
|
|
1477
|
+
TransactionType2["TENDER"] = "U-Tender";
|
|
1478
|
+
TransactionType2["WILL"] = "W-Will";
|
|
1479
|
+
TransactionType2["IN_THE_MONEY"] = "X-InTheMoney";
|
|
1480
|
+
TransactionType2["TRUST"] = "Z-Trust";
|
|
1481
|
+
return TransactionType2;
|
|
1482
|
+
})(TransactionType || {});
|
|
1483
|
+
|
|
1036
1484
|
// src/utils/formatting.ts
|
|
1037
1485
|
function formatCurrency(value, currency = "USD") {
|
|
1038
1486
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -1168,6 +1616,8 @@ exports.FMPClient = FMPClient;
|
|
|
1168
1616
|
exports.FinancialEndpoints = FinancialEndpoints;
|
|
1169
1617
|
exports.ForexEndpoints = ForexEndpoints;
|
|
1170
1618
|
exports.HTTP_STATUS = HTTP_STATUS;
|
|
1619
|
+
exports.InsiderEndpoints = InsiderEndpoints;
|
|
1620
|
+
exports.InstitutionalEndpoints = InstitutionalEndpoints;
|
|
1171
1621
|
exports.ListEndpoints = ListEndpoints;
|
|
1172
1622
|
exports.MAX_LIMIT = MAX_LIMIT;
|
|
1173
1623
|
exports.MarketEndpoints = MarketEndpoints;
|
|
@@ -1175,9 +1625,11 @@ exports.MutualFundEndpoints = MutualFundEndpoints;
|
|
|
1175
1625
|
exports.PERIODS = PERIODS;
|
|
1176
1626
|
exports.Period = Period;
|
|
1177
1627
|
exports.QuoteEndpoints = QuoteEndpoints;
|
|
1628
|
+
exports.SECEndpoints = SECEndpoints;
|
|
1178
1629
|
exports.SECTORS = SECTORS;
|
|
1179
1630
|
exports.SenateHouseEndpoints = SenateHouseEndpoints;
|
|
1180
1631
|
exports.StockEndpoints = StockEndpoints;
|
|
1632
|
+
exports.TransactionType = TransactionType;
|
|
1181
1633
|
exports.formatCurrency = formatCurrency;
|
|
1182
1634
|
exports.formatDate = formatDate;
|
|
1183
1635
|
exports.formatLargeNumber = formatLargeNumber;
|