# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spin.fi/tech-documentation/futures/trading-modules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
