Book a free call

Perpetual DEX in Crypto: How It Works

A perpetual DEX lets traders open margin positions on prices with no expiry, using funding rates to track the spot price. How it works, and what can go wrong.

Hertiv engineering teamReviewed by a senior engineer
6 min read
Perpetual DEX in Crypto: How It Works
On this page

Short answer

A perpetual decentralised exchange is a trading venue where users open long or short positions on crypto prices with borrowed funds, without an expiry date. Trades settle through smart contracts, funding payments keep the contract price near the spot price, and positions close or liquidate automatically when margin runs out.

What is a perpetual DEX?

A perpetual DEX is a decentralised exchange where traders buy and sell perpetual contracts, which track the price of a crypto asset without ever expiring. Unlike a spot exchange, where you buy the asset itself, a perpetual DEX lets you bet on the price going up or down, with borrowed funds, while keeping custody of your own funds.

There is no central company holding your money. Your collateral sits in a smart contract, your trades are executed on chain or on a fast off-chain matching layer, and settlement is enforced by code. That is the core difference from a centralised exchange, where the platform holds your funds and your positions.

Venue What you trade Expiry Who holds funds
Spot DEX The asset itself None You, in your wallet
Perpetual DEX Price contracts None Smart contract
Centralised perpetuals Price contracts None The exchange
Futures exchange Price contracts Fixed date The exchange

Perpetual DEXs grew because traders wanted amplified exposure without handing funds to a centralised platform. The trade-off is that you manage your own wallet, gas fees and liquidation risk. For teams building one, DEX development covers the architecture choices in more depth.

How do perpetual contracts work?

Perpetual contracts work by tracking an index price through funding payments. Traders open long positions if they expect the price to rise, or short positions if they expect it to fall, and the contract price is kept near the spot price by a regular payment between longs and shorts.

When the contract price is above the spot price, long positions pay short positions. When it is below, shorts pay longs. The payment is usually calculated every few hours and is proportional to position size, so holding a large position in a crowded direction costs money over time.

  • Index price. A reference price taken from several spot exchanges, used to value positions and trigger liquidations.
  • Mark price. The fair value used for margin checks, designed to resist short-lived price spikes on a single venue.
  • Funding rate. The periodic payment that pulls the contract price back towards the spot price.
  • Open interest. The total size of all open positions, which shows how much borrowed exposure is in the market.

Funding is the mechanism that replaces expiry. A traditional futures contract converges to the spot price on its settlement date; a perpetual contract converges continuously through funding payments instead.

Borrowed funds, margin and liquidation

Borrowed funds, margin and liquidation are the three mechanics that decide whether a perpetual trade survives. Borrowed funds multiply both gains and losses, margin is the collateral that absorbs losses, and liquidation is the automatic closure of a position when the margin is no longer enough.

With a 10-to-1 margin ratio, a 10 percent move against your position wipes out the margin in full. That is why perpetual DEXs liquidate positions before the margin reaches zero: the venue needs to close the trade while there is still collateral to cover the loss.

  • Isolated margin. Each position has its own collateral, so a loss on one trade cannot touch the rest of your account.
  • Cross margin. All positions share one collateral pool, which can keep a trade alive longer but puts the whole balance at risk.
  • Maintenance margin. The minimum collateral a position must keep. Fall below it and the position is liquidated.
  • Insurance fund. A pool funded by liquidation fees that covers losses when a position closes below zero.

Risk controls on a perpetual DEX are part of the product, not an add-on. DeFi development covers how liquidation engines and insurance funds are designed.

Why traders choose perpetual DEXs

Traders choose perpetual DEXs for self-custody, access and transparency. Your funds stay in your wallet and in smart contracts you can inspect, rather than in an account on a platform that can freeze withdrawals or fail.

  • Self-custody. No deposit into a company account, so there is no counterparty holding your funds between trades.
  • Permissionless access. Anyone with a wallet can open a position, without an account approval process.
  • Transparent rules. Funding, liquidation and fees are set by code that anyone can read, rather than by a platform policy that can change quietly.
  • Composability. Positions and collateral can interact with other on-chain protocols, such as lending markets, in ways a closed exchange cannot offer.

The costs are real too: gas fees on every action, slower execution on some chains, and no customer support to reverse a mistaken trade. Traders accept those costs when custody and access matter more than speed and service.

Example: a margin trade, step by step

