norm operation grouping

This commit is contained in:
dimxy
2019-04-27 13:46:26 +05:00
parent 3c368e8275
commit ba495d5baf

View File

@@ -1337,12 +1337,12 @@ UniValue PricesInfo(uint256 bettxid, int32_t refheight)
for (auto b : bets) {
totalbets += b.amount;
totalprofits += b.profits;
costbasis += b.amount * b.costbasis / PRICES_NORMFACTOR; // prevent overflow
costbasis += b.amount * (b.costbasis / PRICES_NORMFACTOR); // prevent overflow
std::cerr << "PricesInfo() acc costbasis=" << costbasis << " b.amount=" << b.amount << " b.costbasis=" << b.costbasis << std::endl;
}
int64_t equity = totalbets + totalprofits;
costbasis /= totalbets / PRICES_NORMFACTOR;
costbasis /= (totalbets / PRICES_NORMFACTOR);
int64_t liqprice = costbasis - costbasis / leverage;