[bisq-network/bisq] Add new api methods 'getmyoffers' and 'getmyoffer' (#5056)

sqrrm notifications at github.com
Thu Jan 7 19:44:38 CET 2021


@sqrrm approved this pull request.

utACK

@ghubstan There's a comment I'll give you a chance to reply to before merging.

>  
-        // A buyer probably wants to see sell orders in price ascending order.
-        // A seller probably wants to see buy orders in price descending order.
-        if (direction.equalsIgnoreCase(BUY.name()))
-            offers.sort(Comparator.comparing(Offer::getPrice).reversed());
-        else
-            offers.sort(Comparator.comparing(Offer::getPrice));
-
+    List<Offer> getMyOffers(String direction, String currencyCode) {
+        List<Offer> offers = offerBookService.getOffers().stream()
+                .filter(o -> o.isMyOffer(keyRing))
+                .filter(o -> offerMatchesDirectionAndCurrency(o, direction, currencyCode))
+                .collect(Collectors.toList());
+        sortOffers(offers, direction);

Why not sort the offers in the stream, wouldn't that be more efficient? To make it more readable you could make a method `offerComparator`. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5056#pullrequestreview-563731331
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210107/5e82aebf/attachment.htm>


More information about the bisq-github mailing list