Пример #1
0
    def test_get_analysis_quarterly_1101(self):
        analyzer = CashFlowAnalyzer(stock_symbol='1101', period='Q')
        net_profit = analyzer.get_net_profit().get_map()
        self.assertEqual(net_profit[datetime.date(2015, 6, 30)], 2728)
        self.assertEqual(net_profit[datetime.date(2015, 3, 31)], 975)

        cash_flow = analyzer.get_cash_flow_from_operating_activities().get_map()
        self.assertEqual(cash_flow[datetime.date(2015, 6, 30)], 5575)
        self.assertEqual(cash_flow[datetime.date(2015, 3, 31)], 5654)

        cash_flow = analyzer.get_cash_flow_from_investing_activities().get_map()
        self.assertEqual(cash_flow[datetime.date(2015, 6, 30)], -4712)
        self.assertEqual(cash_flow[datetime.date(2015, 3, 31)], -1500)

        cash_flow = analyzer.get_cash_flow_from_financing_activities().get_map()
        self.assertEqual(cash_flow[datetime.date(2015, 6, 30)], 4424)
        self.assertEqual(cash_flow[datetime.date(2015, 3, 31)], -3245)
        
        cash_flow = analyzer.get_free_cash_flow().get_map()
        self.assertEqual(cash_flow[datetime.date(2015, 6, 30)], 5575 - 4712)
        self.assertEqual(cash_flow[datetime.date(2015, 3, 31)], 5654 - 1500)

        cash_flow = analyzer.get_free_cash_flow().get_map()
        self.assertEqual(cash_flow[datetime.date(2015, 6, 30)], 5575 - 4712)
        self.assertEqual(cash_flow[datetime.date(2015, 3, 31)], 5654 - 1500)

        ratio = analyzer.get_long_term_investments_to_assets_ratio().get_map()
        self.assertAlmostEqual(ratio[datetime.date(2015, 6, 30)], 0.0648, places=4)
        self.assertAlmostEqual(ratio[datetime.date(2015, 3, 31)], 0.0695, places=4)
Пример #2
0
    def test_get_analysis_yearly_1101(self):
        analyzer = CashFlowAnalyzer(stock_symbol='1101', period='Y')
        net_profit = analyzer.get_net_profit().get_map()
        self.assertEqual(net_profit[datetime.date(2014, 12, 31)], 16584)
        self.assertEqual(net_profit[datetime.date(2013, 12, 31)], 15119)

        cash_flow = analyzer.get_cash_flow_from_operating_activities().get_map()
        self.assertEqual(cash_flow[datetime.date(2014, 12, 31)], 19987)
        self.assertEqual(cash_flow[datetime.date(2013, 12, 31)], 21974)

        cash_flow = analyzer.get_cash_flow_from_investing_activities().get_map()
        self.assertEqual(cash_flow[datetime.date(2014, 12, 31)], -3098)
        self.assertEqual(cash_flow[datetime.date(2013, 12, 31)], -1249)

        cash_flow = analyzer.get_cash_flow_from_financing_activities().get_map()
        self.assertEqual(cash_flow[datetime.date(2014, 12, 31)], -11731)
        self.assertEqual(cash_flow[datetime.date(2013, 12, 31)], -20773)
        
        cash_flow = analyzer.get_free_cash_flow().get_map()
        self.assertEqual(cash_flow[datetime.date(2014, 12, 31)], 19987 - 3098)
        self.assertEqual(cash_flow[datetime.date(2013, 12, 31)], 21974 - 1249)
        
        ratio = analyzer.get_long_term_investments_to_assets_ratio().get_map()
        self.assertAlmostEqual(ratio[datetime.date(2014, 12, 31)], 0.0730, places=4)
        self.assertAlmostEqual(ratio[datetime.date(2013, 12, 31)], 0.0679, places=4)
Пример #3
0
 def __build_data_param(self, param):
     analyzer = CashFlowAnalyzer(stock_symbol=param['stock_symbol'],
                                 period=param['period'])
     net_profit = analyzer.get_net_profit().get()
     cash_flow_from_operating_activities = analyzer.get_cash_flow_from_operating_activities(
     ).get()
     cash_flow_from_investing_activities = analyzer.get_cash_flow_from_investing_activities(
     ).get()
     cash_flow_from_financing_activities = analyzer.get_cash_flow_from_financing_activities(
     ).get()
     free_cash_flow = analyzer.get_free_cash_flow().get()
     accumulated_free_cash_flow = analyzer.get_accumulated_free_cash_flow(
     ).get()
     long_term_investments_to_assets_ratio = analyzer.get_long_term_investments_to_assets_ratio(
     ).get()
     return {
         'net_profit': {
             'value': net_profit,
             'format': 'integer',
         },
         'cash_flow_from_operating_activities': {
             'value': cash_flow_from_operating_activities,
             'format': 'integer',
         },
         'cash_flow_from_investing_activities': {
             'value': cash_flow_from_investing_activities,
             'format': 'integer',
         },
         'cash_flow_from_financing_activities': {
             'value': cash_flow_from_financing_activities,
             'format': 'integer',
         },
         'free_cash_flow': {
             'value': free_cash_flow,
             'format': 'integer',
         },
         'accumulated_free_cash_flow': {
             'value': accumulated_free_cash_flow,
             'format': 'integer',
         },
         'long_term_investments_to_assets_ratio': {
             'value': long_term_investments_to_assets_ratio,
             'format': 'percentage',
         },
     }
Пример #4
0
 def __build_data_param(self, param):
     analyzer = CashFlowAnalyzer(stock_symbol=param['stock_symbol'], period=param['period'])
     net_profit = analyzer.get_net_profit().get()
     cash_flow_from_operating_activities = analyzer.get_cash_flow_from_operating_activities().get()
     cash_flow_from_investing_activities = analyzer.get_cash_flow_from_investing_activities().get()
     cash_flow_from_financing_activities = analyzer.get_cash_flow_from_financing_activities().get()
     free_cash_flow = analyzer.get_free_cash_flow().get()
     accumulated_free_cash_flow = analyzer.get_accumulated_free_cash_flow().get()
     long_term_investments_to_assets_ratio = analyzer.get_long_term_investments_to_assets_ratio().get()
     return {
         'net_profit' : { 
             'value' : net_profit,
             'format' : 'integer',
         },
         'cash_flow_from_operating_activities' : {
             'value' : cash_flow_from_operating_activities,
             'format' : 'integer',
         },
         'cash_flow_from_investing_activities' : {
             'value' : cash_flow_from_investing_activities,
             'format' : 'integer',
         },
         'cash_flow_from_financing_activities' : {
             'value' : cash_flow_from_financing_activities,
             'format' : 'integer',
         },
         'free_cash_flow' : {
             'value' : free_cash_flow,
             'format' : 'integer',
         },
         'accumulated_free_cash_flow' : {
             'value' : accumulated_free_cash_flow,
             'format' : 'integer',
         },
         'long_term_investments_to_assets_ratio' : {
             'value' : long_term_investments_to_assets_ratio,
             'format' : 'percentage',
         },
     }