MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Extracting Information from XBRL Files

  • To: mathgroup at
  • Subject: [mg127092] Re: Extracting Information from XBRL Files
  • From: Gregory Lypny <gregory.lypny at>
  • Date: Fri, 29 Jun 2012 04:52:38 -0400 (EDT)
  • Delivered-to:
  • References: <>

Hi Hans,

This looks cool, and it is very kind of you!  I'm going to dissect it and run some tests.  I have, in fact, downloaded to CIKs using FinancialData[].  I flag the missing ones, double-check for those where the ticker symbol may be ambiguous, and then manually gather those from EDGAR by searching for ticker or company name.  With the CIKs, I download the text of the companies main page from EDGAR (the one that lists the documents available) and extract the US state location and US state of incorporation, which are variables in my research.  Your function will help me learn to drill down through the documents.  Good stuff!

No matter where this goes, you have earned an acknowledgment on our research paper!



On Thu, Jun 28, 2012, at 4:51 AM, Hans Michel wrote:

> Greg:
> Try
> processSECDEF14A[ticker_] :=
>  Module[{cik, paddedCIK, urlfullpath, searchResults, textOnlylinks,
>    top1linkfromList, formDEF14A}, cik = FinancialData[ticker , =
>   paddedCIK = IntegerString[ToExpression[cik], 10, 10];
>   urlfullpath =
>    ""; <> paddedCIK =
>     "+TYPE%3DDEF&first=1994&last12";
>   searchResults = Import[urlfullpath, "Hyperlinks"];
>   textOnlylinks =
>    Select[searchResults, Function[StringMatchQ[#, "*.txt"] == =
>   top1linkfromList = First[textOnlylinks];
>   formDEF14A = Import[top1linkfromList, "Plaintext"];
>   Return[formDEF14A];
>   ];
> The following Module will return raw text file from the SEC website =
for the
> last available Form DEF 14A.
> This file contains SGML, HTML and uuenconde jpgs or gifs or pdfs.
> I tried
> processSECDEF14A["GE"]
> and
> processSECDEF14A["MSFT"]
> with success.
> The code need to be tighter for when cases fail. And Parsing the HTML
> between <TEXT> </TEXT> tags is left for review.
> The bulk of the data mining for key terms such as "Summary =
Compensation" and
> look for the HTML Tables near those terms.
> Hans
> -----Original Message-----
> From: Gregory Lypny [mailto:gregory.lypny at]
> Sent: Wednesday, June 27, 2012 10:13 AM
> To: MathGroup; Hans Michel
> Subject: Re: Extracting Information from XBRL Files
> Thanks Hans,
> I'm just flying by the seat of my pants.  I will try your suggestion.  =
> need compensation tables from the DEF 14A.  I spoke to a SEC =
> yesterday, and she told me that DEF 14A is not yet available in XBRL =
> I like your download-to-notebook-format idea.
> Thanks once again,
> Gregory
> On Wed, Jun 27, 2012, at 10:19 AM, Hans Michel wrote:
>> Gregory:
>> I have used Mathematica to extract data from the SEC. (Mostly the
>> older EDGAR format).
>> Not all of the data on the SEC website is available in XBRL format.
>> For some forms I prefer the EDGAR SGML-XML-HTML-Text hybrid fixed
>> schema and taxonomy without the PDF.
>> The XBRL structure brings so much framing with it that parsing the
>> core xml file in Mathematica should be straight forward. But =
>> the associates schemas and definitions are not so easy.
>> The SEC provide a RSS feed of interactive data. Mathematica can take=

>> an RSS fee and change it to Notebook format.
>> Import["";, "RSS"]
>> With that note book format you can write code to download and extract=

>> the zip files source.
>> Parsing the main XML data file in a XBRL file is straight forward. It=

>> is attaching the schema and the meaning which could be done in
>> Mathematica but to do so one would have to have a compeling reason =
>> to use other tools that are specifically made for such task.
>> I am familiar with SGML data I would consider the XBRL format a =
>> of SGML-XML even though the use of schemas (DTD) and entity files =
>> What are you trying to do?
>> Hans
>> -----Original Message-----
>> From: Gregory Lypny [mailto:gregory.lypny at]
>> Sent: Wednesday, June 27, 2012 3:09 AM
>> To: mathgroup at
>> Subject: Extracting Information from XBRL Files
>> Hello everyone,
>> This is a long shot, but has anyone used Mathematica to parse XBRL
>> files, such as those accessible from the SEC's (US Securities and
>> Exchange
>> Commission) EDGAR system?  XBRL is a tagged format, an offshoot of =
>> Gregory Lypny

  • Prev by Date: Re: Extracting Information from XBRL Files
  • Next by Date: Re: Extracting Information from XBRL Files
  • Previous by thread: Re: Extracting Information from XBRL Files
  • Next by thread: Re: Extracting Information from XBRL Files