I've written a code which, when I add in a ticker for a company, should give me the revenue data for every year available in SEC API. Specifically, from https://data.sec.gov/api/xbrl/companyfacts/CIK##########.json.
The hashtags are substituted for a CIK code.
The code works, until it doesn't. This is because one company can have their revenue listed under Revenues
, while another may have it listed under RevenueFromContractWithCustomerExcludingAssessedTax
or sometimes they're split between both for some reason.
I'll run it with two companies to show my problem.
Is there a way I could find the revenue by using one term that will work for all tickers? In the forms this data belongs to, the 10-K's, they're all under the term 'Net Sales.'
Please help.
I've tried to search through all the possible terms which could mean revenue but I got like 3 pages worth of text and it's too much ;-;.