Fix swapped arguments in SimulatedTradeService.cancelOrder#5326
Open
Baqirrizvidev wants to merge 1 commit into
Open
Fix swapped arguments in SimulatedTradeService.cancelOrder#5326Baqirrizvidev wants to merge 1 commit into
Baqirrizvidev wants to merge 1 commit into
Conversation
The CancelOrderByCurrencyPair path passed (orderId, apiKey) to MatchingEngine.cancelOrder(apiKey, orderId, type), so cancellation silently never removed the order from the book or released the reserved balance. Adds a regression test covering that path. Fixes knowm#5187 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5187
Problem
In the
CancelOrderByCurrencyPairpath ofSimulatedTradeService.cancelOrder, the call was:but the engine signature is
MatchingEngine.cancelOrder(String apiKey, String orderId, OrderType type). Since both parameters areStrings, this compiled fine but meant the book lookup compared order IDs against the API key — so the cancellation silently did nothing: the order stayed on the book and the reserved balance was never released. (TheDefaultCancelOrderParamIdpath a few lines below already used the correct order.)Fix
Swap the arguments to match the signature, plus a regression test (
testCancelByCurrencyPairIdAndOrderType) that cancels via a params object implementingCancelOrderByCurrencyPair+CancelOrderByIdParams+CancelOrderByOrderTypeParamsand asserts the order is removed and the frozen balance released. The test fails without the one-line fix.mvn -pl xchange-simulated -am testpasses (12/12).🤖 Generated with Claude Code