sec-edgar-api 0.1.0 → 0.2.1

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.
Files changed (26) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +4 -4
  3. package/build/services/DocumentParser/DocumentParser.d.ts +5 -4
  4. package/build/services/DocumentParser/DocumentParser.js +6 -3
  5. package/build/services/DocumentParser/XMLNode/ColNode.d.ts +1 -1
  6. package/build/services/DocumentParser/XMLNode/ColNode.js +5 -6
  7. package/build/services/DocumentParser/XMLNode/DocumentNode.d.ts +2 -0
  8. package/build/services/DocumentParser/XMLNode/DocumentNode.js +74 -0
  9. package/build/services/DocumentParser/XMLNode/RowNode.js +26 -16
  10. package/build/services/DocumentParser/XMLNode/XMLNode.d.ts +1 -1
  11. package/build/services/DocumentParser/XMLNode/XMLNode.js +16 -6
  12. package/build/services/DocumentParser/XMLParser.js +8 -7
  13. package/build/services/DocumentParser/parsers/index.d.ts +2 -0
  14. package/build/services/DocumentParser/parsers/index.js +2 -0
  15. package/build/services/DocumentParser/parsers/parse-form-10k.d.ts +2 -2
  16. package/build/services/DocumentParser/parsers/parse-form-10k.js +13 -66
  17. package/build/services/DocumentParser/parsers/parse-form-13g.d.ts +3 -3
  18. package/build/services/DocumentParser/parsers/parse-form-13g.js +2 -2
  19. package/build/services/DocumentParser/parsers/parse-form-4.d.ts +2 -2
  20. package/build/services/DocumentParser/parsers/parse-form-4.js +1 -1
  21. package/build/services/DocumentParser/parsers/parse-form-def14a.d.ts +8 -0
  22. package/build/services/DocumentParser/parsers/parse-form-def14a.js +126 -0
  23. package/build/services/SecEdgarApi/SecEdgarApi.d.ts +22 -11
  24. package/build/services/SecEdgarApi/SecEdgarApi.js +40 -11
  25. package/build/types/parsed-filings.type.d.ts +31 -1
  26. package/package.json +2 -2
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Andrew Evers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -24,12 +24,14 @@ Reports are all returned as a uniform interface:
24
24
 
