Finance/XBRL: Tidy Approaches to Financial Statement Analysis

Hello,

I am newish to the R community and curious about a topic related to R-Finance.

Can anyone point me to resources (tutorials, code-examples, etc) of utilizing tidyverse and tidy data concepts in extracting financial statement information that is contained with an XBRL filing with the US SEC?

I know that there are multiple companies that have built tools for extracting financial statement data (Bloomberg, CapitalIQ, Sentieo, etc); but my needs are a little bit different and I wanted to see if I could build something from scratch using R.

Any help/guidance would be greatly appreciated!

There's an XBRL package that has a parser:


I don't have personal experience, but a couple things you might want to look at:

The one below isn't in tidy format, necessarily, but could easily be wrangled into it (basically make the year into a variable rather than a column header):

1 Like

Thank you @mara!
I have used the XBRL package to parse some filings. It seems very promising for my use case and I will continue to explore it further.

I had not come across the readme section of https://github.com/bergant/XBRLFiles before. This looks very helpful indeed! I was really looking for examples and sample code on how to extract specific elements within a filing. Looks like this might serve that purpose.

I appreciate the suggested resources.

There's a wrapper if you want to hit the API directly,


From there you can map XBRL to JSON it looks like, though I wouldn't call that the easiest way of dealing with data in R…
https://www.xbrl.org/xbrl-json-making-xbrl-easier/

Along with more generic tools (e.g. tidyr, dplyr, purrr), you may want to take a look at the roomba package from this year's rOpenSci unconf, which aims for some "generic" API response tidying

1 Like

Thanks! Was not familiar with roomba. Will definitely check it out.

1 Like