# Funding Rates

Funding helps keep a perpetual price near its external reference price. Funding is not a protocol trading fee. It transfers value between long and short positions.

* If funding is positive, longs pay shorts.
* If funding is negative, shorts pay longs.

Meridian calculates funding hourly. Product parameters can change, so use the Trading API for current values.

## Basis Samples

The exchange samples the difference between the oracle index and impact prices from the order book.

An impact price is the average execution price for a configured USD amount. It uses more book depth than the best bid or best ask alone.

* If the index is below the impact bid, the basis is positive.
* If the index is above the impact ask, the basis is negative.
* If the index is inside the impact bid and ask, the basis is zero.

If the book does not contain enough usable liquidity, the system can skip a sample.

## Hourly Rate

At the start of an hour, Meridian uses valid samples from the previous hour. The calculation applies three product settings:

* `fundingBaselineApr`: baseline annual rate.
* `fundingClampApr`: range that removes small premium changes.
* `fundingMaxApr`: maximum absolute annual rate.

The product API expresses these settings as decimal annual rates. The hourly equivalent is:

<MathBlock tex={String.raw`\text{hourly rate} = \frac{\text{annual rate}}{365 \times 24}`} />

The exchange converts the hourly rate to a per-unit USD change with the mark price:

<MathBlock tex={String.raw`\text{funding per unit} = \text{hourly rate} \times \text{mark price}`} />

The position size and side determine the final payment.

## Projected Funding

`GET /v1/funding/projected-rate` returns the current projected rate for the end of the hour. WebSocket `Ticker` publishes the same value in `fr1h`. The projection can change until the hourly rate is finalized.

## Accounting

The product stores a cumulative per-unit funding value. Each position stores the cumulative value from its last settlement.

Outstanding funding affects account equity before it is realized into balance. A trade, liquidation, or other position state change can realize it.

Funding actions settle in the exchange action sequence.

## API Data

* `GET /v1/funding` returns product funding updates.
* `GET /v1/product` returns `fundingRate1h`, cumulative funding, and the product parameters.
* Archive API `GET /v1/subaccount/funding` returns account funding history.
