Skip to content

Fix swapped arguments in SimulatedTradeService.cancelOrder#5326

Open
Baqirrizvidev wants to merge 1 commit into
knowm:developfrom
Baqirrizvidev:fix-5187-simulated-cancel-order-args
Open

Fix swapped arguments in SimulatedTradeService.cancelOrder#5326
Baqirrizvidev wants to merge 1 commit into
knowm:developfrom
Baqirrizvidev:fix-5187-simulated-cancel-order-args

Conversation

@Baqirrizvidev

Copy link
Copy Markdown

Fixes #5187

Problem

In the CancelOrderByCurrencyPair path of SimulatedTradeService.cancelOrder, the call was:

engine.cancelOrder(orderId, getApiKey(), type);

but the engine signature is MatchingEngine.cancelOrder(String apiKey, String orderId, OrderType type). Since both parameters are Strings, 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. (The DefaultCancelOrderParamId path 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 implementing CancelOrderByCurrencyPair + CancelOrderByIdParams + CancelOrderByOrderTypeParams and asserts the order is removed and the frozen balance released. The test fails without the one-line fix.

mvn -pl xchange-simulated -am test passes (12/12).

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect parameter order in engine.cancelOrder method

1 participant