Example (hypothetical): a trader opens a long position worth 10,000 dollars on a perpetual DEX using a 10-to-1 margin ratio. The margin posted is 1,000 dollars, and the other 9,000 dollars is effectively borrowed through the contract.

If the price falls 5 percent, the position loses 5 percent of 10,000 dollars, which is 500 dollars. That is half of the 1,000 dollar margin, so the trader has 500 dollars of margin left and the position stays open.

If the price falls 10 percent, the loss is 10 percent of 10,000 dollars, which is 1,000 dollars, equal to the full margin. The position is liquidated at or before that point, and the trader loses the margin posted.

Funding adds a running cost. If the funding rate is 0.01 percent every 8 hours and the trader is long while the rate is positive, each payment is 0.01 percent of 10,000 dollars, which is 1 dollar per period, or 3 dollars a day. Over weeks, that cost matters as much as the price move itself.

What are the common mistakes?

The most common perpetual DEX mistakes are over-borrowing, ignoring funding costs, and treating a decentralised venue as if it had customer support.

  • Too much borrowing. High borrowing turns a normal price move into a liquidation. Most experienced traders use far less borrowing than the maximum offered.
  • Ignoring funding. A position held for weeks in a crowded direction can pay more in funding than it gains from the price move.
  • No stop or plan. Opening a position without a level at which you will exit means the market decides for you, usually at the worst moment.
  • Wrong chain or venue. Gas fees and execution speed vary widely. A venue that is cheap for large trades can be expensive for small ones.
  • Assuming someone will help. There is no support desk to reverse a trade, recover a wallet or refund a liquidation. Every action is final.

How to evaluate a perpetual DEX before trading

You evaluate a perpetual DEX by checking its liquidity, its liquidation design, its fees and its contract security, in that order. A venue that looks cheap but cannot fill your order at a fair price will cost more than a venue with higher stated fees.

  1. Check liquidity and spreads. Look at the order book or the pool depth for the pairs you trade, and at the spread during volatile hours.
  2. Read the liquidation rules. Find the maintenance margin, the liquidation penalty and whether an insurance fund exists.
  3. Add up the real fees. Trading fees, funding and gas together decide the cost, not the headline trading fee alone.
  4. Check the contract audits. Look for independent audit reports and a history of incidents, and treat unaudited venues with caution.
  5. Start small. Open a small position first, test deposits, withdrawals and liquidations, and only scale up once the flow works as expected.

If you are comparing venues for a product rather than a trade, crypto exchange development covers the build and custody choices that matter.

Key takeaways

  • A perpetual DEX trades price contracts with no expiry, settled by smart contracts
  • Funding payments keep the contract price near the spot price
  • Borrowed funds multiply losses as well as gains, and liquidation is automatic
  • Self-custody and transparent rules are the main reasons traders choose them
  • Funding, fees and gas together decide the real cost of holding a position

Frequently asked questions

What is the difference between a perpetual DEX and a spot DEX?

A spot DEX trades the asset itself, so you own the token after the trade. A perpetual DEX trades contracts that track the price, so you can go long or short with borrowed funds without owning the asset, but you pay funding and face liquidation risk.

Do perpetual contracts expire?

No. That is what makes them perpetual. Instead of converging to the spot price on a settlement date, they use funding payments between long and short positions to keep the contract price near the spot price.

What is a funding rate?

A funding rate is a periodic payment between long and short positions, usually calculated every few hours. When the contract price is above the spot price, longs pay shorts, and when it is below, shorts pay longs. The payment pulls the price back towards spot.

Can I lose more than my margin on a perpetual DEX?

Usually the position is liquidated before the margin reaches zero, but in a fast market the price can move past the liquidation level first. Some venues cover the gap from an insurance fund, while others can leave a negative balance, so read the venue rules before trading.

Are perpetual DEXs regulated?

Regulation varies by jurisdiction and is changing quickly. Some venues restrict access by region, and some operate without a clear licence. Check the rules where you live and where the venue operates before trading.

How do I choose between a perpetual DEX and a centralised exchange?

Choose a perpetual DEX when self-custody, permissionless access and transparent rules matter most. Choose a centralised exchange when you want faster execution, customer support and simpler fiat on-ramps, and you accept that the platform holds your funds.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building a DEX or a derivatives product? Talk to Hertiv.

A senior engineer replies within one business day. Or see our DEX Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call