有没有办法从 EDGAR 中的 Interactive Data 网页自动下载 excel 文件以获取代码列表,而无需手动搜索 EDGAR 上的每个代码?或者有没有一种方法可以为一系列公司访问 XBRL,而不必再次物理访问 EDGAR 中的每个页面?我遇到了麻烦,因为我无法弄清楚如何生成唯一的 URL,因为最后六个数字与那一年的归档顺序和帐号有关。
问问题
1371 次
1 回答
0
Edgar 没有 API。我编写了一个包作为 Edgar 的接口,允许通过代码进行搜索。解析搜索结果页面的位如下。整个文件位于https://github.com/andrewkittredge/financial_fundamentals/blob/master/financial_fundamentals/edgar.py。
SEARCH_URL = ('http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&'
'CIK={symbol}&type={filing_type}&dateb=&owner=exclude&count=100')
def _get_document_page_urls(symbol, filing_type):
'''Get the edgar filing document pages for the CIK.
'''
search_url = SEARCH_URL.format(symbol=symbol, filing_type=filing_type)
search_results_page = get_edgar_soup(url=search_url)
xbrl_rows = [row for row in
search_results_page.findAll('tr') if
row.find(text=re.compile('Interactive Data'))]
for xbrl_row in xbrl_rows:
documents_page = xbrl_row.find('a', {'id' : 'documentsbutton'})['href']
documents_url = 'http://sec.gov' + documents_page
yield documents_url
于 2015-05-27T15:20:26.267 回答