UNPKG

@mangosteen/edgar-url

Version:

Get SEC EDGAR URLs for filings and entities.

120 lines 5.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFilingPageUrl = exports.getFilingHeaderUrl = exports.getFilingUrl = exports.geEntityJsonUrl = exports.getOwnerTransactionsPageUrl = exports.getInsiderTransactionsPageUrl = exports.getEntityPageUrl2 = exports.getEntityPageUrl = void 0; const url_1 = require("url"); const utils_1 = require("./utils"); /** * Gets an entity (company, person, etc.) landing page URL in primary EDGAR system. * * @example `https://www.sec.gov/edgar/browse/?CIK=320193` * @param cik Entity's Central Index Key. * @returns URL. */ function getEntityPageUrl(cik) { const url = new url_1.URL('https://www.sec.gov/edgar/browse/'); url.searchParams.append("CIK", (0, utils_1.formatCik)(cik)); return url.toString(); } exports.getEntityPageUrl = getEntityPageUrl; /** * Gets an entity landing page URL in auxiliary EDGAR system. * * @example `https://www.edgarcompany.sec.gov/servlet/CompanyDBSearch?page=detailed&main_back=1&cik=0000320193` * @param cik Entity's Central Index Key. * @returns URL. */ function getEntityPageUrl2(cik) { const url = new url_1.URL('https://www.edgarcompany.sec.gov/servlet/CompanyDBSearch?page=detailed&main_back=1'); url.searchParams.append("cik", (0, utils_1.formatCik)(cik)); return url.toString(); } exports.getEntityPageUrl2 = getEntityPageUrl2; /** * Gets URL of EDGAR page showing transactions of entity securities by insiders. * * @example `https://www.sec.gov/cgi-bin/own-disp?action=getissuer&CIK=0000320193` * @param cik Entity's Central Index Key. * @returns URL. */ function getInsiderTransactionsPageUrl(cik) { const url = new url_1.URL('https://www.sec.gov/cgi-bin/own-disp?action=getissuer'); url.searchParams.append("CIK", (0, utils_1.formatCik)(cik)); return url.toString(); } exports.getInsiderTransactionsPageUrl = getInsiderTransactionsPageUrl; /** * Gets URL of EDGAR page showing transactions of securities owned by the entity. * * @example `https://www.sec.gov/cgi-bin/own-disp?action=getowner&CIK=0000320193` * @param cik Entity's Central Index Key. * @returns URL. */ function getOwnerTransactionsPageUrl(cik) { const url = new url_1.URL('https://www.sec.gov/cgi-bin/own-disp?action=getowner'); url.searchParams.append("CIK", (0, utils_1.formatCik)(cik)); return url.toString(); } exports.getOwnerTransactionsPageUrl = getOwnerTransactionsPageUrl; /** * Gets URL of a JSON document with entity info. * * @example `https://data.sec.gov/submissions/CIK0000320193.json` * @param cik Entity's Central Index Key. * @returns URL. */ function geEntityJsonUrl(cik) { return new url_1.URL(`https://data.sec.gov/submissions/CIK${(0, utils_1.formatCik)(cik)}.json`).toString(); } exports.geEntityJsonUrl = geEntityJsonUrl; /** * Gets URL of a filing in .txt format, which contains all of the following: * - Filing header (in a human-readable text format) * - Main document * - Supplemental documents * - Attachments * * This file seems to be updated when corrections are submitted. * * @example `https://www.sec.gov/Archives/edgar/data/0000320193/0000320193-20-000096.txt` * @param cik Entity's Central Index Key. * @param accessionNumber Filing accession number. * @returns URL. */ function getFilingUrl(cik, accessionNumber) { (0, utils_1.validateAccessionNumber)(accessionNumber); cik = (0, utils_1.repairCik)(cik, accessionNumber); return new url_1.URL(`https://www.sec.gov/Archives/edgar/data/${(0, utils_1.formatCik)(cik)}/${accessionNumber}.txt`).toString(); } exports.getFilingUrl = getFilingUrl; /** * Gets URL of a filing header in SGML format. The header is in machine-readable format. * The header file does not seem to be updated when corrections are submitted. * * @example `https://www.sec.gov/Archives/edgar/data/320193/000032019320000096/0000320193-20-000096.hdr.sgml` * @param cik Entity's Central Index Key. * @param accessionNumber Filing accession number. * @returns URL. */ function getFilingHeaderUrl(cik, accessionNumber) { (0, utils_1.validateAccessionNumber)(accessionNumber); cik = (0, utils_1.repairCik)(cik, accessionNumber); const f_cik = (0, utils_1.formatCik)(cik), f_accessionNumber = accessionNumber.replace(/\-+/g, ''); return new url_1.URL(`https://www.sec.gov/Archives/edgar/data/${f_cik}/${f_accessionNumber}/${accessionNumber}.hdr.sgml`).toString(); } exports.getFilingHeaderUrl = getFilingHeaderUrl; /** * Gets a URL of EDGAR page showing details of a specific filing. * * @example `https://www.sec.gov/Archives/edgar/data/0000320193/000032019320000096/0000320193-20-000096-index.htm` * @param cik Entity's Central Index Key. * @param accessionNumber Filing accession number. * @returns URL. */ function getFilingPageUrl(cik, accessionNumber) { (0, utils_1.validateAccessionNumber)(accessionNumber); cik = (0, utils_1.repairCik)(cik, accessionNumber); const fCik = (0, utils_1.formatCik)(cik); return new url_1.URL(`https://www.sec.gov/Archives/edgar/data/${fCik}/${accessionNumber}-index.htm`).toString(); } exports.getFilingPageUrl = getFilingPageUrl; //# sourceMappingURL=index.js.map