# Query Available Amounts

**To calculate the available amount of liquidity for long positions:**

* indexToken: the address of the token to long
* Available amount in tokens: Vault.poolAmounts(indexToken) - Vault.reservedAmounts(indexToken)
* Available amount in USD: PositionRouter.maxGlobalLongSizes(indexToken) - Vault.guaranteedUsd(indexToken)
* The available liquidity will be the lower of these two values
* PositionRouter.maxGlobalLongSizes(indexToken) can be zero, in which case there is no additional cap, and available liquidity is based only on the available amount of tokens

**To calculate the available amount of liquidity for short positions:**

* indexToken: the address of the token to short
* collateralToken: the address of the stablecoin token to be used as collateral
* Available amount in tokens: Vault.poolAmounts(collateralToken) - Vault.reservedAmounts(collateralToken)
* Available amount in USD: PositionRouter.maxGlobalShortSizes(indexToken) - Vault.globalShortSizes(indexToken)
* The available liquidity will be the lower of these two values
* PositionRouter.maxGlobalShortSizes(indexToken) can be zero, in which case there is no additional cap, and available liquidity is based only on the available amount of tokens


---

# 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.minerva.money/core-features/trading/query-available-amounts.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.
