fix(mexc): omit reduceOnly in non-hedged swap order branch#28414
Merged
carlosmiei merged 2 commits intoccxt:masterfrom Apr 15, 2026
Merged
fix(mexc): omit reduceOnly in non-hedged swap order branch#28414carlosmiei merged 2 commits intoccxt:masterfrom
carlosmiei merged 2 commits intoccxt:masterfrom
Conversation
In hedge mode disabled (non-hedged), when reduceOnly=true, the sideInteger was correctly set to 2 (buy) or 4 (sell), but reduceOnly was not removed from params before the final this.extend(request, params) call, causing reduceOnly to leak into the HTTP request body and trigger id collision with open orders on MEXC futures. Add: params = this.omit (params, 'reduceOnly') inside the non-hedged if (reduceOnly) block, mirroring the existing omit call in the hedged branch.
…SwapOrder Add two static request test entries verifying that when reduceOnly=true in non-hedged mode, the HTTP request body contains the correct sideInteger (2 for buy, 4 for sell) and does NOT include reduceOnly. These tests fail without the fix in createSwapOrder and pass with it, providing regression coverage for Bug A.
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 #28410
MEXC swap orders with
reduceOnly=truein non-hedged mode includereduceOnlyin the HTTP request body. MEXC rejects this parameter, causing order ID collisions with existing open positions in production. The hedged branch already callsthis.omit(params, 'reduceOnly')at line ~2558; this PR mirrors that pattern in the non-hedged else-branch.Only
ts/src/mexc.tsis modified (one line added). Two static request tests are added ints/src/test/static/request/mexc.jsonverifying that thereduceOnlyfield is absent from the serialized request body for both buy (side=2) and sell (side=4) close orders.Note: a separate Bug B (side inversion in the hedged+reduceOnly branch) is under investigation and will be filed as its own issue if confirmed — it is explicitly out of scope for this PR per the ccxt atomic-PR policy.