From f5aea6c1bdc76e50bb1045429de63918b5ad0ca6 Mon Sep 17 00:00:00 2001 From: dimxy Date: Sat, 27 Apr 2019 17:07:27 +0500 Subject: [PATCH] clear last 0000 for liqprice --- src/cc/prices.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index e0ef3029c..a07267bf3 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -1344,13 +1344,16 @@ UniValue PricesInfo(uint256 bettxid, int32_t refheight) int64_t equity = totalbets + totalprofits; if (totalbets != 0) { //prevent zero div costbasis /= totalbets; - costbasis *= PRICES_NORMFACTOR; //denormalization + costbasis *= PRICES_NORMFACTOR; //denormalization, last posiitons should be == 0000 } else costbasis = 0; int64_t liqprice; - if (leverage != 0) // prevent zero div + if (leverage != 0) {// prevent zero div liqprice = costbasis - costbasis / leverage; + liqprice /= PRICES_NORMFACTOR; + liqprice *= PRICES_NORMFACTOR; // last posiitons should be == 0000 + } else liqprice = 0;