# Functions

## `signal(ex, pair)`

This function must return `None`, `False`, or `True`.

* `ex`
  * Exchange
* `pair`
  * Name of the pair being traded

### Return

1. Return `None` if the symbol is not handled by the script. If all scripts return `None` for the symbol then it will trade based on your settings.
2. Return `False` if the signal is not present.
3. Return `True` if the signal is present. This will allow the bot to place trades based on your settings.

## `update(ex, pair, last, avg, size, target)`

Since `v1.2.2`, this function can be used to force the bot to exit its current position and start over.

* `ex`
  * Exchange
* `pair`
  * Name of the pair being traded
* `last`
  * Last price of the pair
* `avg`
  * Average price of all entries
* `size`
  * Current position size
* `target`
  * Current target price

### Return

1. Return `True` to stay in the position.
2. Return `False` (or anything else) to exit the position.

This function should return `True` by default if you just want status updates sent to Python.

## `finished()`

This function is called when the bot is exiting. Depending on how the bot is closed, it may not be called.
