Understanding Cross-Margin

Anders
marginfi

--

marginfi is a decentralized margin protocol for trading across Solana. The protocol makes it easy for traders to access margin, manage risk, and improve capital efficiency across the entire Solana ecosystem from one unified place.
Read more about us.

This article is a continuation of the marginfi Leverage (learning) series.

Hello, traders! We last talked about mandatory margin and how it’s required for assets that feature a counterparty. Now we are going to talk about how margin is handled in a portfolio with multiple positions. There are two core ways to manage margin across a portfolio: cross-margin and isolated-margin.

What is cross-margin?

Cross margining is the use of margin in a portfolio to cover multiple positions. This allows a trader to allocate margin across different positions rather than having to cover each position individually.

In DeFi, cross-margin has typically been implemented at the account-level. That is, margin in a trader’s account is used to cover the margin requirements of all of the open positions in that account. This is straightforward when all positions are denominated in the same token (e.g. USDC), and can also be managed for cross-token denominations.

What is isolated-margin?

A position whose margin is isolated does not receive capital from a trader’s portfolio if the position moves against a trader. Rather than topping up, isolated positions are liquidated when they fall below maintenance margin thresholds. Traders who have isolated margin must monitor the health of a trade manually and add capital to their losing positions.

What’s the tradeoff?

Cross-margin is useful when a trader wants to avoid the risk of liquidation on a given position. The tradeoff is that they instead expose their entire account’s margin to the risk that the cross-margined positions will move against them.

By comparison, isolated margin tends to be useful when a trader makes directional bets that are particularly risky or volatile and the trader does not want to expose their excess portfolio capital to losses in that position.

Let’s take a look at what this looks like in practice.

Comparing cross-margin and isolated margin in action

Let’s create a hypothetical trade where the trader goes long Solana first with isolated margin and then with cross-margin.

Setup

The trader opens an account with $100 USDC and uses $10 of that to go long 1 Solana at $200. The trader’s portfolio now consists of $90 USDC and a $200 position in Solana (funded by $190 in leverage).

Let’s say the liquidation threshold is $190 so if the position goes below that the trader will lose all of their margin.

Isolated margin

The price of Solana falls to $185 and the position is now below the liquidation threshold. If isolated margin was used, the trader would be liquidated and the $10 of margin is lost. Note that the remaining $90 of excess margin is not at risk when using isolated margin.

Cross-margin

Let’s say the trader makes the same trade but instead opts for cross-margin. All of the initial margin in the position will be used first and then margin will be taken from the excess in the portfolio to cover losses. In this scenario, the trader now has $15 of margin in the position and only $85 of excess remaining in the portfolio. They have used more margin but the position is still live.

Despite the larger unrealized loss, this could be beneficial to a trader with high conviction. By using cross-margin and tapping into the portfolio’s excess margin reserves, the trader implicitly dollar-cost-averages into a position that is declining in value.

Results

To recap, if the trader used isolated margin, the whole position would be liquidated because there was no more margin left to cover losses. If they used cross-margin, the position would draw from excess margin across the entire portfolio. The positions would look something like this:

Reversal

As mentioned above, the trader using cross-margin would be exposed $15 of margin (PnL: -$5) but the position is still live. Now let’s say Solana rips up to $215. Since they were not liquidated, they can take advantage of this surge and they now have $25 of margin in the position (PnL: +$15). It is important to note the trader bore additional risk by cross margining their position and exposing the entire portfolio's margin.

A practical note

We’ve simplified the example here, but you may have noticed in the cross-margin example that it could be operationally complex (and annoying!) to move excess margin to individual positions.

Fortunately there’s a shortcut. Instead of managing balances individually, aggregate margin requirements of all of the positions in a trader’s account can be compared to the total amount of equity. As long as a trader has sufficient margin to cover all of the positions, they are not subject to liquidation.

Cross-margin on chain

Many protocols now give you the option to use both types of margin. Here’s a few places you can try it out:

Looking forward

Cross-margin allows a trader to easily manage margin across positions whose values are constantly changing. But you may be wondering: how are margin requirements calculated for positions in the first place? We’ll explore that next.

Follow us to stay updated, or join the discord to get the alpha first.

As always, no marginfi content should ever be considered financial advice and no reference to financial assets, securities, derivatives, or other financial products should be considered an endorsement of the aforementioned. Please consult a licensed financial advisor before making any and all investment decisions, and please do your own research.

--

--

Anders
marginfi

recovering tradfi enthusiast | building @marginfi