def test_000778_income_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-09-30', '2002-06-30', '2002-03-31', '2001-12-31', '2001-06-30', '2000-12-31', '2000-06-30', '1999-12-31', '1999-06-30', '1998-12-31', '1998-06-30', '1997-12-31', '1997-06-30', '1996-12-31', '1995-12-31', '1994-12-31'] result = get_income_statement(session=session, provider='eastmoney', return_type='domain', codes=['000778'], end_timestamp='2018-12-30', order=IncomeStatement.report_date.desc(), time_field='report_date') assert len(correct_timestamps) == len(result) timestamps = [to_time_str(item.report_date) for item in result] assert set(correct_timestamps) == set(timestamps) latest: IncomeStatement = result[0] assert latest.operating_income == 31710000000 assert latest.total_operating_costs == 29230000000 assert latest.operating_costs == 26220000000 assert latest.rd_costs == 185500000 assert latest.net_change_in_insurance_contract_reserves == 0 assert latest.business_taxes_and_surcharges == 359700000 assert latest.sales_costs == 771400000 assert latest.managing_costs == 472900000 assert latest.financing_costs == 397500000 assert latest.assets_devaluation == 824400000 assert latest.investment_income == 104100000 assert latest.investment_income_from_related_enterprise == 61290000 assert latest.operating_profit == 2637000000 assert latest.non_operating_income == 38340000 assert latest.non_operating_costs == 221700000 assert latest.total_profits == 2454000000 assert latest.tax_expense == 579600000 assert latest.net_profit == 1874000000 assert latest.net_profit_as_parent == 1811000000 assert latest.net_profit_as_minority_interest == 63570000 assert latest.deducted_net_profit == 1897000000 assert latest.eps == 0.4537 assert latest.diluted_eps == 0.4537 assert latest.other_comprehensive_income == -521000000 assert latest.other_comprehensive_income_as_parent == -522400000 assert latest.other_comprehensive_income_as_minority_interest == 1403000 assert latest.total_comprehensive_income == 1353000000 assert latest.total_comprehensive_income_as_parent == 1288000000 assert latest.total_comprehensive_income_as_minority_interest == 64980000
def test_000001_income_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-09-30', '2002-06-30', '2002-03-31', '2001-12-31', '2001-09-30', '2001-06-30', '2001-03-31', '2000-12-31', '2000-06-30', '1999-12-31', '1999-06-30', '1998-12-31', '1998-06-30', '1997-12-31', '1997-06-30', '1996-12-31', '1996-06-30', '1995-12-31', '1995-06-30', '1994-12-31', '1994-06-30', '1993-12-31', '1993-06-30', '1992-12-31', '1991-12-31', '1990-12-31', '1989-12-31' ] result = get_income_statement(session=session, provider='eastmoney', return_type='domain', codes=['000001'], end_timestamp='2018-12-30', order=IncomeStatement.report_date.desc(), time_field='report_date') assert len(correct_timestamps) == len(result) timestamps = [to_time_str(item.report_date) for item in result] assert set(correct_timestamps) == set(timestamps) latest: IncomeStatement = result[0] assert latest.operating_income == 86660000000 assert latest.fi_net_interest_income == 54530000000 assert latest.fi_interest_income == 121700000000 assert latest.fi_interest_expenses == 67130000000 assert latest.fi_net_incomes_from_fees_and_commissions == 23710000000 assert latest.fi_incomes_from_fees_and_commissions == 28920000000 assert latest.fi_expenses_for_fees_and_commissions == 5218000000 assert latest.investment_income == 7099000000 assert latest.fi_income_from_fair_value_change == 1047000000 assert latest.fi_income_from_exchange == -40000000 assert latest.fi_other_income == 144000000 assert latest.operating_costs == 26430000000 assert latest.business_taxes_and_surcharges == 847000000 assert latest.fi_operate_and_manage_expenses == 25580000000 assert latest.operating_profit == 26610000000 assert latest.non_operating_income == 14000000 assert latest.non_operating_costs == 62000000 assert latest.total_profits == 26570000000