Choose isolated or cross margin mode

Selecting between isolated and cross margin is the first decision in managing onchain perp margin for capital efficiency. This choice determines how much of your wallet balance is at risk and how much capital remains free for other trades.

Isolated margin assigns a fixed amount of collateral to a single position. If the trade moves against you, you lose only that specific allocation. The rest of your wallet remains untouched. This mode acts like a firebreak: it contains the damage to one position, preventing a liquidation from draining your entire account. It is the safer choice for beginners or for traders who want to cap their maximum loss on a specific bet.

Cross margin pools all available wallet balance to support your open positions. This increases capital efficiency because you can maintain larger positions without adding more funds. However, it raises liquidation risk. A sharp price move can liquidate your entire portfolio balance, not just the funds tied to the losing trade. Cross margin is better suited for experienced traders who actively manage risk across multiple positions and want to avoid frequent margin calls.

The table below summarizes the key differences to help you decide which mode fits your strategy.

onchain perp margin
FeatureIsolated MarginCross MarginBest For
Risk ExposureLimited to position sizeEntire wallet balanceRisk control
Capital EfficiencyLower (funds locked per trade)Higher (shared pool)Maximizing leverage
Liquidation ImpactOnly the specific positionAll positions in walletPortfolio stability
Margin ManagementManual top-ups per tradeAutomatic from walletActive traders

When trading onchain, always verify which margin mode your protocol supports. Some decentralized exchanges default to isolated margin for safety, while others offer cross margin for advanced users. Understanding this distinction is critical to avoiding unexpected liquidations.

Calculate initial margin requirements

Before opening a position, you must determine the exact collateral needed. This figure is called the initial margin. It acts as a security deposit, ensuring you have sufficient funds to cover potential losses without over-leveraging your account.

The calculation relies on three variables: your position size, the current mark price of the asset, and your chosen leverage ratio. MetaMask provides a clear formula for this:

Initial Margin = (Position Size × Mark Price) ÷ Leverage

For example, if you want to open a $10,000 position with 5x leverage, you only need to deposit $2,000 in collateral. The exchange covers the remaining $8,000, effectively borrowing it to you. This mechanism allows you to control a larger position with less capital, which is the core of capital efficiency.

onchain perp margin
1
Determine your position size

Decide the total value of the position you wish to take. This is not the amount of money you have in your wallet, but the total exposure. If you have $5,000 and want to trade with 10x leverage, your maximum position size is $50,000.

onchain perp margin
2
Identify the current mark price

Look up the real-time mark price of the underlying asset on the exchange. Use the mark price rather than the last traded price, as mark prices are less susceptible to manipulation and provide a more accurate baseline for margin calculations.

to Capital Efficiency
3
Apply the leverage ratio

Divide your total position value by your leverage multiplier. This gives you the base initial margin requirement. Remember that higher leverage reduces the initial margin needed, but it also significantly increases the risk of liquidation if the market moves against you.

Most onchain perpetual exchanges display this calculation automatically when you select your leverage. However, verifying the math yourself is a good habit. It prevents surprises when fees or maintenance margin requirements are added to the equation.

Execute the trade with proper leverage

On-chain perpetual futures rely on smart contracts to handle order matching and margin calculations, meaning your execution settings directly dictate your risk exposure [src-serp-3]. Unlike centralized exchanges, you cannot rely on a customer support team to reverse a mistake. Once you confirm the transaction, the smart contract executes it immediately. This section covers the final execution phase, ensuring you set leverage limits and manage slippage to maintain capital efficiency.

1. Set your leverage multiplier

Leverage amplifies your position size relative to your margin deposit. In on-chain perps, this is not just a trading preference but a mathematical constraint on your liquidation price. Setting leverage too high leaves little room for market volatility, increasing the chance of a forced liquidation. Conversely, setting it too low reduces the capital efficiency you are trying to achieve.

Adjust the leverage slider to your target multiplier before confirming the trade. A common mistake is leaving the default 1x or 3x when you intended to use higher leverage. Verify the displayed notional value matches your expectation. If the notional value seems disproportionately large compared to your margin, the leverage setting is likely incorrect.

2. Configure slippage tolerance

Slippage is the difference between the expected price of a trade and the price at which the trade is actually executed. On decentralized exchanges, this occurs because of liquidity depth and price impact. If your slippage tolerance is set too low, your transaction will fail, and you will lose gas fees. If it is set too high, you may receive a significantly worse price than anticipated.

