# 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]:


---

# 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.alcor.exchange/developers-api/amm-swap-contract-api/formulas.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.
