greedo / python-xbrl

xbrl parser written in Python :bulb:

Home Page:https://pypi.python.org/pypi/python-xbrl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installed on OSX 10.9 using "sudo pip" but GAAPSerializer not found

alagalah opened this issue · comments

sudo pip install --upgrade python-xbrl
Requirement already up-to-date: python-xbrl in /Library/Python/2.7/site-packages
Requirement already up-to-date: pytest in /Library/Python/2.7/site-packages (from python-xbrl)
Requirement already up-to-date: pep8 in /Library/Python/2.7/site-packages (from python-xbrl)
Requirement already up-to-date: marshmallow in /Library/Python/2.7/site-packages (from python-xbrl)
Requirement already up-to-date: beautifulsoup4 in /Library/Python/2.7/site-packages (from python-xbrl)
Requirement already up-to-date: ordereddict in /Library/Python/2.7/site-packages (from python-xbrl)
Requirement already up-to-date: lxml in /Library/Python/2.7/site-packages (from python-xbrl)
Requirement already up-to-date: six in /Library/Python/2.7/site-packages (from python-xbrl)
Requirement already up-to-date: py>=1.4.25 in /Library/Python/2.7/site-packages (from pytest->python-xbrl)
Cleaning up...

from xbrl import XBRLParser, GAAPSerializer

xbrl_parser = XBRLParser()

xbrl = XBRLParser.parse(file("~/Desktop/csco-20141025.xml"))

gaap_obj = XBRLParser.parseGAAP(xbrl, doc_date="20141025", doc_type="10-Q", context="current")
serialized = GAAPSerializer(gaap_obj)
print serialized.data

from xbrl import XBRLParser, GAAPSerializer

ImportError: cannot import name GAAPSerializer

import xbrl

xbrl_parser = xbrl.XBRLParser()

xbrl_ptr = xbrl_parser.parse(file("/Users/alagalah/Desktop/csco-20141025.xml"))

gaap_obj = xbrl_parser.parseGAAP(xbrl_ptr, doc_date="20141025", doc_type="10-Q", context="current")

mySerialized = xbrl.xbrl.GAAPSerializer(gaap_obj)
print mySerialized.data

Thank you, sir! I was able to get it working with a little mucking about but I will review the example!

What would be interesting is how to better obtain XBRL sources. I have some code I'm working on using the FreeEdgar FTP XBRL indexes along with Ticker-> CIK resolution. If you have some thoughts along these lines would love to chat with you.

Edgar's FTP XBRLs are pretty good, you could also scrape the site. I have some examples in https://github.com/greedo/DIY-FilingsResearch/blob/master/ingestor.py for both Edgar (US) and Sedar (Canada)

This is great! I noticed you had a requirements.txt but you don't list
lucene. I assume I should follow everything here:
https://lucene.apache.org/pylucene/install.html ??

On Fri, Dec 26, 2014 at 8:34 AM, Joe Cabrera notifications@github.com
wrote:

Edgar's FTP XBRL are pretty good, you could also scrape the site. I have
some examples in
https://github.com/greedo/DIY-FilingsResearch/blob/master/ingestor.py for
both Edgar (US) and Sedar (Canada)


Reply to this email directly or view it on GitHub
#14 (comment).

@alagalah You can use that same requirements.txt for just the download and scraping, you will not need lucene. I packaged what you need with an example at https://github.com/greedo/DIY-FilingsResearch/releases/tag/0.0.1 just download ingestor.tar.gz