no add order with negative profit
This commit is contained in:
@@ -133,9 +133,13 @@ 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);
|
||||
Order order = new Order(sell, buy, 1);
|
||||
if (order.getProfit() < 0) {
|
||||
LOG.trace("{} - is no profit, skip", order);
|
||||
} else {
|
||||
addOrder(order);
|
||||
}
|
||||
}
|
||||
p = p.getNext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user