dYdX swap orders can fill partially before cancellation takes effect
dYdX swap execution records distinguish completed perpetual trades from an order's unfilled remainder. Compare the order identifier, cumulative filled quantity, cancellation status, and resulting position. A submitted cancellation does not reverse completed trades, and a short-term order can still match while cancellation messages spread.
Canceling an unfilled remainder leaves completed fills intact, and short-term orders require particular care because cancellation can race with matching.
Immediate Execution and Resting Orders
Market orders and resting limit orders leave different unfinished states, so the execution policy determines whether a partial fill requires further cancellation. The dYdX perpetual interface submits market orders as immediate-or-cancel by default. Available matching liquidity determines execution, and the policy cancels any unfilled remainder. A smaller completed quantity therefore does not automatically mean the order remains active.
A limit order with a resting execution policy can retain an outstanding quantity after partial execution. Its limit restricts acceptable execution prices; it does not promise a complete fill. Monitor that remainder until execution, cancellation, or expiry removes it. These order states concern perpetual trading on dYdX Chain. Spot trading has a different receiving outcome, so a perpetual position record cannot confirm receipt of spot tokens.
Order Identity and Fill Records
The order identifier connects the submitted instruction with its execution history, while the subaccount and market establish which account activity belongs in the comparison. Retain the original size, side, limit price, execution policy, and expiry. Similar-looking orders can share a market and direction without representing the same instruction.
The order response includes size, cumulative filled quantity, status, and expiry fields. Its update time and block height, when present, help place that snapshot in context. Individual fill records describe executions with their own quantities, prices, fees, and identifiers. Use an attached order identifier where available, rather than assigning every nearby trade to the order under review.
Partial Quantities and Executed Prices
A partial fill means some requested quantity executed, while the order's status and execution policy determine whether its remaining quantity can still trade. For an unchanged order, subtract cumulative filled quantity from original size to calculate the amount not yet recorded as executed. Once cancellation or expiry makes the order unfillable and the records include its final fills, that difference is the final unexecuted amount.
Several fills can contribute to one order at different prices. Calculate their average execution price by multiplying each fill's price by its quantity, summing those products, and dividing by total filled quantity. A simple average of prices gives the wrong weighting when fill sizes differ. Keep recorded trading fees separate from this price calculation; otherwise, the result mixes execution price with trading cost.
A canceled order can therefore have both a positive filled quantity and a positive unexecuted quantity. The status describes its remaining ability to execute.
Normal Waiting and Interrupted Updates
An open limit order with no new fills can reflect ordinary waiting for eligible liquidity, whereas interrupted account updates leave the displayed state uncertain. A moving chart does not establish that the account feed remains connected. Market prices and account activity arrive through different data feeds.
The subaccount feed carries changes to orders, fills, and positions. After a connection interruption, obtain a fresh account snapshot and reconcile execution history before interpreting an unchanged display. For an API integration, connection identifiers and message sequence numbers help identify discontinuities. A fresh market price cannot replace a missing account update, and repeated order submissions cannot repair an incomplete local history.
What Confirms That an Order Cancellation Has Taken Effect?
Confirmation depends on the order's lifetime: stateful cancellation takes effect through blockchain processing, while a short-term best-effort cancellation does not establish network-wide removal. Sending a request, receiving an acknowledgment, and observing its final effect represent different events. A stateful cancellation needs successful execution in a committed block, followed by account records reflecting that outcome.
A best-effort canceled status confirms removal at the reporting node, without guaranteeing removal at every other node. Preserve the distinction when reading an interface or API response. A local removal message can arrive before another validator's fill becomes visible. If the cumulative filled quantity increases afterward, reconcile the additional execution instead of treating the earlier message as proof that nothing else traded.
Cancellation Races Before Expiry
A short-term cancellation can reach one validator before another, leaving an interval when matching remains possible elsewhere in the network. Nodes maintain local order books, and message arrival order can differ. The chain's committed matches determine the completed execution.
The order's Good-Till-Block value supplies a separate boundary. Consensus does not permit a short-term order to fill at a block height greater than its Good-Till-Block value. Once the chain passes that height, reconcile records through the expiry boundary. A fill displayed afterward may belong to an earlier block; distinguish its execution height from the time the interface showed it.
A Partial Buy With a Cancellation in Flight
This hypothetical example starts with no position in the selected perpetual market. All quantities and execution outcomes below are illustrative. The requested buy size is 2.73 units of the market's underlying asset, and the selected market accepts the illustrated quantity increments.
Before submission, the trader checks the limit price, available margin, and short-term expiry. The trader can discard the unsigned, unsubmitted order without creating exposure. After submission, matching can occur before a cancellation request arrives. Submission commits the trader to any resulting fills; cancellation cannot restore the starting position.
The execution record initially shows a fill of 1.18 units. The trader requests cancellation of the remainder. A local best-effort cancellation response appears, but a further fill of 0.23 units reaches the committed history while the order remains valid. Total execution becomes 1.18 + 0.23 = 1.41 units.
The chain then advances beyond the order's expiry height. Updated records covering that boundary show no further fills. The unexecuted amount is 2.73 - 1.41 = 1.32 units, and that remainder can no longer match. No replacement order forms part of this example.
With no other position-changing activity, the receiving account now shows a long position of 1.41 units. Expiry made the remaining order unfillable; the completed fills left the account with a long position. A different final fill total would change both the resulting exposure and the unexecuted remainder.
Replacement Orders and Duplicate Exposure
Replacing a short-term order through the supported replacement mechanism differs from canceling it and submitting an unrelated new order while removal remains uncertain. The latter approach can leave both instructions executable.
At the protocol level, a short-term replacement uses the same order ID and a larger Good-Till-Block value. The identity includes the subaccount, client identifier, order flags, and market identifier. Do not infer those properties from an interface's button label. When using cancellation followed by a separate order, first establish the old order's final filled quantity and non-executable state. The replacement amount must reflect completed execution rather than repeat the original request blindly.
Order Cancellation and Position Closure
A canceled entry order leaves any position its fills created in place, with the applicable margin requirements and funding exposure. Closing that position requires a separate execution, which can itself finish only partially. A close order's terminal status therefore does not prove the position reached zero. Compare the resulting position size with the intended remaining exposure. Reduce-only settings restrict an eligible order's effect on exposure; they do not supply missing liquidity.
Block Expiry and Elapsed Time
Short-term expiry follows block height, so elapsed wall-clock time alone cannot establish that an order has become unfillable. Slow blocks or a chain halt change how long reaching the boundary takes. Stateful orders instead use a block-time expiry. Keep the relevant expiry field with the order record and compare it against chain progress. An estimated duration cannot replace the actual boundary during a delay.
Collateral After a Canceled Remainder
Collateral allocation can outlast an order's unfilled portion when completed fills leave an isolated position open. Cancellation and collateral return therefore answer different questions. An account balance change by itself does not show how much of the order traded.
For an unopened isolated position, the dYdX interface allocates collateral before a resting order fills. Its return behavior depends on the remaining orders and position state. When all orders for an unopened isolated position are canceled, the interface returns the allocated collateral to the cross account. A partial fill changes that situation because a position now exists. Reconcile that position and its allocated collateral separately; the canceled remainder does not release the account from the obligations of completed execution.
dYdX swap: frequently asked questions
Does a Post-Only Rejection Mean Part of My Order Traded?
A post-only order is rejected or canceled if it would immediately match existing liquidity. Its purpose is to enter the book without taking liquidity. Distinguish that initial rejection from a previously accepted post-only order that later received fills; the latter can have completed execution before cancellation.
Why Does My Submitted Short-Term Order Have No On-Chain Placement Transaction?
An unfilled short-term order can exist in validator memory without an on-chain placement transaction. Short-term orders enter committed execution through matching. Absence of a standalone placement transaction therefore does not establish that the network never received the order, or that the order cannot still fill before expiry.
How Should Repeated Fill Updates Be Counted After Reconnecting?
Count each distinct fill identifier once when rebuilding execution totals. A repeated delivery of the same fill does not represent another trade. Preserve the fill's quantity, execution height, and account association, and compare the reconstructed total with the order's cumulative filled quantity before calculating any remaining amount.
Can a Chart Touching My Limit Price Prove My Order Should Have Filled?
A chart touching the limit price does not prove that matching liquidity reached your order. Price-time priority and competing orders affect allocation. A displayed trade also describes execution elsewhere in the market; it does not establish a fill for your specific order or subaccount.
Will Canceling One Order Remove Separate Stop and Take-Profit Orders?
A cancellation targeting one order identifier does not cancel separate order identifiers. Inspect any outstanding stop and take-profit instructions individually. Their presence and execution conditions matter after an entry remainder disappears, especially when partial execution leaves a different position size from the amount originally requested.
Where Do Completed Fills Go After a Market Enters Final Settlement?
Completed trades remain in fills history after a market's final settlement. The settlement process cancels open orders, blocks further trading, and closes remaining positions through deleveraging. Distinguish those settlement records from a cancellation you submitted, since the resulting position closure has a different cause.