# Portfolio Margin

IVX pioneers the start of option portfolio margin trading on-chain by implementing self-custodial smart contract wallets for users. This approach enables users where they can deposit any whitelisted asset by IVX, utilizing the entire portfolio as collateral, to write and purchase option positions on IVX. Each EVM wallet is permitted to create a single smart contract portfolio to interact with the IVX protocol.

### Margin Trading Overview

Margin trading is the possibility to buy and sell option positions using the trading portfolio as collateral, eliminating the need to sell any deposited asset. This mechanism enhances the traders' buying power, enabling interconnected positions on cross margin, and the ability to perform selling positions on leverage.

IVX protocol mandates the following steps for every trade interacting in margin trading:

Create a portfolio account on IVX

Deposit one or more whitelisted assets as collateral

Interact with IVX Diem to open or close option positions

### Effective Balance

Each smart contract account accepts whitelisted assets as collateral determined by the IVX risk engine. For each asset, there is a specific collateral factor that describes how much a trader can use from the tokens deposited as collateral.

The effective balance of the account is calculated as follows:

$\large \text{Effective Balance} = \sum_{i=1}^n \text{Balance}_i \times \text{Price}_i \times \text{Collateral Factor}_i$

IVX uses Chainlink oracle price feeds to fetch token prices into the effective balance.

The collateral factor of each asset is a decimal percentage between 0.0 and 1.0 that determines how much of the asset’s notional value can be used as collateral.

Example

Alice wants to deposit 2 $wETH and 5 $wBTC into the margin model. The collateral factors for each asset are 0.97 and 0.96, $wETH and $wBTC are trading at $1,600 and $22,000 respectively. We can calculate Alice’s margin balance as follows:

### $\text{Margin Balance} = \sum_{i=1}^n \text{Balance}_i \times \text{Price}_i \times \text{Collateral Factor}_i \\ = 2 \cdot 1,600 \cdot 0.95 + 5 \cdot 22,000 \cdot 0.925 \\ = 3,040 + 101,750 \\ = 104,790$

Therefore, Alice’s margin balance is **$104,790**.

### Unrealized Profit and Loss

Unrealized profits and losses of the trading portfolio are stored within each account, affecting the account value calculation. This architecture will allow IVX to support cross-margin accounting between opened positions, facilitating the offsetting of profits and losses to reduce margin requirements, and protect from liquidation events. In addition, traders can leverage cross-margin to perform complex strategies with exotic payoff positions as it can free more capital to be used on other trades.

### Debt

In cross-margin mode, the portfolio account allows traders to open and close positions even when they don't meet the capital requirement, as long as the total unrealized profit and loss exceed the amount and the fees required to open or close a position. The required value is stored in the portfolio status as debt and will be reduced from portfolio assets under specific conditions such as:

Closing profitable positions

Expiration of option positions

The portfolio is liquidatable

Additional assets deposited into the account

Trading on margin offers flexibility in trading by:

Minimising capital requirements to trade due to the necessity to provide only the maintenance margin to keep the position opened.

Reduce liquidation risks through the ability to cover losing positions using the portfolio’s assets

Utilzing unrealized profits in the portfolio account to open extra additional positions

Enabling the creation of complex strategies involving different option positions

Last updated