dYdX changes perpetual positions when orders fill
Updated:dYdX supports perpetual trading on its own blockchain and Solana spot trading through a separate trading experience. Perpetual contracts provide long or short price exposure without a scheduled expiry. Spot trades exchange assets and change token balances. Within perpetual trading, submitting an order does not establish that a position has changed. Executed fills determine traded quantity, while the account reflects the resulting exposure and collateral. Opening or increasing exposure requires sufficient margin. Order status, fill history, and the position answer different questions: what remains executable, what actually traded, and what the account now holds. A cancellation affects the unfilled remainder; it does not undo completed trades.
Jump to a section
Perpetual exposure and spot balances
Perpetual markets on dYdX Chain match buy and sell orders through a decentralized order book, while spot trading exchanges Solana assets. Perpetual positions use USDC collateral and provide exposure to price changes without delivering the underlying token. Buying a spot asset changes token ownership. These paths have different addresses and balances, even when one interface displays both. A connected wallet provides access to an account; its connection alone does not identify the selected product or supply perpetual margin.
Which account supports the intended perpetual trade?
Perpetual trading requires collateral in the trading subaccount that holds the position, with the selected market and margin mode supported by the interface. Cross margin shares collateral among positions in one subaccount. The web interface handles isolated positions in separate subaccounts. That separation describes its implementation; the protocol permits a subaccount to hold multiple positions in cross-marginable markets.
Wallet connection and supported email or social sign-in provide different ways to access trading. They do not determine market eligibility. Perpetual services exclude users in the United States, Canada, and other restricted jurisdictions. The Solana spot rollout allowed U.S. access under separate product conditions.
Suppose an opening buy targets an active perpetual market where the selected subaccount has no existing position.
- Confirm that the deposit funds the perpetual trading account, rather than the separate spot address.
- Match the market and margin mode to the interface; frontend API Trading Keys support cross markets and cross accounts.
- Use an order size that meets the market's minimum amount and size increment, and a limit price that follows its tick size.
- Check that the proposed position meets the account's initial margin requirement. Long-term and conditional orders must also fit the subaccount's current equity-tier limit on open orders; exceeding that limit prevents placement.
- Choose the execution policy before submitting, including whether an unfilled remainder should rest or expire immediately.
A supported buy order can then match sell liquidity in the book. Its committed fill records the executed quantity and price; the same subaccount's new long position shows the resulting exposure. If no quantity fills, the account has no new position from that order. An API key that cannot trade the selected margin mode cannot complete this route.
Order controls and committed fills
Market orders in the default perpetual interface use immediate-or-cancel execution. Matching liquidity determines filled quantity, and the unfilled remainder cancels. The requested amount describes trade size, rather than the resulting position size.
A limit order buys at its limit price or lower, or sells at that price or higher. A marketable limit can execute immediately; otherwise, it may rest on the book. The limit controls acceptable execution price, while available liquidity and the order's validity determine whether any quantity trades.
Stop-loss and take-profit orders wait for a trigger before their market or limit instructions become active. A triggered limit can remain unfilled when liquidity does not meet its price. Trigger price and execution price have different jobs; activating an order does not lock in the eventual sale or purchase price.
A signature authorizes an instruction, and validator acceptance can precede a fill. Short-term orders enter a block only when they participate in a matched trade. Stateful placement can commit before execution.
Order history tracks instructions, while fill history records executed trades. Partial execution can leave both a changed position and an unfilled remainder. An opposing fill reduces existing exposure before any excess establishes exposure in the other direction. Reduce-only restricts eligible instructions to shrinking the position without opening opposite exposure.
When can an unfilled perpetual order still be cancelled?
An order's unfilled quantity can be cancelled before execution, subject to the cancellation rules of its order class. Stateful cancellation commits through the chain. Short-term API cancellation propagates on a best-effort basis, so a later proposer can still match an order that it has not seen cancelled. Block-based expiry prevents fills after that short-term order's validity ends. Cancelling the remainder never reverses an earlier fill. Closing an executed position requires another trade and introduces its own liquidity and execution conditions.
Position equity, funding, and execution costs
Position size changes by filled quantity, and the trade's direction determines whether exposure grows or shrinks. Perpetual equity combines the USDC quote balance with the value of open positions at oracle prices. The quote balance can be negative, so it should not be read as a standalone wallet balance. A trade cannot open or increase a perpetual position if the resulting account equity would fall below the total initial margin requirement.
Margin requirements reflect position size, the oracle price, and the market's margin fraction. Some market configurations increase initial margin as market-wide open notional value grows. Maintenance margin sets the threshold below which liquidation may occur. An accepted opening order does not freeze these conditions; price changes and funding payments can alter account equity while a position remains open.
Funding rates determine payments between long and short positions and can create either a debit or a credit. Those payments are separate from the fee on an executed trade. Reconciliation includes fills, trading fees, funding history, and transfers. Price movement alone may therefore leave part of a balance change unexplained when other entries contributed to the account.
The maker-taker model distinguishes orders that rested on the book from orders that take that liquidity. Fee tiers reflect trailing trading volume, and governance can alter the schedule. Bonded dYdX can qualify for discounts on net positive trading fees; those discounts do not enlarge maker rebates. The portfolio's fee view shows the relevant schedule and tier. Default perpetual trading settings do not charge transaction gas on trades. Transfers and bridging have separate fee rules, and Solana spot trades can incur network and liquidity-provider fees.
Network participation and vault balances
Native dYdX supports validator staking and on-chain governance. Staking rewards reflect protocol activity and validator commission. This network role differs from USDC trading collateral and from ethDYDX, the token issued on Ethereum.
MegaVault uses contributed USDC in automated trading strategies across markets. Its positions can lose value, including in illiquid markets, and withdrawals can incur slippage. Vault holdings do not count as available trading equity while funds remain allocated there. Launching an eligible new market ties the required vault contribution to a governance-controlled lock condition. Moving collateral into a vault can reduce the account's capacity to place additional orders.
dYdX FAQs
-
Do I need native dYdX to open a perpetual position?
- Holding native dYdX is not required simply to open a USDC-collateralized perpetual position. The trading subaccount needs sufficient USDC collateral, while staking serves a separate network role. Actions outside trade execution can have their own transaction-fee requirements, so trading collateral and the balance that pays network fees describe different account functions.
-
Is a limit order always treated as a maker trade?
- A limit order that immediately takes resting liquidity executes as a taker. Quantity that adds liquidity to the book and later fills qualifies as maker execution. Post-only cancels a marketable order before placement, keeping eligible execution on the maker side without guaranteeing that the order will fill.
-
Which price triggers stop-loss and take-profit orders?
- The protocol can trigger conditional orders from the oracle price or a bounded last-traded price. For last-traded triggering, the input comes from a confirmed block and is clamped around the oracle price. A chart's latest tick therefore does not necessarily match the price that the protocol evaluates for activation.
-
How long does a stateful limit order remain open?
- A stateful limit order remains eligible until its configured expiration, unless it fills completely, is cancelled, or is removed earlier. Its good-til-time field defines the expiry. Short-term API orders instead expire at a block height, so the same wall-clock duration does not describe both classes. Supported expiration windows depend on the deployed configuration.
-
Can an API Trading Key withdraw funds from my account?
- The frontend-generated API Trading Key cannot withdraw funds or transfer assets. It can place permitted trades using available margin in the owner's cross account and does not support isolated trades. Limiting transfer permissions does not limit losses from its trades. Revoking its authenticator removes the key's trading access.
-
Are my perpetual positions hidden when I sign in by email?
- Email sign-in does not make dYdX Chain account data private. Public indexer queries identify trading subaccounts using an address and subaccount number and expose associated positions, balances, and fills. Login credentials authorize account use, while on-chain records and public account queries determine what trading information others can inspect.
-
Will closing a perpetual position send collateral back to my external wallet?
- Closing a perpetual position does not itself transfer collateral to an external wallet. A closing fill changes exposure and can realize profit or loss, with execution fees reflected in the account. Funds remain subject to margin requirements for other open positions, while withdrawals and any onward transfer use their applicable processes.
-
What does Final Settlement mean in perpetual fill history?
- Final Settlement records a protocol close-out associated with winding down a market. The governance-approved procedure cancels open orders, blocks new trading, and closes existing positions through deleveraging. Historical fills remain visible after the market becomes unavailable. This record has a different cause from a closing order that the trader voluntarily submitted.