Arcadia Finance
Search
K
Comment on page

Margin calculations

What Is Margin?

In finance, margin is the collateral that an investor has to deposit to cover the credit risk the counterparty holds. An investor can create credit risk if they; borrow cash, borrow to buy more assets, borrow assets to sell them short, or enter into a derivative contract (futures, options...).

What are Arcadia Margin Accounts?

Let's start with an analogy from traditional finance. If you open an account with a broker (or a centralised exchange) you typically start with a spot account: You can deposit/withdraw assets and you can buy and sell them. More advanced investors can also open a margin account, here they can next to buying and selling also borrow assets, or enter in derivative contracts.
Going back to DeFi, you can see your wallet as your spot account (you can deposit/withdraw assets and you can use DEXes to swap assets). And your Arcadia account is your on-chain margin account (you can borrow or use assets as collateral to enter into derivatives).
Margin accounts allow investors to enter into financial contracts, without the need to trust each-other. The Margin accounts manage counterparty risks by enforcing that the assets can cover all liabilities. The overall account must be over-collateralised at all time. If an account is at risk of becoming under-collateralised (-> not all liabilities can be paid off) the whole account will be liquidated, and liabilities will be repaid.
The Arcadia Margin account is a user-owned smart contract (see it as a smart contract wallet) that manages both the assets as the liabilities and enforces that the Margin Account is always in a healthy state (Assets > Liabilities).

Account Health States

Margin accounts have three different states: healthy, unhealthy and liquidatable.
In the healthy state, the total value of the asets is much bigger as the total value of liabilities. The owner of the account is free to withdraw assets, or take on more liabilities, as long as the account remains healthy after the action.
When the vault is unhealthy, but not liquidatable, the owner can only de-risk the account by: depositing more assets, or reducing liabilities.
If the equity of the account further drops and the owner of the account does not de-risk, the account becomes liquidatable: the assets of the account are auctioned to repay the open liabilities.
ToDo: add figures

Collateral and Liquidation value

To calculate the state of an account we compare the total amount of used margin (total value of assets used to cover liabilities) with risk adjusted values of all assets in the account. For each account we define two risk adjusted values: the Collateral Value and the Liquidation Value.

The collateral value

The collateral value of the vault is equal to the spot value of the underlying assets, discounted by a haircut (the Collateral Factor). Since the value of collateralised assets can fluctuate, the haircut guarantees that the vault remains over-collateralised with a high confidence level (99,9%+). The size of the haircut depends on the underlying risk of the assets in the vault, the bigger the volatility or the smaller the on-chain liquidity, the bigger the haircut will be.
The Collateral Value
CVCV
is given as:
CV=iViCFiCV = \sum_{i} V_i \cdot CF_i
With
ViV_i
The value of asset i, and
CFiCF_i
The Collateral Factor of asset i.
For those familiar with traditional margin accounts, the Collateral Factor is very similar to the Initial Margin Requirement (IMR). The exact relation is:
IMR=1CFIMR = 1 - CF
. The reason we use a Collateral Factor instead of the Initial Margin Requirement is twofold:
  • It is more inline with terminology used in other over-collateralised DeFi protocols.
  • It requires less arithmetic operations in the smart contracts to work with CFs instead of IMRs, leading to lower gas costs for users.

The liquidation value

The liquidation value of the vault is equal to the spot value of the underlying assets, discounted by a haircut (the Liquidation Factor). The liquidation value takes into account that not the full value of the assets can go towards repaying the liabilities: a fraction of the value is lost due to: slippage while liquidating the assets, fees for the auction initiator and a commission to the protocol.
The Liquidation Value
LVLV
is given as:
LV=iViLFiLV = \sum_{i} V_i \cdot LF_i
With
ViV_i
The value of asset i, and
LFiLF_i
The Liquidation Factor of asset i.
For those familiar with traditional margin accounts, the Liquidation Factor is very similar to the Maintenance Margin Requirement (MMR). The exact relation is:
MMR=1LFMMR = 1 - LF
. The reason we use a Liquidation Factor instead of the Maintenance Margin Requirement is twofold:
  • It is more inline with terminology used in other over-collateralised DeFi protocols.
  • It requires less arithmetic operations in the smart contracts to work with LFs instead of MMRs, leading to lower gas costs for users.

Account health

The state of the account can be derived from the Used Margin (
UMUM
) and the Collateral and Liquidation value
  • Healthy:
    CVUMCV \ge UM
  • Unhealty:
    CV<UMLVCV < UM \le LV
  • Liquidatable:
    UM>LVUM > LV

Used Margin and Free Margin

Used Margin

Used Margin (
UMUM
) is the value of collateral that an investor has already used to cover the credit risk of its counterparties. For our current use-case (Arcadia Lending), it has of two terms:
UM=D+FLCUM = D + FLC
  • The open debt of the Vault:
    DD
  • A fixed value to pay for liquidation costs (fixedLiquidationCost):
    FLCFLC
    . This term is a fixed cost, independent of the size of the position (gas costs, which need to be paid by liquidators also don't depend on the size of the position). This term avoids that positions are opened that are never profitable to be liquidated -> resulting in infinite pending liquidation and a lot of 'dust' bad debt.
The maximum amount of Margin a trader can take is the Collateral Value, since taking additional margin would result in an unhealthy account (which would revert the transaction).
Used Margin can also be defined as a relative number:
UMrel=FLC+DCVUM_{rel} = \frac{FLC + D}{CV}
. When an account is unhealthy, the Relative Used Margin becomes bigger than 100%.

Free Margin

Free Margin (
FMFM
) is the maximum value of collateral that an investor can still use to back additional liabilities. In other words, it is the additional margin the investor can take until the resulting Used Margin is equal to the Collateral Value:
FM=CVUMFM = CV - UM
Or relative:
FMrel=CVUMCVFM_{rel} = \frac{CV - UM}{CV}
.

Leverage

To find the total leverage of an account, or the leverage per asset in the account, we first need to find the net value of the account (also known as the Equity of the account).
The Net value equals the sum of all assets minus the sum of all liabilities, which gives in our use-case:
NV=iViDNV = \sum_{i} V_i - D
Note that we use the spot value of all assets (Marked to Market), not risk discounted values.
The total leverage of the account is given as:
L=iViNVL = \frac{\sum_{i} V_i}{NV}
And the leverage for an individual asset:
Li=ViNVL_i = \frac{V_i}{NV}
Note that when an account has no debt, it's leverage equals 1 and not 0. And the leverage of an individual asset can be smaller than 1.
The maximum leverage for an individual asset is approximately (ignoring the
FLCFLC
):
Li,max=11CFiL_{i,max} = \frac{1}{1-CF_i}
Example: for an asset with CF of 80%, you can leverage up to 5x.

Maximum Buying Power

The maximum Buying Power for an asset, is the maximum amount of debt that can be borrowed to buy a certain asset:
BPi,max=FM1CFiBP_{i,max} = \frac{FM} {1 - CF_i }