[bisq-network/bisq] Deactivate open offer if trigger price is reached (#5001)

Stan notifications at github.com
Fri Dec 25 19:02:18 CET 2020


@ghubstan commented on this pull request.



> +        int smallestUnitExponent = CurrencyUtil.isCryptoCurrency(currencyCode) ?
+                Altcoin.SMALLEST_UNIT_EXPONENT :
+                Fiat.SMALLEST_UNIT_EXPONENT;
+        long marketPriceAsLong = roundDoubleToLong(
+                scaleUpByPowerOf10(marketPrice.getPrice(), smallestUnitExponent));
+        long triggerPrice = openOffer.getTriggerPrice();
+        if (triggerPrice > 0) {
+            OfferPayload.Direction direction = openOffer.getOffer().getDirection();
+            boolean triggered = direction == OfferPayload.Direction.BUY ?
+                    marketPriceAsLong > triggerPrice :
+                    marketPriceAsLong < triggerPrice;
+            if (triggered) {
+                log.error("Market price exceeded the trigger price of the open offer. " +
+                                "We deactivate the open offer with ID {}. Currency: {}; offer direction: {}; " +
+                                "Market price: {}; Upper price threshold : {}",
+                        openOffer.getOffer().getShortId(),

Minor detail... placement of colons are not consistent (the last one).  
And you sure you wanted to use semi-colons to delimit key value pairs?  Is that consistent with other error log statements?

-- 
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/5001#pullrequestreview-558831204
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201225/d51451fe/attachment.htm>


More information about the bisq-github mailing list