LogoLogo
  • 👋Welcome to Zeta
  • The Zeta DEX
    • 🔗Official Links
    • 📚Learn how to trade on Zeta
      • 🎓Introduction to Perpetuals
      • 💸Compatible Wallets
      • 📖Getting Started on Zeta
      • ✅Order Types
      • 💟Margin Account Parameters
      • 📑Asset Parameters
      • ⚖️Funding Rates
    • 🔧Trading Specifications
      • Fee Tiers
      • Delisting Process
    • 🏗️Exchange Architecture
      • Margin Accounts
      • Margin System
        • Collateral Framework
        • Liquidations & Insurance
          • Insurance Fund
          • Socialized Loss
      • Oracles
      • Orderbook & Matching Engine
      • Trigger orders
      • Trading Mechanism
      • Perpetual Funding System
    • 📱Mobile is LIVE !
    • 🌉Bridging Guide
      • 💱From Exchanges
      • ⛓️From Other Chains
  • Rewards Programs
    • 🪙$ZEX
      • 🪙Staking
        • Staking $ZEX: Step-by-Step Guide
    • 💱Trading Rewards Program
      • Z-Score Active Boosts
        • 🎁Z-Loot
      • 🥩Stakers' Boosted Trading Rewards
      • $BERA Listing (Live)
      • 🗃️Ended Trading Campaigns and Boosts
        • 🪐Jupiter x Zeta (Finished)
        • 1️⃣Season 1 (Finished)
          • 1️⃣Z-Score Season 1
            • 👥NFT Community Partners
          • ⚡S1 Zeta Cards
        • 2️⃣Season 2 (Finished)
          • 2️⃣Z-Score Season 2
            • 🍴Bitcoin Halving (Finished)
            • 🐶$WIF Listing (Finished)
            • 🔴$RNDR Listing (Finished)
            • ⬛$TNSR Listing (Finished)
            • 🔮Pyth Stakers (Finished)
            • 🟥Backpack Boost (Finished)
            • 🏁AssetDash Elements (Finished)
          • ⚡S2 Zeta Cards (Finished)
          • 🎉Community Airdrop (Finished)
        • $POPCAT Listing (Finished)
        • 👯Referral Z-Score Boost (Finished)
        • $EIGEN Listing (Finished)
        • 🟡$DBR Listing (Finished)
        • 🟡$GOAT Listing (Finished)
        • 🟪$DRIFT Listing (Live)
        • 🟪$PNUT Listing (Finished)
        • $PENGU Listing (Finished)
        • $TRUMP Listing (Finished)
    • 🔒Final Epoch
    • 🚰Maker Rewards Program
    • 👨‍👩‍👦‍👦Referrals Program
      • Genesis Epoch Referral Boost (Finished)
      • Breakpoint Referral Boost
    • 🫂Content & Community Programs
      • Creators Program
      • Community Referral Program
  • Build with Zeta
    • 💽SDKs
      • 🐍Python SDK
        • Market Making Bot
      • 🧱Typescript SDK
        • 📚Examples
          • 👶Basic example
          • ⚙️Cranking
          • 🌊Liquidator
          • 🚅Subscription
          • 📬Versioned Transactions
    • 😴REST Data API
    • 💥Program ABI
    • 🎨Brand Assets
      • 📣Brand Book
      • 📰Media Kit
      • 🎨Logo & Visual Guidelines
  • Zeta X
  • Zeta Node
    • 🌐Validator Details
  • Legal
    • Terms and Conditions
    • Staking Terms and Conditions
    • Privacy Policy
    • Location Restrictions
    • TradingView
    • Audit Reports
  • Educational Resources
    • 🆕New to Solana? Start Here!
    • 🆘Support
Powered by GitBook
On this page

Was this helpful?

  1. The Zeta DEX
  2. Exchange Architecture
  3. Margin System

Collateral Framework

PreviousMargin SystemNextLiquidations & Insurance

Last updated 1 year ago

Was this helpful?

Zeta currently only accepts USDC as collateral. So users can only deposit and withdraw USDC from the system. All trades are settled and margined in USDC.

The following specifications are used in the margin system:

Framework Element
Specification

Account Balance (AB)

USDC deposited in account.

Changes on deposit, withdrawal, position close and settlement

Unrealized PnL (UP)

Profit and loss from existing open positions, including unpaid funding

Initial Margin (IM)

Margin level required to open new orders

Maintenance Margin (MM)

Margin level required to maintain positions before liquidation

When a user places an order that adds to their existing position the initial margin requirements are checked. This is done to ensure that opening the position will not push the user into a state of bankruptcy - if this condition is violated users will (1) not be able to place an order, and (2) their existing open orders will be cancelled trustlessly. (3) Liquidators, when taking over a position must also pass this check:

AB+UP−IM+min(0,IPnL)>0AB + UP - IM +min(0, IPnL) > 0AB+UP−IM+min(0,IPnL)>0

where:

  • AB = Account Balance

  • UP = Unrealized PnL

  • IM = Initial Margin x (Opening Orders + Positions)

  • IPnL = instantaneous PnL from execution

When a user places an order that closes an existing position the maintenance margin requirements (including open orders) are checked. This is done to ensure that the user has sufficient funds in their account to place an order and is not currently being liquidated.

AB+UP−MM(O)+min(0,IPnL)>0AB + UP - MM(O) +min(0, IPnL) > 0AB+UP−MM(O)+min(0,IPnL)>0

where:

  • AB = Account Balance

  • UP = Unrealized PnL

  • MM (including open orders) = Maintenance Margin x (Opening Orders + Positions)

  • IPnL = instantaneous PnL from execution

The margin system also monitors a user's existing positions and orders to ensure that the user does not enter a state of bankruptcy:

where:

  • AB = Account Balance

  • UP = Unrealized PnL

  • MM = Maintenance Margin x (Positions)

User withdrawals are also considered by the Zeta margin system ensuring that a withdrawal does not push a user into bankruptcy. As such withdrawals are limited to:

where:

  • UP = Unrealized PnL

  • IM = Initial Margin x (Opening Orders + Positions)

Orders that close a position are not charged margin.

AB+UP−MM>0AB + UP - MM > 0AB+UP−MM>0
AB+min(0,UPnL)−IMAB + min(0, UPnL) - IMAB+min(0,UPnL)−IM
🏗️