Пример #1
0
def test_parse_DEI10Q_RRDonnelley():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/sam-20130629.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    dei_obj = xbrl_parser.parseDEI(xbrl)

    serializer = DEISerializer()
    result = serializer.dump(dei_obj)

    assert result.data['trading_symbol'] == "SAM"
    assert result.data['company_name'] == "BOSTON BEER CO INC"
    assert result.data['shares_outstanding'] == 4007355.0
    assert result.data['public_float'] == 0.0
Пример #2
0
def test_parse_DEI10Q_RRDonnelley():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/sam-20130629.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    dei_obj = xbrl_parser.parseDEI(xbrl)

    serializer = DEISerializer()
    result = serializer.dump(dei_obj)

    assert result.data['trading_symbol'] == "SAM"
    assert result.data['company_name'] == "BOSTON BEER CO INC"
    assert result.data['shares_outstanding'] == 4007355.0
    assert result.data['public_float'] == 0.0
Пример #3
0
xbrl_parser = XBRLParser()
xbrl = xbrl_parser.parse(open("sample_report/apple-2013-qtr1-10Q-xbrl.xml"))

gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                 doc_date="20121229",
                                 context="current",
                                 ignore_errors=0)
print("Cash generated by operating activities: " +
      str(gaap_obj.net_cash_flows_operating))
print("Cash generated by/(used in) investing activities: " +
      str(gaap_obj.net_cash_flows_investing))
print("Cash used in financing activities: " +
      str(gaap_obj.net_cash_flows_financing))
print("Total shareholders’ equity: " + str(gaap_obj.stockholders_equity))
print("Total assets: " + str(gaap_obj.assets))
print("Operating income: " + str(gaap_obj.operating_income_loss))
print("Net income: " + str(gaap_obj.net_income_loss))
print("Liabilities: " + str(gaap_obj.assets - gaap_obj.stockholders_equity))
print("Total net sales: " + str(gaap_obj.revenues))

dei_obj = xbrl_parser.parseDEI(xbrl)
# Serialize the DEI data
serializer = DEISerializer()
result = serializer.dump(dei_obj)

# serializer = GAAPSerializer()
# result = serializer.dump(gaap_obj)
#
# print(result.data)
Пример #4
0
xbrl = xbrl_parser.parse("../tests/sam-20130629.xml")

# Parse just the GAAP data from the xbrl object
gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                 doc_date="20130629",
                                 context="current",
                                 ignore_errors=0)

# Serialize the GAAP data
serializer = GAAPSerializer()
result = serializer.dump(gaap_obj)

# Print out the serialized GAAP data
print(result)

# Parse just the DEI data from the xbrl object
dei_obj = xbrl_parser.parseDEI(xbrl)

# Serialize the DEI data
serializer = DEISerializer()
result = serializer.dump(dei_obj)

# Print out the serialized DEI data
print(result)

# Parse just the Custom data from the xbrl object
custom_obj = xbrl_parser.parseCustom(xbrl)

# Print out the Custom data as an array of tuples
print(custom_obj())