Exemplo n.º 1
0
def test_000778_cash_flow_statement():
    correct_timestamps = ['2018-09-30', '2018-06-30', '2018-03-31', '2017-12-31', '2017-09-30', '2017-06-30',
                          '2017-03-31', '2016-12-31', '2016-09-30', '2016-06-30', '2016-03-31', '2015-12-31',
                          '2015-09-30', '2015-06-30', '2015-03-31', '2014-12-31', '2014-09-30', '2014-06-30',
                          '2014-03-31', '2013-12-31', '2013-09-30', '2013-06-30', '2013-03-31', '2012-12-31',
                          '2012-09-30', '2012-06-30', '2012-03-31', '2011-12-31', '2011-09-30', '2011-06-30',
                          '2011-03-31', '2010-12-31', '2010-09-30', '2010-06-30', '2010-03-31', '2009-12-31',
                          '2009-09-30', '2009-06-30', '2009-03-31', '2008-12-31', '2008-09-30', '2008-06-30',
                          '2008-03-31', '2007-12-31', '2007-09-30', '2007-06-30', '2007-03-31', '2006-12-31',
                          '2006-09-30', '2006-06-30', '2006-03-31', '2005-12-31', '2005-09-30', '2005-06-30',
                          '2005-03-31', '2004-12-31', '2004-09-30', '2004-06-30', '2004-03-31', '2003-12-31',
                          '2003-09-30', '2003-06-30', '2003-03-31', '2002-12-31', '2002-06-30', '2001-12-31',
                          '2001-06-30', '2000-12-31', '2000-06-30', '1999-12-31', '1998-12-31', '1998-06-30']
    result = fundamental.get_cash_flow_statement(session=session, provider=Provider.EASTMONEY, return_type='domain',
                                                 codes=['000778'], end_timestamp='2018-12-30',
                                                 order=CashFlowStatement.timestamp.desc())
    assert len(correct_timestamps) == len(result)
    timestamps = [to_time_str(item.report_date) for item in result]
    assert set(correct_timestamps) == set(timestamps)
    latest: CashFlowStatement = result[0]

    assert latest.cash_from_selling == 27784000000
    assert latest.tax_refund == 60700000
    assert latest.cash_from_other_op == 1463000000
    assert latest.total_op_cash_inflows == 29310000000
    assert latest.cash_to_goods_services == 21210000000
    assert latest.cash_to_employees == 1460000000
    assert latest.taxes_and_surcharges == 2016000000
    assert latest.cash_to_other_related_op == 573700000
    assert latest.total_op_cash_outflows == 25260000000
    assert latest.net_op_cash_flows == 4050000000

    assert latest.cash_from_disposal_of_investments == 556500000
    assert latest.cash_from_returns_on_investments == 44180000
    assert latest.cash_from_disposal_fixed_intangible_assets == 457200
    assert latest.cash_from_disposal_subsidiaries == 1046000000
    assert latest.cash_from_other_investing == 553000000
    assert latest.total_investing_cash_inflows == 2201000000
    assert latest.cash_to_acquire_fixed_intangible_assets == 2521000000
    assert latest.cash_to_investments == 1808000000
    assert latest.total_investing_cash_outflows == 4329000000
    assert latest.net_investing_cash_flows == -2128000000

    assert latest.cash_from_accepting_investment == 24500000
    assert latest.cash_from_subsidiaries_accepting_minority_interest == 24500000
    assert latest.cash_from_borrowings == 10080000000
    assert latest.cash_from_issuing_bonds == 997000000
    assert latest.cash_from_other_financing == 200000000
    assert latest.total_financing_cash_inflows == 11300000000
    assert latest.cash_to_repay_borrowings == 11940000000
    assert latest.cash_to_pay_interest_dividend == 892100000
    assert latest.cash_to_other_financing == 328500000
    assert latest.total_financing_cash_outflows == 13160000000
    assert latest.net_financing_cash_flows == -1862000000

    assert latest.foreign_exchange_rate_effect == 21350000
    assert latest.net_cash_increase == 81240000
    assert latest.cash_at_beginning == 5078000000
    assert latest.cash == 5159000000
