sec-edgar-api 0.3.1 → 0.3.3

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.
@@ -57,11 +57,6 @@ export interface GetDocumentXMLParams {
57
57
  accessionNumber: string;
58
58
  primaryDocument: string;
59
59
  }
60
- export interface GetSubmissionsParams {
61
- /** symbol or cik */
62
- symbol: string;
63
- includeTranslated?: boolean;
64
- }
65
60
  /**
66
61
  * Gets reports from companies filed with the SEC
67
62
  *
@@ -93,7 +88,10 @@ export default class SecEdgarApi {
93
88
  *
94
89
  * endpoint: `/submissions/CIK${cik}.json`
95
90
  */
96
- getSubmissions(params: GetSubmissionsParams): Promise<SubmissionList>;
91
+ getSubmissions(params: GetSymbolParams): Promise<{
92
+ submissionList: SubmissionList;
93
+ filings: FilingListItemTranslated[];
94
+ }>;
97
95
  /**
98
96
  * The company-concept API returns all the XBRL disclosures from a single company (CIK)
99
97
  * and concept (a taxonomy and tag) into a single JSON file, with a separate array
@@ -165,7 +163,7 @@ export default class SecEdgarApi {
165
163
  */
166
164
  getMutualFundList(): Promise<FieldDataResponse<'cik' | 'seriesId' | 'classId' | 'symbol'>>;
167
165
  /**
168
- * Gets a raw xml document string. the parameters are found in the submission list response. (response.filings.recent or response.filings.recentTranslated)
166
+ * Gets a raw xml document string. the parameters are found in the submission list response.
169
167
  *
170
168
  * Some form types can be parsed using the DocumentParser such as form 4 (insider transactions) and form 13g (institutional holders)
171
169
  *
@@ -132,8 +132,11 @@ var SecEdgarApi = /** @class */ (function () {
132
132
  for (var _i = 0, filings_1 = filings; _i < filings_1.length; _i++) {
133
133
  var filing = filings_1[_i];
134
134
  var accessionStr = filing.accessionNumber.replace(/-/g, '');
135
+ var basePath = "".concat(this.baseUrlSec, "/Archives/edgar/data/");
135
136
  var primaryDocument = filing.primaryDocument;
136
- filing.url = "https://www.sec.gov/Archives/edgar/data/".concat(Number(cik), "/").concat(accessionStr, "/").concat(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);
137
140
  }
138
141
  return filings;
139
142
  };
@@ -168,21 +171,19 @@ var SecEdgarApi = /** @class */ (function () {
168
171
  * endpoint: `/submissions/CIK${cik}.json`
169
172
  */
170
173
  SecEdgarApi.prototype.getSubmissions = function (params) {
174
+ var _a;
171
175
  return __awaiter(this, void 0, void 0, function () {
172
- var symbol, includeTranslated, cik, submissions;
173
- return __generator(this, function (_a) {
174
- switch (_a.label) {
176
+ var symbol, cik, submissionList;
177
+ return __generator(this, function (_b) {
178
+ switch (_b.label) {
175
179
  case 0:
176
- symbol = params.symbol, includeTranslated = params.includeTranslated;
180
+ symbol = params.symbol;
177
181
  cik = this.getCikString(symbol);
178
182
  return [4 /*yield*/, this.request("".concat(this.baseUrlEdgar, "/submissions/CIK").concat(cik, ".json"))];
179
183
  case 1:
180
- submissions = _a.sent();
181
- submissions.cik = Number(submissions.cik);
182
- if (!includeTranslated)
183
- return [2 /*return*/, submissions];
184
- submissions.filings.recentTranslated = this.mapFilingListDetails(cik, submissions.filings.recent);
185
- return [2 /*return*/, submissions];
184
+ submissionList = _b.sent();
185
+ submissionList.cik = Number(submissionList.cik);
186
+ return [2 /*return*/, { submissionList: submissionList, filings: this.mapFilingListDetails(cik, (_a = submissionList === null || submissionList === void 0 ? void 0 : submissionList.filings) === null || _a === void 0 ? void 0 : _a.recent) }];
186
187
  }
187
188
  });
188
189
  });
@@ -342,7 +343,7 @@ var SecEdgarApi = /** @class */ (function () {
342
343
  });
343
344
  };
344
345
  /**
345
- * Gets a raw xml document string. the parameters are found in the submission list response. (response.filings.recent or response.filings.recentTranslated)
346
+ * Gets a raw xml document string. the parameters are found in the submission list response.
346
347
  *
347
348
  * Some form types can be parsed using the DocumentParser such as form 4 (insider transactions) and form 13g (institutional holders)
348
349
  *
@@ -53,11 +53,11 @@ export interface FilingListItemTranslated {
53
53
  primaryDocument: string;
54
54
  primaryDocDescription: string;
55
55
  url: string;
56
+ urlPrimaryDocument: string;
56
57
  }
57
58
  interface FilingList {
58
59
  recent: FilingListDetails;
59
60
  files: FileData[];
60
- recentTranslated?: FilingListItemTranslated[];
61
61
  }
62
62
  export interface SubmissionList {
63
63
  cik: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sec-edgar-api",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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)",