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

chimp1984 notifications at github.com
Mon Dec 28 04:51:46 CET 2020


@chimp1984 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(),

I think we have no style rule for that...

-- 
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#discussion_r549205429
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201227/a1ed6757/attachment.htm>


More information about the bisq-github mailing list