Oracles & Pricing Methodology
Oracles & Pricing Methodology
Dreamcash uses two key prices for each market:
Oracle price: the reference index price
Mark price: the risk price used for PnL, margining, and liquidations
Dreamcash perpetuals runs in two regimes: Regular Hours and Off Hours.
Definitions
Let:
O(t) = oracle price at time t
Bid(t) = best bid
Ask(t) = best ask
Last(t) = last trade price (most recent print)
We use:
EWMA₁₅₀s(x): 150-second exponentially-weighted moving average of a series x
EWMA₈h(x): 8-hour exponentially-weighted moving average of a series x
We define two “microstructure” references:
Book mid
Mid(t) = (Bid(t) + Ask(t)) / 2
Robust on-venue price (median of bid/ask/last)
Pₘ(t) = median( Bid(t), Ask(t), Last(t) )
This helps reduce sensitivity to a single noisy print or a momentarily wide spread.
Note: “Normal Hours” vs “Off Hours” are defined per market (e.g., aligned with the underlying’s primary trading session)
Regular Hours
Oracle: external Pyth source
During Normal Hours, Dreamcash uses an external, independent source (provided by Pyth).
Mark: median of three references
During Normal Hours, mark is the median of:
Oracle price: O(t)
Oracle + smoothed basis: O(t) + EWMA₁₅₀s( Mid(t) − O(t) )
Robust on-venue price: Pₘ(t) = median(Bid(t), Ask(t), Last(t))
So:
Mark(t) = median( O(t), O(t) + EWMA₁₅₀s(Mid(t) − O(t)), Pₘ(t) )
Intuition:
The EWMA basis term allows mark to follow sustained order-book premium/discount smoothly (without overreacting to brief spikes).
The median(Bid,Ask,Last) term anchors to what’s actually trading while being robust to outliers.
Off Hours
Off Hours is designed to reduce sudden liquidation events when external price discovery is weaker and liquidity can be thinner.
Impact price difference
Dreamcash computes an impact price from the order book at a predefined “impact size”. Define:
ImpactMid(t) = (ImpactBid(t) + ImpactAsk(t)) / 2
ImpactDiff(t) = ImpactMid(t) − Pₘ(t)
i.e., impact mid relative to a robust on-venue reference price.
Oracle: 8h EWMA of impact price difference
During Off Hours, oracle is constructed as:
O(t) = Pₘ(t) + EWMA₈h( ImpactDiff(t) )
This makes the oracle reflect a smoothed measure of where size trades (impact) rather than just top-of-book. The EWMA is sampled with each oracle update (every ~3 sec). The sampling begins with the last known external oracle price.
Mark: equal to oracle
During Off Hours:
Mark(t) = O(t)
Why mark can differ from oracle
Mark is the risk price. It’s built to be:
hard to manipulate with small trades,
robust to stale/noisy inputs, and
stable enough to avoid unnecessary liquidations.
That’s why Dreamcash uses:
Pyth oracle during Regular Hours, plus a mark that blends oracle, smoothed basis, and a robust on-venue price
impact-based smoothing during Off Hours, with mark = oracle
Practical implications
Liquidations use Mark, not Last.
In Normal Hours, mark adapts to sustained basis but resists transient spikes.
In Off Hours, mark is intentionally smoother; PnL and liquidation thresholds may “move slower” than the top-of-book.
Around Normal ↔ Off Hours transitions, expect mark dynamics to change by design.
Last updated