LogoLogo
Trade Now
  • Trade Now
  • 👋Welcome
    • About Demex
      • Roadmap
      • Terms and Conditions
      • Disclaimers
    • Getting Started
      • Depositing
      • Activate Account
      • One-Click Trading
  • 💰Demex Rewards
    • 🪂Demex Points
      • Spins
      • Wheel of Fortune and Loot Boxes
      • Squads
      • DMX Token
      • FAQs
    • 🏁Demex Endgame: 50,000,000 Demex Points
    • 💵Demex Credits
    • 🕙Past Events
      • 2022
        • Futures Trading Competition
          • Maker vs Taker #1
          • Maker vs Taker #2
        • Perpetuals Trading Competition
          • Top Gainers and Top Traders #1
          • Top Gainers and Top Traders #2
          • Top Gainers #3
      • 2023
        • Demex Trading Leagues
          • Demex Trading League
            • How to Register
          • Demex $100,000 Mega Marathon
            • Demex Trading League Vol 1
              • How to Register
            • Deposit Booster
            • Demex Trading League Vol 2
          • Demex Trading League (Round 3)
            • How to Register
          • Demex Trading League (Round 4)
          • LUNA Earn-A-Thon & Demex Trading League (Round 5)
          • Demex Trading League (Round 6)
          • SCRT Trading League
        • Earn-a-thons
          • Demex x StaFi ATOM Earn-A-Thon
          • Demex x Zilliqa ZIL Earn-A-Thon
            • How to Register
        • Trading Challenges
          • BNB Trading Challenge
            • How to generate your custom hashtag
          • NEO Trading Challenge
            • How to Register
          • OSMO Perp Trading Challenge
          • Perps Trading Challenge
        • Special Events
          • $500 Surprise Flash Promotion
          • Demex Incentivized Devnet (Ended)
            • Perp Pools Deposits
            • Base Vault and $CLP Staking
            • Fluo Dashboard (Deprecated)
              • Stake FLUO
              • Boost Rewards
              • esFLUO Rewards
            • Demex Trading League (Devnet)
              • How to Register
            • The HODL Lottery
              • How to Register
              • How to Count Your Tickets
      • 2024
        • Celestia Trading League
        • FOMO Points Booster
        • DeFi Points Booster
        • Celestia Points Booster
        • 🥛milkTIA x Demex Points Booster Bonanza
        • BTCETH Points Booster
        • 🟠 Archway Trading League
        • ⚛️ Cosmos Trading Competition
          • 🐋Whalecome to Demex
        • 💯DeFi & FOMO Points Booster
        • 💯DeFi & Layer 1 Points Booster
        • 💧dATOM Lend and Trade Spins Promo
        • 🐸Perp Pool Incentives with Leap Wallet
        • 👋Welcome #BackToDemex
        • 🥛milkTIA Lend and Trade Spins Promo
        • 🛡️Loss Protection
        • 🏃‍♂️STRD Lend and Trade Spins Promo
        • 🐶Meme Traders Arena
        • 🛡️Loss Protection Oct-Nov
        • 🌙LUNA Lend and Trade Spins Promo
        • 💯Modular Pool Points Booster
        • 🕰️Mantle Lend & Trade Spins Promo
        • 🏎️Mantle Trading League
        • 🛡️Loss Protection Dec 9 - 20
        • 👑Mantle Trading League S2
      • 2025
        • 🔲Mantle Rewards Station: 30,000,000 Demex Points
        • 🔲Mantle Rush
        • 🔐Loss Protection March 19 - 26, 2025
        • 🌀Mantle Lend & Trade Spins Promo
        • 💙Base Trading League
        • 🧢Base Lend & Trade Spins Promo
        • 🛡️Loss Protection Feb 10 - 20, 2025
        • 📝#DemexContentQuest
        • 📈#PerpsOnDemex
        • 👥Demex Referral Club
        • 🤖Traḋemex Bot
  • 📊Trade
    • Features
    • Perps & Futures
      • Pricing Engine
      • Margin Specifications
      • Liquidation Engine
      • Market Specifications
      • Pre-launch Perpetuals
      • Glossary
      • FAQs
    • Grouped USD Token
      • Constituent Criteria
      • Safety Features
      • Migration Guide
    • Fees
      • Trading Fees
      • Funding Fees
      • Network Fees
      • Deposit & Withdrawal Fees
      • Fee Delegation
      • CEX to Demex VIP Program
      • Fee Distribution
    • Notifications
      • Demex Progressive Web App (PWA)
    • Trading Modes
      • Lite Mode
      • Pro Mode
        • Features
        • Market Leverage
        • Order Types
        • Execution Options
        • Time-In-Force 🆕
        • Trigger (Stop) Orders
          • Take-Profit
          • Stop-Loss
        • Chart Trading 🆕
  • 💰EARN
    • Liquidity Pools
      • Spot Pools
        • Earnings
        • Amplified Pools
        • Uneven Pool Weights
        • Multi-Pool Routing
        • FAQs
      • Perp Pools
        • Earnings
        • Deposting & Redeeming
        • AMM Strategy
    • Nitron (Lend & Borrow)
      • Lending
      • Borrowing
        • Avoiding Liquidations
      • Liquidation
        • Partial Liquidations
      • USC Stablecoin
        • Interest Rate Model
      • High Efficiency Mode (E-Mode)
      • Liquidations
        • Liquidation Guide
      • Strategies
        • Using Nitron for Perp Trading
      • Protocol Safety Features
      • Risks
    • Referrals
      • Sharing Your Referral Link
      • FAQs
      • Terms and Conditions
  • Stake SWTH / DMX
  • 🫂COMMUNITY
    • Public Community Nodes
    • Feedback
    • Glossary
      • Annual Percentage Rate (APR)
      • Arbitrage
      • Decentralized Applications
      • Execution Options
      • Liquidation
      • Liquidity Pool
      • Liquidity Providers
      • Perpetual Pool
      • Open Interest (OI)
      • Order Book
      • Time-In-Force
      • Volume
      • Yield Farming
  • ⚙️Developers
    • APIs Overview
    • WebSocket API
    • RPC API
    • EVM API
    • Insights API
    • Node CLI
    • Running a Node
      • Testnet
      • Mainnet
      • Public API Node
      • Validators
        • Commissions & Penalties
  • 🤖EVM
    • Overview
    • Deployment Tutorial
    • Interacting with Demex L1
      • Built-in Oracle Contracts
      • Precompiled Trading Contracts
    • ICS-20 <> ERC-20 Token Conversion
    • Explorers
