Closed A-Sur590 closed 9 years ago
Also I get error as:
Reason: AttributeError: 'altova_v2_xbrl_taxonomy.Item' object has no attribute 'MONETARY_ITEM_TYPE' Details: python-traceback: File "/Desktop/sec-xbrl-master/extractRatios2.py", line 97, in printFacts if fact.concept.item_type==fact.concept.MONETARY_ITEM_TYPE: python-traceback: File "/Desktop/sec-xbrl-master/extractRatios2.py", line 137, in on_xbrl_finished docType = printFacts( documentType ) python-error: An error occured while processing Python script 'file://Desktop/sec-xbrl-master/extractRatios2.py'!
with RaptorXML+XBRL v2015r3 we introduced a much enhanced python api v2 version, though all previous python api versions are still supported. the python api version can be selected using the --script-api-version
. the script valSECfilings.py
uses python api v1 (but was never updated to use this option).
i've just added --script-api-version=1
to the arguments of raptorxmlxbrl
in valSECfilings.py/validatejob
. after pulling the latest sources your sample should run without modified sources.
you might find the documentation at RatorXML Python API Versions useful.
So because of that the "Reason: AttributeError: 'altova_v2_xbrl.Instance' object has no attribute 'items' " error or "Reason: AttributeError: 'altova_v2_xbrl_taxonomy.Item' object has no attribute 'MONETARY_ITEM_TYPE' " error is coming in extractRatio.py script?
yes, correct. the script was invoked with api v2 (the default) and xbrl.taxonomy.Item changed slightly in v2. it is now xbrl.taxonomy.Item.item_type of type xbrl.ItemType.MONETARY (a enum class). similiar for v1 xbrl.Instance.items which is now xbrl.Instance.child_items ...
Thanks for resolving the issue! Also do you know if there is any dictionary of what parameters can be downloaded and extracted from the SEC fillings? Like in your extractRatio.py code you extract "CashAndCashEquivalentsAtCarryingValue","CashCashEquivalentsAndShortTermInvestments" etc. So is there any place which lists what suck kind of parameters can be extracted?
unfortunately, there is no such dictionary. the standard concepts (like CashAndCashEquivalentsAtCarryingValue
) are defined in the us-gaap taxonomies (distributed with RaptorXML+XBRLServer in subfolder etc/xbr/US-GAAP*
) but companies are free to define their own concepts. additionally the standard concepts are not used the same way in SEC filings from different companies. you might find sec_data_mining useful. it provides examples of how to retrieve the reported value for Net Income
from SEC filings or iterate over all reported facts.
in RaptorXML-Examples we provide *-linkbase-traversal.py
scripts which you can use to get a list of concepts for a specific taxonomy or instance. thay can be applied to SEC filings as well the standard us-gaap taxonomies in etc/xbr/US-GAAP*
.
I was working on extractRatios.py and first when I executed:
python valSECfilings.py -y 2014 -m 8 -k AAPL -s extractRatios.py
I got error as:
Warning: An error occured while processing Python script 'file:///home/cloudera/Desktop/sec-xbrl-master/extractRatios.py'! Reason: AttributeError: 'altova_v2_xbrl.Instance' object has no attribute 'items' Details: python-traceback: File "/home/cloudera/Desktop/sec-xbrl-master/extractRatios.py", line 78, in factFinder for f in instance.items: python-traceback: File "/home/cloudera/Desktop/sec-xbrl-master/extractRatios.py", line 123, in on_xbrl_finished documentType = factFinder( instance, sec_ns, "DocumentType" ) python-error: An error occured while processing Python script 'file:///home/cloudera/Desktop/sec-xbrl-master/extractRatios.py'!
Also initialy I was getting error as: Warning: The Python script 'file:///home/cloudera/Desktop/sec-xbrl-master/extractRatios.py' does not contain the callback function 'on_xbrl_finished'.
then I changed the name of the function from Warning: The Python script 'file:///home/cloudera/Desktop/sec-xbrl-master/extractRatios.py' does not contain the callback function 'on_xbrl_valid' to Warning: The Python script 'file:///home/cloudera/Desktop/sec-xbrl-master/extractRatios.py' does not contain the callback function 'on_xbrl_finished' in extractRatios.py but then I am getting the error I posted in beginning