Marginly MAX leverage specifics
Last updated
Last updated
In Marginly, we specifically invoke a margin call before every user action: If your position happens to be the riskiest in the system, it will liquidate automatically on ANY action of ANY user.
Unfortunately, this means that when you close your position, and it's the riskiest one, instead of closure, you will get liquidated. Why not add leverage checks, you ask? This additional “if” logic increases contract size and requires complete refactoring by splitting the smart contract into many parts.
We will eventually have to do that as we envision some changes/improvements for Marginly’s protocol, including this particular one related to the riskiest position management.
Additionally, I would like to talk about the TWAP oracle we use to value user positions. Take a look at the following picture:
It is an ETH/USDC 1-minute chart. The red line is the average over 30 minutes - our 30-minute TWAP price. Now imagine that you went long 20x in the shaded area. Even though the price temporarily goes up, the TWAP price, at which Marginly values your position, continues to decline as the moving average is lagging current data. If you use max leverage, you will get liquidated. This behavior could be somewhat misleading when looking solely at the charts. The same happens to shorts, by the way, Imagine you shorted at 1880 with 20x, but the system will value your position at ~1882.5 (the TWAP price). This is an instant liquidation.
One of the things we’re currently working on within our UX is a warning on position openings, so people understand the implications when they use max leverage.