> For the complete documentation index, see [llms.txt](https://ivx-smart-contracts.gitbook.io/user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ivx-smart-contracts.gitbook.io/user-guide/1-margin-account.md).

# 1 - Margin Account

### Create Margin Account

```solidity
IVXMarginManager => function createMarginAccount() external returns(IIVXPortfolio)
```

User needs to interact with this function to create his margin account, otherwise trades cannot be open.

This will return an address for the contract created to use for the user's margin assets and portfolio of trades.

We called that contract *IVXPortfolio*, in which we store all the users trades, and assets used for collateralizing said trades.

### Adding assets to Portfolio to increase Margin

```solidity
 IVXPortfolio => function increaseMargin(address _asset, uint256 _amount) external
```

User will then need to approve the Portfolio contract and call this function to add funds to his account.

Only assets supported can be deposited, and those are given by :

```solidity
IVXMarginManager => function getSupportedAssets() view returns (address[] memory)
```

### Removing assets from Portfolio&#x20;

```solidity
 function decreaseMargin(address[] calldata _assets, uint256[] calldata _amounts) external
```

This function allows the user to remove any of his margin assets and any amount, as long as he owns the portfolio and that does not make him liquidatable, more on that [here.](/user-guide/1-margin-account/1.1-user-account-dollar-value.md)
