CEX Unified Account and Portfolio Margin System Design: A Complete Product and Engineering Practice from Account Models and Risk Measurement to Liquidation Sequencing

InfrastructureExchangeWhite Label Solution٥ أغسطس ٢٠٢٦

A unified account puts spot, margin, perpetuals, options, and earn into one asset pool and one risk framework, replacing summation of isolated margin with portfolio margin. It dramatically improves capital efficiency but raises the difficulty of risk contagion and system consistency. This article explains the account model, four margin modes, scenario-based risk measurement, liquidation sequencing and auto-borrow, the unified ledger, APIs, migration, and regulation.

1. From Segregated Accounts to Unified Accounts: Drivers

Early exchanges split spot, futures, margin, and earn into separate wallets, forcing repeated transfers and low capital efficiency. A unified account lets one pool support all products, so unrealized profit on one contract immediately offsets loss on another, reducing avoidable liquidations. The cost is cross-product risk contagion and real-time consolidated risk and ledger computation.

2. Unified Account Model and Equity Calculation

The core concepts are unified Equity and Effective Balance. Equity is the sum of all assets valued in the quote currency, plus unrealized PnL across products, minus accrued fees and interest. Risk uses global equity, not per-wallet balances. Equity must update in real time—any product's PnL must reflect globally or a "locally liquidated, globally safe" window appears.

3. Multi-Currency Collateral, Haircuts, and Effective Balance

Users can post BTC, ETH, stablecoins, and others, but haircuts vary by risk: major coins ~95%, small caps maybe 50% or ineligible. Effective balance = Σ(balance × haircut × price in quote currency). Haircuts track liquidity and volatility and tighten in stress. Stablecoin depeg needs a separate discount to keep one failing stablecoin from sinking the whole account.

4. Four Coexisting Margin Modes and Switching Logic

Unified accounts typically offer spot (no borrowing), single-currency margin, multi-currency margin (whole pool as collateral), and portfolio margin (portfolio-risk-based, for professionals). Switching requires migrating loans and recomputing margin; the switch is rejected if risk is not met. Retail defaults to low-risk modes; portfolio margin opens only to certified professional investors.

5. Portfolio Margin Risk Measurement: From Summation to Scenarios

Isolated summation overstates risk—a long and an equal short BTC offset but each posts margin. Portfolio margin borrows the SPAN idea: construct price and volatility scenarios (e.g. underlying ±5%/±10%/±20% with volatility shifts), compute portfolio loss in each, and take the worst loss as the margin requirement. It recognizes cross-instrument and cross-expiry hedges, improving capital efficiency 30%–60%, but needs a dedicated risk engine.

6. Hedge Offsets, Correlation Discounts, and Abuse Prevention

Scenario methods naturally support offsets, but cross-instrument discounts rely on correlation. BTC and ETH are highly correlated and warrant a large discount; BTC and an illiquid altcoin do not. Guard against "fake hedges" that game lower margin. Set correlation floors, single-asset concentration caps, and remove discounts immediately when correlations break (e.g. a depeg).

7. Liquidation Sequencing and Auto-Borrow Under Unified Accounts

Liquidation must choose which position to close and which collateral to sell first. Typically close the riskiest, most liquid futures first, then sell collateral—disposing of volatile, illiquid assets first while retaining stablecoins and majors. Auto-Borrow covers shortfalls to keep positions open, paired with Auto-Repay when balances recover. It must show rate, cap, and liquidation price prominently to avoid hidden leverage.

8. Unified Ledger, PnL Attribution, and Cross-Business Reconciliation

The unified ledger records every movement across spot, futures, margin, and earn and is the single source of truth. Even with a shared pool, PnL is attributed to each business line for internal settlement, fee sharing, and risk analytics. Daily cross-business reconciliation compares each product's self-reported balance to the ledger sum, with differences traced to individual entries.

9. Consistency Engineering: Matching, Risk, and Ledger Trade-offs

The hardest problem is consistency: matching needs ultra-low latency, risk needs real-time accuracy, the ledger needs strong consistency—all three cannot be synchronous in one transaction. Common design: in-memory matching, async-snapshot risk with pre-trade checks, ledger via event queue with eventual consistency, backed by reconciliation. Define a bounded "risk window" and let liquidation use conservative logic on the latest verifiable price.

