# Mathematical Overview

Kubo prices all trades via an AMM. Trades are accepted if they increase the market maker’s utility (possibly after some fee margin). The market maker’s utility function is the expected utility of its holdings evaluated at a price 4 hours in the future. Letting $$x: \Re \mapsto \Re$$ represent a function that produces the market maker’s wealth at a specific price, we have:

$$
u(x) = \sum\_i \mathbb{P}(p\_i) u(x(p\_i))
$$

We use a negative reciprocal utility (a barrier function). Barrier utility functions in automated market-making were initially introduced by [Othman and Sandholm 2012](https://www.cs.cmu.edu/~sandholm/profitChargingMarketMaker.ec12.pdf) (note: Othman was a core contributor to Kubo), building on the work of [Chen and Pennock 2007](https://arxiv.org/pdf/1206.5252.pdf):

$$
u(v) = -\frac{1}{v}
$$

The positive homogeneous invariant corresponding to this utility function is simply the negative reciprocal itself:

$$
I(x) = -\frac{1}{u(x)}
$$

Changes in the invariant function are used to calculate the issuance of LP tokens. Because the invariant function is positive homogeneous, a user whose LP contribution doubles the market maker’s wealth in all future price states would be issued LP tokens worth half of the resulting market.

### Forecasting the Future Price

The Gauss-Hermite quadrature and the volatility of the individual underlying asset determine the set of points p used to calculate the future price and their probabilities.


---

# 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://sushi-labs.gitbook.io/kubo-documentation/how-kubo-works/overview/mathematical-overview.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.
