well I took a look at the code and the changelog, and found out for some
questionable reasons, the behaviour was changed from displaying the
numeric worth of all investments to a color-trend based on the worth
change...

but looking at the code itself revealed, that the calculation seem
rather broken:

in the code below, the lines in the iterations should rather read like

  var = row[updater.VARIATION]
  now = row[updater.VALUE]
  start = now - var

to make more sense imho... also the color-scale sensitivity might be a
candidate for the preference dialog, as it might need considerable
(relative) worth-changes to cause a noticeable color change, depending
on the investments done...

(from 
http://svn.gnome.org/viewcvs/gnome-applets/trunk/invest-applet/invest/widgets.py?view=markup)
class InvestTrend(gtk.Image):
...
def on_quotes_update(self, updater):
                start_total = 0
                now_total = 0
                for row in updater:
                        # Don't count the ticker only symbols in the color-trend
                        if row[updater.TICKER_ONLY]:
                                continue
                                
                        var = row[updater.VARIATION]/100
                        now = row[updater.VALUE]

                        start = now / (1 + var)
                        
                        portfolio_number = sum([purchase["amount"] for purchase 
in invest.STOCKS[row[updater.SYMBOL]]])
                        start_total += start * portfolio_number
                        now_total += now * portfolio_number
                
                day_var = (now_total - start_total) / start_total * 100
                color = int(2*day_var)
                opacity = min(0xFF, int(abs(127.5*day_var)))
                if day_var < 0:
                        color = 
COLORSCALE_NEGATIVE[min(len(COLORSCALE_NEGATIVE)-1, abs(color))]
                else:
                        color = 
COLORSCALE_POSITIVE[min(len(COLORSCALE_POSITIVE)-1, abs(color))]

                self.set_color(color, opacity)

-- 
Invest applet renders incorrectly
https://launchpad.net/bugs/59060

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to