Swolecharts
Live crypto data · 10 exchanges
Log inSign up

Partial Close vs Add Margin Calculator

Compare the partial close and extra isolated margin needed for a target liquidation boundary on a BTC, ETH or SOL linear position.

USDT treated as a USD equivalentManual balances and rates; no live maintenance tiers

Generic retained-collateral scenario. This is not a venue/account margin preview. Position balances and rates are manual assumptions; the initial entries are an editable example. No orders are submitted.

Your isolated linear position

Leave P blank for a fresh exact USDT perp quote from the selected venue. Entered prices remain manual when coin or venue changes. Cash C excludes unrealized PnL; m, f and k are fractions, not percentages.

Close versus cash added

Defining assumption: retain all residual collateral and realized PnL inside isolated margin, after paying the actual closing fee. No collateral is released pro rata. Reducing size on an exchange does not automatically retain released margin; verify your account's behavior.

Correct the inline errors or enter a manual P to see the comparison. Inputs that require a full close have no partial-close boundary.

Retained-collateral formula

Let s = +1 for long, −1 for short and a = m + f. Closing x coins at P leaves q′ = q − x and C′ = C + s(P − E)x − kPx. E stays unchanged for the remaining position.

K = E − T(1 − a) for a long, or T(1 + a) − E for a short. Let b = s(P − E) − kP. If C ≥ qK, zero close is needed. Otherwise x = (qK − C) / (K + b). Require K + b > 0, 0 < x < q and C′ > 0.

The forward check uses long LP = max(0, (q′E − C′) / (q′(1 − a))), or short LP = (q′E + C′) / (q′(1 + a)). Holding all q coins instead requires extra cash max(0, qK − C).

Long T must be nonnegative and below both E and P; short T must be above both. At P, current equity C + s(P − E)q must exceed (m + f)qP. A flat position has no liquidation boundary. T = 0 for a long means no positive-price liquidation in this model.

m and f are explicit constant assumptions; no live risk tiers are fetched. k is the actual fee paid on the partial close, while f reserves a potential later closing fee on the remainder. Funding, maintenance deductions, mark/last-price differences, slippage, risk-tier changes and cross/portfolio margin are excluded. USDT is treated as a USD equivalent.

Worked losing-long example

For E = 100, q = 10, C = 100, P = 95, T = 85, m = 0.005 and f = k = 0: K = 15.425 and b = −5. Close 5.2038369305 coins (52.038369%). The gross realized loss is 26.0191846523 USDT; 4.7961630695 coins and 73.9808153477 USDT cash remain.

Forward substitution gives (4.7961630695 × 100 − 73.9808153477) / (4.7961630695 × 0.995) ≈ 85. Keeping all 10 coins instead requires 54.25 USDT extra margin. The first choice gives up exposure; the second commits more cash.