MarginPad Calculators API

Liquidation price, position size, PnL, risk/reward, take-profit

GitHub OpenAPI

Operations 5

GET /api/v1/calc/liquidation Liquidation price #
GET /api/v1/calc/position-size Position size #
GET /api/v1/calc/pnl PnL / ROI #
GET /api/v1/calc/risk-reward Risk / reward #
GET /api/v1/calc/take-profit Take-profit price #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/marginpad-io:marginpad-io-calculators-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

marginpad-io-calculators-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: MarginPad Free Crypto Calculators API
  version: 2.9.1
  description: Free, keyless, CORS-enabled crypto market-data API. Live prices, OHLC candles, a scored futures screener, funding rates, open interest, long/short ratios, liquidations, an economic calendar, the Fear & Greed index, top coins, global market stats, DeFi TVL, trading calculators, and a free paper-trading REST API for testing bots. No API key. No sign-up. about 60 requests/minute per client. Every response uses the envelope { ok, data, error, ts }, except the four liquidation-collector passthroughs (feed, liquidations/live, liquidations/recent, clusters), which return the raw collector object and are marked as such.
  contact:
    name: MarginPad
    url: https://marginpad.io/free-crypto-api/
  license:
    name: Free for public use
servers:
- url: https://marginpad.io
  description: Production
tags:
- name: Calculators
  description: Liquidation price, position size, PnL, risk/reward, take-profit
paths:
  /api/v1/calc/liquidation:
    get:
      tags:
      - Calculators
      summary: Liquidation price
      description: Compute the liquidation price for a leveraged position.
      parameters:
      - name: entry
        in: query
        required: true
        description: Entry price.
        schema:
          type: string
        example: '60000'
      - name: leverage
        in: query
        required: true
        description: Leverage, e.g. 10.
        schema:
          type: string
        example: '10'
      - name: side
        in: query
        required: false
        description: long or short.
        schema:
          type: string
        example: long
      - name: mmr
        in: query
        required: false
        description: Maintenance margin rate in percent (default 0.5).
        schema:
          type: string
        example: '0.5'
      responses:
        '200':
          description: ok
      operationId: getApiV1CalcLiquidation
      x-operation-id-source: derived
  /api/v1/calc/position-size:
    get:
      tags:
      - Calculators
      summary: Position size
      description: Risk-based position size from account balance, risk %, entry and stop.
      parameters:
      - name: balance
        in: query
        required: true
        description: Account balance.
        schema:
          type: string
        example: '10000'
      - name: risk
        in: query
        required: true
        description: Risk percent of balance, e.g. 1.
        schema:
          type: string
        example: '1'
      - name: entry
        in: query
        required: true
        description: Entry price.
        schema:
          type: string
        example: '60000'
      - name: stop
        in: query
        required: true
        description: Stop-loss price.
        schema:
          type: string
        example: '58000'
      - name: leverage
        in: query
        required: false
        description: Optional leverage for margin required.
        schema:
          type: string
        example: '10'
      responses:
        '200':
          description: ok
      operationId: getApiV1CalcPositionSize
      x-operation-id-source: derived
  /api/v1/calc/pnl:
    get:
      tags:
      - Calculators
      summary: PnL / ROI
      description: Profit/loss and ROI for a position. Size is the position size in units of the asset, not in dollars.
      parameters:
      - name: entry
        in: query
        required: true
        description: Entry price.
        schema:
          type: string
        example: '60000'
      - name: exit
        in: query
        required: true
        description: Exit price.
        schema:
          type: string
        example: '63000'
      - name: size
        in: query
        required: true
        description: Position size, in units of the asset.
        schema:
          type: string
        example: '0.5'
      - name: leverage
        in: query
        required: false
        description: Leverage multiple.
        schema:
          type: string
        example: '10'
      - name: side
        in: query
        required: false
        description: long or short.
        schema:
          type: string
        example: long
      responses:
        '200':
          description: ok
      operationId: getApiV1CalcPnl
      x-operation-id-source: derived
  /api/v1/calc/risk-reward:
    get:
      tags:
      - Calculators
      summary: Risk / reward
      description: Risk-reward ratio from entry, stop and target. Entry and stop must differ.
      parameters:
      - name: entry
        in: query
        required: true
        description: Entry price.
        schema:
          type: string
        example: '60000'
      - name: stop
        in: query
        required: true
        description: Stop-loss price.
        schema:
          type: string
        example: '58000'
      - name: tp
        in: query
        required: true
        description: Take-profit price.
        schema:
          type: string
        example: '65000'
      responses:
        '200':
          description: ok
      operationId: getApiV1CalcRiskReward
      x-operation-id-source: derived
  /api/v1/calc/take-profit:
    get:
      tags:
      - Calculators
      summary: Take-profit price
      description: The price at which a position reaches a target return on equity.
      parameters:
      - name: entry
        in: query
        required: true
        description: Entry price, above zero.
        schema:
          type: string
        example: '60000'
      - name: roe
        in: query
        required: true
        description: Target return on equity, in percent.
        schema:
          type: string
        example: '50'
      - name: leverage
        in: query
        required: false
        description: Leverage multiple.
        schema:
          type: string
        example: '10'
      - name: side
        in: query
        required: false
        description: long or short.
        schema:
          type: string
        example: long
      responses:
        '200':
          description: ok
      operationId: getApiV1CalcTakeProfit
      x-operation-id-source: derived
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Required for paper-trading endpoints; OPTIONAL on /api/v1/* data endpoints, where sending it moves the call from the 60/minute per-IP limit to the key’s own budget (120/minute on Free, 600 on API Pro, 2000 on Max, 5000 on Business). Mint a key at POST /api/bot/key while signed in, or on https://marginpad.io/trading-api/.
externalDocs:
  description: Full manual with curl / JS / Python examples
  url: https://marginpad.io/free-crypto-api/