no add order with negative profit
This commit is contained in:
@@ -133,8 +133,12 @@ public class PathRoute extends Path<Vendor> {
|
|||||||
Vendor buyer = p.get();
|
Vendor buyer = p.get();
|
||||||
Offer buy = buyer.getBuy(sell.getItem());
|
Offer buy = buyer.getBuy(sell.getItem());
|
||||||
if (buy != null){
|
if (buy != null){
|
||||||
Order order = new Order(sell, buy);
|
Order order = new Order(sell, buy, 1);
|
||||||
addOrder(order);
|
if (order.getProfit() < 0) {
|
||||||
|
LOG.trace("{} - is no profit, skip", order);
|
||||||
|
} else {
|
||||||
|
addOrder(order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p = p.getNext();
|
p = p.getNext();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ public class PathRouteTest extends Assert {
|
|||||||
|
|
||||||
assertEquals(10000, path.getBalance(), 0.0001);
|
assertEquals(10000, path.getBalance(), 0.0001);
|
||||||
assertEquals(1000, path.getProfit(), 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();
|
path = path.getNext();
|
||||||
orders = path.getOrders();
|
orders = path.getOrders();
|
||||||
|
|||||||
Reference in New Issue
Block a user