sec-edgar-api 0.0.3 → 0.0.6

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 (51) hide show
  1. package/README.md +15 -43
  2. package/build/downloader.d.ts +6 -0
  3. package/build/downloader.js +9 -0
  4. package/build/index.d.ts +2 -7
  5. package/build/index.js +12 -8
  6. package/build/services/Client/Client.d.ts +43 -0
  7. package/build/services/Client/Client.js +104 -0
  8. package/build/services/Client/index.d.ts +3 -0
  9. package/build/services/Client/index.js +15 -0
  10. package/build/services/DocumentParser/DocumentParser.d.ts +15 -0
  11. package/build/services/DocumentParser/DocumentParser.js +19 -0
  12. package/build/services/DocumentParser/XMLParser.d.ts +25 -0
  13. package/build/services/DocumentParser/XMLParser.js +178 -0
  14. package/build/services/DocumentParser/index.d.ts +2 -0
  15. package/build/services/DocumentParser/index.js +4 -0
  16. package/build/services/DocumentParser/parsers/index.d.ts +7 -0
  17. package/build/services/DocumentParser/parsers/index.js +9 -0
  18. package/build/services/DocumentParser/parsers/parse-form-13g.d.ts +8 -0
  19. package/build/services/DocumentParser/parsers/parse-form-13g.js +88 -0
  20. package/build/services/DocumentParser/parsers/parse-form-4.d.ts +8 -0
  21. package/build/services/DocumentParser/parsers/parse-form-4.js +220 -0
  22. package/build/services/FactsDownloader/Downloader.d.ts +26 -0
  23. package/build/services/FactsDownloader/Downloader.js +102 -0
  24. package/build/services/FactsDownloader/FactsDownloader.d.ts +37 -0
  25. package/build/services/FactsDownloader/FactsDownloader.js +131 -0
  26. package/build/services/FactsDownloader/Unzipper.d.ts +40 -0
  27. package/build/services/FactsDownloader/Unzipper.js +40 -0
  28. package/build/services/FactsDownloader/index.d.ts +2 -0
  29. package/build/services/FactsDownloader/index.js +4 -0
  30. package/build/services/ReportParser/ReportParser.d.ts +1 -1
  31. package/build/services/ReportParser/ReportTranslatedProxy.d.ts +1 -1
  32. package/build/services/ReportParser/ReportWrapper.js +1 -2
  33. package/build/services/ReportParser/resolvers/helpers.d.ts +1 -1
  34. package/build/services/SecEdgarApi/RequestWrapper.d.ts +30 -0
  35. package/build/services/SecEdgarApi/RequestWrapper.js +133 -0
  36. package/build/services/SecEdgarApi/SecConnector.d.ts +1 -1
  37. package/build/services/SecEdgarApi/SecConnector.js +1 -1
  38. package/build/services/SecEdgarApi/SecEdgarApi.d.ts +140 -30
  39. package/build/services/SecEdgarApi/SecEdgarApi.js +284 -42
  40. package/build/services/SecEdgarApi/Throttler.d.ts +1 -2
  41. package/build/services/SecEdgarApi/Throttler.js +13 -13
  42. package/build/services/SecEdgarApi/index.js +1 -5
  43. package/build/types/common.type.d.ts +12 -0
  44. package/build/types/common.type.js +2 -0
  45. package/build/types/index.d.ts +2 -0
  46. package/build/types/index.js +3 -5
  47. package/build/types/parsed-filings.type.d.ts +58 -0
  48. package/build/types/parsed-filings.type.js +2 -0
  49. package/build/types/report-raw.type.d.ts +3 -3
  50. package/build/types/submission.type.d.ts +19 -1
  51. package/package.json +1 -5
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var fs = require("fs");
4
+ var _unzipper = require("unzipper");
5
+ var Unzipper = /** @class */ (function () {
6
+ function Unzipper(args) {
7
+ if (args === void 0) { args = { fileManager: fs, unzipper: _unzipper }; }
8
+ var fileManager = args.fileManager, unzipper = args.unzipper;
9
+ this.fileManager = fileManager;
10
+ this.unzipper = unzipper;
11
+ }
12
+ Unzipper.prototype.unzip = function (params) {
13
+ var _this = this;
14
+ var inputFilename = params.inputFilename, outputDirname = params.outputDirname, onChunk = params.onChunk, onError = params.onError, _a = params.deleteOriginal, deleteOriginal = _a === void 0 ? false : _a;
15
+ return new Promise(function (resolve, reject) {
16
+ var file = _this.fileManager.createReadStream(inputFilename);
17
+ var filesize = _this.fileManager.statSync(inputFilename).size;
18
+ var unzipped = _this.unzipper.Extract({ path: outputDirname });
19
+ var lengthCurrent = 0;
20
+ file.on('data', function (chunk) {
21
+ lengthCurrent += chunk.length;
22
+ var percentComplete = lengthCurrent / filesize;
23
+ onChunk === null || onChunk === void 0 ? void 0 : onChunk({ percentComplete: percentComplete, chunk: chunk });
24
+ });
25
+ file.pipe(unzipped);
26
+ file.on('end', function () {
27
+ if (deleteOriginal) {
28
+ _this.fileManager.unlinkSync(inputFilename);
29
+ }
30
+ resolve(true);
31
+ });
32
+ file.on('error', function (err) {
33
+ onError === null || onError === void 0 ? void 0 : onError(err);
34
+ reject(false);
35
+ });
36
+ });
37
+ };
38
+ return Unzipper;
39
+ }());
40
+ exports.default = Unzipper;
@@ -0,0 +1,2 @@
1
+ import FactsDownloader from './FactsDownloader';
2
+ export default FactsDownloader;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var FactsDownloader_1 = require("./FactsDownloader");
4
+ exports.default = FactsDownloader_1.default;
@@ -8,7 +8,7 @@ interface ReportParserArgs {
8
8
  propertyResolver?: PropertyResolver;
9
9
  keyTranslator?: Record<string, string[]>;
10
10
  }
