Reputation: 31
I would love to analyze balance sheets and income statements using R. I have come across package finstr.
There is an example of downloading AAPL stock data using this link accessing the XBRL data.
I would like to ask, how do I actually find out the link to the company I want? For example TSLA. I thought that it would be enough just to change the ticker and the date in the URL, obviously it does not work that way. I have been struggling for days to actually find that out, searching through SEC.
Basically I would like to get to a point, where I would be able to generate a link to any company in R (in case I want to write a loop in order to download financial statements data for al the listed companies).
Upvotes: 3
Views: 1281
Reputation: 11
SEC provides high level explanations for accessing EDGAR Data. https://www.sec.gov/os/accessing-edgar-data
To match company names to CIK, https://www.sec.gov/Archives/edgar/cik-lookup-data.txt or https://www.sec.gov/files/company_tickers_exchange.json
With the CIK, https://www.sec.gov/edgar/sec-api-documentation . "Each entity's current filing history is available at the following URL:" https://data.sec.gov/submissions/CIK##########.json.
I used these .json files in the last month to find 10-K URL for a list of 2,000 ticker symbols. I used R. The coding was not without challenges for my intermediate level R skills.
Upvotes: 1
Reputation: 3002
The URL in your link is https://www.sec.gov/Archives/edgar/data/320193/000119312514383437/aapl-20140927.xml
. The first set of numbers - 320193
, in your example - represents the Central Index Key (CIK) for the company with the leading zeros removed. The CIK for APPL is 0000320193, which matches the first set of numbers in that URL. You'd need the CIK for the company in which you're interested to build that URL. If you go to https://www.sec.gov/Archives/edgar/data/320193/
, for example, you'll see all of the folders available for AAPL - the company with the CIK of 0000320193
, remembering to remove leading zeros when constructing that URL.
If you're looking for the CIK for a company, you can also find it through a URL. Perhaps you can start by navigating to https://www.sec.gov/cgi-bin/browse-edgar?CIK=[StockSymbol]&action=getcompany&owner=exclude
to get the CIK and other information. For your example, go to https://www.sec.gov/cgi-bin/browse-edgar?CIK=TSLA&action=getcompany&owner=exclude
. You may be able to find more information at that initial search page.
Upvotes: 1