From c5d0259833f0755f1eee45103ccf1b9f9f33fe56 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Sun, 26 Jun 2022 12:24:23 -0300 Subject: [PATCH] Print the day's BSQ swaps after each completed swap --- java-examples/src/main/java/bisq/bots/BotUtils.java | 1 - .../main/java/bisq/bots/TakeBestPricedOfferToBuyBsq.java | 4 ++++ .../main/java/bisq/bots/TakeBestPricedOfferToSellBsq.java | 4 ++++ .../main/resources/TakeBestPricedOfferToBuyBsq.properties | 6 +++--- .../main/resources/TakeBestPricedOfferToSellBsq.properties | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/java-examples/src/main/java/bisq/bots/BotUtils.java b/java-examples/src/main/java/bisq/bots/BotUtils.java index 4fe1202..3582fae 100644 --- a/java-examples/src/main/java/bisq/bots/BotUtils.java +++ b/java-examples/src/main/java/bisq/bots/BotUtils.java @@ -416,7 +416,6 @@ public static void printTradeSummary(TradeInfo trade) { * @param trades list of trades */ public static void printTradesSummary(GetTradesRequest.Category category, List trades) { - log.info("{} trades:", category.name()); switch (category) { case CLOSED -> new TableBuilder(CLOSED_TRADES_TBL, trades).build().print(out); case FAILED -> new TableBuilder(FAILED_TRADES_TBL, trades).build().print(out); diff --git a/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToBuyBsq.java b/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToBuyBsq.java index 3212478..57c9ed5 100644 --- a/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToBuyBsq.java +++ b/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToBuyBsq.java @@ -28,6 +28,7 @@ import java.util.function.Predicate; import static bisq.bots.BotUtils.*; +import static bisq.proto.grpc.GetTradesRequest.Category.CLOSED; import static java.lang.String.format; import static java.lang.System.exit; import static java.math.RoundingMode.HALF_UP; @@ -227,6 +228,9 @@ private void handleFatalException(StatusRuntimeException fatalException) { * Lock the wallet, stop the API daemon, and terminate the bot. */ private void maybeShutdownAfterSuccessfulSwap() { + log.info("Here are today's completed trades:"); + printTradesSummaryForToday(CLOSED); + if (!isDryRun) { try { lockWallet(); diff --git a/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToSellBsq.java b/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToSellBsq.java index 0933053..b3f809e 100644 --- a/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToSellBsq.java +++ b/java-examples/src/main/java/bisq/bots/TakeBestPricedOfferToSellBsq.java @@ -28,6 +28,7 @@ import java.util.function.Predicate; import static bisq.bots.BotUtils.*; +import static bisq.proto.grpc.GetTradesRequest.Category.CLOSED; import static java.lang.String.format; import static java.lang.System.exit; import static java.math.RoundingMode.HALF_UP; @@ -227,6 +228,9 @@ private void handleFatalException(StatusRuntimeException fatalException) { * Lock the wallet, stop the API daemon, and terminate the bot. */ private void maybeShutdownAfterSuccessfulSwap() { + log.info("Here are today's completed trades:"); + printTradesSummaryForToday(CLOSED); + if (!isDryRun) { try { lockWallet(); diff --git a/java-examples/src/main/resources/TakeBestPricedOfferToBuyBsq.properties b/java-examples/src/main/resources/TakeBestPricedOfferToBuyBsq.properties index 22176e7..444bc92 100644 --- a/java-examples/src/main/resources/TakeBestPricedOfferToBuyBsq.properties +++ b/java-examples/src/main/resources/TakeBestPricedOfferToBuyBsq.properties @@ -1,9 +1,9 @@ # Maximum # of offers to take during one bot session. When reached, bot will shut down (but not the API daemon). -maxTakeOffers=1 +maxTakeOffers=50 # # Minimum distance from 30-day average BSQ trade price. # Note: all BSQ Swap offers have a fixed-price, but the bot uses a margin (%) of the 30-day price for comparison. -minMarketPriceMargin=0 +minMarketPriceMargin=0.00 # # Hard coded 30-day average BSQ trade price, used for development over regtest. regtest30DayAvgBsqPrice=0.00005 @@ -12,7 +12,7 @@ regtest30DayAvgBsqPrice=0.00005 minAmount=0.01 # # Taker bot's max BTC amount to sell. The candidate SELL BTC offer's amount must be <= maxAmount BTC. -maxAmount=0.50 +maxAmount=0.90 # # Taker bot's max acceptable transaction fee rate (sats / byte). # Regtest fee rates are from https://price.bisq.wiz.biz/getFees diff --git a/java-examples/src/main/resources/TakeBestPricedOfferToSellBsq.properties b/java-examples/src/main/resources/TakeBestPricedOfferToSellBsq.properties index f09e8b0..97f13a0 100644 --- a/java-examples/src/main/resources/TakeBestPricedOfferToSellBsq.properties +++ b/java-examples/src/main/resources/TakeBestPricedOfferToSellBsq.properties @@ -1,5 +1,5 @@ # Maximum # of offers to take during one bot session. When reached, bot will shut down (but not the API daemon). -maxTakeOffers=100 +maxTakeOffers=50 # # Maximum distance from 30-day average BSQ trade price. # Note: all BSQ Swap offers have a fixed-price, but the bot uses a margin (%) of the 30-day price for comparison.