PROPELOO

MARGIN TRADING / LEVERAGED EXCHANGE

Build a margin trading platform with the risk management it requires.

PROPELOO engineers margin trading exchanges — from lending pool architecture and borrowing mechanics through margin call systems, forced liquidation, interest rate models and the collateral management that prevents bad debt accumulation. Margin trading is the highest-risk product in crypto trading. The engineering must match the risk.

A margin trading platform that cannot liquidate fast enough will accumulate bad debt that it must cover from operating capital.

Margin trading amplifies both gains and losses. When a leveraged position moves against the trader, the exchange must act quickly: first a margin call (notify the trader that collateral is approaching the minimum), then a forced liquidation if collateral falls below the maintenance margin. If the exchange liquidates slowly — due to slow liquidation engine, thin order book depth, or delayed market data — the position may go underwater before it is closed, creating a deficit that must be covered by the insurance fund or charged to other users. The risk engine is not a secondary concern — it is the product.

The margin trading platform stack.

System Layers

  • Lending Pool Layer: Lender deposits, borrow mechanics, interest accrual, utilisation-based rates
  • Margin Account Layer: Isolated margin accounts, cross margin, leverage calculation, position tracking
  • Risk Layer: Maintenance margin monitoring, margin call triggers, liquidation engine
  • Trading Layer: Margin orders, position management, PnL calculation
  • Settlement Layer: Funding payment, interest settlement, liquidation proceeds distribution

Core Technical Capabilities

  • Lending Pool Architecture

    Lenders deposit assets to earn interest. Borrowers take margin loans from the pool. Utilisation-based interest rate curve (higher utilisation = higher rates). cToken/aToken-style interest-bearing receipts for lenders.

  • Margin Account System

    Isolated margin (separate collateral per position, maximum loss = isolated margin) and cross margin (all collateral shared, higher capital efficiency). Leverage selector, maintenance margin display, liquidation price calculator.

  • Margin Call System

    Real-time monitoring of all margin accounts. Email/push notification when margin ratio approaches maintenance threshold. Warning levels (80%, 90%, 100% of minimum margin). Automated position reduction on breach.

  • Forced Liquidation Engine

    Automatic position close when maintenance margin is breached. Partial liquidation preference (close minimum amount to return to safe margin). Liquidation price execution via market order or limit order.

  • Interest Rate Model

    Utilisation-based interest rates: low rate at low utilisation, sharply increasing rate above target utilisation. Separate rates per asset. Real-time rate display for borrowers.

  • Insurance Fund

    Built from liquidation proceeds. Covers deficits when liquidation cannot recover full loan value. Fund size monitoring, minimum fund threshold alerts.

How we think about margin trading.

