Archived
0

no add order with negative profit

This commit is contained in:
iMoHax
2015-01-05 01:10:47 +03:00
parent e06ba21b8d
commit 41097328bc
2 changed files with 7 additions and 3 deletions

View File

@@ -133,8 +133,12 @@ public class PathRoute extends Path<Vendor> {
Vendor buyer = p.get();
Offer buy = buyer.getBuy(sell.getItem());
if (buy != null){
Order order = new Order(sell, buy);
addOrder(order);
Order order = new Order(sell, buy, 1);
if (order.getProfit() < 0) {
LOG.trace("{} - is no profit, skip", order);
} else {
addOrder(order);
}
}
p = p.getNext();
}

View File

@@ -223,7 +223,7 @@ public class PathRouteTest extends Assert {
assertEquals(10000, path.getBalance(), 0.0001);
assertEquals(1000, path.getProfit(), 0.0001);
TestUtil.assertCollectionEquals(orders, order3, order1, order4, PathRoute.TRANSIT, order2);
TestUtil.assertCollectionEquals(orders, order3, order1, order4, PathRoute.TRANSIT);
path = path.getNext();
orders = path.getOrders();