chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-live.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b6475c6
)
Fix profit margin
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Mon, 24 Aug 2009 13:58:54 +0000
(14:58 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Mon, 24 Aug 2009 13:58:54 +0000
(14:58 +0100)
yarrg/web/routetrade
patch
|
blob
|
history
diff --git
a/yarrg/web/routetrade
b/yarrg/web/routetrade
index 91ff421625fd7d4757a6def0a6e471341ac073e1..56a1c38ff1a137ef8a2e618eb994c2af167948b5 100644
(file)
--- 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->{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'};
$f->{ExpectedUnitProfit}=
$f->{'dst_price'} * (1.0 - $loss_per_league) ** $f->{'dist'}
- $f->{'org_price'};