Calculation version · linear-isolated-v1

Crypto Leverage Methodology

The formulas, decimal policy, strict domains, independent vectors, validation status, and limitations behind every calculator result.

Supported model

The calculator uses a simplified linear USD/USDT-margined isolated perpetual-style position. Prices, margin, exposure, fees, funding cash flow, and PnL use one consistent quote-currency unit. Quantity uses the base-asset unit. Rates are decimal fractions: 0.001 means 0.1%.

This is not an exact exchange liquidation model. It does not cover inverse or token-margined contracts, cross margin, portfolio margin, maintenance tiers, mark-price rules, insurance funds, auto-deleveraging, partial fills, or venue-specific rounding.

The isolated allocation and shared-pool comparison explains those collateral arrangements; it does not extend this calculator to cross-margin accounts.

Calculation version: linear-isolated-v1.

Before-cost loss-budget extension

The separate loss-budget-v1 adapter supplies a position to the same forward model. It does not change that model’s PnL, cost or boundary equations.

For entry E, stop S and planned before-cost loss R:

  • R = fixed amount, or account equity A × chosen percentage p ÷ 100
  • d = |E − S|
  • Q = R ÷ d
  • N = Q × E
  • When leverage is supplied, M = N ÷ L

Long requires 0 < S < E; Short requires S > E > 0. Budget and supplied equity must be positive. Percentage must be above 0 and at most 100, an input domain rather than a recommendation. Size is available before leverage is entered. Leverage changes margin and the boundary context, while quantity, position value and before-cost price loss stay fixed.

For Long entry 100,000, stop 99,000 and budget 100, distance is 1,000, quantity is 0.1 base units and position value is 10,000. The same size follows from equity 10,000 and a chosen 1%. At 5x, 10x and 20x, margin is 2,000, 1,000 and 500. For Short stop 101,000, quantity remains 0.1 and gross stop PnL is −100. These are controlled arithmetic examples, not suggested trades or percentages.

With opening and closing fee rates of 0.0004, the Long example has fees of 4 and 3.96. Its estimated stop loss becomes 107.96, or 7.96 above the price-loss budget. Signed funding uses the forward formulas below; estimated receipts never increase the sized quantity. The adapter does not optimize an all-in budget. Entered account equity below the required margin is flagged; greater equity does not establish that all of it is available collateral.

Budget arithmetic, funding and stop feasibility are separate facts. Ordinary stop PnL and reward/risk are suppressed if the stop is at or beyond the modeled boundary, or if opening assumptions are invalid. A labelled simple fallback is a reference only. For entry 100, stop 95 and budget 100, quantity is 20 and position value 2,000. At 20x the simple Long boundary equals 95; at 25x it is 96 and is reached before the stop. Neither case confirms a loss cap.

Arithmetic retains 80 significant decimal digits. Repeating divisions have finite-precision residuals; display rounding is never fed back into calculation. Quantity display rounds down, using scientific notation when necessary to avoid a false zero. Inputs use the existing plain-decimal rules and magnitude limits. Unrepresentable derived budgets or positions are rejected without clipping. There is no exchange lot or tick model, and the displayed quantity is not order-ready. Costs, fills and liquidation can change actual losses.

Symbols and sign convention

Symbol Meaning
E Entry price
X Scenario or exit price
Q Positive base-asset quantity
s +1 Long, −1 Short
L Leverage, at least 1
M Allocated or required initial margin
N Entry exposure/notional
f_entry, f_exit Entry- and exit-fee rates
r_funding Signed funding rate per interval; positive means Long pays
k Nonnegative whole funding-interval count
m Supplied maintenance-margin rate
f_close Supplied estimated close/liquidation-fee rate
c m + f_close

All financial arithmetic uses a decimal library with 80 significant digits. Intermediate values are not rounded. Display formatting occurs only after the domain calculation and cannot be fed back into it.

Core formulas