Powered by GitBook
On this page
  • Margin Requirements
  • Initial Margin
  • Maintenance Margin

Was this helpful?

  1. Trade
  2. Perps & Futures

Margin Specifications

PreviousPricing EngineNextLiquidation Engine

Last updated 15 days ago

Was this helpful?

Margin Requirements

Opening and maintaining a position on Demex allows for the use of leverage. Users can allocate as much margin or as little margin as they wish for each position, up to the margin requirements stated below.

As Demex has not enabled cross-margin trading, positions on each market is margined separately. Liquidations therefore only affect a single market / position at a time.

Cross-margin and cross-collateral will be enabled on Mainnet in March 2025.

There are two types of margin requirements for each market - Initial Margin and Maintenance Margin. They differ for each market and can be derived from the market parameters in . The following describes how to calculate each margin requirement based on the market parameters.

Initial Margin

Initial margin is the amount of collateral required to open (or increase) a position.

This margin requirement is based on a fraction (IMF) of the position value:

InitialMargin = IMF * Position Size * Entry Price

The initial margin fraction (IMF) is given by:

IMF = initial_margin_base + floor(Position Size / risk_step_size) * initial_margin_step

The underscored parameters can be found in

Example

For a BTC perp where:

# https://api.carbon.network/carbon/market/v1/markets/cmkt%252F118
risk_step_size = 0.1 # this is in human decimals (e.g. 0.1 BTC). Add &raw=true to the above request for raw values.
initial_margin_base = 0.01 # this is a fraction
initial_margin_step = 0.000005 # this is a fraction

Opening a 10 BTC long position at $30,000 will require:

(0.01 + floor(10 / 0.1) * 0.000005) * 10 * 30,000 = 3,150 USDC

This gives an effective leverage of: 300,000 / 3,150 = 95.23x

One can quickly find that 1 / initial_margin_base is the maximum leverage for a market (for position sizes that are smaller than risk_step_size).

For the example above, that would be 1 / 0.01 = 100x.

Maintenance Margin

Maintenance margin is the amount of collateral required to hold a position open.

This margin requirement is based on a fraction of the initial margin requirement for a position:

MaintenanceMargin = InitialMargin * maintenance_margin_ratio.

Example

For a BTC perp where:

# GET https://api.carbon.network/carbon/market/v1/markets/cmkt%252F118
risk_step_size = 0.1 # this is in human decimals (e.g. 0.1 BTC). Add &raw=true to the above request for raw values.
initial_margin_base = 0.01 # this is a fraction
initial_margin_step = 0.000005 # this is a fraction
maintenance_margin_ratio = 0.7 # this is a fraction

Opening a 10 BTC long position at $30,000 will require:

(0.01 + floor(10 / 0.1) * 0.000005) * 10 * 30,000 = 3,150 USDC

Maintaining this position requires that:

InitialMargin + Unrealized PnL > (3,150 * 0.7 = 2,205 USDC)

Assuming the user opens this position at maximum leverage (allocated margin = initial margin = 3,150), then the user's position will be liquidated if the market moves against them such that they incur more than 3,150 - 2,205 = 945 USDC of unrealized losses.

For the above example, this will occur when the Mark Price of the market reaches (10 * $30,000 - 945) / 10 = $29,905.50.

Users can protect this position by manually adding more margin or decreasing their leverage for the market, such that their allocated margin increases above the maintenance margin requirements.

If the effective margin (allocated margin + unrealized PnL) of a position drops below the required maintenance margin, the position will be liquidated according to the rules .

The maintenance_margin_ratio can be found in .

This entails the user's position being taken over by the liquidation engine, and the user will lose the full allocated margin for this position. See the section for the full liquidation procedure.

📊
GET Markets
GET Markets.
GET Markets
Liquidation
here