# Funding Rate

## Funding Rates

Because Perpetuals have no expiration date, final settlement, or delivery, funding rate payments are the incentive mechanism to bring Vortex’s mark price closer to the oracle price.

For instance, a trader with a short position in a market whose mark price > oracle price will receive a payoff proportional to their position size.

Funding is collected hourly based on the ratio between longs and shorts, using a daily funding period. It is calculated using the difference between an hourly time-weighted average price (TWAP) of mark price and an hourly TWAP of the oracle price normalized over 24 hours.

### Funding Formula and Example

$$
\begin{aligned} t & := \text{an ever increasing hour index, e.g. the number of hours after the luanch of Matrix} \ iTwap(t) &:= \text{index TWAP at the end of hour }t \ mTwap(t) &:= \text{mark TWAP at the end of hour }t \ fundingRate(t) & := \frac{mTwap(t) - iTwap(t)}{60\times 60}\ cumFundingRate(t) &:= \text{cumulative funding rate from time 0 to time t}\ amm.cumFundingRate(0) & = 0\ amm.cumFundingRate(t) & = \sum\_t\frac{mTwap(t) - iTwap(t)}{60\times 60}\ fundingPayment\_{user} & := position.baseAsset \times (amm.cumFundingRate - position.lastCumFunding)\ //\ \text{note this is for single market, we need to sum all funding payment for a user against all market index} \\\\\ \bold{Example}\ Alice &:= \text{base asset: 37.5 (in UST), quote asset: 300 UST at hour } t\_0 \end{aligned}
$$

Suppose now the TWAP mark price and index price are $1.6/$1.6, $1.62/$1.6 and $1.64/$1.61 at t0, t1 and t2 respectively, Alice’s payment in t1 and t2 will be the following:

$$
\begin{aligned} fundingRate\_{t0} & := 0\ fundingRate\_{t1} & := \frac{0.02}{3600} + 0 = 0.000005555555556\ fundingRate\_{t2} & := \frac{0.03}{3600} + 0.000005555555556 + 0 = 0.00001388888889\ fundingPayment\_{t1} &:= 0.000005555555556 \times 37.5\ fundingPayment\_{t2} &:= 0.00001388888889 \times 37.5\ \end{aligned}
$$
