# Indices

## Oracle Price

Price oracles are data feeds that provide a reliable reference price for a perp asset. Combined with funding rates, they serve to align the perp price with the reference price of the asset.

### External pricing

Ventuals uses Pyth data feeds as the price oracle for index perps, which can provide external pricing with up to 24 hour coverage on normal weekdays.

Pyth data feeds source executable quotes from institutional liquidity providers during US trading sessions. For overnight sessions when traditional markets are closed, Pyth sources price data from Alternative Trading Systems (ATS).

When fresh external pricing data is available, it is used directly as the oracle price.

| Session            | Days              | Hours           |
| ------------------ | ----------------- | --------------- |
| Pre-market hours   | Monday – Friday   | 4am – 9:30am ET |
| Normal hours       | Monday – Friday   | 9:30am – 4pm ET |
| After-market hours | Monday – Friday   | 4pm – 8pm ET    |
| Overnight          | Sunday – Thursday | 8pm – 4am ET    |

{% hint style="info" %}
For some markets, Pyth may not have pre-market, post-market, or overnight price feeds live. In these cases, the price oracle will switch to Internal Pricing (detailed below).
{% endhint %}

### Internal pricing

When external pricing is unavailable, the oracle switches to an internal pricing mechanism which initializes on the last available external price.

The switchover to internal pricing happens when external pricing is unavailable for more than 30 seconds; for example weekends, or weekday overnight trading hours for markets without an overnight Pyth feed.

| Session | Session Start | Session End   |
| ------- | ------------- | ------------- |
| Weekend | Friday 8pm ET | Sunday 8pm ET |

#### Internal oracle price formula

The oracle for internal pricing initializes on the last available external price, and is defined as:

$$
\text{Oracle}*t = (1 - k) \cdot \text{Oracle}*{t-1} + k \cdot \text{ImpactPx}\_t
$$

Where:

* ImpactPx = median(impactBidPx, impactAskPx)
* k = dynamic adjustment coefficient

**Dynamic Adjustment Coefficient (k)**

The coefficient `k` controls the sensitivity at which impact price adjusts the oracle price. It adapts based on the short-term deviation between the current impact price and its 1-hour EMA:

| Δ (ImpactPx vs EMA) | k value | Max Δ Oracle (per update) |
| ------------------- | ------- | ------------------------- |
| <0.02%              | 0.7     | 0.014%                    |
| \[0.02, 0.05)%      | 0.5     | 0.025%                    |
| \[0.05, 0.1)%       | 0.3     | 0.03%                     |
| \[0.1, 0.2)%        | 0.2     | 0.04%                     |
| \[0.2, 0.4)%        | 0.1     | 0.04%                     |
| ≥0.4%               | 0.0     | 0%                        |

Using this dynamic coefficient increases manipulation resistance during internal pricing regimes (e.g. weekends and holidays).

When external pricing resumes, the oracle snaps to the external pricing mechanism on the next tick.

### Oracle data feed

External pricing data is sourced from Pyth price feeds, for all trading sessions (pre-market, normal market, after-market, and overnight trading).

