Understand margin types in perps

Choosing the right margin mode is the first step in managing onchain perp margin effectively. Every leveraged perpetual futures position is governed by two margin thresholds: initial margin and maintenance margin. Initial margin is the collateral required to open a trade, calculated as position size multiplied by mark price divided by leverage. For example, opening a $10,000 position at 10x leverage requires $1,000 in initial margin [src-serp-1].

Beyond these entry thresholds, your margin level dictates your safety. If your margin level falls below a broker's minimum requirement (e.g., 50%), the broker might close your positions to protect against further losses, known as a stop out. Maintaining a high margin level (ideally above 200%) ensures safer trading and reduces the likelihood of forced liquidation [src-serp-2].

FeatureCross MarginIsolated Margin
Risk ScopeEntire account balanceOnly allocated position funds
Capital EfficiencyHigh (shared collateral)Lower (dedicated funds)
Liquidation RiskSpread across all positionsContained to one position
Best ForDiversified, hedged strategiesHigh-leverage, directional bets

Cross margin pools your entire account balance as collateral for a single position. This offers high capital efficiency because losses in one position can be offset by gains in another. However, it also means a severe market move can liquidate your entire account balance. Isolated margin, now widely available on major exchanges like Crypto.com, restricts risk to only the funds explicitly allocated to that specific position [src-serp-3].

If you are trading high-leverage, directional bets, isolated margin provides a clearer and more controlled way to manage risk. Your potential loss is capped at the allocated funds, protecting the rest of your portfolio. For diversified or hedged strategies, cross margin allows you to use your full balance more efficiently, though it requires constant monitoring to prevent total account wipeout.

onchain perp margin
  • Calculate initial margin required for your target position size
  • Determine your maximum acceptable loss per trade
  • Select isolated margin for high-risk, high-leverage bets
  • Use cross margin only if you have hedged positions and active monitoring

Calculate initial and maintenance margin

To manage onchain perp margin effectively, you must distinguish between the collateral required to open a position and the buffer needed to keep it open. These two thresholds dictate your entry cost and your liquidation risk.

Initial margin: the entry cost

Initial margin is the minimum collateral you must deposit to open a leveraged position. It is calculated directly from the position size, the asset's mark price, and your chosen leverage.

The formula is straightforward:

Position Size × Mark Price / Leverage
Initial Margin Formula

For example, if you want to open a $10,000 position at 10x leverage, you need $1,000 in initial margin. This amount is locked as collateral for the duration of the trade. If your exchange or protocol offers lower leverage, such as 5x, your initial margin requirement doubles to $2,000.

Maintenance margin: the liquidation buffer

Maintenance margin is the minimum collateral balance required to keep your position open. It is always lower than the initial margin. If your account equity falls below this threshold due to adverse price movement, the position will be liquidated.

Most onchain perpetual protocols set the maintenance margin between 0.5% and 1% of the position size. Using the previous example, a $10,000 position with a 0.5% maintenance margin requires $50 in equity to stay open. If your collateral drops below $50, the protocol will automatically close your position to protect against further losses.

Managing the gap

The difference between initial and maintenance margin is your liquidation buffer. A wider buffer allows for more price volatility before liquidation occurs. However, using high leverage narrows this gap, increasing the risk of being stopped out during normal market fluctuations.

To lower funding costs and reduce liquidation risk, calculate both margins before entering. Ensure your initial margin covers the entry, and your available balance exceeds the maintenance margin by a comfortable margin.

Open a leveraged position on-chain

Opening a leveraged position on-chain follows a specific workflow. You start by connecting your wallet to a reputable perpetual exchange, such as Zeta Markets on Solana, which offers up to 10x leverage through cross-margin trading. This setup allows you to use your deposited collateral to open larger positions than your balance would normally permit.

Before executing the trade, you must determine your margin requirements. Every leveraged position is governed by two thresholds: initial margin and maintenance margin. The initial margin is the collateral required to open the trade, calculated as position size × mark price ÷ leverage. For example, opening a $10,000 position at 10x leverage requires $1,000 in initial margin. Understanding this formula is critical to avoiding immediate liquidation.

1
Connect your wallet

Navigate to the exchange interface and connect your wallet. Ensure you are on the correct network (e.g., Solana) and have sufficient native tokens to cover gas fees. Verify the contract address to avoid phishing sites.

