# NDMM Pricing Mechanism

1 When users open, close, or are liquidated from positions, liquidity providers (LPs) always passively become the counterparty, transacting at the same price.

2 The deviation rate (DR) for a trading pair is calculated using the following algorithm:

* The trading pair's LP = Total TLP size \* Trading pair's proportion
* The trading pair's long positions (LONG) = Total value of long positions for that trading pair
* The trading pair's short positions (SHORT) = Total value of short positions for that trading pair
* The trading pair's LP exposure (EXPOSURE) = LONG - SHORT

The formula is as follows:

* Trading Pair Deviation Rate (DR) = LP exposure value / The trading pair's LP= (LONG - SHORT) / The trading pair's LP

For example:

* Trading Pair: BTC/USDT
* LP for BTC/USDT: 10,000,000 USDT
* LONG: 1,000,000 USDT
* SHORT: 400,000 USDT
* EXPOSURE = LONG - SHORT = 600,000 USDT

Then in this case the DR for BTC/USDT would be **600,000/10,000,000=0.06**

OI limit = The trading pair's LP \* MULTIPLIER

ADL：

* EXPOSURE > The trading pair's LP&#x20;

3 The perpetual contract's price premium rate (PR) is determined by the deviation rate (DR) and a premium rate function, i.e., PR is a function of DR, which is decided by the liquidity data and system parameters. Notably, when DR = 0, PR = 0, meaning that when the deviation rate of the trading pair is zero, the contract's premium rate is zero.&#x20;

4 The premium rate function f(x) is an antisymmetric function and should be positively correlated with the deviation rate.&#x20;

Based on the risk-neutral principal, we assumed the Deviation Rate of perpetual contract follows Normal distribution, thus the probability density function has following format:

$$
f(x)=\frac1{\sqrt{2\pi}}e^{-\frac{x^2}2}
$$

<div align="center" data-full-width="false"><figure><img src="https://lh7-us.googleusercontent.com/FX6xbI9p-zOd6PENgA-aSOfTcpHxzIRofg4-9mx65WzrcJJOtnOwgU_FhnCK4DG_oScwVnk7I3ZXFP-NQ_EJbcapR7vDxpGvhXWb_8neeL34voI2Y6Ubr793095zc5lisbmFpIhbhdDrkh1j3yu7HGU" alt=""><figcaption></figcaption></figure></div>

The Premium Rate Function should represent the accumulation of the contract's Deviation Rate. Thus, we performed an integration on the distribution of the deviation rate. As a result, we obtained the Premium Rate Function, which exhibits the characteristics of a cumulative normal distribution function N(x).

$$
PR(x)=\int\_0^x\frac1{\sqrt{2\pi}}e^{-\frac{u^2}2}\mathrm{d}u=N(x)-0.5
$$

<figure><img src="https://lh7-us.googleusercontent.com/ETuNBQ49BMmOB476rQTmwQhoDeXMQNifIEKlkkv51BpDfWlTpcOUu_UdGwIV0cvzvJ74NAn81rS2U7sozoeTfMZHxW8A-KOQVMVPVbjeVCG6lz74-6J0sgN4pcU7jbiuEui__TyePNmhTDk1R4SebO8" alt=""><figcaption></figcaption></figure>

Exact Premium Rate Function is determined by some inner configurations such as premium\_cap etc.&#x20;

Characteristics of the Premium Rate Function:

* It is an antisymmetric function.
* It is positively correlated with the degree of deviation, exhibiting a monotonically increasing relationship.&#x20;

The average transaction price:&#x20;

$$
P\_{a\nu g}=(1+(PR\_0+PR\_1)/2)P\_{index}
$$

where PR0 is the premium rate before the transaction, and PR1 is the premium rate after the transaction.&#x20;

Perpetual contract price formula:&#x20;

$$
P\_{contract}=(1+PR)P\_{index}
$$

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tradoor.io/ndmm-pricing-mechanism.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
