> For the complete documentation index, see [llms.txt](https://docs.alcor.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alcor.exchange/developers-api/amm-swap-contract-api/formulas.md).

# Formulas

For application development, we recommend to use our [SDK](https://github.com/alcorexchange/alcor-v2-sdk). But here you can find formulas for interaction at a low level.

Here you can find formulas for **swap.alcor** contract.

#### Pool token price calculation

<pre class="language-markup"><code class="lang-markup"><a data-footnote-ref href="#user-content-fn-1">tokenA price in terms of tokenB:</a>
sqrtPriceX64 ** 2 / 2 ** 128 * 10 ** (precisionA-precisionB)

<a data-footnote-ref href="#user-content-fn-1">tokenB price in terms of tokenA:</a>
2 ** 128 / sqrtPriceX64 ** 2 * 10 ** (precisionB-precisionA)
</code></pre>

[^1]:
