> For the complete documentation index, see [llms.txt](https://build.sovryn.com/builder-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://build.sovryn.com/builder-portal/smart-contracts/lending-and-margin-trading-protocol/margin-trading.md).

# Margin Trading

Margin trades are opened on the loan token contracts and closed on the Sovryn Protocol.

In order to enter a trade, call `marginTrade` on the respective iToken contract. Let's say you want to trade RBTC against XUSD. You enter a BTC long position by sending either of these currencies to the iXUSD contract and a short position by sending either of them to the iRBTC contract. The process is depicted below.

<figure><img src="https://2753478592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeTZFplyhxCin9IX3EC9X%2Fuploads%2FhqyaqHp5n5p1k52YaTRz%2Fmargintrading.png?alt=media&amp;token=1f3721df-422c-4452-868a-a8b9b9ed3a42" alt=""><figcaption><p>How to open long or short positions.</p></figcaption></figure>