| Ticker   | Data Feeds                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MAG7     | <p><a href="https://insights.pyth.network/price-feeds/Equity.US.MAGS%2FUSD">MAGS / USD</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.MAGS%2FUSD.PRE">MAGS / USD PRE MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.MAGS%2FUSD.POST">MAGS / USD POST MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.MAGS%2FUSD.ON">MAGS / USD OVERNIGHT</a></p> |
| SEMIS    | <p><a href="https://insights.pyth.network/price-feeds/Equity.US.SMH%2FUSD">SMH / USD</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.SMH%2FUSD.PRE">SMH / USD PRE MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.SMH%2FUSD.POST">SMH / USD POST MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.SMH%2FUSD.ON">SMH / USD OVERNIGHT</a></p>         |
| ROBOT    | <p><a href="https://insights.pyth.network/price-feeds/Equity.US.BOTZ%2FUSD">BOTZ / USD</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.BOTZ%2FUSD.PRE">BOTZ / USD PRE MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.BOTZ%2FUSD.POST">BOTZ / USD POST MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.BOTZ%2FUSD.ON">BOTZ / USD OVERNIGHT</a></p> |
| INFOTECH | [XLK / USD](https://insights.pyth.network/price-feeds/Equity.US.XLK%2FUSD)                                                                                                                                                                                                                                                                                                                                                   |
| NUCLEAR  | <p><a href="https://insights.pyth.network/price-feeds/Equity.US.NLR%2FUSD">NLR / USD</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.NLR%2FUSD.PRE">NLR / USD PRE MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.NLR%2FUSD.POST">NLR / USD POST MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.NLR%2FUSD.ON">NLR / USD OVERNIGHT</a></p>         |
| DEFENSE  | <p><a href="https://insights.pyth.network/price-feeds/Equity.US.SHLD%2FUSD">SHLD / USD</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.SHLD%2FUSD.PRE">SHLD / USD PRE MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.SHLD%2FUSD.POST">SHLD / USD POST MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.SHLD%2FUSD.ON">SHLD / USD OVERNIGHT</a></p> |
| ENERGY   | [XLE / USD](https://insights.pyth.network/price-feeds/Equity.US.XLE%2FUSD)                                                                                                                                                                                                                                                                                                                                                   |
| BIOTECH  | <p><a href="https://insights.pyth.network/price-feeds/Equity.US.XBI%2FUSD">XBI / USD</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.XBI%2FUSD.PRE">XBI / USD PRE MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.XBI%2FUSD.POST">XBI / USD POST MARKET</a><br><a href="https://insights.pyth.network/price-feeds/Equity.US.XBI%2FUSD.ON">XBI / USD OVERNIGHT</a></p>         |

***

## Mark Price

Mark price is the fair price of a perpetual contract, and is used for margining, liquidations, stop/limit triggers, funding rates, and computing unrealized PnL.

Mark prices, along with oracle prices, are updated approximately every 3 seconds.

#### External pricing

During external pricing regimes, Ventuals calculates the mark price as the median of:

1. Oracle price
2. Oracle price + 150s EMA of difference between oracle price and the perp's mid-price
3. The median of best bid, best ask, last trade on Hyperliquid

#### Internal pricing

During internal pricing regimes, Ventuals calculates the mark price as the median of:

1. Oracle price
2. Oracle price
3. The median of best bid, best ask, last trade on Hyperliquid

In effect, during internal pricing regimes, the internal oracle price is always used as the mark price. This is for additional protection against price manipulation when external pricing data is unavailable.

### Mark price bands

To protect against price manipulation during periods of thin liquidity, the mark price for each market is constrained to remain within a price band relative to its oracle price.

This mark price band is defined as ±(1 / max\_leverage) of the last external-pricing oracle price, and this band is in effect during all trading sessions (e.g. both external pricing and internal pricing).

For example, if the MAG7 oracle price is $70 from the last external price on Friday, then the mark price is range bound between ($63, $77) until external pricing resumes on Sunday evening ET.

### Mark price velocity limit

There is an additional limit to mark price movements of a max 0.50% move every 3 second update. This prevents overly large price moves over a short period of time, further protecting against manipulation.

***

## Funding rate

For Ventuals indices markets, a multiplier of `0.5`  is applied to Hyperliquid's [funding rate formula](https://hyperliquid.gitbook.io/hyperliquid-docs/trading/funding). This results in a baseline funding rate of \~5.5% annualized, which brings borrow rates closer to industry standards for traditional asset classes.

The exact formula is `Funding Rate Ventuals (F) = 0.5 [Average Premium Index (P) + clamp (interest rate - Premium Index (P), -0.0005, 0.0005)]`.
