public inbox for [email protected]
 help / color / mirror / Atom feed
From: Alviro Iskandar Setiawan <[email protected]>
To: Ammar Faizi <[email protected]>,
	Michael William Jonathan <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
	Ravel Kevin Ethan <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [RFC PATCH 6/9] gwarnt: p2p/binance: Fix invalid page
Date: Tue, 10 Sep 2024 23:44:11 +0200	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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 <[email protected]>
---
 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<gwarnt::p2p_ad> 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<gwarnt::p2p_ad> 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


  parent reply	other threads:[~2024-09-10 21:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 21:44 [RFC PATCH 0/9] Introducing GNU/Weeb Arbitrage Opportunity Notification Bot Alviro Iskandar Setiawan
2024-09-10 21:44 ` [RFC PATCH 2/9] gwarnt: Create initial P2P ad data structure Alviro Iskandar Setiawan
2024-09-10 21:44 ` [RFC PATCH 3/9] gwarnt: p2p: Add P2P Binance Alviro Iskandar Setiawan
2024-09-10 21:44 ` [RFC PATCH 4/9] gwarnt: p2p: Add P2P OKX Alviro Iskandar Setiawan
2024-09-10 21:44 ` [RFC PATCH 5/9] gwarnt: Create function to find arbitrage opportunities Alviro Iskandar Setiawan
2024-09-10 21:44 ` Alviro Iskandar Setiawan [this message]
2024-09-10 21:44 ` [RFC PATCH 7/9] gwarnt: Create the initial example Alviro Iskandar Setiawan
2024-09-10 21:44 ` [RFC PATCH 8/9] gwarnt: Add README file Alviro Iskandar Setiawan
2024-09-10 21:44 ` [RFC PATCH 9/9] gwarnt: Add Telegram bot Alviro Iskandar Setiawan
2024-09-10 22:21 ` [RFC PATCH 0/9] Introducing GNU/Weeb Arbitrage Opportunity Notification Bot Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240910214414.3401712-7-alviro.iskandar@gnuweeb.org \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox