-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
This PR remains in draft status until I figure out how to display the correct share of the BSQ Swap's tx-miner-fee paid by the swap offer maker and taker. The console is incorrectly displaying the full tx-miner-fee for maker and taker. |
@ghubstan I just tried out the gettrades endpoint and it failed for me with following error when trying to call:
|
When trying to call It failed with:
I do know that I have quite a couple of nasty failed trades in my list, but I think this should not prevent this request to execute successfully. |
cli/src/main/java/bisq/cli/table/builder/AbstractTradeTableBuilder.java
Outdated
Show resolved
Hide resolved
Tested again the new gettrades endpoints:
@ghubstan Everything seems to work now for my data set, but I think the response list should be sorted by date. BTW. do we have any limits option in our API endpoints regarding the max response entries? Might not be super critical ATM, but this could change in the future if liquidity changes and the amount of offers online. WDYT? |
By the way amigo, that's some baaaaad data ;-) It is very useful. |
It seems to have worked for failed trades:
but not for closed trades (canceled trades are not included in sorting):
For open trades it also seems to work (have to check with more open trades):
|
@@ -292,7 +298,10 @@ Trade getTrade(String tradeId) { | |||
List<TradeModel> getOpenTrades() { | |||
coreWalletsService.verifyWalletsAreAvailable(); | |||
coreWalletsService.verifyEncryptedWalletIsUnlocked(); | |||
return tradeManager.getTrades().stream().map(t -> (TradeModel) t).collect(Collectors.toList()); | |||
return tradeManager.getTrades().stream() | |||
.map(t -> (TradeModel) t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to map it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is something @xyz123 asked for in his review: "why isn't the mapping consistent between return types for List<TradeModel> getOpenTrades()
and List<TradeModel> getTradeHistory(...)
"? I did intend make the return types consistent, but overlooked it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mean so much about the return types of the method, but rather the fact, that in this case it is unnecessary to cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed two casts in 8206425, but the mapping in line 303 had to stay.
} else { | ||
var failedV1Trades = failedTradesManager.getTrades(); | ||
return failedV1Trades.stream().map(t -> (TradeModel) t).collect(Collectors.toList()); | ||
return failedV1Trades.stream() | ||
.map(t -> (TradeModel) t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to map it here?
Sorting for closed trades does not work as you build the final response list in |
You are right. Fix will come later today. |
This reverts commit f231aac. Sorting cumulative trade history lists should be done once, in GrpcTradesService.
See 111e39f. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK - Tested it on Regtest
The
gettrades
method takes an--category=[open|closed|failed]
parameter and displays pending, closed, and failed trades, respectively:Based on
master
.