25
25
  ```TS
26
26
  interface ReportTranslated {
27
+ cik: number
28
+ url: string | null
27
29
  dateReport: string
28
30
  dateFiled: string
29
31
  fiscalPeriod: FiscalPeriod
30
32
  fiscalYear: number
31
- form: string
32
- isTTM: boolean
33
+ splitDate: string | null
34
+ splitRatio: number | null
33
35
 
34
36
  assetTotal: number | null
35
37
  assetCurrent: number | null
@@ -114,8 +116,6 @@ const reports = await secEdgarApi.getReports({ symbol: 'AAPL' })
114
116
 
115
117
  ## Resolvers
116
118
 
117
- **WARNING** Still in testing. Values may not be accurate for all companies since the properties provided in the reports differ.
118
-
119
119
  The main problem with the edgar API is that the property names and data provided are not uniform. You have to deal with companies omitting important data
120
120
  in some filings, or using different property keys for the same data point.
121
121
 
@@ -1,4 +1,4 @@
1
- import { InsiderTransaction, XMLParams } from '../../types';
1
+ import { XMLParams } from '../../types';
2
2
  import XMLParser from './XMLParser';
3
3
  import parsers from './parsers';
4
4
  interface DocumentParserArgs {
@@ -9,8 +9,9 @@ export default class DocumentParser {
9
9
  private readonly parser;
10
10
  private readonly parsersByName;
11
11
  constructor(args?: DocumentParserArgs);
12
- parseInsiderTransactions(params: XMLParams): InsiderTransaction[];
13
- parseHolders(params: XMLParams): import("../../types").Holder[];
14
- parseEarningsTables(params: XMLParams): import("../../types").TableData[];
12
+ parseForm4(params: XMLParams): import("../../types").Form4Data;
13
+ parseForm13g(params: XMLParams): import("../../types").Form13GData;
14
+ parseForm10k(params: XMLParams): import("../../types").Form10KData;
15
+ parseFormDef14a(params: XMLParams): import("../../types").FormDef14aData;
15
16
  }
16
17
  export {};
@@ -8,15 +8,18 @@ var DocumentParser = /** @class */ (function () {
8
8
  this.parser = parser;
9
9
  this.parsersByName = parsersByName;
10
10
  }
11
- DocumentParser.prototype.parseInsiderTransactions = function (params) {
11
+ DocumentParser.prototype.parseForm4 = function (params) {
12
12
  return this.parsersByName.parseForm4(params, this.parser);
13
13
  };
14
- DocumentParser.prototype.parseHolders = function (params) {
14
+ DocumentParser.prototype.parseForm13g = function (params) {
15
15
  return this.parsersByName.parseForm13g(params, this.parser);
16
16
  };
17
- DocumentParser.prototype.parseEarningsTables = function (params) {
17
+ DocumentParser.prototype.parseForm10k = function (params) {
18
18
  return this.parsersByName.parseForm10k(params, this.parser);
19
19
  };
20
+ DocumentParser.prototype.parseFormDef14a = function (params) {
21
+ return this.parsersByName.parseFormDef14a(params, this.parser);
22
+ };
20
23
  return DocumentParser;
21
24
  }());
22
25
  exports.default = DocumentParser;
@@ -1,7 +1,6 @@
1
1
  import { RowNode } from './RowNode';
2
2
  import { XMLNode } from './XMLNode';
3
3
  export declare class ColNode extends XMLNode {
4
- private colSpan;
5
4
  private index;
6
5
  private topSiblings;
7
6
  private bottomSiblings;
@@ -15,4 +14,5 @@ export declare class ColNode extends XMLNode {
15
14
  getNextSibling(): ColNode | null;
16
15
  getPreviousSibling(): ColNode | null;
17
16
  getColSpan(): number;
17
+ getRowSpan(): number;
18
18
  }
@@ -21,7 +21,6 @@ var ColNode = /** @class */ (function (_super) {
21
21
  __extends(ColNode, _super);
22
22
  function ColNode() {
23
23
  var _this = _super !== null && _super.apply(this, arguments) || this;
24
- _this.colSpan = null;
25
24
  _this.index = null;
26
25
  _this.topSiblings = [];
27
26
  _this.bottomSiblings = [];
@@ -63,11 +62,11 @@ var ColNode = /** @class */ (function (_super) {
63
62
  };
64
63
  ColNode.prototype.getColSpan = function () {
65
64
  var _a;
66
- if (this.colSpan)
67
- return this.colSpan;
68
- var colSpan = Number((_a = this.getAttributes().colspan) !== null && _a !== void 0 ? _a : 1);
69
- this.colSpan = colSpan;
70
- return colSpan;
65
+ return Number((_a = this.getAttributes().colspan) !== null && _a !== void 0 ? _a : 1);
66
+ };
67
+ ColNode.prototype.getRowSpan = function () {
68
+ var _a;
69
+ return Number((_a = this.getAttributes().rowspan) !== null && _a !== void 0 ? _a : 1);
71
70
  };
72
71
  return ColNode;
73
72
  }(XMLNode_1.XMLNode));
@@ -1,3 +1,5 @@
1
+ import { TableData } from '../../../types';
1
2
  import { XMLNode } from './XMLNode';
2
3
  export declare class DocumentNode extends XMLNode {
4
+ parseTables(): TableData[];
3
5
  }
@@ -14,14 +14,88 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
+ if (ar || !(i in from)) {
20
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
+ ar[i] = from[i];
22
+ }
23
+ }
24
+ return to.concat(ar || Array.prototype.slice.call(from));
25
+ };
17
26
  Object.defineProperty(exports, "__esModule", { value: true });
18
27
  exports.DocumentNode = void 0;
28
+ var HRNode_1 = require("./HRNode");
29
+ var NonTableNode_1 = require("./NonTableNode");
30
+ var TableNode_1 = require("./TableNode");
19
31
  var XMLNode_1 = require("./XMLNode");
20
32
  var DocumentNode = /** @class */ (function (_super) {
21
33
  __extends(DocumentNode, _super);
22
34
  function DocumentNode() {
23
35
  return _super !== null && _super.apply(this, arguments) || this;
24
36
  }
37
+ DocumentNode.prototype.parseTables = function () {
38
+ var _a, _b, _c, _d;
39
+ var nodes = this.getChildren();
40
+ var tables = nodes.filter(function (child) { return child instanceof TableNode_1.TableNode; });
41
+ var curSectionIndex = 0;
42
+ var sectionIndexByTable = new Map();
43
+ var tableDataArr = [];
44
+ // map the section index of each table. new section starts for each <hr> tag.
45
+ for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
46
+ var node = nodes_1[_i];
47
+ if (node instanceof TableNode_1.TableNode) {
48
+ sectionIndexByTable.set(node, curSectionIndex);
49
+ }
50
+ else if (node instanceof HRNode_1.HRNode) {
51
+ curSectionIndex++;
52
+ }
53
+ }
54
+ var _loop_1 = function (table) {
55
+ table.mergeHeader();
56
+ table.removeEmptyTopRows();
57
+ var siblingsPrev = table.getSiblings({
58
+ dir: 'previous',
59
+ stopAtType: NonTableNode_1.NonTableNode,
60
+ includeStopAtType: true,
61
+ });
62
+ var siblingsNext = table.getSiblings({ dir: 'next', stopAtType: NonTableNode_1.NonTableNode, includeStopAtType: true });
63
+ // set the title based on the bold text in the previous siblings
64
+ var title = siblingsPrev.map(function (s) { return s.extractBold(); }).join(' | ');
65
+ var textBefore = siblingsPrev.map(function (s) { return s.getText(); }).join('\n');
66
+ var textAfter = siblingsNext.map(function (s) { return s.getText(); }).join('\n');
67
+ var header = table.getHeaderRow();
68
+ var headerTable = header === null || header === void 0 ? void 0 : header.toTable();
69
+ var topRow = table.getChildren()[0];
70
+ var topRowTable = !header ? topRow === null || topRow === void 0 ? void 0 : topRow.toTable() : null;
71
+ var prevTable = tableDataArr[tableDataArr.length - 1];
72
+ var isSameTableSize = prevTable ? ((_a = prevTable === null || prevTable === void 0 ? void 0 : prevTable.rows[0]) === null || _a === void 0 ? void 0 : _a.length) === ((_b = topRowTable === null || topRowTable === void 0 ? void 0 : topRowTable[0]) === null || _b === void 0 ? void 0 : _b.length) : false;
73
+ var isSameSection = prevTable ? prevTable.sectionIndex === sectionIndexByTable.get(table) : false;
74
+ var isSharedHeader = !!topRowTable && table.getTitle() === '' && isSameTableSize && isSameSection;
75
+ // some tables will be in the same section directly below another table and expected to have the same header.
76
+ if (isSharedHeader) {
77
+ topRowTable.unshift(__spreadArray([], prevTable.rows[0], true));
78
+ table.setTitle(prevTable.title);
79
+ }
80
+ var rows = (_c = headerTable !== null && headerTable !== void 0 ? headerTable : topRowTable) !== null && _c !== void 0 ? _c : [];
81
+ if (rows.length === 0)
82
+ return "continue";
83
+ tableDataArr.push({
84
+ title: title.trim(),
85
+ sectionIndex: (_d = sectionIndexByTable.get(table)) !== null && _d !== void 0 ? _d : -1,
86
+ hasHeader: Boolean(header) || isSharedHeader,
87
+ textBefore: textBefore,
88
+ textAfter: textAfter,
89
+ rows: rows.filter(function (r) { return r.length === rows[0].length; }),
90
+ });
91
+ };
92
+ // create table arrays
93
+ for (var _e = 0, tables_1 = tables; _e < tables_1.length; _e++) {
94
+ var table = tables_1[_e];
95
+ _loop_1(table);
96
+ }
97
+ return tableDataArr;
98
+ };
25
99
  return DocumentNode;
26
100
  }(XMLNode_1.XMLNode));
27
101
  exports.DocumentNode = DocumentNode;
@@ -76,22 +76,33 @@ var RowNode = /** @class */ (function (_super) {
76
76
  * ```
77
77
  */
