mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Display buyer's cost in api's gettrade output
The offer volume is shown so traders know how much fiat they are sending or receiving without having to call getoffer. Changed the 'Fiat Sent' and 'Fiat Received' column headers to show which fiat is being transfered, e.g., 'EUR Sent', 'EUR Received'. Adjusted apitest's trade-simulation-utils.sh to the modified gettrade output.
This commit is contained in:
parent
4051d196c2
commit
d60c0dd3ca
@ -267,9 +267,9 @@ istradepaymentsent() {
|
||||
MAKER_OR_TAKER="$2"
|
||||
if [ "$MAKER_OR_TAKER" = "MAKER" ]
|
||||
then
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $11}')
|
||||
else
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $12}')
|
||||
else
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $13}')
|
||||
fi
|
||||
commandalert $? "Could not parse istradepaymentsent from trade detail."
|
||||
echo "$ANSWER"
|
||||
@ -280,9 +280,9 @@ istradepaymentreceived() {
|
||||
MAKER_OR_TAKER="$2"
|
||||
if [ "$MAKER_OR_TAKER" = "MAKER" ]
|
||||
then
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $12}')
|
||||
else
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $13}')
|
||||
else
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $14}')
|
||||
fi
|
||||
commandalert $? "Could not parse istradepaymentreceived from trade detail."
|
||||
echo "$ANSWER"
|
||||
@ -293,9 +293,9 @@ istradepayoutpublished() {
|
||||
MAKER_OR_TAKER="$2"
|
||||
if [ "$MAKER_OR_TAKER" = "MAKER" ]
|
||||
then
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $13}')
|
||||
else
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $14}')
|
||||
else
|
||||
ANSWER=$(echo "$TRADE_DETAIL" | awk '{print $15}')
|
||||
fi
|
||||
commandalert $? "Could not parse istradepayoutpublished from trade detail."
|
||||
echo "$ANSWER"
|
||||
|
@ -27,8 +27,8 @@ class ColumnHeaderConstants {
|
||||
|
||||
// Table column header format specs, right padded with two spaces. In some cases
|
||||
// such as COL_HEADER_CREATION_DATE, COL_HEADER_VOLUME and COL_HEADER_UUID, the
|
||||
// expected max data string length is accounted for. In others, the column header length
|
||||
// are expected to be greater than any column value length.
|
||||
// expected max data string length is accounted for. In others, column header
|
||||
// lengths are expected to be greater than any column value length.
|
||||
static final String COL_HEADER_ADDRESS = padEnd("%-3s Address", 52, ' ');
|
||||
static final String COL_HEADER_AMOUNT = padEnd("BTC(min - max)", 24, ' ');
|
||||
static final String COL_HEADER_AVAILABLE_BALANCE = "Available Balance";
|
||||
@ -49,17 +49,17 @@ class ColumnHeaderConstants {
|
||||
static final String COL_HEADER_PAYMENT_METHOD = "Payment Method";
|
||||
static final String COL_HEADER_PRICE = "Price in %-3s for 1 BTC";
|
||||
static final String COL_HEADER_TRADE_AMOUNT = padStart("Amount(%-3s)", 12, ' ');
|
||||
static final String COL_HEADER_TRADE_BUYER_COST = padEnd("Buyer Cost(%-3s)", 15, ' ');
|
||||
static final String COL_HEADER_TRADE_DEPOSIT_CONFIRMED = "Deposit Confirmed";
|
||||
static final String COL_HEADER_TRADE_DEPOSIT_PUBLISHED = "Deposit Published";
|
||||
static final String COL_HEADER_TRADE_FIAT_SENT = "Fiat Sent";
|
||||
static final String COL_HEADER_TRADE_FIAT_RECEIVED = "Fiat Received";
|
||||
static final String COL_HEADER_TRADE_PAYMENT_SENT = padEnd("%-3s Sent", 8, ' ');
|
||||
static final String COL_HEADER_TRADE_PAYMENT_RECEIVED = padEnd("%-3s Received", 12, ' ');
|
||||
static final String COL_HEADER_TRADE_PAYOUT_PUBLISHED = "Payout Published";
|
||||
static final String COL_HEADER_TRADE_WITHDRAWN = "Withdrawn";
|
||||
static final String COL_HEADER_TRADE_ROLE = "My Role";
|
||||
static final String COL_HEADER_TRADE_SHORT_ID = "ID";
|
||||
static final String COL_HEADER_TRADE_TX_FEE = "Tx Fee(%-3s)";
|
||||
static final String COL_HEADER_TRADE_TAKER_FEE = "Taker Fee(%-3s)";
|
||||
static final String COL_HEADER_TRADE_WITHDRAWAL_TX_ID = "Withdrawal TX ID";
|
||||
|
||||
static final String COL_HEADER_TX_ID = "Tx ID";
|
||||
static final String COL_HEADER_TX_INPUT_SUM = "Tx Inputs (BTC)";
|
||||
|
@ -25,6 +25,7 @@ import java.util.function.Supplier;
|
||||
|
||||
import static bisq.cli.ColumnHeaderConstants.*;
|
||||
import static bisq.cli.CurrencyFormat.formatOfferPrice;
|
||||
import static bisq.cli.CurrencyFormat.formatOfferVolume;
|
||||
import static bisq.cli.CurrencyFormat.formatSatoshis;
|
||||
import static com.google.common.base.Strings.padEnd;
|
||||
|
||||
@ -54,18 +55,33 @@ public class TradeFormat {
|
||||
+ takerFeeHeaderFormat.get()
|
||||
+ COL_HEADER_TRADE_DEPOSIT_PUBLISHED + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_DEPOSIT_CONFIRMED + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_FIAT_SENT + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_FIAT_RECEIVED + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_BUYER_COST + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_PAYMENT_SENT + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_PAYMENT_RECEIVED + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_PAYOUT_PUBLISHED + COL_HEADER_DELIMITER
|
||||
+ COL_HEADER_TRADE_WITHDRAWN + COL_HEADER_DELIMITER
|
||||
+ "%n";
|
||||
|
||||
String counterCurrencyCode = tradeInfo.getOffer().getCounterCurrencyCode();
|
||||
String baseCurrencyCode = tradeInfo.getOffer().getBaseCurrencyCode();
|
||||
String headerLine = isTaker
|
||||
? String.format(headersFormat, counterCurrencyCode, baseCurrencyCode, baseCurrencyCode, baseCurrencyCode)
|
||||
: String.format(headersFormat, counterCurrencyCode, baseCurrencyCode, baseCurrencyCode);
|
||||
|
||||
// The taker's output contains an extra taker tx fee column.
|
||||
String headerLine = isTaker
|
||||
? String.format(headersFormat,
|
||||
/* COL_HEADER_PRICE */ counterCurrencyCode,
|
||||
/* COL_HEADER_TRADE_AMOUNT */ baseCurrencyCode,
|
||||
/* COL_HEADER_TRADE_TX_FEE */ baseCurrencyCode,
|
||||
/* COL_HEADER_TRADE_TAKER_FEE */ baseCurrencyCode,
|
||||
/* COL_HEADER_TRADE_BUYER_COST */ counterCurrencyCode,
|
||||
/* COL_HEADER_TRADE_PAYMENT_SENT */ counterCurrencyCode,
|
||||
/* COL_HEADER_TRADE_PAYMENT_RECEIVED */ counterCurrencyCode)
|
||||
: String.format(headersFormat,
|
||||
/* COL_HEADER_PRICE */ counterCurrencyCode,
|
||||
/* COL_HEADER_TRADE_AMOUNT */ baseCurrencyCode,
|
||||
/* COL_HEADER_TRADE_TX_FEE */ baseCurrencyCode,
|
||||
/* COL_HEADER_TRADE_BUYER_COST */ counterCurrencyCode,
|
||||
/* COL_HEADER_TRADE_PAYMENT_SENT */ counterCurrencyCode,
|
||||
/* COL_HEADER_TRADE_PAYMENT_RECEIVED */ counterCurrencyCode);
|
||||
|
||||
String colDataFormat = "%-" + shortIdColWidth + "s" // lt justify
|
||||
+ " %-" + (roleColWidth + COL_HEADER_DELIMITER.length()) + "s" // left
|
||||
@ -75,8 +91,9 @@ public class TradeFormat {
|
||||
+ takerFeeHeader.get() // rt justify
|
||||
+ " %-" + COL_HEADER_TRADE_DEPOSIT_PUBLISHED.length() + "s" // lt justify
|
||||
+ " %-" + COL_HEADER_TRADE_DEPOSIT_CONFIRMED.length() + "s" // lt justify
|
||||
+ " %-" + COL_HEADER_TRADE_FIAT_SENT.length() + "s" // lt justify
|
||||
+ " %-" + COL_HEADER_TRADE_FIAT_RECEIVED.length() + "s" // lt justify
|
||||
+ "%" + (COL_HEADER_TRADE_BUYER_COST.length() + 1) + "s" // rt justify
|
||||
+ " %-" + (COL_HEADER_TRADE_PAYMENT_SENT.length() - 1) + "s" // left
|
||||
+ " %-" + (COL_HEADER_TRADE_PAYMENT_RECEIVED.length() - 1) + "s" // left
|
||||
+ " %-" + COL_HEADER_TRADE_PAYOUT_PUBLISHED.length() + "s" // lt justify
|
||||
+ " %-" + COL_HEADER_TRADE_WITHDRAWN.length() + "s"; // lt justify
|
||||
|
||||
@ -95,6 +112,7 @@ public class TradeFormat {
|
||||
formatSatoshis(tradeInfo.getTxFeeAsLong()),
|
||||
tradeInfo.getIsDepositPublished() ? "YES" : "NO",
|
||||
tradeInfo.getIsDepositConfirmed() ? "YES" : "NO",
|
||||
formatOfferVolume(tradeInfo.getOffer().getVolume()),
|
||||
tradeInfo.getIsFiatSent() ? "YES" : "NO",
|
||||
tradeInfo.getIsFiatReceived() ? "YES" : "NO",
|
||||
tradeInfo.getIsPayoutPublished() ? "YES" : "NO",
|
||||
@ -111,6 +129,7 @@ public class TradeFormat {
|
||||
formatSatoshis(tradeInfo.getTakerFeeAsLong()),
|
||||
tradeInfo.getIsDepositPublished() ? "YES" : "NO",
|
||||
tradeInfo.getIsDepositConfirmed() ? "YES" : "NO",
|
||||
formatOfferVolume(tradeInfo.getOffer().getVolume()),
|
||||
tradeInfo.getIsFiatSent() ? "YES" : "NO",
|
||||
tradeInfo.getIsFiatReceived() ? "YES" : "NO",
|
||||
tradeInfo.getIsPayoutPublished() ? "YES" : "NO",
|
||||
|
Loading…
Reference in New Issue
Block a user