10. API Design and Institutional Integration

Institutions need one endpoint returning whole-account equity, available balance, per-product positions, and margin ratios—not separate spot/futures calls. WebSockets stream risk metrics (margin ratio, liquidation price, borrow status), and mode switches/borrow/repay are atomic. Rate limits, permission tiers (read/trade/transfer), IP allowlists, and sub-accounts are baseline requirements.

11. Phased Migration Strategy for Existing Users

Do not cut over all users at once. Start with whitelisted institutions and high-net-worth users, then expand by tier and volume. Show before/after equity comparisons and a simulated preview, allow one-click switch but also retain the old account, and keep a rollback path. Run old and new ledgers in parallel during migration to ensure balances match exactly.

12. Regulation, Audit, and Client Asset Segregation

SC, BAPPEBTI/OJK, Thailand's SEC, and MAS require client assets segregated from platform assets—unification is internal, while bank/on-chain custody remains client-segregated. The portfolio margin model must be explainable to regulators with stress tests, and client collateral cannot be rehypothecated. Every liquidation, borrow, and mode switch needs full audit logs.

13. Engineering Architecture and Performance

Split into account, lending, risk engine, liquidation, and ledger services decoupled over Kafka. The risk engine is the hot path: keep portfolio positions in memory, compute scenario PnL incrementally, and hold per-account computation to milliseconds. Liquidation must scale horizontally for mass events. Multi-AZ deployment, a risk-engine fallback to isolated logic, and stress testing are prerequisites.

14. SoonTech Unified Account Implementation

SoonTech's unified account is live at several Southeast Asian exchanges: four margin modes, multi-currency collateral haircuts, SPAN-like portfolio margin, auto-borrow/repay, unified ledger with cross-business reconciliation, institutional APIs, phased migration tooling, and regulator-ready risk/stress reports. We start with multi-currency margin for quick launch and open portfolio margin progressively by qualification.

15. Enterprise Implementation Recommendations

A unified account is a rebuild of accounts, risk, and ledger—not a UI refresh. Build the unified ledger and multi-currency collateral first (fast value, controllable risk), then auto-borrow, and finally portfolio margin for professionals. Each step needs stress tests, rollback plans, and audit-grade client asset segregation.

FAQ

Q1: Is a unified account just merging wallets visually?

A: No. It truly unifies the asset pool, risk framework, and ledger, with PnL offsetting across products in real time.

Q2: Is portfolio margin riskier than isolated margin?

A: For genuine hedges it measures risk more accurately and uses capital better; if correlations fail it can understate risk, hence dynamic discounts, stress tests, and professional-only access.

Q3: Can a stablecoin depeg sink a multi-currency collateral account?

A: Yes, which is why stablecoins have separate discounts and concentration caps, with haircuts cut and margin calls triggered on depeg.

Q4: Does liquidation close futures first or sell spot first?

A: Usually close the riskiest, most liquid futures first, then dispose of collateral—selling volatile/illiquid assets first while keeping stablecoins and majors; the order is configurable.

Q5: Can auto-borrow create hidden leverage?

A: The product must show rate, borrowed amount, and liquidation price prominently, with per-trade/daily caps and a toggle.

Q6: What do Southeast Asian regulators require?

A: Client/platform asset segregation, an explainable risk model, auditable stress tests, and no rehypothecation of client collateral, with local counsel for specifics.

Conclusion

A unified account is a necessary step toward institutional-grade CEX service. Capital efficiency comes from risk and ledger capability, not UI. With asset segregation, risk measurement, liquidation sequencing, and consistency engineering done right, it improves efficiency without amplifying systemic risk.

🌐 Build secure and scalable Web3 platforms with SoonTech.

Explore our solutions for White Label Crypto Exchanges, Prediction Markets, MPC Wallets, Matching Engines, Liquidity Integration, and Compliance.

ابدأ رحلة blockchain الخاصة بك

سيقدم لك الفريق المحترف استشارة مجانية حول الحلول

اتصل بنا