78
78
  RowNode.prototype.getTableFromCols = function () {
79
- var tableRowCols = [];
79
+ var _a, _b, _c;
80
80
  var colIndexRanges = this.getChildren().map(function (col) { return [col.getIndex(), col.getIndex() + col.getColSpan()]; });
81
- for (var _i = 0, _a = this.getParent().getChildren(); _i < _a.length; _i++) {
82
- var row = _a[_i];
83
- var rowCols = colIndexRanges.map(function () { return []; });
84
- for (var _b = 0, _c = row.getChildren(); _b < _c.length; _b++) {
85
- var col = _c[_b];
86
- var _d = [col.getIndex(), col.getIndex() + col.getColSpan()], indexStart = _d[0], indexEnd = _d[1];
81
+ var rows = this.getParent().getChildren();
82
+ var tableRowCols = rows.map(function () { return colIndexRanges.map(function () { return []; }); });
83
+ for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {
84
+ var row = rows[rowIndex];
85
+ var colsShift = 0;
86
+ var _loop_1 = function (col) {
87
+ var _e = [col.getIndex(), col.getIndex() + col.getColSpan()], indexStart = _e[0], indexEnd = _e[1];
88
+ // // TODO: Instead of shifting cols here, just shift them in XMLParser when they are created
89
+ while ((_a = tableRowCols[rowIndex][colsShift]) === null || _a === void 0 ? void 0 : _a.some(function (c) { return c.getParent() !== col.getParent(); })) {
90
+ colsShift++;
91
+ }
92
+ // tableRowCols
87
93
  for (var i = 0; i < colIndexRanges.length; i++) {
88
- var _e = colIndexRanges[i], boundaryStart = _e[0], boundaryEnd = _e[1];
94
+ var _f = colIndexRanges[i], boundaryStart = _f[0], boundaryEnd = _f[1];
89
95
  if (indexEnd <= boundaryStart || indexStart >= boundaryEnd)
90
96
  continue;
91
- rowCols[i].push(col);
97
+ for (var j = rowIndex; j < rowIndex + col.getRowSpan(); j++) {
98
+ (_c = (_b = tableRowCols[j]) === null || _b === void 0 ? void 0 : _b[i + colsShift]) === null || _c === void 0 ? void 0 : _c.push(col);
99
+ }
92
100
  }
101
+ };
102
+ for (var _i = 0, _d = row.getChildren(); _i < _d.length; _i++) {
103
+ var col = _d[_i];
104
+ _loop_1(col);
93
105
  }
94
- tableRowCols.push(rowCols);
95
106
  }
96
107
  return tableRowCols;
97
108
  };
@@ -121,12 +132,11 @@ var RowNode = /** @class */ (function (_super) {
121
132
  var nextCol = (_b = colArr[colArr.length - 1]) === null || _b === void 0 ? void 0 : _b.getNextSibling();
122
133
  var isMissingPercentSign = (nextCol === null || nextCol === void 0 ? void 0 : nextCol.getText().includes('%')) && nextCol.parseValue() === null;
123
134
  var isMissingParenthesis = (nextCol === null || nextCol === void 0 ? void 0 : nextCol.getText().includes(')')) && colText.includes('(') && !colText.includes(')');
124
- var colTextTrimmed = isMissingParenthesis ? "".concat(colText.trim(), ")") : colText.trim();
125
- colTextTrimmed = isMissingPercentSign ? "".concat(colText.trim(), "%") : colText.trim();
126
- colTextTrimmed = this.parseValue(colTextTrimmed);
127
- colTextTrimmed =
128
- typeof colTextTrimmed === 'string' ? colTextTrimmed.replace(/\s+/g, ' ') : colTextTrimmed;
129
- colTextArr.push(colTextTrimmed);
135
+ var colValue = isMissingParenthesis ? "".concat(colText.trim(), ")") : colText.trim();
136
+ colValue = isMissingPercentSign ? "".concat(colText.trim(), "%") : colText.trim();
137
+ colValue = this.parseValue(colValue);
138
+ colValue = typeof colValue === 'string' ? colValue.replace(/\s+/g, ' ') : colValue;
139
+ colTextArr.push(colValue);
130
140
  }
131
141
  tableTextArr.push(colTextArr);
132
142
  }
@@ -1,4 +1,4 @@
1
- interface XMLNodeArgs {
1
+ export interface XMLNodeArgs {
2
2
  path?: string;
3
3
  attributesStr?: string;
4
4
  }
@@ -47,30 +47,40 @@ var XMLNode = /** @class */ (function () {
47
47
  return boldText.replace(/\s+/g, ' ').trim();
48
48
  };
49
49
  XMLNode.prototype.parseValue = function (str) {
50
+ var _a;
50
51
  if (str === void 0) { str = this.text; }
51
52
  if (str === null)
52
53
  return null;
53
54
  var text = str
54
- .replace(/\n|&#160;|&nbsp;/g, ' ')
55
+ .replace(/&#160;|&nbsp;|\n/g, ' ')
55
56
  .replace(/&#174;/g, '')
56
57
  .replace(/&#8211;|&#8212;|&#x2014;/g, '-')
57
- .replace(/&#8217;|&#8220;|&#8221;/g, "'")
58
- .replace(/\}\}\{\{/g, ' ')
59
- .replace(/\{\{|\}\}/g, '')
58
+ .replace(/&#8217;|&#8220;|&#8221;|&rsquo;/g, "'")
59
+ .replace(/(?<=\{\{).*(?=\}\})/g, function (match) { return "{{".concat(match.replace(/\{\{/g, '').replace(/\}\}/g, ''), "}}"); })
60
+ .replace(/\{\{+/g, '{{')
61
+ .replace(/\}\}+/g, '}}')
60
62
  .replace(/\s+/, ' ')
61
63
  .trim();
62
64
  if (str.replace(/&#8211;|&#8212;|&#x2014;/g, '-') === '-')
63
65
  return '-';
64
66
  if (text === '')
65
67
  return null;
66
- var colNum = text.replace(/,|\(|\)|\%/g, '').trim();
68
+ var colNum = text
69
+ .replace(/,|\(|\)|\%/g, '')
70
+ .replace(/\{\{/g, '')
71
+ .replace(/\}\}/g, '')
72
+ .trim();
67
73
  if (colNum === '-' || colNum === '$')
68
74
  return null;
69
75
  colNum = colNum.replace(/\-|\$/g, '');
76
+ var hasNumBeforeParenthesis = Boolean(/\d+\s*(?=\()/.test(text));
77
+ colNum = hasNumBeforeParenthesis ? (_a = colNum.split(' ')[0]) === null || _a === void 0 ? void 0 : _a.trim() : colNum;
70
78
  if (!isNaN(Number(colNum))) {
71
79
  if (text.includes('%'))
72
80
  return text.replace(/[^a-zA-Z\d\s:]/g, '') === '' ? null : text;
73
- return text.includes('(') || text.includes('-') ? Number(colNum) * -1 : Number(colNum);
81
+ return (text.trim().includes('(') && !hasNumBeforeParenthesis) || text.includes('-')
82
+ ? Number(colNum) * -1
83
+ : Number(colNum);
74
84
  }
75
85
  return text;
76
86
  };
@@ -203,21 +203,21 @@ var XMLParser = /** @class */ (function () {
203
203
  var boldPath = null;
204
204
  var pushColToRow = function (col) {
205
205
  var _a;
206
- var colSpan = col.getColSpan();
207
206
  var colIndex = curRowCols.length;
208
207
  col.setIndex(colIndex);
209
- for (var i = 0; i < colSpan; i++) {
210
- curRowCols.push(col);
211
- }
208
+ var colSpan = col.getColSpan();
209
+ Array.from({ length: colSpan }).forEach(function () { return curRowCols.push(col); });
212
210
  var topSibling = (_a = prevRowCols[colIndex]) !== null && _a !== void 0 ? _a : null;
213
211
  topSibling === null || topSibling === void 0 ? void 0 : topSibling.addBottomSibling(col);
214
212
  };
215
213
  this.iterateXML({
216
214
  xml: xml,
217
- onCloseTag: function () {
218
- var _a;
215
+ onCloseTag: function (_a) {
216
+ var _b;
217
+ var path = _a.path;
218
+ var tag = path.split('.').pop();
219
219
  if ((curNode === null || curNode === void 0 ? void 0 : curNode.getPath()) === boldPath) {
220
- curNode === null || curNode === void 0 ? void 0 : curNode.setText("".concat((_a = curNode === null || curNode === void 0 ? void 0 : curNode.getText()) !== null && _a !== void 0 ? _a : '', "}}"));
220
+ curNode === null || curNode === void 0 ? void 0 : curNode.setText("".concat((_b = curNode === null || curNode === void 0 ? void 0 : curNode.getText()) !== null && _b !== void 0 ? _b : '', "}}"));
221
221
  boldPath = null;
222
222
  }
223
223
  },
@@ -299,6 +299,7 @@ var XMLParser = /** @class */ (function () {
299
299
  }
300
300
  },
301
301
  });
302
+ documentNode.setText(xml);
302
303
  return documentNode;
303
304
  };
304
305
  return XMLParser;
@@ -1,9 +1,11 @@
1
1
  import { parseForm4 } from './parse-form-4';
2
2
  import { parseForm13g } from './parse-form-13g';
3
3
  import { parseForm10k } from './parse-form-10k';
4
+ import { parseFormDef14a } from './parse-form-def14a';
4
5
  declare const parsers: {
5
6
  parseForm4: typeof parseForm4;
6
7
  parseForm13g: typeof parseForm13g;
7
8
  parseForm10k: typeof parseForm10k;
9
+ parseFormDef14a: typeof parseFormDef14a;
8
10
  };
9
11
  export default parsers;
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var parse_form_4_1 = require("./parse-form-4");
4
4
  var parse_form_13g_1 = require("./parse-form-13g");
5
5
  var parse_form_10k_1 = require("./parse-form-10k");
6
+ var parse_form_def14a_1 = require("./parse-form-def14a");
6
7
  var parsers = {
7
8
  parseForm4: parse_form_4_1.parseForm4,
8
9
  parseForm13g: parse_form_13g_1.parseForm13g,
9
10
  parseForm10k: parse_form_10k_1.parseForm10k,
11
+ parseFormDef14a: parse_form_def14a_1.parseFormDef14a,
10
12
  };
11
13
  exports.default = parsers;
@@ -1,3 +1,3 @@
1
- import { TableData, XMLParams } from '../../../types';
1
+ import { Form10KData, XMLParams } from '../../../types';
2
2
  import XMLParser from '../XMLParser';
3
- export declare function parseForm10k(params: XMLParams, xmlParser?: XMLParser): TableData[];
3
+ export declare function parseForm10k(params: XMLParams, xmlParser?: XMLParser): Form10KData;
@@ -1,78 +1,25 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
7
8
  }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
10
12
  };
11
13
  Object.defineProperty(exports, "__esModule", { value: true });
12
14
  exports.parseForm10k = void 0;
13
- var HRNode_1 = require("../XMLNode/HRNode");
14
- var NonTableNode_1 = require("../XMLNode/NonTableNode");
15
- var TableNode_1 = require("../XMLNode/TableNode");
16
15
  var XMLParser_1 = require("../XMLParser");
17
16
  function parseForm10k(params, xmlParser) {
18
- var _a, _b, _c, _d;
19
17
  if (xmlParser === void 0) { xmlParser = new XMLParser_1.default(); }
20
18
  var xml = params.xml;
21
19
  var doc = xmlParser.getDocumentNode({ xml: xml });
22
- var nodes = doc.getChildren();
23
- var tables = nodes.filter(function (child) { return child instanceof TableNode_1.TableNode; });
24
- var curSectionIndex = 0;
25
- var sectionIndexByTable = new Map();
26
- var tableDataArr = [];
27
- // map the section index of each table. new section starts for each <hr> tag.
28
- for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
29
- var node = nodes_1[_i];
30
- if (node instanceof TableNode_1.TableNode) {
31
- sectionIndexByTable.set(node, curSectionIndex);
32
- }
33
- else if (node instanceof HRNode_1.HRNode) {
34
- curSectionIndex++;
35
- }
36
- }
37
- var _loop_1 = function (table) {
38
- table.mergeHeader();
39
- table.removeEmptyTopRows();
40
- var siblingsPrev = table.getSiblings({ dir: 'previous', stopAtType: NonTableNode_1.NonTableNode, includeStopAtType: true });
41
- var siblingsNext = table.getSiblings({ dir: 'next', stopAtType: NonTableNode_1.NonTableNode, includeStopAtType: true });
42
- // set the title based on the bold text in the previous siblings
43
- var title = siblingsPrev.map(function (s) { return s.extractBold(); }).join(' | ');
44
- var textBefore = siblingsPrev.map(function (s) { return s.getText(); }).join('\n');
45
- var textAfter = siblingsNext.map(function (s) { return s.getText(); }).join('\n');
46
- var header = table.getHeaderRow();
47
- var headerTable = header === null || header === void 0 ? void 0 : header.toTable();
48
- var topRow = table.getChildren()[0];
49
- var topRowTable = !header ? topRow === null || topRow === void 0 ? void 0 : topRow.toTable() : null;
50
- var prevTable = tableDataArr[tableDataArr.length - 1];
51
- var isSameTableSize = prevTable ? ((_a = prevTable === null || prevTable === void 0 ? void 0 : prevTable.rows[0]) === null || _a === void 0 ? void 0 : _a.length) === ((_b = topRowTable === null || topRowTable === void 0 ? void 0 : topRowTable[0]) === null || _b === void 0 ? void 0 : _b.length) : false;
52
- var isSameSection = prevTable ? prevTable.sectionIndex === sectionIndexByTable.get(table) : false;
53
- var isSharedHeader = !!topRowTable && table.getTitle() === '' && isSameTableSize && isSameSection;
54
- // some tables will be in the same section directly below another table and expected to have the same header.
55
- if (isSharedHeader) {
56
- topRowTable.unshift(__spreadArray([], prevTable.rows[0], true));
57
- table.setTitle(prevTable.title);
58
- }
59
- var rows = (_c = headerTable !== null && headerTable !== void 0 ? headerTable : topRowTable) !== null && _c !== void 0 ? _c : [];
60
- if (rows.length === 0)
61
- return "continue";
62
- tableDataArr.push({
63
- title: title.trim(),
64
- sectionIndex: (_d = sectionIndexByTable.get(table)) !== null && _d !== void 0 ? _d : -1,
65
- hasHeader: Boolean(header) || isSharedHeader,
66
- textBefore: textBefore,
67
- textAfter: textAfter,
68
- rows: rows.filter(function (r) { return r.length === rows[0].length; }),
69
- });
70
- };
71
- // create table arrays
72
- for (var _e = 0, tables_1 = tables; _e < tables_1.length; _e++) {
73
- var table = tables_1[_e];
74
- _loop_1(table);
75
- }
76
- return tableDataArr;
20
+ var tables = doc.parseTables().map(function (table) { return (__assign(__assign({}, table), { rows: table.rows.map(function (row) {
21
+ return row.map(function (col) { return (typeof col === 'string' ? col.replace(/\{\{/g, '').replace(/\}\}/g, '') : col); });
22
+ }) })); });
23
+ return { tables: tables };
77
24
  }
78
25
  exports.parseForm10k = parseForm10k;
@@ -1,8 +1,8 @@
1
- import { Holder, XMLParams } from '../../../types';
1
+ import { Form13GData, XMLParams } from '../../../types';
2
2
  import XMLParser from '../XMLParser';
3
3
  /**
4
- * Form SC 13G - Holders
4
+ * Form SC 13G - Institutional Holders
5
5
  *
6
6
  * example at https://www.sec.gov/Archives/edgar/data/320193/000119312523038262/d382361dsc13ga.htm
7
7
  */
8
- export declare function parseForm13g(params: XMLParams, xmlParser?: XMLParser): Holder[];
8
+ export declare function parseForm13g(params: XMLParams, xmlParser?: XMLParser): Form13GData;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseForm13g = void 0;
4
4
  var XMLParser_1 = require("../XMLParser");
5
5
  /**
6
- * Form SC 13G - Holders
6
+ * Form SC 13G - Institutional Holders
7
7
  *
8
8
  * example at https://www.sec.gov/Archives/edgar/data/320193/000119312523038262/d382361dsc13ga.htm
9
9
  */
@@ -83,6 +83,6 @@ function parseForm13g(params, xmlParser) {
83
83
  if (((_d = holders[holders.length - 1]) === null || _d === void 0 ? void 0 : _d.name) === '') {
84
84
  holders.pop();
85
85
  }
86
- return holders;
86
+ return { holders: holders };
87
87
  }
88
88
  exports.parseForm13g = parseForm13g;
@@ -1,8 +1,8 @@
1
- import { InsiderTransaction, XMLParams } from '../../../types';
1
+ import { Form4Data, XMLParams } from '../../../types';
2
2
  import XMLParser from '../XMLParser';
3
3
  /**
4
4
  * Form 4 - Insider Transactions
5
5
  *
6
6
  * example at https://www.sec.gov/Archives/edgar/data/320193/000032019323000079/xslF345X05/wk-form4_1691533817.xml
7
7
  */
8
- export declare function parseForm4(params: XMLParams, xmlParser?: XMLParser): InsiderTransaction[];
8
+ export declare function parseForm4(params: XMLParams, xmlParser?: XMLParser): Form4Data;
@@ -215,6 +215,6 @@ function parseForm4(params, xmlParser) {
215
215
  }
216
216
  transactions.push(transaction);
217
217
  }
218
- return transactions;
218
+ return { transactions: transactions };
219
219
  }
220
220
  exports.parseForm4 = parseForm4;
@@ -0,0 +1,8 @@
1
+ import { FormDef14aData, XMLParams } from '../../../types';
2
+ import XMLParser from '../XMLParser';
3
+ /**
4
+ * Form DEF 14a - Proxy Statement
5
+ *
6
+ * example at https://www.sec.gov/Archives/edgar/data/320193/000130817923000019/laap2023_def14a.htm
7
+ */
8
+ export declare function parseFormDef14a(params: XMLParams, xmlParser?: XMLParser): FormDef14aData;
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseFormDef14a = void 0;
4
+ var XMLParser_1 = require("../XMLParser");
5
+ /**
6
+ * Form DEF 14a - Proxy Statement
7
+ *
8
+ * example at https://www.sec.gov/Archives/edgar/data/320193/000130817923000019/laap2023_def14a.htm
9
+ */
10
+ function parseFormDef14a(params, xmlParser) {
11
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
12
+ if (xmlParser === void 0) { xmlParser = new XMLParser_1.default(); }
13
+ var xml = params.xml;
14
+ var doc = xmlParser.getDocumentNode({ xml: xml });
15
+ var tables = doc.parseTables();
16
+ var usedTables = [];
17
+ var compensationArr = [];
18
+ var holderArr = [];
19
+ var findCompensationTables = function (type) {
20
+ var tablesFound = tables.filter(function (table) {
21
+ var _a, _b, _c, _d, _e;
22
+ var hasNameRow = (_a = table.rows[0]) === null || _a === void 0 ? void 0 : _a.some(function (col) { return "".concat(col).toLowerCase().includes('name'); });
23
+ var hasTotalRow = (_b = table.rows[0]) === null || _b === void 0 ? void 0 : _b.some(function (col) { return "".concat(col).toLowerCase().includes('total'); });
24
+ var hasAwardRow = (_c = table.rows[0]) === null || _c === void 0 ? void 0 : _c.some(function (col) { return "".concat(col).toLowerCase().includes('award'); });
25
+ var titleLower = table.title.toLowerCase();
26
+ var textLower = (_e = (_d = table.textBefore) === null || _d === void 0 ? void 0 : _d.toLowerCase()) !== null && _e !== void 0 ? _e : '';
27
+ var isTitleMatch = titleLower.includes(type) && titleLower.includes('compensation');
28
+ var isTextMatch = hasNameRow && hasTotalRow && hasAwardRow && textLower.includes(type);
29
+ return (isTitleMatch || isTextMatch) && !usedTables.includes(table);
30
+ });
31
+ tablesFound.forEach(function (t) { return usedTables.push(t); });
32
+ return tablesFound;
33
+ };
34
+ var tablesHolder = tables.filter(function (table) {
35
+ var _a, _b;
36
+ var hasNameRow = (_a = table.rows[0]) === null || _a === void 0 ? void 0 : _a.some(function (col) { return "".concat(col).toLowerCase().includes('name'); });
37
+ var hasPercent = (_b = table.rows[0]) === null || _b === void 0 ? void 0 : _b.some(function (col) { return "".concat(col).toLowerCase().includes('percent'); });
38
+ var titleLower = table.title.toLowerCase();
39
+ var isTitleMatch = titleLower.includes('security') && titleLower.includes('owner') && titleLower.includes('beneficial');
40
+ return isTitleMatch && hasNameRow && hasPercent;
41
+ });
42
+ var foundHoldersKeys = new Set();
43
+ var _loop_1 = function (table) {
44
+ var header = table.rows[0];
45
+ var getIndex = function (search) { return header.findIndex(function (col) { return "".concat(col).toLowerCase().includes(search); }); };
46
+ var indexName = getIndex('name');
47
+ var indexPercent = getIndex('percent');
48
+ var indexShares = (_b = (_a = table.rows[1]) === null || _a === void 0 ? void 0 : _a.findIndex(function (col) { return typeof col === 'number' && !isNaN(col); })) !== null && _b !== void 0 ? _b : -1;
49
+ for (var i = 1; i < table.rows.length; i++) {
50
+ for (var i_1 = 1; i_1 < table.rows.length; i_1++) {
51
+ var nameVal = (_d = (_c = table.rows[i_1]) === null || _c === void 0 ? void 0 : _c[indexName]) !== null && _d !== void 0 ? _d : null;
52
+ if (typeof nameVal !== 'string')
53
+ continue;
54
+ var nameParts = nameVal.split('}}');
55
+ var namePartsSpaces = nameVal.split(' ');
56
+ var position = (_e = nameParts[1]) !== null && _e !== void 0 ? _e : namePartsSpaces.slice(2, namePartsSpaces.length).join(' ');
57
+ var name_1 = nameParts[1] ? nameParts[0] : namePartsSpaces.slice(0, 2).join(' ');
58
+ var holder = {
59
+ name: name_1.replace(/{{/g, '').replace(/}}/g, '').trim(),
60
+ position: position.replace(/{{/g, '').replace(/}}/g, '').trim() || null,
61
+ shares: Number((_f = table.rows[i_1]) === null || _f === void 0 ? void 0 : _f[indexShares]) || null,
62
+ percentOfClass: String((_g = table.rows[i_1]) === null || _g === void 0 ? void 0 : _g[indexPercent]) || null,
63
+ };
64
+ var key = "".concat(holder.name).concat(holder.position).concat(holder.shares).concat(holder.percentOfClass);
65
+ if (!foundHoldersKeys.has(key))
66
+ holderArr.push(holder);
67
+ foundHoldersKeys.add(key);
68
+ }
69
+ }
70
+ };
71
+ for (var _i = 0, tablesHolder_1 = tablesHolder; _i < tablesHolder_1.length; _i++) {
72
+ var table = tablesHolder_1[_i];
73
+ _loop_1(table);
74
+ }
75
+ for (var _t = 0, _u = ['director', 'executive', 'summary']; _t < _u.length; _t++) {
76
+ var type = _u[_t];
77
+ var _loop_2 = function (table) {
78
+ if (!table)
79
+ return "continue";
80
+ var header = table.rows[0];
81
+ var getIndex = function (search) { return header.findIndex(function (col) { return "".concat(col).toLowerCase().includes(search); }); };
82
+ var indexName = getIndex('name');
83
+ var indexYear = getIndex('year');
84
+ var indexSalary = getIndex('salary') === -1 ? getIndex('cash') : getIndex('salary');
85
+ var indexBonus = getIndex('bonus');
86
+ var indexStock = getIndex('stock');
87
+ var indexNonEquity = getIndex('non-equity') === -1 ? getIndex('option') : getIndex('non-equity');
88
+ var indexOther = getIndex('other');
89
+ var indexTotal = getIndex('total');
90
+ var defaultPosition = {
91
+ director: 'Director',
92
+ executive: 'Executive',
93
+ summary: null,
94
+ }[type];
95
+ for (var i = 1; i < table.rows.length; i++) {
96
+ var nameVal = (_j = (_h = table.rows[i]) === null || _h === void 0 ? void 0 : _h[indexName]) !== null && _j !== void 0 ? _j : null;
97
+ if (typeof nameVal !== 'string')
98
+ continue;
99
+ var nameParts = nameVal.split('}}');
100
+ var namePartsSpaces = nameVal.split(' ');
101
+ var position = (_k = nameParts[1]) !== null && _k !== void 0 ? _k : namePartsSpaces.slice(2, namePartsSpaces.length).join(' ');
102
+ var name_2 = nameParts[1] ? nameParts[0] : namePartsSpaces.slice(0, 2).join(' ');
103
+ var compensation = {
104
+ name: name_2.replace(/{{/g, '').replace(/}}/g, '').trim(),
105
+ position: position.replace(/{{/g, '').replace(/}}/g, '').trim() || (defaultPosition !== null && defaultPosition !== void 0 ? defaultPosition : null),
106
+ year: Number((_l = table.rows[i]) === null || _l === void 0 ? void 0 : _l[indexYear]) || null,
107
+ salaryDollars: Number((_m = table.rows[i]) === null || _m === void 0 ? void 0 : _m[indexSalary]) || null,
108
+ bonusDollars: Number((_o = table.rows[i]) === null || _o === void 0 ? void 0 : _o[indexBonus]) || null,
109
+ stockAwardDollars: Number((_p = table.rows[i]) === null || _p === void 0 ? void 0 : _p[indexStock]) || null,
110
+ nonEquityDollars: Number((_q = table.rows[i]) === null || _q === void 0 ? void 0 : _q[indexNonEquity]) || null,
111
+ otherDollars: Number((_r = table.rows[i]) === null || _r === void 0 ? void 0 : _r[indexOther]) || null,
112
+ totalDollars: Number((_s = table.rows[i]) === null || _s === void 0 ? void 0 : _s[indexTotal]) || null,
113
+ };
114
+ if (compensation.totalDollars !== null) {
115
+ compensationArr.push(compensation);
116
+ }
117
+ }
118
+ };
119
+ for (var _v = 0, _w = findCompensationTables(type); _v < _w.length; _v++) {
120
+ var table = _w[_v];
121
+ _loop_2(table);
122
+ }
123
+ }
124
+ return { executiveCompensation: compensationArr, holders: holderArr };
125
+ }
126
+ exports.parseFormDef14a = parseFormDef14a;
@@ -1,4 +1,4 @@
1
- import { CompanyFactFrame, CompanyFactListData, CompanyTickerItem, FieldDataResponse, Holder, InsiderTransaction, MultiCompanyFactFrame, ReportRaw, ReportTranslated, TableData } from '../../types';
1
+ import { CompanyFactFrame, CompanyFactListData, CompanyTickerItem, FieldDataResponse, Form10KData, Form13GData, Form4Data, FormDef14aData, MultiCompanyFactFrame, ReportRaw, ReportTranslated } from '../../types';
2
2
  import { FilingListDetails, FilingListItemTranslated, SubmissionList } from '../../types/submission.type';
3
3
  import { IClient } from '../Client';
4
4
  import DocumentParser from '../DocumentParser';
@@ -187,23 +187,23 @@ export default class SecEdgarApi {
187
187
  * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
188
188
  * const requestWrapper = secEdgarApi.createRequestInsiderTransactions({ symbol: 'AAPL', filings: submissions.filings.recent })
189
189
  *
190
- * const transactions1 = (await requestWrapper.requestNext()).result // array of transactions from most recent doc
191
- * const transactions2 = (await requestWrapper.requestNext()).result // array of transactions from second most recent doc
190
+ * const transactions1 = (await requestWrapper.requestNext()).result.transactions // array of transactions from most recent doc
191
+ * const transactions2 = (await requestWrapper.requestNext()).result.transactions // array of transactions from second most recent doc
192
192
  * ```
193
193
  */
194
- createRequestInsiderTransactions(params: CreateRequestWrapperParams): SubmissionRequestWrapper<InsiderTransaction[]>;
194
+ createRequestInsiderTransactions(params: CreateRequestWrapperParams): SubmissionRequestWrapper<Form4Data>;
195
195
  /**
196
196
  * Used for getting institutional holders. extracts holders urls from submission list response, and parses the xml doc.
197
197
  *
198
198
  * ```ts
199
199
  * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
200
- * const requestWrapper = secEdgarApi.createRequestHolders({ symbol: 'AAPL', filings: submissions.filings.recent })
200
+ * const requestWrapper = secEdgarApi.createRequestInstitutionalHolders({ symbol: 'AAPL', filings: submissions.filings.recent })
201
201
  *
202
- * const holders1 = (await requestWrapper.requestNext()).result // array of holders from most recent doc
203
- * const holders2 = (await requestWrapper.requestNext()).result // array of holders from second most recent doc
202
+ * const holders1 = (await requestWrapper.requestNext()).result.holders // array of holders from most recent doc
203
+ * const holders2 = (await requestWrapper.requestNext()).result.holders // array of holders from second most recent doc
204
204
  * ```
205
205
  */
206
- createRequestHolders(params: CreateRequestWrapperParams): SubmissionRequestWrapper<Holder[]>;
206
+ createRequestInstitutionalHolders(params: CreateRequestWrapperParams): SubmissionRequestWrapper<Form13GData>;
207
207
  /**
208
208
  * Used for getting earnings report tables from submission files.
209
209
  *
@@ -211,10 +211,21 @@ export default class SecEdgarApi {
211
211
  * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
212
212
  * const requestWrapper = secEdgarApi.createRequesEarningsReports({ symbol: 'AAPL', filings: submissions.filings.recent })
213
213
  *
214
- * const tables1 = (await requestWrapper.requestNext()).result // array of tables from most recent doc
215
- * const tables2 = (await requestWrapper.requestNext()).result // array of tables from second most recent doc
214
+ * const tables1 = (await requestWrapper.requestNext()).result.tables // array of tables from most recent doc
215
+ * const tables2 = (await requestWrapper.requestNext()).result.tables // array of tables from second most recent doc
216
216
  * ```
217
217
  */
218
- createRequestEarningsReports(params: CreateRequestWrapperParams): SubmissionRequestWrapper<TableData[]>;
218
+ createRequestEarningsReports(params: CreateRequestWrapperParams): SubmissionRequestWrapper<Form10KData>;
219
+ /**
220
+ * Proxy statement includes list of holders, executiveCompensation, and other tables. returns FormDef14aData
221
+ *
222
+ * ```ts
223
+ * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
224
+ * const requestWrapper = secEdgarApi.createRequesProxyStatement({ symbol: 'AAPL', filings: submissions.filings.recent })
225
+ *
226
+ * const { holders, executiveCompensation } = (await requestWrapper.requestNext()).result
227
+ * ```
228
+ */
229
+ createRequestProxyStatement(params: CreateRequestWrapperParams): SubmissionRequestWrapper<FormDef14aData>;
219
230
  }
220
231
  export {};
@@ -366,8 +366,8 @@ var SecEdgarApi = /** @class */ (function () {
366
366
  * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
367
367
  * const requestWrapper = secEdgarApi.createRequestInsiderTransactions({ symbol: 'AAPL', filings: submissions.filings.recent })
368
368
  *
369
- * const transactions1 = (await requestWrapper.requestNext()).result // array of transactions from most recent doc
370
- * const transactions2 = (await requestWrapper.requestNext()).result // array of transactions from second most recent doc
369
+ * const transactions1 = (await requestWrapper.requestNext()).result.transactions // array of transactions from most recent doc
370
+ * const transactions2 = (await requestWrapper.requestNext()).result.transactions // array of transactions from second most recent doc
371
371
  * ```
372
372
  */
373
373
  SecEdgarApi.prototype.createRequestInsiderTransactions = function (params) {
@@ -380,7 +380,7 @@ var SecEdgarApi = /** @class */ (function () {
380
380
  return __generator(this, function (_d) {
381
381
  switch (_d.label) {
382
382
  case 0:
383
- _b = (_a = this.documentParser).parseInsiderTransactions;
383
+ _b = (_a = this.documentParser).parseForm4;
384
384
  _c = {};
385
385
  return [4 /*yield*/, this.getDocumentXMLByUrl(params)];
386
386
  case 1: return [2 /*return*/, _b.apply(_a, [(_c.xml = _d.sent(), _c)])];
@@ -394,13 +394,13 @@ var SecEdgarApi = /** @class */ (function () {
394
394
  *
395
395
  * ```ts
396
396
  * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
397
- * const requestWrapper = secEdgarApi.createRequestHolders({ symbol: 'AAPL', filings: submissions.filings.recent })
397
+ * const requestWrapper = secEdgarApi.createRequestInstitutionalHolders({ symbol: 'AAPL', filings: submissions.filings.recent })
398
398
  *
399
- * const holders1 = (await requestWrapper.requestNext()).result // array of holders from most recent doc
400
- * const holders2 = (await requestWrapper.requestNext()).result // array of holders from second most recent doc
399
+ * const holders1 = (await requestWrapper.requestNext()).result.holders // array of holders from most recent doc
400
+ * const holders2 = (await requestWrapper.requestNext()).result.holders // array of holders from second most recent doc
401
401
  * ```
402
402
  */
403
- SecEdgarApi.prototype.createRequestHolders = function (params) {
403
+ SecEdgarApi.prototype.createRequestInstitutionalHolders = function (params) {
404
404
  var _this = this;
405
405
  var submissions = this.getCreateRequestSubmissions(params, ['SC 13G', 'SC 13G/A']);
406
406
  var options = { maxRequests: params.maxRequests };
@@ -410,7 +410,7 @@ var SecEdgarApi = /** @class */ (function () {
410
410
  return __generator(this, function (_d) {
411
411
  switch (_d.label) {
412
412
  case 0:
413
- _b = (_a = this.documentParser).parseHolders;
413
+ _b = (_a = this.documentParser).parseForm13g;
414
414
  _c = {};
415
415
  return [4 /*yield*/, this.getDocumentXMLByUrl(params)];
416
416
  case 1: return [2 /*return*/, _b.apply(_a, [(_c.xml = _d.sent(), _c)])];
@@ -426,8 +426,8 @@ var SecEdgarApi = /** @class */ (function () {
426
426
  * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
427
427
  * const requestWrapper = secEdgarApi.createRequesEarningsReports({ symbol: 'AAPL', filings: submissions.filings.recent })
428
428
  *
429
- * const tables1 = (await requestWrapper.requestNext()).result // array of tables from most recent doc
430
- * const tables2 = (await requestWrapper.requestNext()).result // array of tables from second most recent doc
429
+ * const tables1 = (await requestWrapper.requestNext()).result.tables // array of tables from most recent doc
430
+ * const tables2 = (await requestWrapper.requestNext()).result.tables // array of tables from second most recent doc
431
431
  * ```
432
432
  */
433
433
  SecEdgarApi.prototype.createRequestEarningsReports = function (params) {
@@ -440,7 +440,36 @@ var SecEdgarApi = /** @class */ (function () {
440
440
  return __generator(this, function (_d) {
441
441
  switch (_d.label) {
442
442
  case 0:
443
- _b = (_a = this.documentParser).parseEarningsTables;
443
+ _b = (_a = this.documentParser).parseForm10k;
444
+ _c = {};
445
+ return [4 /*yield*/, this.getDocumentXMLByUrl(params)];
446
+ case 1: return [2 /*return*/, _b.apply(_a, [(_c.xml = _d.sent(), _c)])];
447
+ }
448
+ });
449
+ }); };
450
+ return new RequestWrapper_1.default({ submissions: submissions, options: options, sendRequest: sendRequest });
451
+ };
452
+ /**
453
+ * Proxy statement includes list of holders, executiveCompensation, and other tables. returns FormDef14aData
454
+ *
455
+ * ```ts
456
+ * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
457
+ * const requestWrapper = secEdgarApi.createRequesProxyStatement({ symbol: 'AAPL', filings: submissions.filings.recent })
458
+ *
459
+ * const { holders, executiveCompensation } = (await requestWrapper.requestNext()).result
460
+ * ```
461
+ */
462
+ SecEdgarApi.prototype.createRequestProxyStatement = function (params) {
463
+ var _this = this;
464
+ var submissions = this.getCreateRequestSubmissions(params, ['DEF 14A']);
465
+ var options = { maxRequests: params.maxRequests };
466
+ var sendRequest = function (params) { return __awaiter(_this, void 0, void 0, function () {
467
+ var _a, _b;
468
+ var _c;
469
+ return __generator(this, function (_d) {
470
+ switch (_d.label) {
471
+ case 0:
472
+ _b = (_a = this.documentParser).parseFormDef14a;
444
473
  _c = {};
445
474
  return [4 /*yield*/, this.getDocumentXMLByUrl(params)];
446
475
  case 1: return [2 /*return*/, _b.apply(_a, [(_c.xml = _d.sent(), _c)])];
@@ -44,7 +44,7 @@ export interface InsiderTransaction {
44
44
  ownership: string;
45
45
  explainationByKey: Partial<Record<keyof InsiderTransaction, string>>;
46
46
  }
47
- export interface Holder {
47
+ export interface InstitutionalHolder {
48
48
  name: string;
49
49
  origin: string;
50
50
  shares: number;
@@ -63,4 +63,34 @@ export interface TableData {
63
63
  sectionIndex: number;
64
64
  rows: (string | number | null)[][];
65
65
  }
66
+ export interface ExecutiveCompensation {
67
+ name: string;
68
+ position: string | null;
69
+ year: number | null;
70
+ salaryDollars: number | null;
71
+ bonusDollars: number | null;
72
+ stockAwardDollars: number | null;
73
+ nonEquityDollars: number | null;
74
+ otherDollars: number | null;
75
+ totalDollars: number | null;
76
+ }
77
+ export interface Holder {
78
+ name: string;
79
+ position: string | null;
80
+ shares: number | null;
81
+ percentOfClass: string | null;
82
+ }
83
+ export interface Form4Data {
84
+ transactions: InsiderTransaction[];
85
+ }
86
+ export interface Form10KData {
87
+ tables: TableData[];
88
+ }
89
+ export interface Form13GData {
90
+ holders: InstitutionalHolder[];
91
+ }
92
+ export interface FormDef14aData {
93
+ executiveCompensation: ExecutiveCompensation[];
94
+ holders: Holder[];
95
+ }
66
96
  export {};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "sec-edgar-api",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Fetch and parse SEC earnings reports and other filings. Useful for financial analysis.",
5
5
  "main": "build/index.js",
6
6
  "author": "Andrew Evers (https://github.com/andyevers)",
7
7
  "homepage": "https://github.com/andyevers/sec-edgar-api#readme",
8
- "license": "ISC",
8
+ "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/andyevers/sec-edgar-api.git"