From 8a910e5952382b26aaa86b8495ec881c0691a768 Mon Sep 17 00:00:00 2001 From: dimxy Date: Fri, 10 May 2019 10:56:40 +0500 Subject: [PATCH] corr logic expr --- src/cc/prices.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index 08cd20575..a902ef5e5 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -2068,12 +2068,13 @@ static bool prices_ispositionup(const std::vector &vecparsed, int16_t prices_splitpair(std::string(name), upperquote, bottomquote); uint16_t opcode1 = vecparsed[1]; + bool isInverted = ((opcode1 & KOMODO_PRICEMASK) == PRICES_INV); std::cerr << "prices_ispositionup upperquote=" << upperquote << " bottomquote=" << bottomquote << " opcode1=" << opcode1 << " (opcode1 & KOMODO_PRICEMASK)=" << (opcode1 & KOMODO_PRICEMASK) << std::endl; if (upperquote == "BTC" || bottomquote == "BTC") { // it is relatively btc - if (upperquote == "BTC" && (leverage > 0 || (opcode1 & KOMODO_PRICEMASK) != PRICES_INV) || - bottomquote == "BTC" && (leverage < 0 || (opcode1 & KOMODO_PRICEMASK) == PRICES_INV)) { + if (upperquote == "BTC" && (leverage > 0 && !isInverted || leverage < 0 && isInverted) || + bottomquote == "BTC" && (leverage < 0 && !isInverted || leverage > 0 && isInverted)) { std::cerr << "prices_ispositionup return true for BTC" << std::endl; return true; } @@ -2082,8 +2083,8 @@ static bool prices_ispositionup(const std::vector &vecparsed, int16_t } if (upperquote == "USD" || bottomquote == "USD") { // it is relatively usd - if (upperquote == "USD" && (leverage > 0 || (opcode1 & KOMODO_PRICEMASK) != PRICES_INV) || - bottomquote == "USD" && (leverage < 0 || (opcode1 & KOMODO_PRICEMASK) == PRICES_INV)) { + if (upperquote == "USD" && (leverage > 0 && !isInverted || leverage < 0 && isInverted) || + bottomquote == "USD" && (leverage < 0 && !isInverted || leverage > 0 && isInverted)) { std::cerr << "prices_ispositionup return true for USD" << std::endl; return true; }