Price Feeds
Accurate and manipulation-resistant price data is essential to ensure fair trading, liquidation, and funding outcomes. Margin Trade uses a robust multi-source price feed system designed to minimize the impact of outliers, illiquid markets, and manipulation attempts.
Two primary prices are used throughout the protocol:
Oracle Price — external fair reference price used for funding rate calculations
Mark Price — internal fair value used for unrealized PnL, margining, and liquidation triggers. It is a dynamic and smoothed estimate that tracks the true market price while resisting sudden deviations caused by short-term volatility.
Both are updated continuously by the network and validated against multiple independent sources.
Oracle Price
The oracle price represents an external reference value for an asset and is designed to reflect fair market value while remaining resistant to manipulation.
Crypto Assets
For crypto perpetuals, the oracle price is derived from a weighted median of major centralized exchange (CEX) spot prices.
Prices are sampled every few seconds from supported venues, filtered for invalid or abnormal ticks, and aggregated using a weighted median to ensure robustness against outliers and temporary venue dislocations.
Binance
4
OKX
3
Bybit
3
A minimum of two venues must provide valid, fresh prices.
If fewer than two venues are available, the oracle price is considered unavailable.
If a venue feed temporarily drops, the system may reuse the last valid oracle price for a bounded period. If the oracle remains unavailable beyond this window, protective protocol constraints apply.
Equities
For equity and stock-linked perpetuals, the oracle price is provided by Polygon.io (Massive).
Oracle prices are sourced from consolidated U.S. equity market data and updated in near real-time during regular trading hours.
During pre-market and post-market sessions, oracle updates may continue but are subject to additional smoothing and validation due to reduced liquidity.
Oracle availability rules
Oracle prices must be fresh and valid to be used
Short disruptions may reuse the last valid oracle price within a bounded window
If the oracle remains unavailable (e.g. overnight or due to data gaps), the oracle is treated as unavailable and oracle price fallback rules apply
Mark Price
The mark price is the internal fair value used for unrealized PnL, margin and leverage calculations, and liquidation thresholds. It is calculated as the median of three independent methods, each designed to capture a different signal while resisting manipulation. At least two valid methods must be available for a mark price to be produced.
Method 1: Oracle + EMA of Market-Oracle Difference
This method anchors the mark price to the oracle while incorporating executed onchain market activity, smoothed over time.
A 300-second exponential moving average (EMA) smooths short-term price dislocations and bursty trades, making it difficult to influence the mark price with brief aggressive activity while still allowing sustained market consensus to be reflected over time.
If no recent trades are available, the EMA term naturally decays toward zero, reverting this method toward the oracle price. This ensures that mark prices respond quickly to legitimate price movements without overreacting to temporary order book noise.
Method 2: Oracle Price
This method provides a stable, manipulation-resistant anchor directly tied to external spot markets.
If the oracle price is unavailable, this method is excluded from the final calculation.
Method 3: Market Price (Trades and Order Book)
For additional robustness, the mark price incorporates a median of realtime onchain market conditions.
This allows the mark price to remain robust by preventing a single stale or extreme individual input from dominating the result. If fewer than two of these inputs are available, this method is excluded.
Final Mark Price Selection
The final mark price is the median of all available methods.
At least two valid methods are required for a mark price to be produced.
If insufficient data is available, the mark price becomes unavailable and protective protocol constraints apply.
This blended approach balances responsiveness, resistance to manipulation, and stability during volatile periods.
After-Hours & Oracle-Unavailable Behavior (Equities)
When traditional equity markets are closed (post-market, overnight, pre-market), or when the equity oracle is unavailable due to data gaps, Margin Trade applies additional safeguards.
U.S. Equity Trading Hours Definition
For equity and stock-linked perpetuals, trading hours are defined as:
Pre-Market: 4:00 AM to 9:30 AM ET
Regular trading hours: 9:30 AM to 4:00 PM ET
After-Hours: 4:00 PM to 8:00 PM ET
Any time outside of regular trading hours - including overnight periods, weekends, and U.S. market holidays - is treated as after-hours for the purposes of oracle availability, mark price clamping, and taker order execution constraints.
Price Clamp When Oracle Is Unavailable
If the oracle price is unavailable:
The mark price is clamped relative to the last valid market-hours price
The allowable deviation is defined by a per-market clamp percentage
Clamp parameters vary by asset and are defined in the Perpetuals Specifications
This ensures continuity in pricing while preventing extreme dislocations under reduced liquidity.
Taker Order Impact Guardrails
During oracle-unavailable or after-hours periods:
Market (taker) orders cannot execute beyond the configured clamp range
Any portion of a taker order that would exceed the clamp is rejected or left unfilled
This prevents aggressive orders from forcing large price moves when the underlying market is closed.
Maker Liquidity Remains Unrestricted
Limit (maker) orders may be placed freely at any price level
Participants may:
Express directional views
Provide liquidity ahead of market open
Gradually reshape the order book
Only taker execution is constrained during these periods.
Last updated

