> For the complete documentation index, see [llms.txt](https://unimex.gitbook.io/apemex/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unimex.gitbook.io/apemex/getting-started/liquidations.md).

# Liquidations

## Liquidation & Rewards

When a position falls below its liquidation threshold or stop loss, or rises above the take profit percentage, it becomes eligible for the liquidation function to be called. Anyone can call liquidation functions.

Due to the nature of smart contracts, orders cannot be autonomously closed. To solve this issue, the ApeMexMargin contract makes it possible for anyone to run bots for liquidating orders. By successfully liquidating an order (even something like stop loss), you earn the liquidation fee supplied in escrow by the issuer of the position. Limit orders with a preset price function in a similar manner, allowing anyone to auto-open them.&#x20;