Exemplo n.º 2
0
def test_000001_cash_flow_statement():
    correct_timestamps = [
        '2018-09-30', '2018-06-30', '2018-03-31', '2017-12-31', '2017-09-30',
        '2017-06-30', '2017-03-31', '2016-12-31', '2016-09-30', '2016-06-30',
        '2016-03-31', '2015-12-31', '2015-09-30', '2015-06-30', '2015-03-31',
        '2014-12-31', '2014-09-30', '2014-06-30', '2014-03-31', '2013-12-31',
        '2013-09-30', '2013-06-30', '2013-03-31', '2012-12-31', '2012-09-30',
        '2012-06-30', '2012-03-31', '2011-12-31', '2011-09-30', '2011-06-30',
        '2011-03-31', '2010-12-31', '2010-09-30', '2010-06-30', '2010-03-31',
        '2009-12-31', '2009-09-30', '2009-06-30', '2009-03-31', '2008-12-31',
        '2008-09-30', '2008-06-30', '2008-03-31', '2007-12-31', '2007-09-30',
        '2007-06-30', '2007-03-31', '2006-12-31', '2006-09-30', '2006-06-30',
        '2006-03-31', '2005-12-31', '2005-09-30', '2005-06-30', '2005-03-31',
        '2004-12-31', '2004-09-30', '2004-06-30', '2004-03-31', '2003-12-31',
        '2003-09-30', '2003-06-30', '2003-03-31', '2002-12-31', '2002-06-30',
        '2001-12-31', '2001-06-30', '2000-12-31', '2000-06-30', '1999-12-31',
        '1999-06-30', '1998-12-31', '1998-06-30'
    ]
    result = fundamental.get_cash_flow_statement(
        session=session,
        provider=Provider.EASTMONEY,
        return_type='domain',
        codes=['000001'],
        end_timestamp='2018-09-30',
        order=CashFlowStatement.timestamp.desc())
    assert len(correct_timestamps) == len(result)
    timestamps = [to_time_str(item.timestamp) for item in result]
    assert set(correct_timestamps) == set(timestamps)
    latest: CashFlowStatement = result[0]

    # 00000000
    assert latest.fi_deposit_increase == 104700000000
    assert latest.fi_borrow_from_central_bank_increase == 18960000000
    assert latest.fi_deposit_in_others_decrease == 60880000000
    assert latest.fi_lending_and_buy_repurchase_decrease == 12330000000
    assert latest.fi_lending_decrease == 12270000000
    assert latest.fi_buy_repurchase_decrease == 56000000
    assert latest.fi_cash_from_interest_commission == 133700000000
    assert latest.cash_from_other_op == 20540000000
    assert latest.total_op_cash_inflows == 381200000000
    assert latest.fi_loan_advance_increase == 250300000000
    assert latest.fi_borrowing_and_sell_repurchase_decrease == 14350000000
    assert latest.fi_borrowing_decrease == 10190000000
    assert latest.fi_sell_repurchase_decrease == 4155000000
    assert latest.fi_cash_to_interest_commission == 56760000000

    assert latest.cash_to_employees == 12930000000
    assert latest.taxes_and_surcharges == 20010000000
    assert latest.cash_to_other_related_op == 38150000000
    assert latest.total_op_cash_outflows == 392500000000
    assert latest.net_op_cash_flows == -11310000000

    assert latest.cash_from_disposal_of_investments == 348900000000
    assert latest.cash_from_returns_on_investments == 21080000000
    assert latest.cash_from_disposal_fixed_intangible_assets == 108000000
    assert latest.total_investing_cash_inflows == 370100000000
    assert latest.cash_to_investments == 294600000000
    assert latest.cash_to_acquire_fixed_intangible_assets == 1518000000
    assert latest.total_investing_cash_outflows == 296100000000
    assert latest.net_investing_cash_flows == 73960000000
    assert latest.cash_from_issuing_bonds == 581200000000
    assert latest.total_financing_cash_inflows == 581200000000
    assert latest.cash_to_repay_borrowings == 612500000000
    assert latest.fi_cash_to_pay_interest == 2511000000
    assert latest.cash_to_pay_interest_dividend == 3209000000
    assert latest.total_financing_cash_outflows == 618300000000
    assert latest.net_financing_cash_flows == -37080000000
    assert latest.foreign_exchange_rate_effect == 2018000000
    assert latest.net_cash_increase == 27590000000
    assert latest.cash_at_beginning == 137000000000
    assert latest.cash == 164600000000