From 4d67a78cf9ce16640830d627b407b97810d25bf9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 24 Aug 2009 14:58:54 +0100 Subject: [PATCH] Fix profit margin --- yarrg/web/routetrade | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 91ff421..56a1c38 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -259,6 +259,11 @@ foreach my $f (@flows) { $f->{MaxProfit}= $f->{MaxQty} * $f->{'unitprofit'}; $f->{MaxCapital}= $f->{MaxQty} * $f->{'org_price'}; + $f->{MarginSortKey}= sprintf "%d", + $f->{'dst_price'} * 10000 / $f->{'org_price'}; + $f->{Margin}= sprintf "%3.1f%%", + $f->{'dst_price'} * 100.0 / $f->{'org_price'} - 100.0; + $f->{ExpectedUnitProfit}= $f->{'dst_price'} * (1.0 - $loss_per_league) ** $f->{'dist'} - $f->{'org_price'}; -- 2.30.2