> For the complete documentation index, see [llms.txt](https://docs.spin.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spin.fi/tech-documentation/futures/trading-modules.md).

# Trading Modules

### Spin's trading modules

**Margin Vault** is an on-chain wallet that works according to the smart contract logic. To trade on Spin, users need to deposit funds to the margin vault that stores users' funds safely, while the smart contract defines the amount of funds the user can transfer depending on their balance and current positions.&#x20;

**Risk Engine** is a module that runs pre-trade checking and order settlement.&#x20;

All information about the user activity is kept in the smart contract that calculates traders' metrics such as required collateral, uPnL, margin ratio, etc.

1. The user deposits USDC to the margin account

<figure><img src="/files/yhuMNbAZpgG8XXTq2xCL" alt=""><figcaption></figcaption></figure>

2\. User enters a position for 1 BTC-PERP

<figure><img src="/files/QDDKmodEEkLA33XSqdog" alt=""><figcaption></figcaption></figure>

3\. User closes the position

<figure><img src="/files/jAWsmxYzAn9we6FJSroG" alt=""><figcaption></figcaption></figure>
