Print the day's BSQ swaps after each completed swap

This commit is contained in:
ghubstan 2022-06-26 12:24:23 -03:00
parent 03102125b5
commit c5d0259833
No known key found for this signature in database
GPG Key ID: E35592D6800A861E
5 changed files with 12 additions and 5 deletions

View File

@ -416,7 +416,6 @@ public class BotUtils {
* @param trades list of trades * @param trades list of trades
*/ */
public static void printTradesSummary(GetTradesRequest.Category category, List<TradeInfo> trades) { public static void printTradesSummary(GetTradesRequest.Category category, List<TradeInfo> trades) {
log.info("{} trades:", category.name());
switch (category) { switch (category) {
case CLOSED -> new TableBuilder(CLOSED_TRADES_TBL, trades).build().print(out); case CLOSED -> new TableBuilder(CLOSED_TRADES_TBL, trades).build().print(out);
case FAILED -> new TableBuilder(FAILED_TRADES_TBL, trades).build().print(out); case FAILED -> new TableBuilder(FAILED_TRADES_TBL, trades).build().print(out);

View File

@ -28,6 +28,7 @@ import java.util.function.BiPredicate;
import java.util.function.Predicate; import java.util.function.Predicate;
import static bisq.bots.BotUtils.*; import static bisq.bots.BotUtils.*;
import static bisq.proto.grpc.GetTradesRequest.Category.CLOSED;
import static java.lang.String.format; import static java.lang.String.format;
import static java.lang.System.exit; import static java.lang.System.exit;
import static java.math.RoundingMode.HALF_UP; import static java.math.RoundingMode.HALF_UP;
@ -227,6 +228,9 @@ public class TakeBestPricedOfferToBuyBsq extends AbstractBot {
* Lock the wallet, stop the API daemon, and terminate the bot. * Lock the wallet, stop the API daemon, and terminate the bot.
*/ */
private void maybeShutdownAfterSuccessfulSwap() { private void maybeShutdownAfterSuccessfulSwap() {
log.info("Here are today's completed trades:");
printTradesSummaryForToday(CLOSED);
if (!isDryRun) { if (!isDryRun) {
try { try {
lockWallet(); lockWallet();

View File

@ -28,6 +28,7 @@ import java.util.function.BiPredicate;
import java.util.function.Predicate; import java.util.function.Predicate;
import static bisq.bots.BotUtils.*; import static bisq.bots.BotUtils.*;
import static bisq.proto.grpc.GetTradesRequest.Category.CLOSED;
import static java.lang.String.format; import static java.lang.String.format;
import static java.lang.System.exit; import static java.lang.System.exit;
import static java.math.RoundingMode.HALF_UP; import static java.math.RoundingMode.HALF_UP;
@ -227,6 +228,9 @@ public class TakeBestPricedOfferToSellBsq extends AbstractBot {
* Lock the wallet, stop the API daemon, and terminate the bot. * Lock the wallet, stop the API daemon, and terminate the bot.
*/ */
private void maybeShutdownAfterSuccessfulSwap() { private void maybeShutdownAfterSuccessfulSwap() {
log.info("Here are today's completed trades:");
printTradesSummaryForToday(CLOSED);
if (!isDryRun) { if (!isDryRun) {
try { try {
lockWallet(); lockWallet();

View File

@ -1,9 +1,9 @@
# Maximum # of offers to take during one bot session. When reached, bot will shut down (but not the API daemon). # 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. # 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. # 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. # Hard coded 30-day average BSQ trade price, used for development over regtest.
regtest30DayAvgBsqPrice=0.00005 regtest30DayAvgBsqPrice=0.00005
@ -12,7 +12,7 @@ regtest30DayAvgBsqPrice=0.00005
minAmount=0.01 minAmount=0.01
# #
# Taker bot's max BTC amount to sell. The candidate SELL BTC offer's amount must be <= maxAmount BTC. # 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). # Taker bot's max acceptable transaction fee rate (sats / byte).
# Regtest fee rates are from https://price.bisq.wiz.biz/getFees # Regtest fee rates are from https://price.bisq.wiz.biz/getFees

View File

@ -1,5 +1,5 @@
# Maximum # of offers to take during one bot session. When reached, bot will shut down (but not the API daemon). # 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. # 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. # Note: all BSQ Swap offers have a fixed-price, but the bot uses a margin (%) of the 30-day price for comparison.