Disclosures/Text¶
It is easy to access the contents of SEC filings from Calcbench.
Calcbench parses the sections of the 10-K/Q such as Management’s Discussion and Analysis and Risk Factors. See the list of available sections @ https://www.calcbench.com/disclosure_list
- class calcbench.disclosures.DisclosureContent(**kwargs)¶
Cooresponds to XBRLDisclosure on the server
- CIK: str¶
- accession_id: int¶
- blobs: Sequence[str]¶
- property contents: str¶
- Return type:
str
- disclosure_type: int¶
- document_type: str¶
Public end_date As Date Public filing_date As Date Public date_reported As DateTime
- entity_id: int¶
- entity_name: str¶
- fact_id: int¶
- fiscal_period: str¶
- fiscal_year: int¶
- is_detail: bool¶
- label: str¶
- last_in_group: bool¶
- local_name: str¶
- networkID: int¶
- sec_accession_number: str¶
- sec_html_url: str¶
- table_list: list¶
- ticker: str¶
- class calcbench.disclosures.DisclosureSearchResults(**kwargs)¶
Represents a disclosure.
- CIK: str¶
- SEC_URL: str¶
- accession_id: int¶
- blob_id: str¶
- calendar_period: Period¶
- calendar_year: int¶
- content: DisclosureContent | None = None¶
- property date_reported: datetime | None¶
Time (EST) the document was available from Calcbench
- Return type:
Optional
[datetime
]
- description: str¶
- disclosure_type_name: str¶
- document_type: str¶
- entity_id: int¶
- entity_name: str¶
- fact_id: int¶
- filing_date: str¶
- filing_type: int¶
- fiscal_period: Period¶
- fiscal_year: int¶
- footnote_type: str¶
- footnote_type_title: FootnoteTypeTitle¶
- get_contents()¶
Content of the document, with the filers HTML
- Return type:
str
- get_contents_text()¶
Contents of the HTML of the document
- Return type:
str
- get_disclosure()¶
Content of the document, with the filers HTML
- Return type:
- guide_link: str¶
- id_detail: bool¶
- local_name: str¶
- network_id: int¶
- page_url: str¶
- period_end_date: str¶
- received_date: str¶
- sec_accession_number: str¶
- sec_filing_id: int¶
- ticker: str¶
- class calcbench.disclosures.FootnoteTypeTitle(value)¶
An enumeration.
- AccountingPolicies = 'Accounting Policies'¶
- AdditionalSections = 'Additional 10-K and 10-Q Sections'¶
- BusinessCombinations = 'Business Combinations'¶
- CashAndEquivalents = 'Cash And Cash Equivalents'¶
- CommitmentsAndContigencies = 'Commitment And Contingencies'¶
- Compensation = 'Compensation Related Costs Postemployment Benefits'¶
- Debt = 'Debt'¶
- Derivatives = 'Derivative Instruments And Hedging Activities'¶
- EigthKsByItemType = '8-Ks By Item Type'¶
- Equity = 'Equity'¶
- Goodwill = 'Goodwill & Intangible Assets'¶
- IncomeTax = 'Income Tax'¶
- InterimReporting = 'Interim Reporting'¶
- Inventory = 'Inventory & PPE'¶
- Leases = 'Leases'¶
- Other = 'Other'¶
- OtherExpenses = 'Other Expenses'¶
- PolicyTextBlock = 'Policy Text Block'¶
- RelatedDocuments = 'Related Documents (8-Ks, Proxys & Letters)'¶
- RevenueFromContractWithCustomer = 'Revenuefrom Contract With Customer'¶
- Segment = 'Segment'¶
- TextBlock = 'Text Block'¶
- calcbench.disclosures.disclosure_dataframe(company_identifiers=[], disclosure_names=[], all_history=False, year=None, period=None, progress_bar=None, period_type=None, identifier_key='ticker', block_tag_names=[], use_fiscal_period=True, entire_universe=False, batch_size=100)¶
Disclosures/Footnotes in a DataFrame
formerly know as “document_dataframe”
- Parameters:
company_identifiers (
Sequence
[Union
[str
,int
]]) – list of tickers or CIK codesdisclosure_names (
Sequence
[str
]) – The sections to retrieve, see the full list @ https://www.calcbench.com/disclosure_list. You cannot request XBRL and non-XBRL sections in the same request. eg. [‘Management’s Discussion And Analysis’, ‘Risk Factors’]all_history (
bool
) – Search all time periodsyear (
Optional
[int
]) – The year to searchperiod (
Union
[Period
,Literal
[0, 1, 2, 3, 4],None
]) – period of data to getperiod_type (
Optional
[PeriodType
]) – Only applicable when other period data not supplied. Use “annual” to only search end-of-year documents, “quarterly” is all history all periodsprogress_bar (
Optional
[tqdm
]) – Pass a tqdm progress bar to keep an eye on things.identifier_key (
Literal
[‘ticker’, ‘CIK’]) – how to index the returned DataFrame.use_fiscal_period (
bool
) – Index disclosure by fiscal, as opposed to calendar periods.entire_universe (
bool
) – Data for all companies
- Return type:
DataFrame
- Returns:
A DataFrame of DisclosureSearchResults indexed by document name -> company identifier.
Usage:
>>> data = calcbench.disclosure_dataframe(company_identifiers=["msft", "goog"], >>> all_history=True, >>> disclosure_names=["ManagementsDiscussionAndAnalysis", "RiskFactors"], >>> period_type="annual") >>> word_counts = data.applymap(lambda disclosure: disclosure.get_contents_text().split() >>> na_action="ignore")
- calcbench.disclosures.disclosure_search(company_identifiers=None, full_text_search_term=None, year=None, period=Period.Annual, period_type=None, document_type=None, block_tag_name=None, entire_universe=False, use_fiscal_period=False, document_name=None, all_history=False, updated_from=None, batch_size=100, sub_divide=False, all_documents=False, disclosure_names=[], progress_bar=None, accession_id=None, all_text_blocks=False)¶
Footnotes and other text
Search for footnotes and other sections of 10-K, see https://www.calcbench.com/footnote.
Formerly know as “document_search”
- Parameters:
company_identifiers (
Optional
[Sequence
[Union
[str
,int
]]]) – list of tickers or CIK codesyear (
Optional
[int
]) – Year to get data forfull_text_search_term (
Optional
[str
]) – Use Calcbench’s full text index to search documents. Documents are returned in decreasing order of relevance as defined by TF-IDF. Use Lucene query syntax, https://lucene.apache.org/core/2_9_4/queryparsersyntax.html. You can restrict the documents search by setting the document_type. For instance, ‘commentLetter’, ‘EarningsPressReleaseFrom8K’, ‘eightk_all_types’period (
Union
[Period
,Literal
[0, 1, 2, 3, 4],None
]) – period of data to get. 0 for annual data, 1, 2, 3, 4 for quarterly data.use_fiscal_period (
bool
) – interpret the passed period as a fiscal period, as opposed to calendar periodperiod_type (
Optional
[PeriodType
]) – only applicable when other period data not supplied. Use “annual” to only search end-of-year disclosures, “quarterly” is all history all periodsdocument_type (
Optional
[str
]) – Search a specific document type.disclosure_names (
Sequence
[str
]) – The sections to retrieve, see the full list @ https://www.calcbench.com/disclosure_list. You cannot request XBRL and non-XBRL sections in the same request. eg. [‘Management’s Discussion And Analysis’, ‘Risk Factors’]all_history (
bool
) – Search all time periodsupdated_from (
Optional
[date
]) – include filings from this date and after.sub_divide (
bool
) – return the disclosures split into sections based on headers.all_documents (
bool
) – all of the documents for a single company/period.entire_universe (
bool
) – Search all companiesprogress_bar (
Optional
[tqdm
]) – Pass a tqdm progress bar to keep an eye on things.block_tag_name (
Optional
[str
]) – Level 2 or 3 XBRL tag. See the list of FASB tags @ https://www.calcbench.com/disclosure_list#blockTagsall_text_blocks (
bool
) – All level 1 and accounting policy text blocks
- Return type:
Generator
[DisclosureSearchResults
,None
,None
]- Returns:
A iterator of DisclosureSearchResults
Usage:
>>> import tqdm >>> sp500 = calcbench.tickers(index="SP500") >>> with tqdm.tqdm() as progress_bar: >>> risk_factors = calcbench.disclosure_search( >>> company_identifiers=sp500, >>> disclosure_names=["RiskFactors"], >>> all_history=True, >>> progress_bar=progress_bar >>> )