def get_info(self): if not self.portfolio: return [] change, percent = self.portfolio.current_change change_text = gui_utils.get_string_from_float(percent) + '%' + ' | ' + gui_utils.get_currency_format_from_float(change) o_change, o_percent = self.portfolio.overall_change o_change_text = gui_utils.get_string_from_float(o_percent) + '%' + ' | ' + gui_utils.get_currency_format_from_float(o_change) return [(_('Day\'s gain'), gui_utils.get_green_red_string(change, change_text)), (_('Overall gain'), gui_utils.get_green_red_string(o_change, o_change_text)), ('Investments', gui_utils.get_currency_format_from_float(self.portfolio.get_current_value())), ('# positions', self.portfolio.active_positions_count), ('Last update', gui_utils.datetime_format(self.portfolio.last_update, False)) ]
def on_change(self, widget=None): price = self.total_entry.get_value() - self.costs_entry.get_value() shares = self.shares_entry.get_value() if shares > 0.0: price_per_share = price / shares else: price_per_share = 0.0 self.price_entry.set_text(gui_utils.get_string_from_float(price_per_share))
def quantity_markup(column, cell, model, iterator, column_id): pos = model.get_value(iterator, 0) markup = gui_utils.get_string_from_float(model.get_value(iterator, column_id)) cell.set_property('markup', markup)