Technical Documentation
Futures Contract Specifications
Open Mandi offers perpetual futures contracts for gold (XAU) and silver (XAG), collateralized with USDT or USDC. This document details the contract parameters, margin model, and liquidation mechanics.
Gold Futures (XAU/USD)
| Parameter | Value |
|---|---|
| Symbol | XAU-PERP |
| Underlying | Gold spot price (USD) |
| Contract Type | Perpetual (no expiry) |
| Contract Size | 0.001 troy ounce per contract |
| Tick Size | $0.01 |
| Collateral | USDT or USDC |
| Maximum Leverage | 50x |
| Initial Margin | 2% of position notional |
| Maintenance Margin | 1% of position notional |
| Maker Fee | 0.02% |
| Taker Fee | 0.05% |
Silver Futures (XAG/USD)
| Parameter | Value |
|---|---|
| Symbol | XAG-PERP |
| Underlying | Silver spot price (USD) |
| Contract Type | Perpetual (no expiry) |
| Contract Size | 0.1 troy ounce per contract |
| Tick Size | $0.001 |
| Collateral | USDT or USDC |
| Maximum Leverage | 50x |
| Initial Margin | 2% of position notional |
| Maintenance Margin | 1% of position notional |
| Maker Fee | 0.02% |
| Taker Fee | 0.05% |
Price Feed Integration
The mark price for each futures contract is derived from an external price oracle providing real-time spot prices for gold and silver in USD. Two prices are maintained:
- Index Price — the external reference price from the oracle, representing the global spot market consensus
- Mark Price — a weighted combination of the index price and the order book mid-price, used for liquidation calculations and unrealized PnL
markPrice = (indexPrice * 0.7) + (orderBookMidPrice * 0.3)
// If order book is empty or illiquid:
markPrice = indexPriceMargin Model
Initial Margin
The initial margin is the collateral required to open a position. It is calculated as:
initialMargin = (quantity * contractSize * markPrice) / leverage
Example (Gold, 10x leverage):
quantity = 100 contracts
contractSize = 0.001 oz
markPrice = $2,850
initialMargin = (100 * 0.001 * 2850) / 10 = $28.50Maintenance Margin
The maintenance margin is the minimum collateral required to keep a position open. If unrealized losses cause the remaining margin to fall below this threshold, liquidation is triggered.
maintenanceMargin = quantity * contractSize * markPrice * 0.01
// Liquidation occurs when:
// margin + unrealizedPnL < maintenanceMarginLiquidation Mechanism
Liquidation is the forced closure of a position when the trader's margin can no longer sustain the position. The process:
- The liquidation engine continuously monitors all open positions against the current mark price
- When a position breaches the maintenance margin threshold, a liquidation order is placed as a market order on the opposite side
- The position is closed at the best available market price
- Remaining margin (if any) is returned to the trader's wallet
- If the liquidation results in a shortfall (negative equity), the insurance fund absorbs the loss
Liquidation Price Calculation
// For long positions:
liquidationPrice = entryPrice * (1 - (initialMarginRate - maintenanceMarginRate))
// For short positions:
liquidationPrice = entryPrice * (1 + (initialMarginRate - maintenanceMarginRate))Funding Rate
As perpetual contracts have no expiry date, a funding rate mechanism keeps the futures price anchored to the index price:
- When the futures price trades above the index, longs pay shorts
- When the futures price trades below the index, shorts pay longs
- Funding payments are exchanged every 8 hours
fundingRate = clamp(
(futuresMidPrice - indexPrice) / indexPrice,
-0.01, // max -1% per interval
+0.01 // max +1% per interval
)
payment = positionNotional * fundingRate