> For the complete documentation index, see [llms.txt](https://erc20-docs.particle.trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://erc20-docs.particle.trade/developer/close-position.md).

# Close Position

* Function: `closePosition`
* The actual position closing steps are in `_closePosition`, which implements: swap back the needed amount to repay LP (`Base.swap`), repay LP (`increaseLiquidity`), send gains to trader (`refundWithCheck`), pays for fees (`addTokensOwed`).
* Note: caller is authorized by checking the liens\[msg.sender, lienId] belonging to the caller is non empty.