Phemex and other platforms suggest reviewing slippage settings based on market conditions [src-serp-8]. For stable, high-liquidity pairs, a low tolerance (0.5%–1%) is usually sufficient. For volatile assets or during high-volume periods, you may need to increase this to 2%–5% to ensure the transaction goes through. Always balance the risk of a bad fill against the risk of a failed transaction.

3. Review and confirm the transaction

Before signing, double-check the direction (Long/Short), the asset pair, the leverage multiplier, and the slippage tolerance. Once you click "Confirm" or "Swap," you are submitting a transaction to the blockchain. The network will then process your request, and the smart contract will update your position.

onchain perp margin
1
Verify position details

Check the summary screen for the correct pair, leverage, and notional value. Ensure the slippage tolerance matches your risk tolerance.

onchain perp margin
2
Set slippage limits

Adjust the slippage percentage based on current market volatility. Higher volatility requires a wider tolerance to prevent failed transactions.

to Capital Efficiency
3
Sign and submit

Review all settings one last time. Sign the transaction with your wallet and wait for network confirmation. Monitor the transaction hash to ensure it clears.

4. Monitor margin level post-execution

After execution, your position is live, and your margin level becomes the primary indicator of account health. A margin level above 200% generally provides a safer buffer against sudden price swings [src-serp-8]. If your margin level drops below critical thresholds, the protocol may liquidate your position to protect the pool.

Keep an eye on your liquidation price. This is the price point at which your margin is no longer sufficient to cover losses. Setting stop-losses or managing your margin deposit actively can help prevent unwanted liquidations. Remember, on-chain perps are automated; there is no manual intervention to save a position once the liquidation threshold is breached.

Monitor margin level and funding rates

Managing onchain perpetual margin requires active observation of two distinct metrics: your margin level and the funding rate. While the margin level tells you how close you are to liquidation, the funding rate reveals the cost of maintaining your position over time. Treating these numbers as static data points is a mistake; they are dynamic signals that dictate when to adjust, hedge, or exit.

Watch the margin level to avoid liquidation

The margin level is the primary indicator of your account's health. It represents the ratio of your total equity to the maintenance margin required by the exchange. If this number drops too low, the protocol will automatically liquidate your position to cover losses.

Most professional traders aim to keep their margin level above 200% to absorb market volatility without triggering a forced close. A level below 100% is dangerous territory, and falling below the exchange's minimum threshold (often around 50-75% depending on the platform) means you are no longer in control of your position.

Onchain perps often use cross-margin models, which share collateral across multiple positions. This increases capital efficiency but also means a loss in one position can drain the buffer of another. You must monitor the aggregate margin level of your entire portfolio, not just individual trades, to understand your true exposure.

Track funding rates to manage holding costs

Funding rates are periodic payments exchanged between long and short traders to keep the perpetual contract price aligned with the underlying spot price. When the funding rate is positive, longs pay shorts. When it is negative, shorts pay longs. This mechanism ensures that the perp price does not drift too far from the spot market.

For capital efficiency, high funding rates are a silent killer. If you are holding a long position during a period of consistently positive funding, you are effectively paying a premium to keep the trade open. Over days or weeks, these payments can erode your profits significantly, even if the price action is favorable.

Monitor the funding rate trend rather than just the current value. A sudden spike in funding often indicates extreme sentiment and potential over-leverage in the market. If the rate is unusually high, consider reducing your position size or hedging with spot assets to avoid paying excessive fees while waiting for the market to cool down.

Close positions and withdraw collateral

Closing a position and withdrawing collateral finalizes the cycle of managing onchain perp margin. This process locks in your realized profit or loss and returns the remaining funds to your wallet or stablecoin reserve, ensuring your capital is no longer at risk.

1. Review and confirm position details

Before closing, verify the current mark price, your entry price, and the accumulated funding payments. This confirms the exact realized PnL you are about to secure. Check the interface for any pending fees or liquidation risks that might affect the final settlement.

2. Execute the close trade

Select the "Close" or "Market Close" option on the trading interface. For immediate liquidity, a market order is standard, though limit orders allow you to target a specific exit price if the market is volatile. Confirm the transaction in your wallet, noting the gas fees required to settle the smart contract interaction.

3. Withdraw remaining collateral

Once the position is closed, the remaining margin (initial margin plus realized PnL minus fees) is returned to your available balance. Navigate to the withdrawal or transfer section of the platform. Initiate a transfer of these funds back to your personal wallet or a stablecoin reserve to complete the capital efficiency loop.

Final checklist for closing a position

  • Verify realized PnL and funding payments
  • Confirm gas fees for the close transaction
  • Execute market or limit close order
  • Transfer remaining collateral to wallet

Frequently asked questions about perp margin