※当サイトの記事には、広告・プロモーションが含まれます。

EDGAR(Electronic Data Gathering, Analysis, and Retrieval system)のデータを取得してみる

dcross.impress.co.jp

⇧ DXが進んでいない話って、政府組織にも言える気がするんだけどな...

EDGAR(Electronic Data Gathering, Analysis, and Retrieval system)とは

Securities and Exchange Commission (SEC)」の説明によると、

www.sec.gov

EDGAR, the Electronic Data Gathering, Analysis, and Retrieval system, is the primary system for companies and others submitting documents under the Securities Act of 1933, the Securities Exchange Act of 1934, the Trust Indenture Act of 1939, and the Investment Company Act of 1940.

https://www.sec.gov/edgar/about

Containing millions of company and individual filings, EDGAR benefits investors, corporations, and the U.S. economy overall by increasing the efficiency, transparency, and fairness of the securities markets. The system processes about 3,000 filings per day, serves up 3,000 terabytes of data to the public annually, and accommodates 40,000 new filers per year on average. 

https://www.sec.gov/edgar/about

アメリカの証券市場に関する情報を管理するシステムっぽい。

EDGARで管理されてるデータに対しては、

www.sec.gov

Overview

All companies, foreign and domestic, are required to file registration statements, periodic reports, and other forms electronically through the U.S. Securities and Exchange Commission's EDGAR (Electronic Data Gathering, Analysis, and Retrieval) system. Anyone can access and download this information for free or query it through a variety of EDGAR public searches.

https://www.sec.gov/os/accessing-edgar-data

⇧ 誰でも無料で活用できますということらしい。

データの形式としては、

www.sec.gov

New data APIs now available

Submissions by company and extracted XBRL data are available via RESTful APIs on data.sec.gov, offering JSON formatted data.

https://www.sec.gov/developer

⇧ 日本の金融庁が管理しているシステムの「EDINET(Electronic Disclosure for Investors' NETwork・エディネット)」で扱っているのと同様に「XBRL(eXtensible Business Reporting Language)」が対応してる他、JSONも対応可能になっている模様。

で、

www.sec.gov

"data.sec.gov" was created to host RESTful data Application Programming Interfaces (APIs) delivering JSON-formatted data to external customers and to web pages on SEC.gov. These APIs do not require any authentication or API keys to access.

https://www.sec.gov/edgar/sec-api-documentation

APIの利用に関して認証のためのAPIキーとか不要と言ってはいるけども、

www.sec.gov

The SEC does not allow botnets or automated tools to crawl the site. Any request that has been identified as part of a botnet or an automated tool outside of the acceptable policy will be managed to ensure fair access for all users.

Please declare your user agent in request headers:

https://www.sec.gov/os/accessing-edgar-data

⇧ リクエストヘッダーは必要ということらしいのだけど、リクエストヘッダーの値については、どんな制約があるのか特に記載はないので、

github.com

⇧ 上記サイト様を参考に、適当な値で良いと思われる。

EDGAR(Electronic Data Gathering, Analysis, and Retrieval system)のデータを取得してみる

基本的には、

www.sec.gov

CIK

  • EDGAR assigns to filers a unique numerical identifier, known as a Central Index Key (CIK), when they sign up to make filings to the SEC. CIK numbers remain unique to the filer; they are not recycled.
  • Current list of all CIKs matched with entity name (13 MB, text file). Note that this list includes funds and individuals and is historically cumulative for company names. Thus a given CIK may be associated with multiple names in the case of company or fund name changes, and the list contains some entities that no longer file with the SEC.

https://www.sec.gov/os/accessing-edgar-data

⇧ CIK(Central Index Key)というもので一意に識別できるように管理されているようなので、CIK(Central Index Key)で個別の情報を取得することができるっぽい。

CIK(Central Index Key)のリストが公開されているので、試しにGoogleのCIKを探してみた。

⇧ なんか、複数あるけど、そのうちの1つのCIKで情報の取得を試してみた。

⇧ 正常なレスポンスが取得できていそうではありますと。

で、別のAPIはエラーになりました...

う~む、ドキュメントの「XBRL data APIs」に記載のAPIが上手くいかない...

qiita.com

⇧ 上記サイト様によりますと、仕様変更があったらしいので、何かしら影響してるんだろうか...

あと考えられるケースとしては、企業がデータを開示してないから、データが存在しないってことでエラーになるのかね?

「EDGAR Application Programming Interfaces」のページでAPIについての情報が少な過ぎて、何とも言えませんな...

どうやら、

stackoverflow.com

⇧ stackoverflowに載ってたCIKで試したところ、

⇧ responseが返ってきたので、企業がデータを開示してない場合にエラーになるってことのよう。であるなら、企業がデータを公開してるかどうかを判定することができるようなAPIを用意しておいて欲しいよね...

そして、SDK(Software Development Kit)のようなものも特に用意されていなさそうなので、プログラミング経由でデータを取得するには、非公式のライブラリを利用するか、独自に「EDGAR Application Programming Interfaces」をプログラミングで実行するようにラッパーしていくしか無さそうってことですかね...

ちなみに、

github.com

⇧ 非公式なライブラリとしては、Python向けのライブラリがあるようですが、2023年2月19日(日)時点で確認したところ、6年前で更新は止まっているっぽい。

まぁ、何て言うか、IT先進国のアメリカであっても、政府組織のデジタル化については意外に整備されていないんだな、という印象ですかね。

毎度モヤモヤ感が半端ない...

今回はこのへんで。