The most important metric on a margin trading platform is not trading volume. It is the ratio of insurance fund to total open interest — that ratio tells you how safe the platform is.

  • Pre-liquidation warning reduces bad debt

    Alerting users before their position reaches the liquidation threshold gives them a chance to add margin or reduce the position voluntarily. Voluntary position reduction is better than forced liquidation: it happens at the trader's timing, at potentially better prices, and without creating large market sell orders that can cascade.

    Axiom:

  • Partial liquidation is gentler than full close

    Closing the entire margin position when maintenance margin is breached can create unnecessary market impact and liquidate more than required. Partial liquidation — reducing the position to the amount where the remaining collateral satisfies minimum margin — is better for the trader, better for the market, and reduces the probability of triggering cascading liquidations.

    Axiom:

  • Interest rate must clear the market

    An interest rate that is too low will exhaust the lending pool (all lenders' capital is borrowed, no more borrowing available). An interest rate that is too high will reduce demand for margin trading. The kinked curve model (flat rate at low utilisation, steep rate at high utilisation) is the standard: it maintains available lending capacity while compensating lenders for capital efficiency.

    Axiom:

  • Cross-asset correlation creates systemic risk

    A margin platform that allows users to use ETH as collateral to borrow BTC is exposed to correlation risk: if both ETH and BTC drop simultaneously, the collateral value drops and the borrowed value drops, but the liquidation mechanism must still work correctly. Stress testing margin requirements against correlated asset drops is required.

    Axiom:

Margin trading design decisions.

  • Isolated vs cross margin?

    Impact: Both isolated and cross, user-selectable. Default to isolated for new users (limits maximum loss to the isolated margin). Cross for experienced users who want capital efficiency.

    • Isolated only — safest for users, less capital efficient
    • Cross only — capital efficient, higher max loss
    • Both, user selects — production standard
    • Portfolio margin (full netting) — institutional, complex
  • Lending pool or P2P margin?

    Impact: Lending pool for most CEX margin implementations — simpler UX, always-available borrow at current rate. P2P margin for platforms that want user-set rates.

    • Lending pool (Aave-style) — pooled liquidity, dynamic rates
    • P2P margin (matched borrow requests) — explicit rate agreement, slower
    • Hybrid — pool as fallback for P2P
    • Integrated with external protocols (Aave/Compound) — borrow from DeFi
  • Leverage limits?

    Impact: Start with 5-10x for spot margin. Higher leverage requires faster liquidation engine, higher insurance fund and more sophisticated risk monitoring. Calibrate max leverage by asset liquidity.

    • 3x max — conservative, attracts cautious traders
    • 5x max — balanced risk profile
    • 10x max — industry standard for spot margin
    • 20x+ max — higher risk, requires robust risk engine
  • Liquidation mechanism?

    Impact: Partial liquidation via limit order with market fallback if not filled within X seconds. Maximises recovery for the trader while ensuring the exchange can close the position.

    • Market order liquidation — fastest, worst price
    • Limit order liquidation — better price, may not fill
    • Partial liquidation with limit — preferred for larger positions
    • ADL (auto-deleveraging) — last resort when no buyers
  • Insurance fund model?

    Impact: Dynamic insurance fund that grows from liquidation proceeds is the sustainable model. Exchange-backed guarantee as a marketing commitment backed by reserves.

    • No insurance fund — all deficits charged to users (ADL)
    • Fixed insurance fund — initial capitalization, grows from fees
    • Dynamic (% of liquidation proceeds) — grows with usage
    • Exchange-backed guarantee — exchange covers all deficits, highest trust

What PROPELOO builds.

  • Spot Margin Trading

    Isolated and cross margin for spot trading — lending pool, borrowing mechanics, real-time margin monitoring, margin calls and liquidation.

  • DeFi Margin Protocol

    On-chain margin trading protocol — smart contract lending pools, over-collateralised borrowing, liquidation bots, oracle integration.

  • Margin + Derivatives Combo

    Unified margin account covering both spot margin positions and derivatives positions — portfolio margin with cross-collateralisation.

  • Institutional Margin

    Prime brokerage-style margin for institutional clients — higher leverage limits (with enhanced verification), portfolio margin, OTC desk integration.

  • Margin Risk System Upgrade

    Upgrade existing margin platform risk system — faster liquidation, better interest rate model, improved insurance fund management.

  • Crypto-backed Lending

    Retail crypto-backed loans — use BTC/ETH as collateral for USDC loans, configurable LTV, automated liquidation, non-custodial option.

The margin trading stack.

  • Risk Engine

    Stack: Go / Rust (real-time monitoring), Redis (position state), Custom margin calculator

  • Lending Pool

    Stack: Custom lending contracts (DeFi), PostgreSQL (loan ledger), Interest accrual engine

  • Liquidation

    Stack: Automated liquidation bot, Order placement (exchange API), Insurance fund contracts

  • Data

    Stack: Real-time price feeds (Pyth/Chainlink), PostgreSQL, TimescaleDB (position history)

  • Frontend

    Stack: React + TradingView, Real-time margin ratio display, Liquidation price calculator

  • Alerts

    Stack: PagerDuty (operations), Push notifications (margin calls), Email alerts

Margin trading security includes economic attack prevention.

  • Oracle manipulation resistance

    Margin calls and liquidations must be based on manipulation-resistant prices. TWAP or multi-source oracle. Circuit breakers on price anomalies.

  • Flash loan borrowing attacks

    An attacker borrowing the entire lending pool in a flash loan would spike interest rates and potentially trigger cascading margin calls. Maximum utilisation caps and flash loan borrow prevention.

  • Liquidation cascade prevention

    Correlated asset price drops can trigger many simultaneous liquidations. Staggered liquidation execution, circuit breakers on liquidation volume, maximum liquidation rate per second.

  • Interest rate manipulation

    An attacker who can manipulate utilisation rate can spike interest rates on existing borrows. Rate change caps per period.

  • Collateral withdrawal with open borrows

    Attempting to withdraw collateral while having outstanding borrows must be blocked until the borrow is repaid. Critical accounting invariant.

  • Audit for lending contracts

    Lending pool contracts hold all user funds. Critical vulnerabilities (reentrancy in withdraw, incorrect interest calculation) can drain the pool. Full third-party audit required.

From design to live margin platform.

  1. 01. Risk Architecture

    Leverage tiers, maintenance margin parameters, insurance fund model, interest rate curve.

  2. 02. Lending Pool

    Lender deposit/withdraw, borrow mechanics, interest accrual, rate model.

  3. 03. Margin Account

    Isolated/cross margin, collateral management, position tracking, PnL calculation.

  4. 04. Risk Engine

    Real-time margin monitoring, margin call triggers, liquidation engine.

  5. 05. Trading Interface

    Margin trading UI, leverage selector, liquidation price display, margin ratio indicator.

  6. 06. Risk Testing

    Historical stress testing, cascade simulation, insurance fund adequacy.

  7. 07. Launch

    Staged launch with low leverage limits, increase as confidence in risk system builds.

Frequently Asked Questions

What is the difference between isolated and cross margin?

Isolated margin: each position has its own dedicated collateral. If the position is liquidated, only that allocated collateral is at risk — other positions and your available balance are unaffected. Maximum loss per position is predictable. Cross margin: all available balance serves as collateral for all open positions. If one position is performing well, its unrealised gains can cover the margin of another position. More capital-efficient but higher risk — a bad trade can liquidate your entire account.

How does the interest rate model work?

Most margin lending pools use the kinked interest rate curve (Aave's model): at low utilisation (say, under 80%), the interest rate increases slowly. Above 80% utilisation, the rate increases sharply, incentivising lenders to deposit more capital and borrowers to repay loans. This mechanism maintains a utilisation "target zone" — the pool is usually 70-80% utilised, which means borrowers can always access capital and lenders are well-compensated.

What is a margin call?

A margin call is a notification that your collateral is approaching the minimum margin requirement. If your margin ratio (collateral / position value) drops below the warning level, you receive an alert to either add more collateral or reduce your position. If the ratio drops below the maintenance margin level without action, the exchange initiates a forced liquidation to close the position and recover the loan. The margin call is your last chance to avoid forced liquidation.