sec-edgar-api 0.3.3 → 0.4.0
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/build/services/Client/Client.d.ts +1 -0
- package/build/services/DocumentParser/DocumentParser.d.ts +18 -1
- package/build/services/DocumentParser/DocumentParser.js +17 -2
- package/build/services/DocumentParser/DocumentXmlSplitter.d.ts +17 -0
- package/build/services/DocumentParser/DocumentXmlSplitter.js +38 -0
- package/build/services/DocumentParser/ObjectUtil.d.ts +20 -0
- package/build/services/DocumentParser/ObjectUtil.js +60 -0
- package/build/services/DocumentParser/XBRLParser/HeaderParser.d.ts +38 -0
- package/build/services/DocumentParser/XBRLParser/HeaderParser.js +138 -0
- package/build/services/DocumentParser/XBRLParser/InstanceParser.d.ts +6 -0
- package/build/services/DocumentParser/XBRLParser/InstanceParser.js +107 -0
- package/build/services/DocumentParser/XBRLParser/LinkbaseParser.d.ts +13 -0
- package/build/services/DocumentParser/XBRLParser/LinkbaseParser.js +99 -0
- package/build/services/DocumentParser/XBRLParser/SchemaParser.d.ts +11 -0
- package/build/services/DocumentParser/XBRLParser/SchemaParser.js +144 -0
- package/build/services/DocumentParser/XBRLParser/XBRLParser.d.ts +34 -0
- package/build/services/DocumentParser/XBRLParser/XBRLParser.js +64 -0
- package/build/services/DocumentParser/XBRLParser/util-type.d.ts +15 -0
- package/build/services/DocumentParser/XBRLParser/util-type.js +34 -0
- package/build/services/DocumentParser/XMLNode/XMLNode.js +2 -2
- package/build/services/DocumentParser/XMLParser.d.ts +9 -38
- package/build/services/DocumentParser/XMLParser.js +88 -283
- package/build/services/DocumentParser/XMLParserLegacy.d.ts +43 -0
- package/build/services/DocumentParser/XMLParserLegacy.js +308 -0
- package/build/services/DocumentParser/parsers/index.d.ts +10 -0
- package/build/services/DocumentParser/parsers/index.js +10 -0
- package/build/services/DocumentParser/parsers/parse-companies.d.ts +5 -0
- package/build/services/DocumentParser/parsers/parse-companies.js +52 -0
- package/build/services/DocumentParser/parsers/parse-current-filings-daily.js +8 -8
- package/build/services/DocumentParser/parsers/parse-current-filings-xbrl.d.ts +2 -0
- package/build/services/DocumentParser/parsers/parse-current-filings-xbrl.js +104 -0
- package/build/services/DocumentParser/parsers/parse-current-filings.d.ts +2 -0
- package/build/services/DocumentParser/parsers/parse-current-filings.js +76 -0
- package/build/services/DocumentParser/parsers/parse-form-10k.d.ts +1 -1
- package/build/services/DocumentParser/parsers/parse-form-10k.js +2 -2
- package/build/services/DocumentParser/parsers/parse-form-13g.d.ts +1 -1
- package/build/services/DocumentParser/parsers/parse-form-13g.js +2 -2
- package/build/services/DocumentParser/parsers/parse-form-4.d.ts +1 -1
- package/build/services/DocumentParser/parsers/parse-form-4.js +6 -4
- package/build/services/DocumentParser/parsers/parse-form-def14a.d.ts +1 -1
- package/build/services/DocumentParser/parsers/parse-form-def14a.js +2 -2
- package/build/services/DocumentParser/parsers/parse-insider-transaction.d.ts +7 -0
- package/build/services/DocumentParser/parsers/parse-insider-transaction.js +199 -0
- package/build/services/DocumentParser/parsers/parse-xbrl.d.ts +8 -0
- package/build/services/DocumentParser/parsers/parse-xbrl.js +171 -0
- package/build/services/HtmlTableExtractor/HtmlTableExtractor.d.ts +45 -0
- package/build/services/HtmlTableExtractor/HtmlTableExtractor.js +430 -0
- package/build/services/HtmlTableExtractor/index.d.ts +2 -0
- package/build/services/HtmlTableExtractor/index.js +4 -0
- package/build/services/ReportParser/ReportParser.d.ts +1 -1
- package/build/services/ReportParser/ReportWrapper.js +1 -1
- package/build/services/ReportRawBuilder/FactFiscalCalculator.d.ts +0 -1
- package/build/services/ReportRawBuilder/FactFiscalCalculator.js +1 -1
- package/build/services/ReportRawBuilder/FactGrouper.d.ts +1 -0
- package/build/services/ReportRawBuilder/FactGrouper.js +21 -13
- package/build/services/ReportRawBuilder/FactSplitAdjuster.js +17 -7
- package/build/services/ReportRawBuilder/ReportRawBuilder.d.ts +1 -0
- package/build/services/ReportRawBuilder/ReportRawBuilder.js +20 -15
- package/build/services/SecEdgarApi/FilingMapper.d.ts +4 -0
- package/build/services/SecEdgarApi/FilingMapper.js +37 -0
- package/build/services/SecEdgarApi/RequestWrapper.d.ts +2 -0
- package/build/services/SecEdgarApi/RequestWrapper.js +6 -4
- package/build/services/SecEdgarApi/SecEdgarApi.d.ts +66 -2
- package/build/services/SecEdgarApi/SecEdgarApi.js +236 -71
- package/build/services/SecEdgarApi/Throttler.d.ts +9 -8
- package/build/types/common.type.d.ts +9 -9
- package/build/types/company-search.type.d.ts +5 -0
- package/build/types/company-search.type.js +2 -0
- package/build/types/current-filings.type.d.ts +57 -0
- package/build/types/current-filings.type.js +2 -0
- package/build/types/index.d.ts +3 -0
- package/build/types/index.js +3 -0
- package/build/types/insider-transaction.type.d.ts +32 -0
- package/build/types/insider-transaction.type.js +2 -0
- package/build/types/parsed-filings.type.d.ts +3 -3
- package/build/types/xbrl.type.d.ts +155 -0
- package/build/types/xbrl.type.js +2 -0
- package/package.json +8 -3
|
@@ -46,11 +46,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
49
60
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
61
|
var cik_by_symbol_1 = require("../../util/cik-by-symbol");
|
|
51
62
|
var Client_1 = require("../Client");
|
|
52
63
|
var DocumentParser_1 = require("../DocumentParser");
|
|
53
64
|
var ReportParser_1 = require("../ReportParser");
|
|
65
|
+
var FilingMapper_1 = require("./FilingMapper");
|
|
54
66
|
var RequestWrapper_1 = require("./RequestWrapper");
|
|
55
67
|
var Throttler_1 = require("./Throttler");
|
|
56
68
|
/**
|
|
@@ -66,13 +78,15 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
66
78
|
cikBySymbol: cik_by_symbol_1.default,
|
|
67
79
|
reportParser: new ReportParser_1.default(),
|
|
68
80
|
documentParser: new DocumentParser_1.default(),
|
|
81
|
+
filingMapper: new FilingMapper_1.default(),
|
|
69
82
|
}; }
|
|
70
|
-
var client = args.client, throttler = args.throttler, cikBySymbol = args.cikBySymbol, reportParser = args.reportParser, documentParser = args.documentParser;
|
|
83
|
+
var client = args.client, throttler = args.throttler, cikBySymbol = args.cikBySymbol, reportParser = args.reportParser, documentParser = args.documentParser, _a = args.filingMapper, filingMapper = _a === void 0 ? new FilingMapper_1.default() : _a;
|
|
71
84
|
this.client = client;
|
|
72
85
|
this.throttler = throttler;
|
|
73
86
|
this.cikBySymbol = cikBySymbol;
|
|
74
87
|
this.reportParser = reportParser;
|
|
75
88
|
this.documentParser = documentParser;
|
|
89
|
+
this.filingMapper = filingMapper;
|
|
76
90
|
this.baseUrlEdgar = 'https://data.sec.gov';
|
|
77
91
|
this.baseUrlSec = 'https://www.sec.gov';
|
|
78
92
|
}
|
|
@@ -81,64 +95,40 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
81
95
|
return __awaiter(this, void 0, void 0, function () {
|
|
82
96
|
var _this = this;
|
|
83
97
|
return __generator(this, function (_a) {
|
|
84
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}); });
|
|
114
|
-
return [2 /*return*/];
|
|
115
|
-
});
|
|
116
|
-
}); })];
|
|
98
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
99
|
+
_this.throttler.add(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
100
|
+
var response, responseData, e_1;
|
|
101
|
+
var _a, _b;
|
|
102
|
+
return __generator(this, function (_c) {
|
|
103
|
+
switch (_c.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
_c.trys.push([0, 2, , 3]);
|
|
106
|
+
return [4 /*yield*/, this.client.request({
|
|
107
|
+
url: url,
|
|
108
|
+
onError: function (err) { return reject(err); },
|
|
109
|
+
})];
|
|
110
|
+
case 1:
|
|
111
|
+
response = _c.sent();
|
|
112
|
+
responseData = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.toString('utf-8')) !== null && _b !== void 0 ? _b : null;
|
|
113
|
+
if (response.statusCode >= 400 || typeof responseData !== 'string') {
|
|
114
|
+
reject("Request failed with status ".concat(response.statusCode, " ").concat(response.message));
|
|
115
|
+
}
|
|
116
|
+
resolve((isText ? responseData : JSON.parse(responseData)));
|
|
117
|
+
return [3 /*break*/, 3];
|
|
118
|
+
case 2:
|
|
119
|
+
e_1 = _c.sent();
|
|
120
|
+
reject(e_1);
|
|
121
|
+
return [3 /*break*/, 3];
|
|
122
|
+
case 3: return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}); });
|
|
126
|
+
})];
|
|
117
127
|
});
|
|
118
128
|
});
|
|
119
129
|
};
|
|
120
130
|
SecEdgarApi.prototype.mapFilingListDetails = function (cik, filingListDetails) {
|
|
121
|
-
|
|
122
|
-
var filings = [];
|
|
123
|
-
for (var key in filingListDetails) {
|
|
124
|
-
var k = key;
|
|
125
|
-
var dataArr = filingListDetails[k];
|
|
126
|
-
for (var i = 0; i < dataArr.length; i++) {
|
|
127
|
-
filings[i] = (_a = filings[i]) !== null && _a !== void 0 ? _a : {};
|
|
128
|
-
var filing = filings[i];
|
|
129
|
-
filing[k] = dataArr[i];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
for (var _i = 0, filings_1 = filings; _i < filings_1.length; _i++) {
|
|
133
|
-
var filing = filings_1[_i];
|
|
134
|
-
var accessionStr = filing.accessionNumber.replace(/-/g, '');
|
|
135
|
-
var basePath = "".concat(this.baseUrlSec, "/Archives/edgar/data/");
|
|
136
|
-
var primaryDocument = filing.primaryDocument;
|
|
137
|
-
var accessionFile = "".concat(filing.accessionNumber, ".txt");
|
|
138
|
-
filing.url = "".concat(basePath, "/").concat(Number(cik), "/").concat(accessionStr, "/").concat(accessionFile);
|
|
139
|
-
filing.urlPrimaryDocument = "".concat(basePath, "/").concat(Number(cik), "/").concat(accessionStr, "/").concat(primaryDocument);
|
|
140
|
-
}
|
|
141
|
-
return filings;
|
|
131
|
+
return this.filingMapper.mapFilingListDetails(cik, filingListDetails);
|
|
142
132
|
};
|
|
143
133
|
SecEdgarApi.prototype.getCreateRequestSubmissions = function (params, forms) {
|
|
144
134
|
var symbol = params.symbol, filings = params.filings, _a = params.cutoffDate, cutoffDate = _a === void 0 ? new Date('1970-01-01') : _a;
|
|
@@ -171,19 +161,39 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
171
161
|
* endpoint: `/submissions/CIK${cik}.json`
|
|
172
162
|
*/
|
|
173
163
|
SecEdgarApi.prototype.getSubmissions = function (params) {
|
|
174
|
-
var _a;
|
|
175
164
|
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
-
var symbol, cik, submissionList;
|
|
177
|
-
|
|
178
|
-
|
|
165
|
+
var symbol, includeOldFilings, cik, submissionList, additionalFilings, filings;
|
|
166
|
+
var _this = this;
|
|
167
|
+
return __generator(this, function (_a) {
|
|
168
|
+
switch (_a.label) {
|
|
179
169
|
case 0:
|
|
180
|
-
symbol = params.symbol;
|
|
170
|
+
symbol = params.symbol, includeOldFilings = params.includeOldFilings;
|
|
181
171
|
cik = this.getCikString(symbol);
|
|
182
172
|
return [4 /*yield*/, this.request("".concat(this.baseUrlEdgar, "/submissions/CIK").concat(cik, ".json"))];
|
|
183
173
|
case 1:
|
|
184
|
-
submissionList =
|
|
174
|
+
submissionList = _a.sent();
|
|
175
|
+
if (!includeOldFilings) return [3 /*break*/, 3];
|
|
176
|
+
return [4 /*yield*/, Promise.all(submissionList.filings.files.map(function (file) {
|
|
177
|
+
return _this.request("".concat(_this.baseUrlEdgar, "/submissions/").concat(file.name));
|
|
178
|
+
}))];
|
|
179
|
+
case 2:
|
|
180
|
+
additionalFilings = _a.sent();
|
|
181
|
+
additionalFilings.forEach(function (data) {
|
|
182
|
+
var _loop_1 = function (key) {
|
|
183
|
+
var k = key;
|
|
184
|
+
var valuesCurrent = submissionList.filings.recent[k];
|
|
185
|
+
var values = data[k];
|
|
186
|
+
values.forEach(function (v) { return valuesCurrent.push(v); });
|
|
187
|
+
};
|
|
188
|
+
for (var key in data) {
|
|
189
|
+
_loop_1(key);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
_a.label = 3;
|
|
193
|
+
case 3:
|
|
185
194
|
submissionList.cik = Number(submissionList.cik);
|
|
186
|
-
|
|
195
|
+
filings = this.mapFilingListDetails(cik, submissionList.filings.recent);
|
|
196
|
+
return [2 /*return*/, { submissionList: submissionList, filings: filings }];
|
|
187
197
|
}
|
|
188
198
|
});
|
|
189
199
|
});
|
|
@@ -263,7 +273,7 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
263
273
|
*/
|
|
264
274
|
SecEdgarApi.prototype.getReports = function (params) {
|
|
265
275
|
return __awaiter(this, void 0, void 0, function () {
|
|
266
|
-
var _a, withWrapper, _b, usePropertyResolver, reportsRaw, reports;
|
|
276
|
+
var _a, withWrapper, _b, usePropertyResolver, reportsRaw, reportsWithWrapper, reports;
|
|
267
277
|
return __generator(this, function (_c) {
|
|
268
278
|
switch (_c.label) {
|
|
269
279
|
case 0:
|
|
@@ -271,8 +281,9 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
271
281
|
return [4 /*yield*/, this.getReportsRaw(__assign(__assign({}, params), { includeNamePrefix: false }))];
|
|
272
282
|
case 1:
|
|
273
283
|
reportsRaw = _c.sent();
|
|
274
|
-
|
|
275
|
-
|
|
284
|
+
reportsWithWrapper = this.reportParser.parseReportsFromRaw({ reportsRaw: reportsRaw, usePropertyResolver: usePropertyResolver });
|
|
285
|
+
reports = withWrapper ? reportsWithWrapper : reportsWithWrapper.map(function (report) { return report.getReport(); });
|
|
286
|
+
return [2 /*return*/, reports];
|
|
276
287
|
}
|
|
277
288
|
});
|
|
278
289
|
});
|
|
@@ -405,7 +416,12 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
405
416
|
}
|
|
406
417
|
});
|
|
407
418
|
}); };
|
|
408
|
-
return new RequestWrapper_1.default({
|
|
419
|
+
return new RequestWrapper_1.default({
|
|
420
|
+
submissions: submissions,
|
|
421
|
+
options: options,
|
|
422
|
+
sendRequest: sendRequest,
|
|
423
|
+
usePrimaryDocument: true,
|
|
424
|
+
});
|
|
409
425
|
};
|
|
410
426
|
/**
|
|
411
427
|
* Used for getting institutional holders. extracts holders urls from submission list response, and parses the xml doc.
|
|
@@ -435,7 +451,12 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
435
451
|
}
|
|
436
452
|
});
|
|
437
453
|
}); };
|
|
438
|
-
return new RequestWrapper_1.default({
|
|
454
|
+
return new RequestWrapper_1.default({
|
|
455
|
+
submissions: submissions,
|
|
456
|
+
options: options,
|
|
457
|
+
sendRequest: sendRequest,
|
|
458
|
+
usePrimaryDocument: true,
|
|
459
|
+
});
|
|
439
460
|
};
|
|
440
461
|
/**
|
|
441
462
|
* Used for getting earnings report tables from submission files.
|
|
@@ -450,7 +471,16 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
450
471
|
*/
|
|
451
472
|
SecEdgarApi.prototype.createRequestEarningsReports = function (params) {
|
|
452
473
|
var _this = this;
|
|
453
|
-
var submissions = this.getCreateRequestSubmissions(params, [
|
|
474
|
+
var submissions = this.getCreateRequestSubmissions(params, [
|
|
475
|
+
'10-Q',
|
|
476
|
+
'10-Q/A',
|
|
477
|
+
'10-K',
|
|
478
|
+
'10-K/A',
|
|
479
|
+
'20-F',
|
|
480
|
+
'20-F/A',
|
|
481
|
+
'40-F',
|
|
482
|
+
'40-F/A',
|
|
483
|
+
]);
|
|
454
484
|
var options = { maxRequests: params.maxRequests };
|
|
455
485
|
var sendRequest = function (params) { return __awaiter(_this, void 0, void 0, function () {
|
|
456
486
|
var _a, _b;
|
|
@@ -465,7 +495,12 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
465
495
|
}
|
|
466
496
|
});
|
|
467
497
|
}); };
|
|
468
|
-
return new RequestWrapper_1.default({
|
|
498
|
+
return new RequestWrapper_1.default({
|
|
499
|
+
submissions: submissions,
|
|
500
|
+
options: options,
|
|
501
|
+
sendRequest: sendRequest,
|
|
502
|
+
usePrimaryDocument: true,
|
|
503
|
+
});
|
|
469
504
|
};
|
|
470
505
|
/**
|
|
471
506
|
* Proxy statement includes list of holders, executiveCompensation, and other tables. returns FormDef14aData
|
|
@@ -494,10 +529,15 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
494
529
|
}
|
|
495
530
|
});
|
|
496
531
|
}); };
|
|
497
|
-
return new RequestWrapper_1.default({
|
|
532
|
+
return new RequestWrapper_1.default({
|
|
533
|
+
submissions: submissions,
|
|
534
|
+
options: options,
|
|
535
|
+
sendRequest: sendRequest,
|
|
536
|
+
usePrimaryDocument: true,
|
|
537
|
+
});
|
|
498
538
|
};
|
|
499
539
|
/**
|
|
500
|
-
* Gets list of
|
|
540
|
+
* Gets list of filings for a day up to 5 days ago.
|
|
501
541
|
*
|
|
502
542
|
* @see https://www.sec.gov/edgar/searchedgar/currentevents
|
|
503
543
|
*/
|
|
@@ -531,6 +571,131 @@ var SecEdgarApi = /** @class */ (function () {
|
|
|
531
571
|
});
|
|
532
572
|
});
|
|
533
573
|
};
|
|
574
|
+
SecEdgarApi.prototype.getCurrentFilings = function (params) {
|
|
575
|
+
var _a;
|
|
576
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
577
|
+
var _b, _c, page, _d, itemsPerPage, formType, searchType, symbol, type, owner, offset, cik, url, xml;
|
|
578
|
+
return __generator(this, function (_e) {
|
|
579
|
+
switch (_e.label) {
|
|
580
|
+
case 0:
|
|
581
|
+
_b = params !== null && params !== void 0 ? params : {}, _c = _b.page, page = _c === void 0 ? 1 : _c, _d = _b.itemsPerPage, itemsPerPage = _d === void 0 ? 100 : _d, formType = _b.formType, searchType = _b.searchType, symbol = _b.symbol;
|
|
582
|
+
type = (_a = formType === null || formType === void 0 ? void 0 : formType.replace(/\s/, '+')) !== null && _a !== void 0 ? _a : null;
|
|
583
|
+
owner = searchType !== null && searchType !== void 0 ? searchType : ((formType === null || formType === void 0 ? void 0 : formType.includes(' ')) ? 'include' : 'only');
|
|
584
|
+
offset = (page - 1) * Math.max(1, itemsPerPage || 100);
|
|
585
|
+
cik = symbol ? Number(this.getCikString(symbol)) : null;
|
|
586
|
+
url = "".concat(this.baseUrlSec, "/cgi-bin/browse-edgar?action=getcurrent&start=").concat(offset, "&count=").concat(itemsPerPage, "&output=atom");
|
|
587
|
+
if (cik)
|
|
588
|
+
url += "&CIK=".concat(symbol);
|
|
589
|
+
if (type)
|
|
590
|
+
url += "&type=".concat(formType);
|
|
591
|
+
if (owner)
|
|
592
|
+
url += "&owner=".concat(searchType);
|
|
593
|
+
return [4 /*yield*/, this.request(url, true)];
|
|
594
|
+
case 1:
|
|
595
|
+
xml = (_e.sent());
|
|
596
|
+
return [2 /*return*/, this.documentParser.parseCurrentFilings({ xml: xml })];
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* @see https://www.sec.gov/structureddata/rss-feeds-submitted-filings
|
|
603
|
+
*/
|
|
604
|
+
SecEdgarApi.prototype.getCurrentFilingsXBRL = function (params) {
|
|
605
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
606
|
+
var _a, taxonomy, urlByTaxonomy, url, xml;
|
|
607
|
+
return __generator(this, function (_b) {
|
|
608
|
+
switch (_b.label) {
|
|
609
|
+
case 0:
|
|
610
|
+
_a = (params !== null && params !== void 0 ? params : {}).taxonomy, taxonomy = _a === void 0 ? 'allXbrl' : _a;
|
|
611
|
+
urlByTaxonomy = {
|
|
612
|
+
usGaap: 'https://www.sec.gov/Archives/edgar/usgaap.rss.xml',
|
|
613
|
+
mutualFund: 'https://www.sec.gov/Archives/edgar/xbrl-rr.rss.xml',
|
|
614
|
+
inlineXbrl: 'https://www.sec.gov/Archives/edgar/xbrl-inline.rss.xml',
|
|
615
|
+
allXbrl: 'https://www.sec.gov/Archives/edgar/xbrlrss.all.xml',
|
|
616
|
+
};
|
|
617
|
+
url = urlByTaxonomy[taxonomy] || urlByTaxonomy.allXbrl;
|
|
618
|
+
return [4 /*yield*/, this.request(url, true)];
|
|
619
|
+
case 1:
|
|
620
|
+
xml = _b.sent();
|
|
621
|
+
return [2 /*return*/, this.documentParser.parseCurrentFilingsXbrl({ xml: xml })];
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
};
|
|
626
|
+
SecEdgarApi.prototype.getDocumentXbrl = function (params) {
|
|
627
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
628
|
+
var url, options, xml;
|
|
629
|
+
return __generator(this, function (_a) {
|
|
630
|
+
switch (_a.label) {
|
|
631
|
+
case 0:
|
|
632
|
+
url = params.url, options = __rest(params, ["url"]);
|
|
633
|
+
return [4 /*yield*/, this.getDocumentXMLByUrl({ url: url })];
|
|
634
|
+
case 1:
|
|
635
|
+
xml = _a.sent();
|
|
636
|
+
return [2 /*return*/, this.documentParser.parseXbrl(__assign({ xml: xml }, options))];
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
};
|
|
641
|
+
/**
|
|
642
|
+
* Gets insider transactions for a provided symbol or CIK.
|
|
643
|
+
*
|
|
644
|
+
* To get transactions by a specific owner, set isOwnerCik to true and provide
|
|
645
|
+
* the owner CIK for the symbol parameter.
|
|
646
|
+
*
|
|
647
|
+
* example at https://www.sec.gov/cgi-bin/own-disp?action=getissuer&CIK=0000320193
|
|
648
|
+
*/
|
|
649
|
+
SecEdgarApi.prototype.getInsiderTransactions = function (params) {
|
|
650
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
651
|
+
var page, symbol, itemsPerPage, _a, isOwnerCik, action, offset, cik, url, xml;
|
|
652
|
+
return __generator(this, function (_b) {
|
|
653
|
+
switch (_b.label) {
|
|
654
|
+
case 0:
|
|
655
|
+
page = params.page, symbol = params.symbol, itemsPerPage = params.itemsPerPage, _a = params.isOwnerCik, isOwnerCik = _a === void 0 ? false : _a;
|
|
656
|
+
action = isOwnerCik ? 'getowner' : 'getissuer';
|
|
657
|
+
offset = (page - 1) * Math.max(1, itemsPerPage || 100);
|
|
658
|
+
cik = this.getCikString(symbol);
|
|
659
|
+
url = "".concat(this.baseUrlSec, "/cgi-bin/own-disp?action=").concat(action, "&CIK=").concat(cik, "&owner=include&start=").concat(offset, "&count=").concat(itemsPerPage);
|
|
660
|
+
return [4 /*yield*/, this.request(url, true)];
|
|
661
|
+
case 1:
|
|
662
|
+
xml = (_b.sent());
|
|
663
|
+
return [2 /*return*/, this.documentParser.parseInsiderTransactions({ xml: xml })];
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* Search for companies from by name, sic code, or state.
|
|
670
|
+
*/
|
|
671
|
+
SecEdgarApi.prototype.searchCompanies = function (params) {
|
|
672
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
673
|
+
var sic, page, itemsPerPageProp, state, company, companyMatch, match, itemsPerPage, offset, url, xml;
|
|
674
|
+
return __generator(this, function (_a) {
|
|
675
|
+
switch (_a.label) {
|
|
676
|
+
case 0:
|
|
677
|
+
sic = params.sic, page = params.page, itemsPerPageProp = params.itemsPerPage, state = params.state, company = params.company, companyMatch = params.companyMatch;
|
|
678
|
+
match = companyMatch === 'startsWith' ? '' : 'contains';
|
|
679
|
+
itemsPerPage = Math.max(1, Math.min(100, itemsPerPageProp || 100));
|
|
680
|
+
offset = (page - 1) * itemsPerPage;
|
|
681
|
+
url = "".concat(this.baseUrlSec, "/cgi-bin/browse-edgar?action=getcompany&owner=exclude&&start=").concat(offset, "&count=").concat(itemsPerPage, "&hidefilings=0");
|
|
682
|
+
if (sic)
|
|
683
|
+
url += "&SIC=".concat(sic);
|
|
684
|
+
if (state)
|
|
685
|
+
url += "&State=".concat(state);
|
|
686
|
+
if (company)
|
|
687
|
+
url += "&company=".concat(company, "&match=").concat(match);
|
|
688
|
+
if (!sic && !state && !company) {
|
|
689
|
+
throw new Error('You must provide sic, company, or state filters');
|
|
690
|
+
}
|
|
691
|
+
return [4 /*yield*/, this.request(url, true)];
|
|
692
|
+
case 1:
|
|
693
|
+
xml = (_a.sent());
|
|
694
|
+
return [2 /*return*/, this.documentParser.parseCompanies({ xml: xml })];
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
};
|
|
534
699
|
return SecEdgarApi;
|
|
535
700
|
}());
|
|
536
701
|
exports.default = SecEdgarApi;
|
|
@@ -2,17 +2,18 @@ interface OnProgressData {
|
|
|
2
2
|
queueLength: number;
|
|
3
3
|
countRunning: number;
|
|
4
4
|
}
|
|
5
|
+
type ResolveValue = any;
|
|
5
6
|
interface ThrottlerArgs {
|
|
6
7
|
maxConcurrent?: number;
|
|
7
8
|
delayMs?: number;
|
|
8
9
|
onProgress?: (data: OnProgressData) => void;
|
|
9
|
-
onResult?: (result:
|
|
10
|
-
onError?: (err:
|
|
11
|
-
onEnd?: (results:
|
|
10
|
+
onResult?: (result: ResolveValue) => void;
|
|
11
|
+
onError?: (err: ResolveValue) => void;
|
|
12
|
+
onEnd?: (results: ResolveValue[], errors: ResolveValue[]) => void;
|
|
12
13
|
}
|
|
13
14
|
export interface IThrottler {
|
|
14
15
|
setDelayMs(delayMs: number): void;
|
|
15
|
-
add: (fn: () => Promise<
|
|
16
|
+
add: (fn: () => Promise<ResolveValue>) => void;
|
|
16
17
|
}
|
|
17
18
|
export default class Throttler implements IThrottler {
|
|
18
19
|
private readonly decrementTimeouts;
|
|
@@ -22,12 +23,12 @@ export default class Throttler implements IThrottler {
|
|
|
22
23
|
private maxConcurrent;
|
|
23
24
|
private delayMs;
|
|
24
25
|
onProgress?: (data: OnProgressData) => void;
|
|
25
|
-
onResult?: (result:
|
|
26
|
-
onError?: (err:
|
|
27
|
-
onEnd?: (results:
|
|
26
|
+
onResult?: (result: ResolveValue) => void;
|
|
27
|
+
onError?: (err: ResolveValue) => void;
|
|
28
|
+
onEnd?: (results: ResolveValue[], errors: ResolveValue[]) => void;
|
|
28
29
|
constructor(args?: ThrottlerArgs);
|
|
29
30
|
setDelayMs(delayMs: number): void;
|
|
30
|
-
add(fn: () => Promise<
|
|
31
|
+
add(fn: () => Promise<ResolveValue>): void;
|
|
31
32
|
private run;
|
|
32
33
|
}
|
|
33
34
|
export {};
|
|
@@ -29,18 +29,18 @@ export interface FactGroup {
|
|
|
29
29
|
filedLast: string;
|
|
30
30
|
endFirst: string;
|
|
31
31
|
endLast: string;
|
|
32
|
-
values: number[];
|
|
32
|
+
values: (number | string)[];
|
|
33
33
|
fiscalYear: number;
|
|
34
34
|
quarter: number;
|
|
35
35
|
facts: FactItem[];
|
|
36
|
-
valueSplitAdjustedPeriod: number | null;
|
|
37
|
-
valueSplitAdjustedTrailing: number | null;
|
|
38
|
-
valuePeriodResolved: number | null;
|
|
39
|
-
valueTrailingResolved: number | null;
|
|
40
|
-
valuePeriodFirst: number | null;
|
|
41
|
-
valuePeriodLast: number | null;
|
|
42
|
-
valueTrailingFirst: number | null;
|
|
43
|
-
valueTrailingLast: number | null;
|
|
36
|
+
valueSplitAdjustedPeriod: number | string | null;
|
|
37
|
+
valueSplitAdjustedTrailing: number | string | null;
|
|
38
|
+
valuePeriodResolved: number | string | null;
|
|
39
|
+
valueTrailingResolved: number | string | null;
|
|
40
|
+
valuePeriodFirst: number | string | null;
|
|
41
|
+
valuePeriodLast: number | string | null;
|
|
42
|
+
valueTrailingFirst: number | string | null;
|
|
43
|
+
valueTrailingLast: number | string | null;
|
|
44
44
|
}
|
|
45
45
|
export interface FactItemExtended extends FactItem {
|
|
46
46
|
period: number;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface CurrentFilingsXBRL {
|
|
2
|
+
title: string;
|
|
3
|
+
link: string;
|
|
4
|
+
description: string;
|
|
5
|
+
language: string;
|
|
6
|
+
pubDate: string;
|
|
7
|
+
lastBuildDate: string;
|
|
8
|
+
items: FilingItemXBRL[];
|
|
9
|
+
}
|
|
10
|
+
export interface FilingItemXBRL {
|
|
11
|
+
title: string;
|
|
12
|
+
link: string;
|
|
13
|
+
guid: string;
|
|
14
|
+
enclosureUrl: string;
|
|
15
|
+
enclosureLength: number;
|
|
16
|
+
enclosureType: string;
|
|
17
|
+
pubDate: string;
|
|
18
|
+
description: string;
|
|
19
|
+
companyName: string;
|
|
20
|
+
formType: string;
|
|
21
|
+
filingDate: string;
|
|
22
|
+
cikNumber: number;
|
|
23
|
+
accessionNumber: string;
|
|
24
|
+
fileNumber: string;
|
|
25
|
+
acceptanceDatetime: string;
|
|
26
|
+
period: string;
|
|
27
|
+
assistantDirector: string;
|
|
28
|
+
assignedSic: number;
|
|
29
|
+
fiscalYearEnd: string;
|
|
30
|
+
files: FilingItemXBRLFile[];
|
|
31
|
+
}
|
|
32
|
+
export interface FilingItemXBRLFile {
|
|
33
|
+
sequence: number;
|
|
34
|
+
file: string;
|
|
35
|
+
type: string;
|
|
36
|
+
size: number;
|
|
37
|
+
description: string;
|
|
38
|
+
url: string;
|
|
39
|
+
inlineXBRL: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface CurrentFilingEntry {
|
|
42
|
+
title: string;
|
|
43
|
+
link: string;
|
|
44
|
+
filingDate: string;
|
|
45
|
+
accessionNumber: string;
|
|
46
|
+
size: string;
|
|
47
|
+
updated: string;
|
|
48
|
+
form: string;
|
|
49
|
+
url: string;
|
|
50
|
+
cik: number;
|
|
51
|
+
}
|
|
52
|
+
export interface CurrentFilingsList {
|
|
53
|
+
title: string;
|
|
54
|
+
id: string;
|
|
55
|
+
updated: string;
|
|
56
|
+
entries: CurrentFilingEntry[];
|
|
57
|
+
}
|
package/build/types/index.d.ts
CHANGED
|
@@ -4,3 +4,6 @@ export * from './report-translated.type';
|
|
|
4
4
|
export * from './submission.type';
|
|
5
5
|
export * from './parsed-filings.type';
|
|
6
6
|
export * from './common.type';
|
|
7
|
+
export * from './insider-transaction.type';
|
|
8
|
+
export * from './company-search.type';
|
|
9
|
+
export * from './current-filings.type';
|
package/build/types/index.js
CHANGED
|
@@ -20,3 +20,6 @@ __exportStar(require("./report-translated.type"), exports);
|
|
|
20
20
|
__exportStar(require("./submission.type"), exports);
|
|
21
21
|
__exportStar(require("./parsed-filings.type"), exports);
|
|
22
22
|
__exportStar(require("./common.type"), exports);
|
|
23
|
+
__exportStar(require("./insider-transaction.type"), exports);
|
|
24
|
+
__exportStar(require("./company-search.type"), exports);
|
|
25
|
+
__exportStar(require("./current-filings.type"), exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface Owner {
|
|
2
|
+
ownerName: string;
|
|
3
|
+
ownerCik: number;
|
|
4
|
+
ownerPosition: string | null;
|
|
5
|
+
isDirector: boolean;
|
|
6
|
+
isOfficer: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface Issuer {
|
|
9
|
+
issuerName: string;
|
|
10
|
+
issuerCik: number;
|
|
11
|
+
}
|
|
12
|
+
export interface InsiderTransaction {
|
|
13
|
+
ownerName: string;
|
|
14
|
+
ownerCik: number;
|
|
15
|
+
ownerPosition: string | null;
|
|
16
|
+
issuerCik: number;
|
|
17
|
+
issuerName: string;
|
|
18
|
+
isDirector: boolean;
|
|
19
|
+
isOfficer: boolean;
|
|
20
|
+
/** true = buy, false = sell */
|
|
21
|
+
isAcquisition: boolean;
|
|
22
|
+
isDirectOwnership: boolean;
|
|
23
|
+
securityTitle: string;
|
|
24
|
+
transactionDate: string;
|
|
25
|
+
transactionCode: string;
|
|
26
|
+
transactionShares: number;
|
|
27
|
+
sharesOwnedFollowingTransaction: number;
|
|
28
|
+
lineNumber: number;
|
|
29
|
+
deemedExecutionDate: string;
|
|
30
|
+
form: string;
|
|
31
|
+
accessionNumber: string;
|
|
32
|
+
}
|
|
@@ -22,7 +22,7 @@ interface TransactionDescriptionByCode {
|
|
|
22
22
|
export type TransactionType = 'Acquire' | 'Dispose';
|
|
23
23
|
export type TransactionCode = keyof TransactionDescriptionByCode;
|
|
24
24
|
export type TransactionDescription = TransactionDescriptionByCode[TransactionCode];
|
|
25
|
-
export interface
|
|
25
|
+
export interface InsiderTransactionExtended {
|
|
26
26
|
filerName: string;
|
|
27
27
|
filerPosition: string;
|
|
28
28
|
filerPositionTypes: string[];
|
|
@@ -42,7 +42,7 @@ export interface InsiderTransaction {
|
|
|
42
42
|
price: number | null;
|
|
43
43
|
priceExcercised: number | null;
|
|
44
44
|
ownership: string;
|
|
45
|
-
explainationByKey: Partial<Record<keyof
|
|
45
|
+
explainationByKey: Partial<Record<keyof InsiderTransactionExtended, string>>;
|
|
46
46
|
}
|
|
47
47
|
export interface InstitutionalHolder {
|
|
48
48
|
name: string;
|
|
@@ -81,7 +81,7 @@ export interface Holder {
|
|
|
81
81
|
percentOfClass: string | null;
|
|
82
82
|
}
|
|
83
83
|
export interface Form4Data {
|
|
84
|
-
transactions:
|
|
84
|
+
transactions: InsiderTransactionExtended[];
|
|
85
85
|
}
|
|
86
86
|
export interface Form10KData {
|
|
87
87
|
tables: TableData[];
|