set precision
This commit is contained in:
parent
7358859366
commit
cb7d07df52
1 changed files with 7 additions and 3 deletions
|
|
@ -238,8 +238,8 @@ public class OrderCurrencyListener extends QueueConsumer implements Initializing
|
||||||
});
|
});
|
||||||
updateOrderFieldsByListing(orderT0, listingT0);
|
updateOrderFieldsByListing(orderT0, listingT0);
|
||||||
updateOrderFieldsByListing(orderT1, listingT1);
|
updateOrderFieldsByListing(orderT1, listingT1);
|
||||||
orderT0.setPrice(rateT0.getValue());
|
orderT0.setPrice(rateT0.getValue().setScale(listingT0.getPrecision().intValue(), RoundingMode.HALF_UP));
|
||||||
orderT1.setPrice(BigDecimalUtil.safeSumBD(swap.getPrice(), rateT1.getValue()));
|
orderT1.setPrice(BigDecimalUtil.safeSumBD(swap.getPrice(), rateT1.getValue()).setScale(listingT1.getPrecision().intValue(), RoundingMode.HALF_UP));
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,7 +280,11 @@ public class OrderCurrencyListener extends QueueConsumer implements Initializing
|
||||||
swap.setListingId(listing.getId());
|
swap.setListingId(listing.getId());
|
||||||
swap.setOvernightType(OvernightType.SWAP.getKey());
|
swap.setOvernightType(OvernightType.SWAP.getKey());
|
||||||
swap.setMarket(market.getCode());
|
swap.setMarket(market.getCode());
|
||||||
swap.setPrice(safeBD(spotT1.getPrice()).subtract(safeBD(spotT0.getPrice())));
|
BigDecimal price = safeBD(spotT1.getPrice())
|
||||||
|
.subtract(safeBD(spotT0.getPrice()))
|
||||||
|
.setScale(listing.getPrecision().intValue(), RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
swap.setPrice(price);
|
||||||
|
|
||||||
if (rates != null) {
|
if (rates != null) {
|
||||||
rateValue = rates.getValue().setScale(listing.getPrecision().intValue(), RoundingMode.HALF_UP);
|
rateValue = rates.getValue().setScale(listing.getPrecision().intValue(), RoundingMode.HALF_UP);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue