Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API 'gettrades' method #5976

Merged
merged 35 commits into from Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
55a54f3
Add GetTrades proto message, + needed TradeInfo fields
ghubstan Jan 16, 2022
e6e944b
Add GrpcTradesService.getTrades service method
ghubstan Jan 16, 2022
b4fa52f
Add List<Trade> getTrades() to FailedTradesManager (w/out transitive …
ghubstan Jan 16, 2022
50bbbfe
Add List<Trade> getTrades() to TradeManager (w/out transitive jfx dep)
ghubstan Jan 16, 2022
a53fee3
Add List<OpenOffer> getCanceledOpenOffers() ClosedTradableManager
ghubstan Jan 16, 2022
5c21779
Add buyer/seller dep & status-desc fields to TradeInfoV1Builder
ghubstan Jan 16, 2022
a9e7484
Add buyer/seller dep & status-desc fields to TradeInfo
ghubstan Jan 16, 2022
fdd94fe
Remove commented code
ghubstan Jan 16, 2022
d98d795
Add server impl for gettrades (open|closed), refactor getrole methods
ghubstan Jan 16, 2022
4c7ae49
Format gettrades CLI outout
ghubstan Jan 16, 2022
ffa31b0
Support gRPC gettrades call in CLI
ghubstan Jan 16, 2022
3cd1e05
Try to display accurate status of closed trades, or "Pending" if stil…
ghubstan Jan 18, 2022
a5857e2
Re-set log level to INFO in apitest cases
ghubstan Jan 18, 2022
0ec0952
Remove trailing spaces
ghubstan Jan 20, 2022
2e7346a
Fix comments
ghubstan Jan 20, 2022
b10cb11
Display trade.txFee for BSQ swap trades
ghubstan Jan 20, 2022
69e6c9c
Remove duplicated buyer/seller proto fields (already exist no OfferInfo)
ghubstan Jan 20, 2022
2a3a298
Fix maker/taker fee column headers & value func defs
ghubstan Jan 20, 2022
6e02996
Fill out gettrades-help.txt
ghubstan Jan 22, 2022
fadaaf9
Display tx-fee from BsqSwapProtocolModel
ghubstan Jan 22, 2022
0e020e8
Add payout fields to trade proto msgs, show optional trade/tx fees in…
ghubstan Jan 23, 2022
3e14bd3
Change var name
ghubstan Jan 23, 2022
fdd91a8
Fix displayed bsq-swap's optional trade & tx fees
ghubstan Jan 23, 2022
2db20c0
Split BsqSwap tests into "buy" and "sell" tests
ghubstan Jan 23, 2022
fd0c4c2
Add BsqSwapSellBtcTradeTest
ghubstan Jan 23, 2022
89c4ab3
Use toTradeFeeBtc, not toTradeFeeBsq
ghubstan Jan 23, 2022
d902e77
Add Bisq license banners
ghubstan Jan 25, 2022
210d966
Fix method name
ghubstan Jan 25, 2022
4ab4c3d
Log exception and return "Not Available" when trade role cannot be found
ghubstan Jan 25, 2022
ef00a2c
Remove unused class
ghubstan Jan 25, 2022
4c8cec5
Push Trade->TradeModel mapping down from CoreApi into CoreTradesService
ghubstan Jan 25, 2022
f231aac
Sort API gettrades's response list by trade date
ghubstan Jan 26, 2022
ad638e3
Revert "Sort API gettrades's response list by trade date"
ghubstan Jan 27, 2022
8206425
Remove unnecessary casts
ghubstan Jan 27, 2022
111e39f
Sort the final, cumulative trades list in gRPC GetTrades service
ghubstan Jan 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -26,7 +26,6 @@
import java.math.RoundingMode;

import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
Expand Down Expand Up @@ -216,7 +215,8 @@ protected void validate() {
}
};

protected final BiFunction<TradeInfo, Boolean, Long> toTradeFeeBsq = (t, isMyOffer) -> {
protected final Function<TradeInfo, Long> toTradeFeeBsq = (t) -> {
var isMyOffer = t.getOffer().getIsMyOffer();
if (isMyOffer) {
return t.getOffer().getIsCurrencyForMakerFeeBtc()
? 0L // Maker paid BTC fee, return 0.
Expand All @@ -228,7 +228,8 @@ protected void validate() {
}
};

protected final BiFunction<TradeInfo, Boolean, Long> toTradeFeeBtc = (t, isMyOffer) -> {
protected final Function<TradeInfo, Long> toTradeFeeBtc = (t) -> {
var isMyOffer = t.getOffer().getIsMyOffer();
if (isMyOffer) {
return t.getOffer().getIsCurrencyForMakerFeeBtc()
? t.getOffer().getMakerFee()
Expand Down
Expand Up @@ -45,15 +45,15 @@ private void populateColumns() {
colCurrency.addRow(toPaymentCurrencyCode.apply(t));
colMinerTxFee.addRow(toMyMinerTxFee.apply(t));

long tradeFeeBsq = toTradeFeeBsq.apply(t, true);
long tradeFeeBtc = toTradeFeeBtc.apply(t, true);
long tradeFeeBsq = toTradeFeeBsq.apply(t);
long tradeFeeBtc = toTradeFeeBtc.apply(t);
if (tradeFeeBsq > 0)
colMixedTradeFee.addRow(tradeFeeBsq, true);
else
colMixedTradeFee.addRow(tradeFeeBtc, false);

colBuyerDeposit.addRow(t.getBuyerDeposit());
colSellerDeposit.addRow(t.getSellerDeposit());
colBuyerDeposit.addRow(t.getOffer().getBuyerSecurityDeposit());
colSellerDeposit.addRow(t.getOffer().getSellerSecurityDeposit());
colOfferType.addRow(toOfferType.apply(t));
colClosingStatus.addRow(t.getClosingStatus());
});
Expand Down
Expand Up @@ -36,8 +36,8 @@ class TableBuilderConstants {
static final String COL_HEADER_UNLOCKING_BONDS_BALANCE = "Unlocking Bonds Balance";
static final String COL_HEADER_UNVERIFIED_BALANCE = "Unverified Balance";
static final String COL_HEADER_BSQ_SWAP_TRADE_ROLE = "My BSQ Swap Role";
static final String COL_HEADER_BUYER_DEPOSIT = "Buyer Deposit";
static final String COL_HEADER_SELLER_DEPOSIT = "Seller Deposit";
static final String COL_HEADER_BUYER_DEPOSIT = "Buyer Deposit (BTC)";
static final String COL_HEADER_SELLER_DEPOSIT = "Seller Deposit (BTC)";
static final String COL_HEADER_CONFIRMATIONS = "Confirmations";
static final String COL_HEADER_DEVIATION = "Deviation";
static final String COL_HEADER_IS_USED_ADDRESS = "Is Used";
Expand Down