The relationship solver uses:

  • N = Q × E
  • N = M × L
  • Q = N ÷ E
  • M = N ÷ L
  • L = N ÷ M

Gross PnL is:

grossPnL = s × Q × (X − E)

Estimated costs and returns are:

  • entryFee = Q × E × f_entry
  • exitFee = Q × X × f_exit
  • fundingCashFlow = −s × N × r_funding × k
  • netPnL = grossPnL − entryFee − exitFee + fundingCashFlow
  • ROE = netPnL ÷ M
  • accountImpact = netPnL ÷ accountEquity

Funding is estimated from entry exposure and the entered rate/count. Actual rates and calculation bases vary. A positive funding rate produces a negative cash flow for Long and a positive cash flow for Short in this sign convention.

Leverage Impact Atlas relationships

The examples page uses the same position solver and gross PnL equation. If u is the signed market move as a decimal fraction, its separate gross change relative to allocated margin is:

grossChangeOnMargin = grossPnL ÷ M = s × L × u

This is a gross position relationship before fees and funding. It is not the calculator’s estimated net ROE and it is not whole-account return.

When margin stays fixed, N = M × L, so exposure, quantity, and gross PnL magnitude scale with leverage. When exposure stays fixed, M = N ÷ L, so exposure, quantity, and gross PnL stay constant while required margin changes. The gross change relative to margin and simple boundary distance remain tied to the leverage row under either comparison.

Atlas cells compare the unrounded scenario price with the simple boundary and use three exact states: inside, at, or beyond. For Long, inside means scenario price is above the boundary; for Short, inside means it is below. Equality is its own state. At and beyond results are labeled theoretical because ordinary exit PnL may not be realizable under the simplified assumptions.

For desired signed gross change g expressed as a percentage, the reverse impact tool uses:

required market move % = s × desired gross change % ÷ L

A required move of −100% or less has no positive scenario price and therefore does not produce a usable calculator link. The optional account exposure multiple is N ÷ accountEquity; it is dimensionless but is not position leverage N ÷ M. Account equity is excluded from Atlas links and exports.

Long and Short worked examples

Use E=25,000, M=1,000, and L=5. Then N=5,000 and Q=0.2. Use f_entry=0.0004, f_exit=0.0006, r_funding=0.0001, k=3, and account equity 20,000.

For a Long exiting at 27,500, gross PnL is 500, entry fee is 2, exit fee is 3.3, funding cash flow is −1.5, and estimated net PnL is 493.2. ROE is 49.32%; estimated account impact is 2.466%.

For a Short exiting at 22,500, gross PnL is also 500, entry fee is 2, exit fee is 2.7, funding cash flow is 1.5, and estimated net PnL is 496.8. ROE is 49.68%; estimated account impact is 2.484%.

Fixed-notional and fixed-margin example

Consider a Long from 100 to 110, with entry and exit fee rates 0.001, funding rate 0.0005 for two intervals, and account equity 2,000.

When entry exposure stays at 1,000, gross PnL stays at 100 and estimated net PnL stays at 96.9 at 2x, 5x, and 10x. Required margin is respectively 500, 200, and 100, so ROE changes from 19.38% to 48.45% to 96.9%.

When margin stays at 100, exposure is 200, 500, and 1,000. Gross PnL is 20, 50, and 100, while estimated net PnL is 19.38, 48.45, and 96.9. This is why the comparison basis must be stated.

Boundary derivation and strict domain

Ignoring maintenance, fees, tiers, and funding, the simple margin-exhaustion boundary is:

  • Long: E × (1 − 1/L)
  • Short: E × (1 + 1/L)

The optional illustrative isolated-margin estimate is:

  • Long: E × (1 − 1/L) ÷ (1 − c)
  • Short: E × (1 + 1/L) ÷ (1 + c)

It is calculated only when:

0 ≤ c < 1/L

