def __get_chart_type_heatmap__(self):
     graph_list = []
     if self._index in ['', INDICES.ALL]:
         index_list = [
             INDICES.CRYPTO_CCY, INDICES.DOW_JONES, INDICES.NASDAQ100,
             INDICES.Q_FSE
         ]
         # ToDo Check if Q_FSE works...
     else:
         index_list = [self._index]
     for index in index_list:
         index_for_key = index.replace(' ', '_').lower()
         index_for_key = index_for_key if self._index == '' else '{}_{}'.format(
             index_for_key, 'single')
         chart_id = '{}_{}'.format(self._chart_id, index_for_key)
         # print('__get_chart_type_heatmap__: chart_id={}'.format(chart_id))
         chart_name = index
         graph_api = DccGraphApi(chart_id, chart_name)
         graph_api.figure_data = self.__get_heatmap_figure_data__(index)
         graph_api.figure_layout_height = 200
         graph_api.figure_layout_margin = {
             'b': 50,
             'r': 50,
             'l': 50,
             't': 50
         }
         graph_list.append(MyDCC.graph(graph_api))
     return graph_list
예제 #2
0
 def __get_chart_type_stack_group__(self):
     graph_api = DccGraphApi(self._chart_id, '{} ({})'.format(self._chart_name, 'Assets'))
     graph_api.figure_data = self.__get_stack_group_figure_data__()
     # print(graph_api.figure_data)
     graph_api.figure_layout_x_axis_dict = self.__get_figure_layout_x_axis_dict__()
     graph_api.figure_layout_y_axis_dict = self.__get_figure_layout_y_axis_dict__(graph_api)
     return [MyDCC.graph(graph_api)]
예제 #3
0
 def __get_chart_type_area_winner_loser__(self):
     graph_api = DccGraphApi(self._chart_id, '{} ({})'.format(self._chart_name, 'winner & loser'))
     graph_api.figure_data = self.__get_area_winner_loser_figure_data__()
     graph_api.figure_layout_x_axis_dict = None  # dict(type='date',)
     graph_api.figure_layout_y_axis_dict = None  # dict(type='linear', range=[1, 100], dtick=20, ticksuffix='%')
     # graph_api.figure_layout_y_axis_dict = {'type': 'log', 'autorange': True}
     return [MyDCC.graph(graph_api)]
 def __get_dcc_graph_element__(self, detector, graph_api: DccGraphApi):
     pattern_df = graph_api.df
     pattern_list = detector.pattern_list if detector else [
         graph_api.pattern_trade.pattern
     ]
     # print('Pattern_list={}'.format(pattern_list))
     period = detector.sys_config.period if detector else graph_api.period
     # print('_period={} from detector:{}'.format(_period, detector is None))
     candlestick = self.__get_candlesticks_trace__(pattern_df,
                                                   graph_api.ticker_id,
                                                   period)
     # print(candlestick)
     shapes = self.__get_pattern_shape_list__(pattern_list)
     shapes += self.__get_pattern_regression_shape_list__(pattern_list)
     if detector:
         shapes += self.__get_fibonacci_shape_list__(detector)
         shapes += self.__get_wave_peak_shape_list__(detector)
     if graph_api.pattern_trade:
         # graph_api.pattern_trade.ticker_actual.print_ticker('__get_pattern_trade_shape_list__...: last ticker')
         shapes += self.__get_pattern_trade_shape_list__(
             graph_api.pattern_trade)
     if (graph_api.indicator == INDI.BOLLINGER
             or True) and detector is not None:
         indicator_shape_list = self.__get_indicator_shape_list__(
             detector, graph_api.indicator)
         shapes += indicator_shape_list
     graph_api.figure_layout_shapes = [
         my_shapes.shape_parameters for my_shapes in shapes
     ]
     # print(' graph_api.figure_layout_shapes: {}'.format( graph_api.figure_layout_shapes))
     graph_api.figure_layout_annotations = [
         my_shapes.annotation_parameters for my_shapes in shapes
     ]
     graph_api.figure_data = [candlestick]
     return MyDCC.graph(graph_api)
예제 #5
0
 def __get_chart_type_pie__(self):
     graph_api_all = DccGraphApi(self._chart_id + '_all', self._chart_name + ' (all)')
     graph_api_all.figure_data = self.__get_pie_figure_data__('all')
     graph_api_winner = DccGraphApi(self._chart_id + '_winner', self._chart_name + ' (winner)')
     graph_api_winner.figure_data = self.__get_pie_figure_data__('winner')
     graph_api_loser = DccGraphApi(self._chart_id + '_loser', self._chart_name + ' (loser)')
     graph_api_loser.figure_data = self.__get_pie_figure_data__('loser')
     w_h, l_h = self.__get_winner_loser_heights__(graph_api_winner.values_total, graph_api_loser.values_total)
     graph_api_all.figure_layout_height = 800
     graph_api_winner.figure_layout_height = 800
     graph_api_loser.figure_layout_height = 800
     graph_api_loser.figure_layout_height *= w_h
     graph_api_loser.figure_layout_height *= l_h
     graph_api_all.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     graph_api_winner.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     graph_api_loser.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     return [MyDCC.graph(graph_api_all), MyDCC.graph(graph_api_winner), MyDCC.graph(graph_api_loser)]
예제 #6
0
 def get_chart_type_regression(self, master_sale: SalesmanSale):
     graph_api = DccGraphApi(self._chart_id,
                             '{}'.format(master_sale.title),
                             use_title_for_y_axis=False)
     graph_api.figure_data = self.__get_regression_figure_data__(
         master_sale)
     graph_api.figure_layout_x_axis_dict = self.__get_figure_layout_x_axis_dict__(
     )
     # graph_api.figure_layout_y_axis_dict = self.__get_figure_layout_y_axis_dict__(graph_api)
     return [MyDCC.graph(graph_api)]
