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 rpc method 'getoffers' #4329

Merged
merged 36 commits into from Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b1146fd
Rename CoreWalletService -> CoreWalletsService
ghubstan Jun 12, 2020
ec66b14
Add rpc wallet(s) protection tests
ghubstan Jun 12, 2020
85c9676
Add rpc method 'getfundingaddresses'
ghubstan Jun 13, 2020
2e415de
Replace duplicate code in getFundingAddresses
ghubstan Jun 14, 2020
b1228e5
Add rpc method 'getaddressbalance'
ghubstan Jun 14, 2020
a7542e9
Add rpc method 'createpaymentacct'
ghubstan Jun 15, 2020
bac3ed5
Call core wallets service methods from CoreApi
ghubstan Jun 15, 2020
258d180
Factor duplicate unlocked wallet checks into new method
ghubstan Jun 16, 2020
c5134e1
Replace Tuple3 with memoization
dmos62 Jun 18, 2020
9db9ee2
Merge pull request #2 from dmos62/Z-getfundingaddresses-patch
ghubstan Jun 18, 2020
b0e278f
Refactor getFundingAddresses to use memoization
ghubstan Jun 18, 2020
1930411
Rmove blank line
ghubstan Jun 18, 2020
435672a
Add rpc method 'getpaymentaccts'
ghubstan Jun 19, 2020
331f488
Return protos from funding address methods
ghubstan Jun 19, 2020
612bafe
Refactor AddressBalanceInfo display logic
ghubstan Jun 20, 2020
37fb606
Add license comment
ghubstan Jun 20, 2020
855ac0f
Add license comment
ghubstan Jun 20, 2020
bfcc693
Add license comment
ghubstan Jun 20, 2020
d06807b
Wrap Exception from core in gRPC StatusRuntimeException
ghubstan Jun 20, 2020
7c073c6
Revert "Add license comment"
ghubstan Jun 20, 2020
d6ea0ea
Re-add license comment
ghubstan Jun 20, 2020
41f1add
Remove try catch block
ghubstan Jun 20, 2020
88cb90e
Add rpc method 'getoffers'
ghubstan Jun 20, 2020
1756258
Do not use protobuf.OfferPayload.Direction in client
ghubstan Jun 20, 2020
4778976
Fix comments
ghubstan Jun 20, 2020
b25abf1
Refactor CLI output table formatting
ghubstan Jun 21, 2020
a48af7c
Add 'getoffers' unit tests
ghubstan Jun 22, 2020
61285a7
Do not change case of input params in client
ghubstan Jun 22, 2020
0d9bdef
Add 'getoffers' smoke test
ghubstan Jun 22, 2020
8dcfa50
Define reusable headers from balance-info tbl
ghubstan Jun 22, 2020
52529a9
Move getpaymentaccts tbl formatting to TableFormat
ghubstan Jun 22, 2020
9691f35
Check param count only, not param order correctness
ghubstan Jun 23, 2020
e1fddfa
Remove duplication in wallets availability checks
ghubstan Jun 23, 2020
6979209
Check param count only, not param order correctness
ghubstan Jun 23, 2020
51d82b1
Fix offer list filter bug due to direction flip
ghubstan Jun 23, 2020
f820897
Format dates ISO 8601 in UTC
ghubstan Jun 24, 2020
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
2 changes: 1 addition & 1 deletion cli/src/main/java/bisq/cli/TableFormat.java
Expand Up @@ -92,7 +92,7 @@ static String formatOfferTable(List<OfferInfo> offerInfo, String fiatCurrency) {
return headerLine
+ offerInfo.stream()
.map(o -> format(colDataFormat,
o.getDirection().equals("BUY") ? "SELL" : "BUY",
o.getDirection(),
formatOfferPrice(o.getPrice()),
formatAmountRange(o.getMinAmount(), o.getAmount()),
formatVolumeRange(o.getMinVolume(), o.getVolume()),
Expand Down
15 changes: 10 additions & 5 deletions core/src/main/java/bisq/core/grpc/CoreOffersService.java
Expand Up @@ -60,14 +60,19 @@ public CoreOffersService(CreateOfferService createOfferService,

public List<Offer> getOffers(String direction, String fiatCurrencyCode) {
List<Offer> offers = offerBookService.getOffers().stream()
.filter(o -> !o.getDirection().name().equalsIgnoreCase(direction)
&& o.getOfferPayload().getCounterCurrencyCode().equalsIgnoreCase(fiatCurrencyCode))
.filter(o -> {
var offerOfWantedDirection = o.getDirection().name().equalsIgnoreCase(direction);
var offerInWantedCurrency = o.getOfferPayload().getCounterCurrencyCode().equalsIgnoreCase(fiatCurrencyCode);
return offerOfWantedDirection && offerInWantedCurrency;
})
.collect(Collectors.toList());

if (direction.equals(BUY.name()))
offers.sort(Comparator.comparing(Offer::getPrice));
else
// A buyer probably wants to see sell orders in price ascending order.
// A seller probably wants to see buy orders in price descending order.
if (direction.equalsIgnoreCase(BUY.name()))
offers.sort(Comparator.comparing(Offer::getPrice).reversed());
else
offers.sort(Comparator.comparing(Offer::getPrice));

return offers;
}
Expand Down