Free calculators
Crypto trading profit, liquidation and staking calculator documentation
Inputs, formulas, assumptions and API/MCP examples for the crypto trading profit, liquidation and staking calculator. Reproduce a calculation and cite its sources.
Content updated . Assumptions reviewed .
Formula and assumptions
Linear profit = direction × quantity × (exit − entry) − entry fee − exit fee − funding. Liquidation solves equity = maintenance margin + closing fee.
- Prices and trade amounts are in USD; quantities and staking principal are coin units.
- Liquidation is an estimate for one isolated linear position with constant maintenance rate. It excludes exchange tiers, maintenance deductions, inverse contracts, cross collateral, slippage and mark-price differences.
- Stops may execute at a worse price; position sizing does not guarantee a maximum loss.
- Staking assumes constant rates, fractional compounding, no token-price change, and a fee on positive rewards only.
Assumptions reviewed:
Sources
- KlarFort calculation methodology. Free to use with the credit line; vintage 1.
Parameters
| Name | Description | Type | Default | Minimum | Maximum |
|---|---|---|---|---|---|
| symbol | A supported symbol; arithmetic uses the price you enter. | string | "BTC" | ||
| mode | Mode | string | "profit-loss" | ||
| side | Position direction | string | "long" | ||
| entryPrice | Entry price in USD | number | 50000 | 0.000000001 | 1,000,000,000 |
| exitPrice | Exit price in USD | number | 55000 | 0 | 1,000,000,000 |
| quantity | Coin quantity | number | 1 | 0 | 1,000,000,000,000 |
| entryFeePercent | Entry fee (%) | number | 0.1 | 0 | 10 |
| exitFeePercent | Exit or liquidation closing fee (%) | number | 0.1 | 0 | 10 |
| fundingCost | Positive is a payment; negative is a funding credit. | number | 0 | -1,000,000,000 | 1,000,000,000 |
| margin | Isolated margin in USD | number | 1000 | 0 | 1,000,000,000,000 |
| leverage | Leverage multiple | number | 10 | 1 | 100 |
| maintenanceMarginPercent | Maintenance margin (%) | number | 0.5 | 0 | 50 |
| accountEquity | Account equity in USD | number | 10000 | 0 | 1,000,000,000,000 |
| riskPercent | Risk budget (%) | number | 1 | 0.001 | 100 |
| stopPrice | Stop price in USD | number | 45000 | 0.000000001 | 1,000,000,000 |
| principal | Coins staked | number | 100 | 0 | 1,000,000,000,000 |
| annualRate | Annual rate (%) | number | 5 | -99 | 1,000 |
| rateKind | Annual rate type | string | "apr" | ||
| compoundingPeriods | Compounds per year | integer | 12 | 1 | 365 |
| months | Staking duration in months | integer | 12 | 1 | 600 |
| stakingFeePercent | Fee on positive staking rewards (%) | number | 0 | 0 | 100 |
JSON API
GET accepts one input parameter containing URL-encoded JSON. POST sends the JSON input object. Prefer POST for personal figures. Inputs are limited to 16 KiB. POST results are not stored; GET results may be cached for up to 24 hours.
curl -X POST https://klarfort.com/tools/api/v1/crypto-trading-calculator -H "Content-Type: application/json" --data '{"symbol":"BTC","mode":"profit-loss","side":"long","entryPrice":50000,"exitPrice":55000,"quantity":1,"entryFeePercent":0.1,"exitFeePercent":0.1,"fundingCost":0,"margin":1000,"leverage":10,"maintenanceMarginPercent":0.5,"accountEquity":10000,"riskPercent":1,"stopPrice":45000,"principal":100,"annualRate":5,"rateKind":"apr","compoundingPeriods":12,"months":12,"stakingFeePercent":0}'fetch("https://klarfort.com/tools/api/v1/crypto-trading-calculator", {method:"POST", headers:{"Content-Type":"application/json"}, body:JSON.stringify({"symbol":"BTC","mode":"profit-loss","side":"long","entryPrice":50000,"exitPrice":55000,"quantity":1,"entryFeePercent":0.1,"exitFeePercent":0.1,"fundingCost":0,"margin":1000,"leverage":10,"maintenanceMarginPercent":0.5,"accountEquity":10000,"riskPercent":1,"stopPrice":45000,"principal":100,"annualRate":5,"rateKind":"apr","compoundingPeriods":12,"months":12,"stakingFeePercent":0})})import json, urllib.request
request = urllib.request.Request("https://klarfort.com/tools/api/v1/crypto-trading-calculator", data=json.dumps({"symbol":"BTC","mode":"profit-loss","side":"long","entryPrice":50000,"exitPrice":55000,"quantity":1,"entryFeePercent":0.1,"exitFeePercent":0.1,"fundingCost":0,"margin":1000,"leverage":10,"maintenanceMarginPercent":0.5,"accountEquity":10000,"riskPercent":1,"stopPrice":45000,"principal":100,"annualRate":5,"rateKind":"apr","compoundingPeriods":12,"months":12,"stakingFeePercent":0}).encode(), headers={"Content-Type":"application/json"})
print(urllib.request.urlopen(request).read().decode())Connected assistants
Connect using https://klarfort.com/tools/mcp. Discover this calculator with tools/list, then call crypto-trading-calculator. Protocol versions 2026-07-28 and 2025-11-25 are supported. Modern requests carry protocol metadata and matching HTTP headers. Set Mcp-Name to params.name for tools/call and to params.uri for resources/read. Older clients initialize first.
Limits: 120 requests per minute per address and approximately 3,000 per minute per edge location. Simulations are capped at 1,000 paths, 600 months and 150,000 path-months (paths multiplied by months). Shorten the duration or reduce paths when that work limit is exceeded. A limit response returns 429 and Retry-After. No exact remaining-request count is available.
Usage and credit
Free for personal, commercial and any other lawful use with credit to KlarFort at https://klarfort.com/. Third-party data terms still apply.
Place a visible credit near the reused material or in the credits for your work or integration. One clear credit per work or integration is sufficient; no separate credit per API request is required. Links to individual calculators are optional.
Computed with KlarFort Calculators, https://klarfort.com/
The API returns this text in credit and the homepage in credit_url. The optional citation_url identifies the calculator for reference. See usage and credit for the full permission.
KlarFort is not financial, investment, tax, or legal advice. Verify outputs before making material decisions.