From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1726004660; bh=iOr+18g3iVR4V5DOkBu8uiJRTxSn1uyxcnQd0M7FavU=; h=From:To:Cc:Subject:Message-Id:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:From; b=AJbabhEnxEmXUiYFOeFVLl9wK/j9YJZ8ItXDGcI/GkBoOd/aCa8tajwonmyYaiPK2 pIqlnhI9gf3HcYfbCXZ9eS8oTEZkk5Uuxg8hwytZMuT/AQbRx6i6+HjcGAJ0SKrq9f 8FQ+bZtFCE+aCPKuavd1hDvzneh1vbLHM19ypYgvLoLd4lbIsRL1k/NxmiH+s5ubAE g0LF29yP3C5IaKPl38/+bktryynkhCkvpYPYSzROrCFMVjhnNNuYEUuvXWZ/wScWP1 ldI6raE09X80xK6o+h2x6vxTx92rGkOcp1A2rAlGsbaqX19SFK635T1Oja5EQ6InZl xzlwZrFtmcMyw== Received: from server-vie001.gnuweeb.org (unknown [192.168.57.1]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 270713106504; Tue, 10 Sep 2024 21:44:20 +0000 (UTC) From: Alviro Iskandar Setiawan To: Ammar Faizi , Michael William Jonathan Cc: Alviro Iskandar Setiawan , Ravel Kevin Ethan , GNU/Weeb Mailing List Subject: [RFC PATCH 6/9] gwarnt: p2p/binance: Fix invalid page Date: Tue, 10 Sep 2024 23:44:11 +0200 Message-Id: <20240910214414.3401712-7-alviro.iskandar@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240910214414.3401712-1-alviro.iskandar@gnuweeb.org> References: <20240910214414.3401712-1-alviro.iskandar@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The page passed to __get_data was wrong, it should take from the iteration variable instead of 'page' argument which is always ~0ull in value. While in there, also fix the inverted search as Binance will show SELL ads when the filter is BUY and vice versa. Signed-off-by: Alviro Iskandar Setiawan --- src/gwarnt/p2p/binance.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gwarnt/p2p/binance.cpp b/src/gwarnt/p2p/binance.cpp index 541a5de..81d23fe 100644 --- a/src/gwarnt/p2p/binance.cpp +++ b/src/gwarnt/p2p/binance.cpp @@ -50,7 +50,7 @@ std::vector binance::get_data(const std::string &fiat, size_t i; for (i = 1; i <= 5; i++) { - tmp = __get_data(fiat, crypto, trade_type, page); + tmp = __get_data(fiat, crypto, trade_type, i); ads.insert(ads.end(), tmp.begin(), tmp.end()); } } else { @@ -72,9 +72,9 @@ std::vector binance::__get_data(const std::string &fiat, type = trade_type; strtoupper(type); if (type == "BUY") - type = "BUY"; - else if (type == "SELL") type = "SELL"; + else if (type == "SELL") + type = "BUY"; else throw std::runtime_error("Invalid trade type: " + trade_type); -- Alviro Iskandar Setiawan