Skip to content

Commit

Permalink
Merge pull request #2318 from ripcurlx/remove-filter-in-offerbook-tables
Browse files Browse the repository at this point in the history
Remove filter for offerbook teaser tables
  • Loading branch information
ManfredKarrer authored Jan 24, 2019
2 parents e847a86 + 59a515d commit 43da9ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ private void updateChartData() {
})
.collect(Collectors.toList());

allBuyOffers = filterOffersWithRelevantPrices(allBuyOffers);

final Optional<Offer> highestBuyPriceOffer = allBuyOffers.stream()
.filter(o -> o.getPrice() != null)
.max(Comparator.comparingLong(o -> o.getPrice().getValue()));
Expand Down Expand Up @@ -339,8 +337,6 @@ private void updateChartData() {
})
.collect(Collectors.toList());

allSellOffers = filterOffersWithRelevantPrices(allSellOffers);

final Optional<Offer> highestSellPriceOffer = allSellOffers.stream()
.filter(o -> o.getPrice() != null)
.max(Comparator.comparingLong(o -> o.getPrice().getValue()));
Expand All @@ -362,26 +358,6 @@ private void updateChartData() {
buildChartAndTableEntries(allSellOffers, OfferPayload.Direction.SELL, sellData, topSellOfferList);
}

// If there are more then 3 offers we ignore the offers which are further than 30% from the best price
private List<Offer> filterOffersWithRelevantPrices(List<Offer> offers) {
if (offers.size() > 3) {
Price bestPrice = offers.get(0).getPrice();
if (bestPrice != null) {
long bestPriceAsLong = bestPrice.getValue();
return offers.stream()
.filter(e -> {
if (e.getPrice() == null)
return false;

double ratio = (double) e.getPrice().getValue() / (double) bestPriceAsLong;
return Math.abs(1 - ratio) < 0.3;
})
.collect(Collectors.toList());
}
}
return offers;
}

private void buildChartAndTableEntries(List<Offer> sortedList, OfferPayload.Direction direction, List<XYChart.Data> data, ObservableList<OfferListItem> offerTableList) {
data.clear();
double accumulatedAmount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ protected void addContent() {

Tuple4<Button, BusyAnimation, Label, HBox> tuple3 = addButtonBusyAnimationLabel(gridPane, ++gridRow, 0,
Res.get("portfolio.pending.step2_buyer.paymentStarted"), 10);

GridPane.setColumnSpan(tuple3.forth, 2);
confirmButton = tuple3.first;
confirmButton.setOnAction(e -> onPaymentStarted());
busyAnimation = tuple3.second;
Expand Down

0 comments on commit 43da9ad

Please sign in to comment.