11
- type TranslateRawReportsCallback<T> = (report: T extends undefined ? ReportTranslated : Record<keyof T, string | number>, reportRaw: ReportRaw, keyTranslator: T) => any;
11
+ declare type TranslateRawReportsCallback<T> = (report: T extends undefined ? ReportTranslated : Record<keyof T, string | number>, reportRaw: ReportRaw, keyTranslator: T) => any;
12
12
  /**
13
13
  * Takes company facts data from the SEC and translates them to reports as json objects.
14
14
  */
@@ -1,5 +1,5 @@
1
1
  import { ReportTranslated } from '../../types';
2
- type ExtendableReportProxy = {
2
+ declare type ExtendableReportProxy = {
3
3
  new (report: ReportTranslated): ReportTranslated;
4
4
  };
5
5
  /**
@@ -22,9 +22,8 @@ var ReportTranslatedProxy_1 = require("./ReportTranslatedProxy");
22
22
  var ReportWrapper = /** @class */ (function (_super) {
23
23
  __extends(ReportWrapper, _super);
24
24
  function ReportWrapper(report, reportRaw, reportMap) {
25
- var _this = this;
26
25
  var _a;
27
- _this = _super.call(this, report) || this;
26
+ var _this = _super.call(this, report) || this;
28
27
  _this.report = report;
29
28
  _this.reportMap = reportMap !== null && reportMap !== void 0 ? reportMap : new Map();
30
29
  _this.reportRaw = reportRaw !== null && reportRaw !== void 0 ? reportRaw : {
@@ -5,7 +5,7 @@ interface SplitValueBetweenReportsParams {
5
5
  reports: ReportTranslated[];
6
6
  roundToPlaces: number;
7
7
  }
8
- export type ExcludeNulls<T> = {
8
+ export declare type ExcludeNulls<T> = {
9
9
  [K in keyof T]: Exclude<T[K], null>;
10
10
  };
11
11
  export declare function getSingleNullKey<T>(obj: T): keyof T | null;
@@ -0,0 +1,30 @@
1
+ export interface RequestWrapperOptions {
2
+ maxRequests?: number;
3
+ }
4
+ export interface SendRequestParams {
5
+ url: string;
6
+ }
7
+ interface RequestWrapperArgs<T> {
8
+ urls: string[];
9
+ options?: RequestWrapperOptions;
10
+ sendRequest: (params: SendRequestParams) => Promise<T | T[]>;
11
+ }
12
+ export default class RequestWrapper<T> {
13
+ private results;
14
+ private readonly options;
15
+ private readonly urls;
16
+ private readonly errors;
17
+ private readonly sendRequest;
18
+ private requestCount;
19
+ private isDone;
20
+ constructor(args: RequestWrapperArgs<T>);
21
+ setOptions(options: RequestWrapperOptions): void;
22
+ requestNext(): Promise<T[] | null>;
23
+ skip(count?: number): void;
24
+ requestAll(): Promise<T[]>;
25
+ clearResults(): void;
26
+ getResults(): T[];
27
+ getErrors(): string[];
28
+ getSize(): number;
29
+ }
30
+ export {};
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var RequestWrapper = /** @class */ (function () {
40
+ function RequestWrapper(args) {
41
+ var urls = args.urls, _a = args.options, options = _a === void 0 ? {} : _a, sendRequest = args.sendRequest;
42
+ this.options = options;
43
+ this.urls = urls;
44
+ this.results = [];
45
+ this.errors = [];
46
+ this.sendRequest = sendRequest;
47
+ this.requestCount = 0;
48
+ this.isDone = (options === null || options === void 0 ? void 0 : options.maxRequests) === 0;
49
+ }
50
+ RequestWrapper.prototype.setOptions = function (options) {
51
+ for (var key in options) {
52
+ this.options[key] = options[key];
53
+ }
54
+ };
55
+ RequestWrapper.prototype.requestNext = function () {
56
+ return __awaiter(this, void 0, void 0, function () {
57
+ var _a, maxRequests, url, result, resultArr, e_1, error;
58
+ var _this = this;
59
+ return __generator(this, function (_b) {
60
+ switch (_b.label) {
61
+ case 0:
62
+ _a = this.options.maxRequests, maxRequests = _a === void 0 ? Infinity : _a;
63
+ if (this.requestCount >= maxRequests || this.isDone)
64
+ return [2 /*return*/, null];
65
+ url = this.urls[this.requestCount];
66
+ this.requestCount++;
67
+ if (this.requestCount >= this.urls.length || this.requestCount >= maxRequests) {
68
+ this.isDone = true;
69
+ }
70
+ _b.label = 1;
71
+ case 1:
72
+ _b.trys.push([1, 3, , 4]);
73
+ return [4 /*yield*/, this.sendRequest({ url: url })];
74
+ case 2:
75
+ result = _b.sent();
76
+ resultArr = Array.isArray(result) ? result : [result];
77
+ resultArr.forEach(function (result) { return _this.results.push(result); });
78
+ return [2 /*return*/, resultArr];
79
+ case 3:
80
+ e_1 = _b.sent();
81
+ error = e_1;
82
+ this.errors.push(error.message);
83
+ return [3 /*break*/, 4];
84
+ case 4: return [2 /*return*/, null];
85
+ }
86
+ });
87
+ });
88
+ };
89
+ RequestWrapper.prototype.skip = function (count) {
90
+ if (count === void 0) { count = 1; }
91
+ this.requestCount += count;
92
+ };
93
+ RequestWrapper.prototype.requestAll = function () {
94
+ var _a;
95
+ return __awaiter(this, void 0, void 0, function () {
96
+ var promises, maxRequests, i, resultsArr, resultsFlat;
97
+ return __generator(this, function (_b) {
98
+ switch (_b.label) {
99
+ case 0:
100
+ promises = [];
101
+ maxRequests = (_a = this.options.maxRequests) !== null && _a !== void 0 ? _a : this.urls.length;
102
+ for (i = 0; i < maxRequests; i++) {
103
+ promises.push(this.requestNext());
104
+ }
105
+ return [4 /*yield*/, Promise.all(promises)];
106
+ case 1:
107
+ resultsArr = _b.sent();
108
+ resultsFlat = [];
109
+ resultsArr.forEach(function (results) {
110
+ results === null || results === void 0 ? void 0 : results.forEach(function (result) { return resultsFlat.push(result); });
111
+ });
112
+ this.clearResults();
113
+ this.results = resultsFlat;
114
+ return [2 /*return*/, resultsFlat];
115
+ }
116
+ });
117
+ });
118
+ };
119
+ RequestWrapper.prototype.clearResults = function () {
120
+ this.results = [];
121
+ };
122
+ RequestWrapper.prototype.getResults = function () {
123
+ return this.results;
124
+ };
125
+ RequestWrapper.prototype.getErrors = function () {
126
+ return this.errors;
127
+ };
128
+ RequestWrapper.prototype.getSize = function () {
129
+ return this.urls.length;
130
+ };
131
+ return RequestWrapper;
132
+ }());
133
+ exports.default = RequestWrapper;
@@ -1,6 +1,6 @@
1
1
  import { CompanyFactFrame, CompanyFactListData, MultiCompanyFactFrame } from '../../types';
2
2
  import { SubmissionList } from '../../types/submission.type';
3
- import { IClient } from './Client';
3
+ import { IClient } from '../Client';
4
4
  import { IThrottler } from './Throttler';
5
5
  interface SecApiArgs {
6
6
  throttler: IThrottler;
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var cik_by_symbol_1 = require("../../util/cik-by-symbol");
40
- var Client_1 = require("./Client");
40
+ var Client_1 = require("../Client");
41
41
  var Throttler_1 = require("./Throttler");
42
42
  /**
43
43
  * Gets reports from companies filed with the SEC
@@ -1,55 +1,107 @@
1
- import { CompanyFactFrame, CompanyFactListData, MultiCompanyFactFrame, ReportRaw, SubmissionList } from '../../types';
1
+ import { CompanyFactFrame, CompanyFactListData, CompanyTickerItem, FieldDataResponse, Holder, InsiderTransaction, MultiCompanyFactFrame, ReportRaw, ReportTranslated } from '../../types';
2
+ import { FilingListDetails, FilingListItemTranslated, SubmissionList } from '../../types/submission.type';
3
+ import { IClient } from '../Client';
4
+ import DocumentParser from '../DocumentParser';
2
5
  import ReportParser from '../ReportParser';
3
6
  import { ParseReportsOptions } from '../ReportParser/ReportRawParser';
4
7
  import ReportWrapper from '../ReportParser/ReportWrapper';
5
- import { DownloadCompanyFactsDirectoryParams, IFactsDownloader } from './FactsDownloader';
6
- import { GetFactFrameParams, GetFactParams, GetSymbolParams, ISecConnector } from './SecConnector';
7
- interface SecEdgarApiArgs {
8
- secConnector: ISecConnector;
8
+ import RequestWrapper from './RequestWrapper';
9
+ import { IThrottler } from './Throttler';
10
+ interface SecApiArgs {
11
+ throttler: IThrottler;
12
+ client: IClient;
13
+ cikBySymbol: Record<string, number>;
9
14
  reportParser: ReportParser;
10
- factsDownloader: IFactsDownloader;
15
+ documentParser: DocumentParser;
16
+ }
17
+ export interface CreateRequestWrapperParams {
18
+ /** symbol or cik */
19
+ symbol: string | number;
20
+ filings: FilingListDetails | FilingListItemTranslated[];
21
+ /** earliest allowed filing date that is allowed to be fetched */
22
+ cutoffDate?: Date;
23
+ maxRequests?: number;
24
+ }
25
+ export interface GetSymbolParams {
26
+ /** symbol or cik */
27
+ symbol: string | number;
28
+ }
29
+ export interface GetReportsParams {
30
+ /** symbol or cik */
31
+ symbol: string | number;
32
+ withWrapper?: boolean;
33
+ }
34
+ export interface GetFactParams {
35
+ /** symbol or cik */
36
+ symbol: string | number;
37
+ fact: string;
38
+ taxonomy?: 'us-gaap' | 'dei' | 'invest' | string;
39
+ }
40
+ export interface GetFactFrameParams {
41
+ fact: string;
42
+ frame: string;
43
+ unit?: 'pure' | 'USD' | 'shares' | string;
44
+ taxonomy?: 'us-gaap' | 'dei' | 'invest' | string;
45
+ }
46
+ export interface GetDocumentXMLParams {
47
+ /** symbol or cik */
48
+ symbol: string | number;
49
+ accessionNumber: string;
50
+ primaryDocument: string;
51
+ }
52
+ export interface GetSubmissionsParams {
53
+ /** symbol or cik */
54
+ symbol: string;
55
+ includeTranslated?: boolean;
11
56
  }
12
57
  /**
13
- * Gets company reports and filings from the SEC EDGAR API
14
- *
15
- * Requests are throttled with 120ms delay between requests to avoid rate limiting
58
+ * Gets reports from companies filed with the SEC
16
59
  *
17
60
  * @see https://www.sec.gov/edgar/sec-api-documentation
18
61
  */
19
62
  export default class SecEdgarApi {
20
- private readonly reportParser;
21
- private readonly secConnector;
22
- private readonly factsDownloader;
23
- constructor(args?: SecEdgarApiArgs);
63
+ private readonly baseUrlEdgar;
64
+ private readonly baseUrlSec;
65
+ private readonly throttler;
66
+ private readonly client;
67
+ readonly cikBySymbol: Record<string, number>;
68
+ readonly reportParser: ReportParser;
69
+ readonly documentParser: DocumentParser;
70
+ constructor(args?: SecApiArgs);
71
+ private request;
72
+ private mapFilingListDetails;
73
+ private getCreateRequestUrls;
74
+ /**
75
+ * If symbol is not in cikBySymbol, assume it is a cik. does not make a request
76
+ */
77
+ getCikString(symbol: string | number): string;
24
78
  /**
25
- * endpoint: /submissions/CIK${cik}.json
26
- *
27
79
  * This JSON data structure contains metadata such as current name, former name,
28
80
  * and stock exchanges and ticker symbols of publicly-traded companies. The object’s
29
81
  * property path contains at least one year’s of filing or to 1,000 (whichever is more)
30
82
  * of the most recent filings in a compact columnar data array. If the entity has
31
83
  * additional filings, files will contain an array of additional JSON files and the
32
84
  * date range for the filings each one contains.
33
- */
34
- getSubmissions(params: GetSymbolParams): Promise<SubmissionList>;
35
- /**
36
- * endpoint /api/xbrl/companyconcept/CIK${cik}/${taxonomy}/${fact}.json
37
85
  *
38
- * This API returns all the company concepts data for a company into a single API call:
86
+ * endpoint: `/submissions/CIK${cik}.json`
39
87
  */
40
- getFacts(params: GetSymbolParams): Promise<CompanyFactListData>;
88
+ getSubmissions(params: GetSubmissionsParams): Promise<SubmissionList>;
41
89
  /**
42
- * endpoint /api/xbrl/companyconcept/CIK${cik}/${taxonomy}/${fact}.json
43
- *
44
90
  * The company-concept API returns all the XBRL disclosures from a single company (CIK)
45
91
  * and concept (a taxonomy and tag) into a single JSON file, with a separate array
46
92
  * of facts for each units on measure that the company has chosen to disclose
47
93
  * (e.g. net profits reported in U.S. dollars and in Canadian dollars).
94
+ *
95
+ * endpoint `/api/xbrl/companyconcept/CIK${cik}/${taxonomy}/${fact}.json`
48
96
  */
49
97
  getFact(params: GetFactParams): Promise<CompanyFactFrame>;
50
98
  /**
51
- * endpoint /api/xbrl/frames/${taxonomy}/${fact}/${unit}/${frame}.json
99
+ * Returns all the company concepts data for a company into a single API call:
52
100
  *
101
+ * endpoint `/api/xbrl/companyconcept/CIK${cik}/${taxonomy}/${fact}.json`
102
+ */
103
+ getFacts(params: GetSymbolParams): Promise<CompanyFactListData>;
104
+ /**
53
105
  * The xbrl/frames API aggregates one fact for each reporting entity that is last filed
54
106
  * that most closely fits the calendrical period requested. This API supports for annual,
55
107
  * quarterly and instantaneous data:
@@ -67,6 +119,8 @@ export default class SecEdgarApi {
67
119
  * data is assembled by the dates that best align with a calendar quarter or year. Data
68
120
  * users should be mindful different reporting start and end dates for facts contained
69
121
  * in a frame.
122
+ *
123
+ * endpoint `/api/xbrl/frames/${taxonomy}/${fact}/${unit}/${frame}.json`
70
124
  */
71
125
  getFactFrame(params: GetFactFrameParams): Promise<MultiCompanyFactFrame>;
72
126
  /**
@@ -79,19 +133,75 @@ export default class SecEdgarApi {
79
133
  * for all reports. This includes only 10-K and 10-Q annual and quarterly reports. To include
80
134
  * all reports, use getReportsRaw.
81
135
  */
82
- getReports(params: GetSymbolParams): Promise<ReportWrapper[]>;
136
+ getReports<T extends GetReportsParams>(params: T): Promise<T['withWrapper'] extends true ? ReportWrapper[] : ReportTranslated[]>;
83
137
  /**
84
138
  * Parses reports from company facts. Calculates missing properties and uses a single interface
85
139
  * for all reports.
86
140
  */
87
141
  getReportsRaw(params: GetSymbolParams & ParseReportsOptions): Promise<ReportRaw[]>;
88
142
  /**
89
- * Downloads the companyfacts.zip file and extracts the directory containing all company
90
- * reports available from sec.gov. After downloading, you can use factFileReader and reportParser
91
- * to get and read reports.
143
+ * Gets a list of all tickers and CIKs from `https://www.sec.gov/files/company_tickers.json`
144
+ *
145
+ * Note that they key cik_str is actually a number. To get cik string, you can do `${cik_str}`.padStart(10, '0')
146
+ */
147
+ getCompanyTickerList(): Promise<CompanyTickerItem[]>;
148
+ /**
149
+ * Gets a list of all tickers and CIKs with exchange and company name from `https://www.sec.gov/files/company_tickers_exchange.json`
150
+ *
151
+ * response: { fields: ['cik', 'name', 'ticker', 'exchange'], data: [ [320193,'Apple Inc.','AAPL','Nasdaq'], ... ] }
152
+ */
153
+ getCompanyTickerExchangeList(): Promise<FieldDataResponse<'cik' | 'name' | 'ticker' | 'exchange'>>;
154
+ /**
155
+ * Gets a list of all mutual funds from `https://www.sec.gov/files/company_tickers_mf.json`
156
+ *
157
+ * response: { fields: ['cik','seriesId','classId','symbol'], data: [ [2110,'S000009184','C000024954','LACAX'], ... ] }
158
+ */
159
+ getMutualFundList(): Promise<FieldDataResponse<'cik' | 'seriesId' | 'classId' | 'symbol'>>;
160
+ /**
161
+ * Gets a raw xml document string. the parameters are found in the submission list response. (response.filings.recent or response.filings.recentTranslated)
162
+ *
163
+ * Some form types can be parsed using the DocumentParser such as form 4 (insider transactions) and form 13g (institutional holders)
164
+ *
165
+ * endpoint: `https://www.sec.gov/Archives/edgar/data/${cik}/${accessionNumber}/${primaryDocument}`
166
+ *
167
+ * @see https://www.sec.gov/forms for a list of form types
168
+ */
169
+ getDocumentXML(params: GetDocumentXMLParams): Promise<string>;
170
+ /**
171
+ * Gets a raw xml document string. the url is found in the submission list response. (response.filings.recentTranslated.url)
172
+ *
173
+ * Some form types can be parsed using the DocumentParser such as form 4 (insider transactions) and form 13g (institutional holders)
174
+ *
175
+ * endpoint: `https://www.sec.gov/Archives/edgar/data/${cik}/${accessionNumber}/${primaryDocument}`
176
+ *
177
+ * @see https://www.sec.gov/forms for a list of form types
178
+ */
179
+ getDocumentXMLByUrl(params: {
180
+ url: string;
181
+ }): Promise<string>;
182
+ /**
183
+ * Used for getting insider transactions. extracts insider transaction urls from submission list response, and parses the xml doc.
184
+ *
185
+ * ```ts
186
+ * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
187
+ * const requestWrapper = secEdgarApi.createRequestInsiderTransactions({ symbol: 'AAPL', filings: submissions.filings.recent })
188
+ *
189
+ * const transactions1 = await requestWrapper.requestNext() // array of transactions from most recent doc
190
+ * const transactions2 = await requestWrapper.requestNext() // array of transactions from second most recent doc
191
+ * ```
192
+ */
193
+ createRequestInsiderTransactions(params: CreateRequestWrapperParams): RequestWrapper<InsiderTransaction>;
194
+ /**
195
+ * Used for getting institutional holders. extracts holders urls from submission list response, and parses the xml doc.
196
+ *
197
+ * ```ts
198
+ * const submissions = await secEdgarApi.getSubmissions({ symbol: 'AAPL' })
199
+ * const requestWrapper = secEdgarApi.createRequestHolders({ symbol: 'AAPL', filings: submissions.filings.recent })
92
200
  *
93
- * Note: Over 15GB of data is downloaded and extracted.
201
+ * const holders1 = await requestWrapper.requestNext() // array of holders from most recent doc
202
+ * const holders2 = await requestWrapper.requestNext() // array of holders from second most recent doc
203
+ * ```
94
204
  */
95
- downloadCompanyFactsDirectory(params: DownloadCompanyFactsDirectoryParams): Promise<boolean>;
205
+ createRequestHolders(params: CreateRequestWrapperParams): RequestWrapper<Holder>;
96
206
  }
97
207
  export {};