> For the complete documentation index, see [llms.txt](https://docs.origami.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.origami.tech/reference/grid-language/functions.md).

# Functions

All grid language functions — market data, balances, exchange info, math and statistics functions for Origami Tech formulas.

Functions that can be called inside the grid parameters.

## Market Data

<table data-header-hidden data-full-width="true"><thead><tr><th width="342">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><code>ticker</code></h3></td><td>The current market price of the latest traid on the market.</td></tr><tr><td><h3><code>orderbook</code></h3></td><td>Orderbook from the market in the Orderbook structure.</td></tr><tr><td><h3><code>candles</code></h3></td><td>Market candlesticks in the Candle structure.</td></tr><tr><td><h3><code>own</code></h3></td><td>Self orders in the Orderbook structure.</td></tr><tr><td><h3><code>vwap</code></h3></td><td>Calculates the volume-weighted average.</td></tr><tr><td><h3><code>amount_before_price</code></h3></td><td>The amount of basic tokens up to a certain price.</td></tr><tr><td><h3><code>amount_threshold_index</code></h3></td><td></td></tr></tbody></table>

***

## Balances and Exchange info

<table data-header-hidden data-full-width="true"><thead><tr><th width="240">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><code>symbol</code></h3></td><td>Exchange information in Symbol structure.</td></tr><tr><td><h3><code>balance</code></h3></td><td>Token balance of certain exchange in Balance structure.</td></tr><tr><td><h3><code>saved_balance</code></h3></td><td>Saved token balance of certain exchange in Balance structure.</td></tr><tr><td><h3><code>group_balance</code></h3></td><td>The sum of the token balances from all exchanges in the group in Group Balace structure.</td></tr></tbody></table>

***

## Calculations

<table data-header-hidden data-full-width="true"><thead><tr><th width="252">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><code>mean</code></h3></td><td>Compute the arithmetic mean (average) of the given list elements.</td></tr><tr><td><h3><code>median</code></h3></td><td>Compute the median of the given list elements.</td></tr><tr><td><h3><code>max</code></h3></td><td>Returns max value of the given list elements.</td></tr><tr><td><h3><code>min</code></h3></td><td>Returns min value of the given list elements.</td></tr><tr><td><h3><code>exp</code></h3></td><td>Calculates the exponent value.</td></tr><tr><td><h3><code>abs</code></h3></td><td>Returns the absolute value of the given number.</td></tr><tr><td><h3><code>logn</code></h3></td><td>Calculates the value of the natural logarithm.</td></tr><tr><td><h3><code>count</code></h3></td><td>Returns the number of the given list elements.</td></tr><tr><td><h3><code>random</code></h3></td><td>Random decimal value in range [0, 1].</td></tr><tr><td><h3><code>sum</code></h3></td><td>Sum of the given list elements.</td></tr></tbody></table>

***

## Other

<table data-header-hidden data-full-width="true"><thead><tr><th width="254">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><code>cached</code></h3></td><td>Used to cache the results of calculating the cached_value formula for the ttl time in seconds.</td></tr><tr><td><h3><code>remove_nan</code></h3></td><td>Drop decimal(Nan) of the given list elements.</td></tr><tr><td><h3><code>is_nan</code></h3></td><td>True if input Nan and False if input not Nan.</td></tr><tr><td><h3><code>var</code></h3></td><td></td></tr></tbody></table>
