# OMM Orderbook Pricing

OptiFi Market Maker (OMM) utilizes [oracle](https://switchboard.xyz/explorer) to retrieve key market information such as spot prices and implied volatilities. However, to manage orderbook market risk, it also utilizes the widely popular constant product formula combined with Trade Capacity metrics to build neatly spaced bids and ask orders on each orderbook relative to market values implied by spot prices and implied volatilities.

### Constant Product Formula

A Constant Product Formula, popularized by [Uniswap](https://uniswap.org/):&#x20;

$$
X \* Y = K
$$

Which can be expressed in terms of token X balance, token Y balance and their “constant” balance K. In spot exchanges, users submit balances X and Y in two different currencies and OMM maintains trading price to keep the total balance of currencies the same.

Using the above formula, we can find price points at which OMM is willing to buy or sell Bitcoin.

For example, the current BTCUSDC spot price is $40,000/BTC and total Liquidity is 10 BTCUSDC. Furthermore, let's assume that the Trade Capacity is 2.5 BTC (25% of the pool), i.e. there are no outstanding positions:

![](https://lh3.googleusercontent.com/vgcQuRUAvpeysevnk5Q2-StBDOjnNDJjCfAqrqnu69hOx5W8E-TdTawA8-vY5-6PQeQcNISQ_LGRPiMIvGDehy2rtNxhA8vBCjQLUqUEGw2vDrazQAAVPd_YAoiBT9krFp3lYMKj)

The above quantities, can then be converted into incremental, smaller buy and sell quantities at a different price level looking just like an orderbook:

![](https://lh3.googleusercontent.com/kT784T39Ws_wpXczngBBanumUbLzRMhRTgOYB-gGxlPp86MrUScSF8DZVQq7RagV1PFlavpk5zTCGbYu-uBN5cETWNzOLIfdiPP6LW_J_ak1WIE0d6EE5UNk1JP0KGElCNoLHBYG)

One point to note – if someone was to trade all bids or asks, the average price they would achieve for buying or selling all 2.5 BTC would be equivalent to exactly $53,333 and $32,000 respectively – just as implied by the constant product formula.

OMM utilizes this approach to build its delta BID and ASK orderbook quantities and quote price levels. The quote prices are then used to price options contracts together with oracle implied volatilities to submit bid/ask orders to options orderbooks. Furthermore, quote prices will be used to provide liquidity in the Perpetual Future orderbook.


---

# 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://optifi.gitbook.io/optifi/optifi-in-depth/optifi-market-maker-omm/omm-orderbook-pricing.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.
