Esempio n. 1
0
    def calculate(self):
        symbols = self.arg_widget.get_symbol_input()
        discount = self.arg_widget.get_control_input('discount')

        for symbol in symbols:
            if discount is None:
                discount = markets.cost_of_equity(
                    ticker=symbol,
                    start_date=self.arg_widget.get_control_input('start_date'),
                    end_date=self.arg_widget.get_control_input('end_date'))
            dividends = services.get_dividend_history(ticker=symbol)
            cashflow = Cashflow(sample=dividends, discount_rate=discount)
            graph_widget = components.GraphWidget(
                tmp_graph_key=
                f'{keys.keys["GUI"]["TEMP"]["DIVIDEND"]}_{symbol}',
                layer=utilities.get_next_layer(self.objectName()))
            plotter.plot_cashflow(
                ticker=symbol,
                cashflow=cashflow,
                show=False,
                savefile=
                f'{settings.TEMP_DIR}/{keys.keys["GUI"]["TEMP"]["DIVIDEND"]}_{symbol}'
            )

            graph_widget.set_pixmap()
            self.tab_widget.addTab(graph_widget, f'{symbol} DDM PLOT')
        self.tab_widget.show()
        self.arg_widget.fire()
Esempio n. 2
0
 def _init_widgets(self):
     self.graph_widget = components.GraphWidget(
         tmp_graph_key=keys.keys['GUI']['TEMP']['FRONTIER'],
         layer=utilities.get_next_layer(self.objectName()))
     self.arg_widget = components.ArgumentWidget(
         calculate_function=self.calculate,
         clear_function=self.clear,
         controls=self.controls,
         layer=utilities.get_next_layer(self.objectName()))
     self.setLayout(QtWidgets.QHBoxLayout())
Esempio n. 3
0
 def _init_widgets(self):
     self.graph_widget = components.GraphWidget(
         keys.keys['GUI']['TEMP']['AVERAGES'],
         layer=utilities.get_next_layer(self.objectName()))
     self.arg_widget = components.ArgumentWidget(
         calculate_function=self.calculate,
         clear_function=self.clear,
         controls=self.controls,
         layer=utilities.get_next_layer(self.objectName()),
         mode=components.SYMBOLS_SINGLE)
     self.setLayout(QtWidgets.QHBoxLayout())
Esempio n. 4
0
    def _init_widgets(self):
        self.graph_widget = components.GraphWidget(
            tmp_graph_key=keys.keys['GUI']['TEMP']['YIELD'],
            layer=utilities.get_next_layer(self.objectName()))
        self.arg_widget = components.ArgumentWidget(
            calculate_function=self.calculate,
            clear_function=self.clear,
            controls=self.controls,
            layer=utilities.get_next_layer(self.objectName()),
            mode=components.SYMBOLS_NONE)
        # TODO: initialize arg widget WITHOUT tickers

        self.setLayout(QtWidgets.QHBoxLayout())
Esempio n. 5
0
    def calculate(self):
        symbols = self.arg_widget.get_symbol_input()
        start_date = self.arg_widget.get_control_input('start_date')
        end_date = self.arg_widget.get_control_input('end_date')

        for symbol in symbols:
            qq_plot = components.GraphWidget(
                tmp_graph_key=f'{keys.keys["GUI"]["TEMP"]["QQ"]}_{symbol}',
                layer=utilities.get_next_layer(self.objectName()))
            dist_plot = components.GraphWidget(
                tmp_graph_key=f'{keys.keys["GUI"]["TEMP"]["DIST"]}_{symbol}',
                layer=utilities.get_next_layer(self.objectName()))
            returns = statistics.get_sample_of_returns(ticker=symbol,
                                                       start_date=start_date,
                                                       end_date=end_date,
                                                       daily=True)
            qq_series = estimators.qq_series_for_sample(sample=returns)
            plotter.plot_qq_series(
                ticker=symbol,
                qq_series=qq_series,
                show=False,
                savefile=
                f'{settings.TEMP_DIR}/{keys.keys["GUI"]["TEMP"]["QQ"]}_{symbol}'
            )
            plotter.plot_return_histogram(
                ticker=symbol,
                sample=returns,
                show=False,
                savefile=
                f'{settings.TEMP_DIR}/{keys.keys["GUI"]["TEMP"]["DIST"]}_{symbol}',
            )
            dist_plot.set_pixmap()
            qq_plot.set_pixmap()
            self.tab_widget.addTab(qq_plot, f'{symbol} QQ Plot')
            self.tab_widget.addTab(dist_plot, f'{symbol} Distribution')
        self.tab_widget.show()
        self.arg_widget.fire()