2
Deposit collateral

Transfer the required initial margin into the trading account. This collateral acts as your security deposit. If your margin level falls below the broker's minimum requirement (often around 50%), the position may be forcibly closed to protect against further losses.

3
Select market and leverage

Choose the perpetual contract you wish to trade. Set your desired leverage ratio. Higher leverage increases potential returns but also amplifies risk. For lower funding costs, consider positions that align with positive funding rates or use cross-margin to distribute risk across your entire balance.

4
Configure risk parameters

Set stop-loss and take-profit levels before opening the position. On-chain trading is immutable; once executed, you cannot easily reverse a bad trade. Define your exit strategy to protect your capital from sudden market volatility.

5
Execute the trade

Review all parameters one last time. Confirm the position size, leverage, and estimated funding rate. Click to open the position. Monitor your margin level closely, as maintaining a high margin level (ideally above 200%) provides a safer buffer against liquidation.

After execution, your position is live on-chain. You can now monitor your PnL, margin level, and funding costs in real-time. Remember that perp trading involves ongoing funding costs and the risk of losing all deposited collateral through liquidation.

Monitor funding rates to cut costs

Funding rates are the hidden tax on perpetual futures. Unlike traditional futures that expire, perps have no end date, so the exchange charges a periodic fee to keep the perp price tethered to the spot price. If you hold a position for days or weeks, these fees compound. Ignoring them turns a profitable trade into a net loss.

To manage this, you need to watch the rate in real time. Funding rates typically settle every 8 hours on major exchanges. When the rate is positive, long traders pay short traders. When it’s negative, shorts pay longs. Your goal is simple: avoid paying fees when you can, or collect them when the market is skewed against you.

Track the spread and settle times

Don’t guess the rate. Check the official data feed on your exchange dashboard or a reliable aggregator like DeFi Prime. Look at the current rate and the annualized percentage. A rate of 0.01% per 8 hours sounds small, but it compounds to roughly 11% annually. If you’re holding a large position, that’s significant drag on your margin.

Set a reminder for the settlement window. If you see a high positive rate and you’re long, consider closing or reducing the position before the settlement timestamp. You can reopen later if the trend continues, but you’ve just avoided the fee. This is especially critical for leveraged positions, where your margin buffer is thin.

Adjust leverage to absorb volatility

Monitoring isn’t just about timing entries; it’s about sizing. High leverage amplifies both gains and funding costs. If you’re holding a position through a high-funding period, reduce your leverage. This gives your margin more room to breathe and reduces the percentage of your capital eaten by fees.

Think of your margin like a fuel tank. Funding rates are the engine’s idle consumption. If you drive slowly (low leverage), you make the fuel last longer. If you floor it (high leverage), you burn through your capital reserves quickly, leaving you vulnerable to liquidation if the price moves against you while you’re paying high fees.

Use the data to your advantage

Sometimes, high funding rates signal an opportunity. If the rate is extremely negative, shorts are paying longs. This might indicate a market that is overly bearish, potentially setting up a short squeeze. In these cases, going long and collecting funding can be a profitable strategy, even if the price doesn’t move much.

However, this is a advanced tactic. Ensure you understand the mechanics before trying to play the funding rate. For most traders, the best strategy is to minimize holding time. If you need to hold a position for more than a few days, calculate the total funding cost and subtract it from your projected profit. If the trade isn’t profitable after fees, don’t take it.

Avoid liquidation with proper margin levels

Liquidation is the primary risk in onchain perpetual futures. When your margin level drops below the protocol's maintenance threshold, the system automatically closes your position to protect the lending pool. This results in the total loss of your collateral, often with additional liquidation penalties.

To stay safe, maintain a margin level well above 100%. While some protocols allow positions to remain open at 100%, a drop below this triggers immediate action. Aim for a buffer of 200% or higher to absorb normal market volatility without triggering a forced close. This buffer acts as a shock absorber, giving you time to react to sudden price swings rather than being forced out.

Monitor your margin level in real-time. Do not rely on static entries; as prices move, your margin level changes. Keep an eye on the mark price, not just the last traded price, to get an accurate picture of your account health. Setting up alerts for when your margin level approaches critical thresholds can help you add collateral or reduce size before a liquidation event occurs.

Onchain perp margin FAQ