The inequality is strict. Equality means the simplified position is already at the assumed requirement at entry, so a numeric estimate would be misleading. The calculator keeps the simple boundary visible and reports the optional assumption as invalid.

The calculator labels the applicable value Estimated liquidation price. With zero maintenance and closing-fee settings, it is the simple boundary. With valid nonzero settings, it is the illustrative boundary; invalid opening settings leave a clearly labelled simple fallback. Stop comparison and distance use that applicable value. Neither boundary includes entry/exit fees or funding, and neither predicts an exchange’s actual liquidation trigger.

For a Long with E=199, L=10, and c=0.005, the simple boundary is 179.1 and the optional estimate is exactly 180. For a Short with E=201, the corresponding values are 221.1 and exactly 220.

If a Long scenario price is at or below the applicable boundary—or a Short scenario is at or above it—the result is marked beyond the modeled survival range. Ordinary exit PnL is still shown for arithmetic transparency but is not presented as a realizable liquidation prediction.

Reverse stop-to-boundary leverage constraint

For stop S and buffer rate b, the desired boundary is:

  • Long: B = S × (1 − b)
  • Short: B = S × (1 + b)

The leverage ceiling is:

  • Long: Lmax = 1 ÷ (1 − B × (1 − c) ÷ E)
  • Short: Lmax = 1 ÷ (B × (1 + c) ÷ E − 1)

The result means L ≤ Lmax, subject to the stricter opening domain. A zero or negative denominator is a nonbinding stop-derived constraint, not infinite or negative leverage. For Short, a denominator above 1 means the reciprocal is below 1x, so there is no solution for allowed leverage L ≥ 1.

Example: Long E=199, c=0.005, stop 160, and buffer 0.25 produce desired boundary 120, denominator 0.4, and ceiling 2.5x. The mirrored Short fixture uses E=201, stop 224, and the same assumptions, producing desired boundary 280 and the same 2.5x ceiling.

A Short with E=201, stop 360, and those assumptions has denominator 1.25. Its raw reciprocal 0.8 is not an allowed result; the calculator reports no solution for leverage at or above 1x.

Independent verification vectors

The expected values were independently derived before implementation. Tests hardcode them; production functions do not generate their own expected values.

Test Inputs Exact output
Solve exposure E=25000, M=1250, L=8 N=10000, Q=0.4
Solve margin E=3200, N=7200, L=4.5 M=1600, Q=2.25
Solve leverage E=62500, N=12500, M=500 L=25, Q=0.2
Long PnL sign E=100, Q=2, X=110 gross 20
Short PnL sign E=100, Q=2, X=110 gross −20
Zero move E=X=100, either direction gross 0
Invalid optional boundary L=10, c=0.1 equality rejected
Reverse Long E=199, S=160, b=0.25, c=0.005 Lmax=2.5
Reverse Short no solution E=201, S=360, b=0.25, c=0.005 no solution for L≥1

The repository specification contains the larger exact vector set, including cost signs, comparison ladders, stop/target outcomes, boundary equality, and inclusive warnings.

View the full leverage impact table to see the reviewed relationship across common leverage levels and market moves.

Validation status and change history

On 2026-09-01, the pre-code independent math review passed and the first local domain run passed 45 hardcoded unit tests. Final browser, accessibility, deployment, and CI status is not implied by that result and is recorded separately in release evidence.

Version history:

  • linear-isolated-v1 — initial three-mode solver, costs, comparison bases, scenario matrix, simple/optional boundaries, reverse constraint, and the post-launch Atlas gross-impact/reference layer.

Limitations

Outputs depend entirely on the values entered. They do not use live prices or venue data. The model excludes slippage, spread, taxes, interest on leveraged spot borrowing, changing funding bases, mark-price divergence, order execution, margin tiers, cross-position collateral, and exchange intervention.

Use the methodology to understand the arithmetic—not to substitute for a contract specification, account view, risk assessment, or professional advice.