Home › Guides › Liquidation price
OKX Liquidation Price: How It's Calculated, with Worked Examples
You get 20% of your trading fees back with this code; the site owner earns a commission at no extra cost to you. Not for residents of restricted regions (incl. U.S., Canada). Rewards vary by region and are not guaranteed. Independent guide, not an official OKX site.
Short answer: OKX liquidates a futures position when its maintenance margin ratio falls to 100% or below, and it measures this with the mark price, not the last traded price. For an isolated USDT-margined long, OKX's formula is (margin − position value at entry) ÷ (position size × (maintenance margin rate + fee rate − 1)). In practice the distance to liquidation is roughly 1 ÷ leverage, minus the maintenance margin and fee rates: about 9.5% at 10x, about 1.5% at 50x and under 0.5% at 100x in our example below. This page shows the arithmetic so you can check it yourself before you risk money.
This is a deep dive into the math only. For how to practise without money, see OKX demo trading; for what fees cost, see OKX fees explained. Futures and leverage are not available in every country, and this is not financial advice.
OKX liquidation rules at a glance
| Item | What OKX says |
|---|---|
| When liquidation starts | When the maintenance margin ratio is at or below 100%. OKX warns from 300%, and says it may change that warning level. |
| Which price counts | The mark price only, not the last traded price. The mark price blends spot indexes from several exchanges plus a basis. |
| Margin ratio (isolated) | (Margin balance + position PnL) ÷ (maintenance margin + liquidation fees). |
| Maintenance margin rate (MMR) | Set by position tier: larger positions sit in higher tiers with a higher MMR and a lower maximum leverage. See Position tiers on the trading page. |
| How it happens | In stages: futures positions are cut by two tiers per step and the ratio is rechecked. If it is still at or below 100% at the lowest tiers, the rest is closed at the mark price. |
| Fees on liquidation | A liquidation fee at the taker rate of your fee tier, plus a "liquidation clearance fee" equal to the maintenance margin at the moment of trigger. |
| What you can lose | Isolated: that position's margin. Cross: all margin in that currency in the trading account. The funding account isn't affected. |
| Beyond your margin | A security fund covers negative balances. If it can't, auto-deleveraging (ADL) reduces profitable positions on the other side. |
| Region | Derivatives are restricted in some countries, for example the UK, Australia, Brazil and South Korea, per OKX's disclosure. See OKX supported countries. |
The formula OKX publishes
OKX's forced-liquidation FAQ gives these formulas for isolated futures. M is the margin balance, F the contract face value, n the number of contracts, P the average entry price, mmr the maintenance margin rate of your tier, and fee the fee rate. F × n is simply your position size in coins.
| Contract | Long | Short |
|---|---|---|
| USDT-margined | (M − F·n·P) ÷ (F·n·(mmr + fee − 1)) | (M + F·n·P) ÷ (F·n·(mmr + fee + 1)) |
| Crypto-margined | F·n·(mmr + fee + 1) ÷ (M + F·n/P) | F·n·(mmr + fee − 1) ÷ (M − F·n/P) |
Why the shortcut works: at leverage L, your margin is about position value ÷ L. Liquidation comes when the loss has eaten the margin down to the maintenance margin plus fees. So the price can move about 1/L − (mmr + fee) against you. Leverage sets the first term, which is why it dominates everything else.
Worked example: the same trade at seven leverage levels
Illustrative numbers only, not live OKX data. A long and a short of 0.1 BTC on a USDT-margined perpetual, entry 60,000 USDT, so the position is worth 6,000 USDT. We assume an MMR of 0.5% and a fee rate of 0.05%; check the real MMR for your size under Position tiers and your fee rate in your account. Isolated margin, no extra margin added, funding ignored.
| Leverage | Margin posted | Long liquidation price | Drop that liquidates the long | Short liquidation price | Rise that liquidates the short |
|---|---|---|---|---|---|
| 2x | 3,000 USDT | 30,166 | −49.7% | 89,508 | +49.2% |
| 3x | 2,000 USDT | 40,221 | −33.0% | 79,562 | +32.6% |
| 5x | 1,200 USDT | 48,266 | −19.6% | 71,606 | +19.3% |
| 10x | 600 USDT | 54,299 | −9.5% | 65,639 | +9.4% |
| 20x | 300 USDT | 57,315 | −4.5% | 62,655 | +4.4% |
| 50x | 120 USDT | 59,125 | −1.5% | 60,865 | +1.4% |
| 100x | 60 USDT | 59,729 | −0.45% | 60,269 | +0.45% |
Check one row by hand. 10x long: M = 600. (600 − 0.1 × 60,000) ÷ (0.1 × (0.005 + 0.0005 − 1)) = −5,400 ÷ −0.09945 ≈ 54,299 USDT, a 9.5% drop. Crypto can move that much in a day, and 0.45% is ordinary noise within minutes. Note also that the position, and so the profit or loss per dollar of price move, is the same in every row: leverage only changes how much margin stands between you and liquidation.
How to check a liquidation price before you open a trade
- Find your MMR. On the futures trading page, open Position tiers for the contract and find the tier for the size you plan. A bigger position can sit in a higher tier with a higher MMR.
- Find your fee rate. Your taker rate is shown in your account; see OKX fees explained.
- Use OKX's own calculator. OKX points users to the futures Calculator, which has a Liquidation price option. Enter the same inputs as your planned trade.
- Check it with the formula above. If your number and OKX's differ by a lot, find out why before trading (see "Common problems" below).
- Compare it with your stop. Your stop-loss must sit well before the liquidation price. If it doesn't, cut size or leverage, not the stop.
- Practise in demo first. Open the same position in demo trading and compare the liquidation price OKX shows with your own.
Position sizing: the number that matters more than leverage
Illustrative numbers. Say your account is 2,000 USDT and you decide to risk at most 1% (20 USDT) on one trade, with a stop 2% from entry. Position size = 20 ÷ 0.02 = 1,000 USDT. Fees for a taker round trip at 0.05% per side add about 1 USDT, so the loss at the stop is about 21 USDT whatever leverage you pick.
| Leverage on that 1,000 USDT position | Margin locked | Rough liquidation distance | Stop (2%) hit before liquidation? |
|---|---|---|---|
| 2x | 500 USDT | ~49% | Yes, by a wide margin |
| 10x | 100 USDT | ~9.5% | Yes |
| 50x | 20 USDT | ~1.5% | No: liquidation comes first, with liquidation fees |
The lesson: decide the risk in USDT first, then the size, and only then check that the liquidation price sits far beyond the stop. Note that a stop is an order, not a promise: in a fast market it can fill worse than its trigger price.
How fees compound with leverage and trade frequency
Futures fees are charged on the position value, not on your margin. Illustrative numbers: 1,000 USDT of margin at 10x is a 10,000 USDT position. At a 0.05% taker rate, each side costs 5 USDT, so a round trip costs 10 USDT, which is 1% of your margin.
| Round trips per day | Fees per day | As % of 1,000 USDT margin | Fees per 30 days | 30 days after a 20% rebate |
|---|---|---|---|---|
| 2 | 20 USDT | 2% | 600 USDT | 480 USDT |
| 5 | 50 USDT | 5% | 1,500 USDT | 1,200 USDT |
| 20 | 200 USDT | 20% | 6,000 USDT | 4,800 USDT |
Funding payments, slippage and spread come on top. Fees also shrink your margin balance between trades, which moves later liquidation prices closer. The 20% rebate with code 33746534 lowers the fee line; it doesn't turn a losing pattern into a winning one. Run your own numbers in the OKX fee calculator.
Common problems: what if…?
Why is OKX's liquidation price different from my calculation?
The usual causes: your position sits in a different tier with a different MMR; your fee rate differs from the one you assumed; you use cross margin, where the whole trading-account balance in that currency counts (so the price moves whenever your balance or other positions change); funding or fees have changed the margin balance; or your average entry price differs from the price you had in mind after several fills.
Why was I liquidated when the chart never reached my liquidation price?
The chart you watched probably showed the last traded price. OKX liquidates on the mark price, which you can switch to on the candlestick chart. A position can also be partly reduced in stages before it is fully closed, so the first fill may come earlier than you expected.
What if I add margin to an isolated position?
A larger M moves the liquidation price away. In the table above, adding 600 USDT to the 10x long (M = 1,200) moves liquidation from about 54,299 to about 48,266, the same as 5x. But you also put twice as much money at risk on the same trade; adding margin to rescue a losing trade is a common way to lose more.
What if I use cross margin instead?
The liquidation price is usually further away, because more balance supports the position, but OKX says all the margin in that currency in your trading account may be lost, and unfilled orders, including bot orders, are cancelled on liquidation. Isolated margin limits the loss to one position; cross shares the risk across all of them.
Can a bot or script get liquidated?
Yes. Futures grid bots and API scripts use the same margin rules. A script can open leveraged positions faster than you notice a bug, which is why the checks below belong in code.
A read-only liquidation-distance check in Python
This builds on the script in your first OKX API script: save that as okx_first.py in the same folder. It runs against demo (that script sets DEMO = True), only reads data and never places an order. It warns when liquidation is close and creates the STOP kill-switch file when the daily max loss is hit. Use a read-only key kept in environment variables.
# liq_watch.py: read-only, demo only. Needs okx_first.py from our first-script guide.
import os, time
from okx_first import call, KILL_FILE
MIN_DISTANCE = 0.15 # warn if liquidation is closer than 15% of the mark price
DAILY_MAX_LOSS_USDT = 50 # create the STOP file after this drawdown
start_equity = None
while not os.path.exists(KILL_FILE):
res = call("GET", "/api/v5/account/positions?instType=SWAP", private=True)
if res.get("code") != "0":
print("error", res.get("code"), res.get("msg"))
time.sleep(30)
continue
for p in res["data"]:
mark, liq = float(p["markPx"] or 0), float(p["liqPx"] or 0)
if mark and liq:
dist = abs(mark - liq) / mark
print(f"{p['instId']} {p['mgnMode']} {p['lever']}x mark {mark} liq {liq} distance {dist:.1%}")
if dist < MIN_DISTANCE:
print("Liquidation is close: reduce size by hand.")
bal = call("GET", "/api/v5/account/balance?ccy=USDT", private=True)
if bal.get("code") == "0":
equity = float(bal["data"][0]["totalEq"] or 0)
start_equity = start_equity or equity
if start_equity - equity > DAILY_MAX_LOSS_USDT:
open(KILL_FILE, "w").close() # halts every script that checks for STOP
print("Daily max loss reached: STOP file created. Review positions by hand.")
time.sleep(30)
Risk section: read before you use leverage
- Demo first. Learn how margin, the mark price and liquidation behave with virtual funds. Demo fills and prices are not live ones.
- Backtests and demo results are not live results. Real slippage, gaps, outages and your own reactions are missing from both.
- Size by risk, not by leverage. Fix a maximum loss per trade in USDT, keep it small, and check that liquidation sits far beyond your stop.
- Set a daily max loss and stop trading for the day when you hit it. Put it in code if a script trades for you.
- Keep a kill switch: one action that stops your script, plus a way to cancel orders and close positions by hand.
- API keys: never enable withdrawal permission, bind keys to your IP addresses, keep them in environment variables, and never share the key, secret or passphrase with anyone, including "support".
- Most active leveraged traders lose money. Fees, funding and liquidation fees work against you on every trade. High leverage plus frequent trading compounds those losses.
Honest limits of this page
- Our numbers are illustrative. Real MMRs depend on the contract and your tier, and fee rates depend on your account. Use OKX's calculator and Position tiers for live values.
- The formula covers isolated margin. Cross and multi-currency margin depend on your whole account and can't be reduced to one line.
- Funding is left out. Funding payments change your margin balance over time; the interval and rate vary by contract.
- Availability and legality depend on your country. Many places restrict derivatives for retail traders. Educational information only, not financial advice.
If you're not signed up yet, our OKX referral code guide explains what code 33746534 gives you.
Official sources
FAQ
What does liquidation price mean on OKX?
It is the mark price at which your position's maintenance margin ratio would fall to 100%, the point where OKX starts forced liquidation. It moves when your margin, position size, tier or fee rate changes.
Does OKX use the last price or the mark price for liquidation?
The mark price. OKX says forced liquidation only looks at the mark price, which blends spot indexes from several exchanges plus a basis, so a brief spike in the last traded price alone shouldn't trigger it.
How far can the price move before I'm liquidated at 10x?
Roughly 1 divided by the leverage, minus the maintenance margin and fee rates. With an illustrative 0.5% MMR and 0.05% fee, that is about 9.5% at 10x, 4.5% at 20x and 1.5% at 50x for an isolated position. Check your real numbers with OKX's calculator.
What is the maintenance margin rate on OKX?
It is the minimum margin, as a share of the position, needed to keep the position open. OKX sets it by position tier: larger positions get a higher rate and a lower maximum leverage. You can see the tiers under Position tiers on the trading page.
Does adding margin lower my liquidation risk?
On an isolated position, adding margin moves the liquidation price further away, but it also puts more money at risk on the same trade. Reducing position size lowers risk without adding exposure.
Is isolated or cross margin safer for liquidation?
Neither is safe. Isolated limits the loss to the margin of that one position. Cross usually puts liquidation further away, but OKX says all margin in that currency in the trading account may be lost.
What fees does OKX charge when a position is liquidated?
According to OKX's FAQ, a liquidation fee at the taker rate of your fee tier, plus a liquidation clearance fee equal to the maintenance margin at the moment liquidation is triggered. Larger tiers mean larger fees.
Can I lose more than my margin on OKX futures?
In isolated mode OKX says only that position's margin is lost, and its security fund covers negative balances. In cross mode, all the margin in that currency in your trading account can be lost. Your funding account isn't affected.