Sticking to the facts

If you want to get great data on a company then using the Company Facts API might be what you need. This article looks at the upgraded Company Facts API in edgartools

Sticking to the facts

Let's talk about Company Facts. Let's say you are doing fundamental research into a company, and you need Research and Development Expenses for the last 10 years to feed into your model. So is the solution to get the last 10 10-K filings, get the XBRL for each then find us-gaap:ResearchAndDevelopmentExpense? This is easy enough.

There is an easier and potentially a better way. I recently spent a couple days revamping the Facts API in edgartools and I'm liking the results. It is built on the SEC's Company Facts API which provides accumulated facts about a company from their filings over time, mainly from their 10-K and 10-Q filings. This means you can get that R&D time series you were looking for. If you're clever you can even assemble the Income Statement.

The new Fact API provides a lot of this functionality. You can for example, get the EntityFacts for TSLA.

from edgar import *
from edgar.entity import EntityFacts

c = Company("TSLA")

facts = c.facts

For Tesla there are over 22,441 facts since 2011, and you can also see at a glance the key financial metrics like Total Assets and Shares Outstanding. Facts are also classified by statement type which gives us the ability to retrieve financial statements like Balance Sheet, CashFlow or IncomeStatement. So you can do this

income_statement = facts.income_statement()

This isn't perfect since the classification is currently incomplete. However this opens another pathway to get financial statement.

The Query API

Another great feature is the ability to query the facts. So you can do the following

print(facts
      .query()
      .by_concept("us-gaap:GrossProfit")
      .by_period_length(12)
      .pivot_by_period()
)

and get a table of annual GrossProfit.

Conclusion

The EntityFacts API is still new and still needs improvement and your feedback is very welcome.

Visit the Entity Facts documentation for details.

Subscribe to EdgarTools

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe