> ## Documentation Index
> Fetch the complete documentation index at: https://injectivelabs-docs-ai-sdk.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Scoring a Market Maker's Epoch Performance in a Single Market

# Scoring Formula/Methodology

To promote deep, lasting liquidity across the Injective on-chain orderbook, the following metrics are prioritized by OLP:

* **Dual-sided liquidity** (both bid and ask liquidity)
* **Liquidity depth**
* **Bid-ask spread**
* **Market maker uptime**
* **Volume** (maker and taker)
* **Participation in multiple markets**

## Total Score

For any given market, a liquidity provider's $TS$ (Total Score) in an epoch is calculated as:

$$
TS_{Market} = (LS_{Epoch})^a \cdot (Uptime_{Epoch})^b \cdot (Volume_{epoch})^c
$$

where $LS_{epoch}$ is the liquidity provider's [Liquidity Score](/defi/open-liquidity-program/scoring#liquidity-score) in the market in the epoch, $Uptime_{Epoch}$is the liquidity provider's [Uptime score](/defi/open-liquidity-program/scoring#uptime-score) in the market in the epoch, and $Volume_{epoch}$ is the liquidity provider's total volume (maker and taker) in the market in the epoch.

<Info>
  $a$, $b$, and $c$ are exponent [parameters](/defi/open-liquidity-program/formula-parameters) that weight the different components of the formula.
</Info>

## Liquidity Score

$$
LS_{Epoch} =  \sum \limits_{N=1}^{40,320}  \min(LS_{N_{Bid}}, LS_{N_{Ask}})
$$

The liquidity provider’s Liquidity Score for a market in an epoch, $LS_{Epoch}$, is the sum of the minimum between the Bid and Ask Liquidity Scores (see below) across all order book snapshots in the epoch for the relevant market, multiplied by a bespoke volatility parameter for each market (represented by Θ). This promotes dual-sided liquidity since single-sided liquidity will earn a Liquidity Score of 0 under the $\min()$ function.

A snapshot of the order book is taken randomly every 10-100 blocks. This is approximately every minute on average, which means there are approximately 40,320 snapshots in an epoch $(60 \cdot 24 \cdot 28 = 40,320).$ In practice, the upper bound of the summation will vary depending on the actual number of snapshots in the epoch. For the purposes of this guide, we will assume that there were exactly 40,320 snapshots in the epoch.

$$
LS_{N_{Bid}} = \frac{BidDepth_1}{Spread_1} \cdot \Theta_{vol} + \frac{BidDepth_2}{Spread_2} \cdot \Theta_{vol} + \ldots \\
\forall \ BidDepth_i \geq MinDepth \text{ and } Spread_i \leq MaxSpread
$$

$$
LS_{N_{Ask}} = \frac{AskDepth_1}{Spread_1} \cdot \Theta_{vol} + \frac{AskDepth_2}{Spread_2} \cdot \Theta_{vol} + \ldots \\
\forall \ AskDepth_i \geq MinDepth \text{ and } Spread_i \leq MaxSpread
$$

$LS_{N_{Bid}}$ is the sum of all bid order depths divided by the spread of the order, multiplied by the volatility parameter for that snapshot, for all limit orders placed by the liquidity provider in snapshot $N$ that exceed $MinDepth$ in size and are within the $MaxSpread.$

$LS_{N_{Ask}}$ follows the same logic as $LS_{N_{Bid}}$, but on the ask side of the order book.

The volatility parameter is calculated as follows:

$$
\Theta_{\text{vol}}(S_b)\;=\;
\min\!\bigl(\,\Theta_{\max},\;
           \max\!\{\,1,\;
                    e^{\alpha\,\sigma_b\,|\frac{S_b-\mu_b}{S_b}|}\}\bigr)
$$

where $\mu_b$ is the oracle price moving average over $N$ blocks (1000 blocks, or roughly 10 minutes), $S_b$ represents the oracle price of the current block, and $\sigma_b$ represents the realized volatility over $N$ blocks. This function has a clamp and scales well if the current oracle price deviates from the moving average, or if there is a spike in volatility over the last $N$ blocks. The range of $\Theta_{\text{vol}} \in [1, \Theta_{\text{max}}]$ - so we bound it within a finite field. We introduce two new parameters $(\alpha, \Theta_{\text{max}})$ which monitor the sensitivity to volatility and a clamp. Because $\Theta_{\text{max}}$ should trend towards the cap of 10 as described above for a 3% price move within a 10-minute span, $\alpha$ is currently set at 2,500. A higher value $\alpha$ means $\Theta$ trends towards $\Theta_{\text{max}}$ faster, but as $\Theta_{\text{max}}$ is currently set to 10 per market (and can be modified on a per-market basis), a higher $\alpha$ would not bypass that maximum.

$Spread$ is calculated from the mid-price (distance from mid-price divided by mid-price).

<Info>
  For the current values of $MinDepth$ and $MaxSpread$, see the [Formula Parameters page](/defi/open-liquidity-program/formula-parameters).
</Info>

## Uptime Score

$$
Uptime_{Epoch} = \sum \limits_{N=1}^{40,320} \begin{cases}1&\text{if } \min(LS_{N_{Bid}}, LS_{N_{Ask}}) > 0\\ 0&\text{otherwise}\end{cases}
$$

$Uptime_{Epoch}$ is the number of order book snapshots throughout the epoch in which the liquidity provider had a [***positive Bid Liquidity Score and a positive Ask Liquidity Score***](/defi/open-liquidity-program/scoring#liquidity-score) in the market of interest. This means the liquidity provider quoted on both sides of the order book with order sizes greater than or equal to $MinDepth$ with spreads less than or equal to $MaxSpread$ in the snapshot.

For liquidity providers who qualify for OLP rewards (for the first time ever) partway through an epoch, $Uptime_{Epoch}$ is scaled based on the total number of snapshots from the moment of qualification to the end of the epoch.

For example, suppose there are exactly 40,320 snapshots in an epoch and a liquidity provider qualifies for the first time with exactly 20,000 snapshots remaining. Also suppose the liquidity provider had an $Uptime_{Epoch}$ of 18,0000 as defined by the scoring formula above during the remainder of the epoch. In this case, $Uptime_{Epoch}$ would be scaled to $\frac{18000}{20000}*40320 = 36288$.

<Info>
  For addresses that qualify partway through an epoch but have qualified in the past (the address failed to maintain eligibility at some point), $Uptime_{Epoch}$ will not be scaled. This is to disincentivize addresses from losing their eligibility from epoch to epoch.
</Info>

## Volume

$Volume$ is a liquidity provider's cumulative eligible maker and taker volume in the market during the epoch.

## Fully Expanded Formula

The fully expanded formula is:

$TS_{Market} =$

$$
\left(\sum \limits_{N=1}^{40,320}  \min(LS_{N_{Bid}}, LS_{N_{Ask}})\right)^a \cdot \left(\sum \limits_{N=1}^{40,320} \begin{cases}1&\text{if } \min(LS_{N_{Bid}}, LS_{N_{Ask}}) > 0\\ 0&\text{otherwise}\end{cases} \right)^b \cdot Volume^c
$$

where

$$
LS_{N_{Bid}} = \frac{BidDepth_1}{Spread_1} \cdot \Theta_{vol} + \frac{BidDepth_2}{Spread_2} \cdot \Theta_{vol} + \ldots \\
\forall \ BidDepth_i \geq MinDepth \text{ and } Spread_i \leq MaxSpread
$$

$$
LS_{N_{Ask}} = \frac{AskDepth_1}{Spread_1} \cdot \Theta_{vol} + \frac{AskDepth_2}{Spread_2} \cdot \Theta_{vol} + \ldots \\
\forall \ AskDepth_i \geq MinDepth \text{ and } Spread_i \leq MaxSpread
$$

<Info>
  For information on individual reward calculations each epoch, see the [Reward Allocations page](/defi/open-liquidity-program/reward-allocations).
</Info>

[^1]: Market Maker

[^2]: Market Maker

[^3]: Average between best bid price and best ask price in the order book

[^4]: Market Maker

[^5]: Market Maker

[^6]: Market Makers

[^7]: Market Maker

[^8]: Market Maker

[^9]: Market Maker

[^10]: Market Maker
