示例#1
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())
示例#2
0
 def _init_widgets(self):
     self.table_widget = components.TableWidget(
         widget_title="Correlation Matrix",
         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())
示例#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())
示例#4
0
 def _init_widgets(self):
     self.title = factories.atomic_widget_factory(component='heading',
                                                  title=None)
     self.table_widget = components.TableWidget(
         widget_title="Optimization Results",
         layer=utilities.get_next_layer(self.objectName()))
     self.arg_widget = components.ArgumentWidget(
         calculate_function=self.optimize,
         clear_function=self.clear,
         controls=self.controls,
         layer=utilities.get_next_layer(self.objectName()))
     self.setLayout(QtWidgets.QHBoxLayout())
示例#5
0
 def _init_widgets(self):
     self.composite_widget = components.CompositeWidget(
         keys.keys['GUI']['TEMP']['PROFILE'],
         widget_title="Risk Analysis",
         table_title="CAPM Risk Profile",
         graph_title="Risk-Return Plane",
         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())
示例#6
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())
示例#7
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()
示例#8
0
 def _init_widgets(self):
     self.tab_container = factories.layout_factory(layout='vertical-box')
     self.tab_widget = QtWidgets.QTabWidget()
     self.arg_widget = components.ArgumentWidget(
         calculate_function=self.calculate,
         clear_function=self.clear,
         controls=self.controls,
         layer=utilities.get_next_layer(self.objectName()))
     # TODO: restrict arg symbol input to one symbol somehow
     self.setLayout(QtWidgets.QHBoxLayout())
示例#9
0
 def _init_widgets(self):
     self.arg_widget = components.ArgumentWidget(
         calculate_function=self.calculate,
         clear_function=self.clear,
         controls=self.controls,
         layer=utilities.get_next_layer(self.objectName()))
     self.title = factories.atomic_widget_factory(
         component='heading', title='Distribution of Returns')
     self.tab_container = factories.layout_factory(layout='vertical-box')
     self.tab_widget = QtWidgets.QTabWidget()
     self.setLayout(QtWidgets.QHBoxLayout())
示例#10
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()