예제 #7
0
 def get_chart_type_scatter(self, title: str):
     graph_api = DccGraphApi(self._chart_id,
                             '{}: {}'.format(self._chart_name, title),
                             use_title_for_y_axis=False)
     graph_api.figure_data = self.__get_scatter_figure_data__()
     graph_api.figure_layout_x_axis_dict = self.__get_figure_layout_x_axis_dict__(
     )
     graph_api.figure_layout_y_axis_dict = self.__get_figure_layout_y_axis_dict__(
         graph_api)
     return [MyDCC.graph(graph_api)]
    def __get_chart_type_mood__(self):
        graph_list = []
        if self._index in ['', INDICES.ALL]:
            index_list = [
                INDICES.CRYPTO_CCY, INDICES.DOW_JONES, INDICES.NASDAQ100,
                INDICES.Q_FSE
            ]
            # ToDo Check INDICES.Q_FSE
        else:
            index_list = [self._index]

        for index in index_list:
            index_for_key = index.replace(' ', '_').lower()
            index_for_key = index_for_key if self._index == '' else '{}_{}'.format(
                index_for_key, 'single')
            chart_id = '{}_{}'.format(self._chart_id, index_for_key)
            # print('__get_chart_type_heatmap__: chart_id={}'.format(chart_id))
            chart_name = index
            graph_api = DccGraphApi(chart_id, chart_name)
            figure_data, max_value = self.__get_mood_chart_figure_data__(index)
            max_value = int(round(max_value + 5, -1))
            value_interval = max(10, int(round(max_value / 3, -1)))
            tick_vals = list(range(-max_value, max_value, value_interval))
            tick_text = [abs(value) for value in tick_vals]
            graph_api.figure_data = figure_data
            graph_api.figure_layout_height = 300
            graph_api.figure_layout_margin = {
                'b': 50,
                'r': 50,
                'l': 50,
                't': 50
            }
            graph_api.figure_layout_barmode = 'overlay'
            graph_api.figure_layout_bargap = 0.1
            graph_api.figure_layout_x_axis_dict = {}
            graph_api.figure_layout_y_axis_dict = {
                'range': 'Date',
                'tickvals': tick_vals,
                'ticktext': tick_text
            }
            graph_list.append(MyDCC.graph(graph_api))
        return graph_list
예제 #9
0
 def __get_scatter_graph_for_trades__(
         self, scatter_graph_id='trade_statistics_scatter_graph'):
     graph_api = DccGraphApi(scatter_graph_id, 'My Trades')
     graph_api.figure_data = self.__get_scatter_figure_data_for_trades__(
         self._df_trade)
     return MyDCC.graph(graph_api)
 def __get_chart_type_pie__(self):
     graph_api = DccGraphApi(self._chart_id, self._chart_name)
     graph_api.figure_data = self.__get_pie_figure_data__('all')
     graph_api.figure_layout_height = 800
     graph_api.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     return [MyDCC.graph(graph_api)]
예제 #11
0
 def __get_chart_type_heatmap__(self):
     graph_api = DccGraphApi(self._chart_id, '{} ({})'.format(self._chart_name, 'Heatmap'))
     graph_api.figure_data = self.__get_heatmap_figure_data__('Test')
     graph_api.figure_layout_x_axis_dict = None  # dict(type='date',)
     graph_api.figure_layout_y_axis_dict = None  # dict(type='linear', range=[1, 100], dtick=20, ticksuffix='%')
     return [MyDCC.graph(graph_api)]
예제 #12
0
 def __get_chart_type_scatter__(self):
     graph_api = DccGraphApi(self._chart_id, '{} ({})'.format(self._chart_name, 'winner & loser'))
     graph_api.figure_data = self.__get_scatter_figure_data__()
     graph_api.figure_layout_x_axis_dict = self.__get_figure_layout_x_axis_dict__()
     graph_api.figure_layout_y_axis_dict = self.__get_figure_layout_y_axis_dict__(graph_api)
     return [MyDCC.graph(graph_api)]
예제 #13
0
 def __get_chart_type_roc__(self):
     graph_api = DccGraphApi(self._chart_id, '{} ({})'.format(self._chart_name, 'Models'))
     graph_api.figure_data = self.__get_roc_figure_data__()
     graph_api.figure_layout_x_axis_dict = self.__get_figure_layout_x_axis_dict__()
     graph_api.figure_layout_y_axis_dict = self.__get_figure_layout_y_axis_dict__(graph_api)
     return [MyDCC.graph(graph_api)]
예제 #14
0
 def __get_chart_type_confusion_regression__(self):
     graph_api = DccGraphApi(self._chart_id, '{} ({})'.format(self.predictor, self.x_variable))
     graph_api.figure_data = self.__get_confusion_regression_figure_data__()
     graph_api.figure_layout_x_axis_dict = self.__get_figure_layout_x_axis_dict__()
     # graph_api.figure_layout_y_axis_dict = self.__get_figure_layout_y_axis_dict__(graph_api)
     return [MyDCC.graph(graph_api)]
예제 #15
0
 def __get_chart_type_predictor__(self):
     graph_api = DccGraphApi(self._chart_id, '{} ({})'.format(self._chart_name, 'master_predictor'))
     graph_api.figure_data = self.__get_scatter_figure_data_for_predictor__()
     return [MyDCC.graph(graph_api)]