From af15b01d2f0ca8a72feafe5aac908b5888275d56 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 13 Aug 2014 21:40:11 -0700 Subject: [PATCH] List items in descending profit order. --- tradecalc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tradecalc.py b/tradecalc.py index 66fe58c2..975b0936 100644 --- a/tradecalc.py +++ b/tradecalc.py @@ -47,7 +47,7 @@ def detail(self, verbose=False): hop = self.hops[i] str += " >-> " if i == 0 else " -+- " str += "%-20s Buy" % route[i] - for item in hop[0]: + for item in sorted(hop[0], key=lambda item: item[1] * item[0].gainCr, reverse=True): str += " %d*%s," % (item[1], item[0]) str += "\n" if verbose: