MARGINPAD
Home / API

MarginPad API

A free, public JSON API for the most common crypto futures calculations. No API key, no signup, CORS-enabled — call it from anywhere.

Base URL   https://marginpad.io/api
Method     GET
Auth       none
CORS       enabled (Access-Control-Allow-Origin: *)
Format     JSON

Liquidation price

GET /api/liquidation?entry=60000&leverage=10&side=long&mmr=0.5
entryrequired — entry price
leveragerequired — leverage multiple (>0)
sideoptional — long (default) or short
mmroptional — maintenance margin rate %, default 0.5
{
  "side": "long",
  "liquidationPrice": 54300,
  "distancePct": -9.5
}

Position size (by risk)

GET /api/position-size?balance=5000&risk=1&entry=60000&stop=58800&leverage=10
balancerequired — account balance
riskrequired — risk per trade %
entryrequired — entry price
stoprequired — stop-loss price
leverageoptional — for margin required
{ "positionSize": 0.041667, "notional": 2500, "riskAmount": 50, "marginRequired": 250 }

PnL / ROI / ROE

GET /api/pnl?entry=60000&exit=66000&size=0.5&leverage=10&side=long
{ "pnl": 3000, "roiPct": 10, "roePct": 100 }

Risk / reward

GET /api/risk-reward?entry=60000&stop=58000&tp=66000
{ "riskRewardRatio": 3, "riskPerUnit": 2000, "rewardPerUnit": 6000, "breakevenWinRatePct": 25 }

Take-profit target

GET /api/take-profit?entry=60000&leverage=10&roe=75&side=long
{ "targetExitPrice": 64500, "priceMovePct": 7.5 }

Notes

Calculations use the isolated-margin estimate and are for educational use, not financial advice. Figures exclude exchange fees and funding. The API is provided free and as-is. If you build something with it, a link back to marginpad.io is appreciated.

Prefer the visual tools?

The same calculations with a UI, in 12 languages — free, no signup.

Open MarginPad calculators →