def plot_dollar_value_bars(self, group=False):
        """Plot the dollar value of portfolio holdings for the most recent day
        as a bar plot.

        Args:
            group: Whether to aggregate based on symbol_groups in config.
        """
        dollar_values = self._get_dollar_values(group).ix[-1, :]
        percents = dollar_values / np.sum(dollar_values)
        labels = plot_utils.get_percent_strings(percents)
        title = 'Portfolio Weights\n'

        plot = dollar_values.plot(kind='bar', alpha=self._BAR_ALPHA)
        plot.set_title(title, color=self._TEXT_COLOR)
        plot.set_xticklabels(dollar_values.index, rotation=0)
        plot_utils.format_y_ticks_as_dollars(plot)
        plot_utils.add_bar_labels(plot, labels, self._TEXT_COLOR)
        return plot
Example #2
0
    def plot_dollar_value_bars(self, group=False):
        """Plot the dollar value of portfolio holdings for the most recent day
        as a bar plot.

        Args:
            group: Whether to aggregate based on symbol_groups in config.
        """
        dollar_values = self._get_dollar_values(group).ix[-1, :]
        percents = dollar_values / np.sum(dollar_values)
        labels = plot_utils.get_percent_strings(percents)
        title = 'Portfolio Weights\n'

        plot = dollar_values.plot(kind='bar', alpha=self._BAR_ALPHA)
        plot.set_title(title, color=self._TEXT_COLOR)
        plot.set_xticklabels(dollar_values.index, rotation=0)
        plot_utils.format_y_ticks_as_dollars(plot)
        plot_utils.add_bar_labels(plot, labels, self._TEXT_COLOR)
        return plot
    def plot_dollar_change_bars(self, group=False):
        """Plot the change in dollars for the most recent day as a bar plot.

        Args:
            group: Whether to aggregate based on symbol_groups in config.
        """
        dollar_values = self._get_dollar_values(group).ix[-1, :]
        dollar_returns = self._get_dollar_returns(group).ix[-1, :]
        percent_returns = dollar_returns / dollar_values
        labels = plot_utils.get_percent_strings(percent_returns)
        bar_colors = plot_utils.get_conditional_colors(
            percent_returns, self._BAR_ALPHA)
        title = ('1-Day Change | ' + self._TITLE_DOLLAR_FORMAT + (
            '\n')).format(np.sum(dollar_returns))

        plot = dollar_returns.plot(kind='bar', color=bar_colors)
        plot.set_title(title, color=self._TEXT_COLOR)
        plot.set_xticklabels(dollar_returns.index, rotation=0)
        plot_utils.format_y_ticks_as_dollars(plot)
        plot_utils.add_bar_labels(plot, labels, self._TEXT_COLOR)
        return plot
Example #4
0
    def plot_dollar_change_bars(self, group=False):
        """Plot the change in dollars for the most recent day as a bar plot.

        Args:
            group: Whether to aggregate based on symbol_groups in config.
        """
        dollar_values = self._get_dollar_values(group).ix[-1, :]
        dollar_returns = self._get_dollar_returns(group).ix[-1, :]
        percent_returns = dollar_returns / dollar_values
        labels = plot_utils.get_percent_strings(percent_returns)
        bar_colors = plot_utils.get_conditional_colors(percent_returns,
                                                       self._BAR_ALPHA)
        title = ('1-Day Change | ' + self._TITLE_DOLLAR_FORMAT +
                 ('\n')).format(np.sum(dollar_returns))

        plot = dollar_returns.plot(kind='bar', color=bar_colors)
        plot.set_title(title, color=self._TEXT_COLOR)
        plot.set_xticklabels(dollar_returns.index, rotation=0)
        plot_utils.format_y_ticks_as_dollars(plot)
        plot_utils.add_bar_labels(plot, labels, self._TEXT_COLOR)
        return plot