DEV Community

LONG DOGE
LONG DOGE

Posted on AI-assisted

How to estimate the liquidation price of a leveraged DOGE long (with the math I use)

I built a small mobile front end for Hyperliquid that only opens DOGE longs. The feature people ask about most is the liquidation estimate it shows before an order. Here is the math, so you can check it yourself and poke holes in it.

The formula

Hyperliquid's docs describe liquidation for a position in terms of its maintenance margin. For a long:

maintenance rate m = 1 / (2 * maxLeverage)
liq price = entry * (1 - (1/L - m) / (1 - m))
Enter fullscreen mode Exit fullscreen mode

where L is the leverage you use on the position. This is an estimate for a single isolated long with no funding or fees applied. The exchange's own number is the one that counts once you hold the position.

DOGE's max leverage on Hyperliquid is 10x (from the public meta endpoint), so m = 0.05.

In code

function liqPrice(entry, lev, maxLev = 10) {
  const m = 1 / (2 * maxLev);
  return entry * (1 - (1 / lev - m) / (1 - m));
}
Enter fullscreen mode Exit fullscreen mode

Worked numbers (DOGE max leverage 10x, so m = 0.05)

Entry Leverage Price drop to liquidation Estimated liq price
$0.060 5x 15.79% $0.0505
$0.065 4x 21.05% $0.0513
$0.075 3x 29.82% $0.0526
$0.075 2x 47.37% $0.0395
$0.095 2x 47.37% $0.0500

Note that the drop percentage depends only on leverage. That is why the same liquidation price needs lower leverage as the entry price goes up.

Exposure and the 1% move

exposure = balance * leverage
effect of a 1% move = exposure * 0.01
Enter fullscreen mode Exit fullscreen mode

With $20 at 5x, exposure is $100 and a 1% move is about $1, which is 5% of your balance. That is why the calculator shows it next to the liquidation price.

What this does not cover

Funding payments, fees, slippage, cross margin, and the exchange's margin tiers for large sizes all change the real number. Treat the estimate as a sanity check, not a guarantee.

Risk

Leveraged trading uses real money and can lose your whole margin. This is not financial advice. Whether you are allowed to trade on Hyperliquid depends on where you live.

Try it

The calculator is part of LONG DOGE, a front end I built (disclosure: I am the author): https://getrichfaster.vercel.app. It is not an exchange and does not hold funds. I would like feedback on whether the estimate and the wording are clear.

Verification: formula and maxLeverage: 10 checked against the site's own code and https://api.hyperliquid.xyz/info (type=meta); table numbers computed, not rounded by hand.

Top comments (0)