From: Ian Jackson Date: Sun, 4 Oct 2009 21:46:08 +0000 (+0100) Subject: Show expected profit in voyage trading plan X-Git-Tag: 5.0^2~72 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=commitdiff_plain;h=ba117b2a7d73eae16ad76edf42ebf7e7c93f282a Show expected profit in voyage trading plan --- diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index d7679f8..f9ebfea 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -57,6 +57,7 @@ my $now= time; my @flow_conds; my @query_params; my %dists; +my $expected_total_profit; my $sd_condition= sub { my ($bs, $ix) = @_; @@ -526,6 +527,9 @@ if ($qa->{'debug'}) { $found_section= 1; next; } + if (m/^Objective:\s+totalprofit = (\d+\.\d*) /) { + $expected_total_profit= $1; + } next unless $found_section==1; if (!length $continuation) { next if !$continuation && m/^[- ]+$/; @@ -876,6 +880,9 @@ $addcols->({ Total => 0, DoReverse => 1, TotalSubflows => 1 }, qw( %> <& query_age:dataages, id2age => \%da_ages &> +Expected average profit: + approx. <% sprintf "%d", $expected_total_profit %> poe + (considering expected losses, but ignoring rum consumed) % % } # ========== TRADING PLAN ==========