Verified futures calculations
for deterministic workflows
Every formula is traceable. Every output is regression-tested. This page runs live on every request.
What is this?
Every calculator on TradingCalc runs against a set of canonical test vectors — exact input/output pairs derived step-by-step from the underlying formulas. This page executes all vectors in real time on each request (no cache) and reports the result.
The vectors cover all 12 calculators: PnL, Liquidation, Breakeven, Risk Sizer, Funding Cost, Average Entry, Target Exit, Scenario, Max Leverage, Hedge Ratio, Funding Arb, and Compound Funding.
The same vectors are also available to AI agents via the verify_calculators MCP tool at tradingcalc.io/api/mcp.
Formula assumptions
Test vectors
| # | Calculator | Test case | Status |
|---|---|---|---|
| 1 | pnl | BTC long +10%: gross=500, fees=3.75, pnl=496.25 | PASS |
| 2 | pnl | ETH short −10%: gross=300, fees=1.95, pnl=298.05 | PASS |
| 3 | pnl | Zero fees: pnl equals gross exactly | PASS |
| 4 | liquidation | BTC long 10x: liqPrice=45250 (Binance isolated-margin formula) | PASS |
| 5 | liquidation | BTC short 10x: liqPrice=54750 | PASS |
| 6 | breakeven | Long with standard exchange fees: breakeven≈100.0700 | PASS |
| 7 | breakeven | Zero fees: breakeven=entry, totalFees=0, distance=0 | PASS |
| 8 | risk_sizer | Long, 5% stop, $10 risk: stopDistPct=5, sizeBase≈1.9734 | PASS |
| 9 | funding_cost | Long, 0.01% per 8h, 7 days: totalCost=0.21, annualPct=10.95 | PASS |
| 10 | funding_cost | Short receives when rate is positive: totalCost=−0.03 | PASS |
| 11 | average_entry | Weighted average: (100×1+200×3)/4=175 | PASS |
| 12 | target_exit | Target pnl=0 → net pnl is zero (round-trip breakeven) | PASS |
| 13 | target_exit | Long target $10 PnL no fees: pnl≈10, exit above entry | PASS |
| 14 | scenario | Long +10% no fees: scenarios[0].pnl=10 | PASS |
| 15 | max_leverage | 10k acct, 10% max drawdown, 3% vol: maxLev=2.8x, safeMargin=3500 | PASS |
| 16 | max_leverage | Extreme volatility: leverage is always ≥1 (floored) | PASS |
| 17 | hedge_ratio | Full hedge 2x: perpNotional=10000, margin=5000, dailyCost=3 | PASS |
| 18 | hedge_ratio | 50% hedge 1x: perpNotional=5000, margin=5000 | PASS |
| 19 | funding_arb | 0.02% net rate 30d: gross=180, net=170, APY=21.9% | PASS |
| 20 | funding_arb | Hyperliquid 1h interval: 24 periods/day | PASS |
| 21 | compound_funding | 1000 USDT, 0.01%/8h, 1 day, 100% reinvest: finalCapital≈1000.3003 | PASS |
| 22 | compound_funding | reinvestPct=0: capital unchanged, totalEarned=0 | PASS |
| 23 | pre_trade_check | BTC long 10x, 5% SL, 1% risk, 0.01%/8h funding: size=0.04, liqDist=9.5%, safety=warn | PASS |
Error model
A required parameter is missing, out of range, or the wrong type.
Inputs are valid but the combination produces a mathematically undefined result (e.g. liquidation price below zero).
The requested exchange / margin type / side combination is not supported by the formula.
The caller has exceeded the call quota for their tier. Retry after the window resets.
The endpoint requires a valid API key. Anonymous quota exhausted.
Unexpected server-side error. The formula did not execute. Safe to retry.
Version history
- Changed: pre_trade_check output now includes summary_a/b/c — human-readable Russian decision strings
- summary_a: position size, breakeven price, funding cost per 24h
- summary_b: liquidation distance ratio with safety verdict (ok/warn/danger)
- summary_c: overnight breakeven shift over hold_hours
- Added: pre_trade_check — composite intent tool (orchestrates risk_sizer + breakeven + liquidation + funding_cost)
- Returns decision card: position size, breakeven, funding cost, liquidation safety, overnight breakeven shift
- Verification: 23 canonical test vectors (was 22)
- Added: max_leverage, hedge_ratio, funding_arb, compound_funding
- Changed: tool grouping into 3 canonical suites (Trade Planning / Risk & Margin / Funding & Carry)
- Verification: 22 canonical test vectors (was 12)
- Initial release: pnl, breakeven, target_exit, position_sizer, average_entry, scenario, liquidation, funding_cost
- Verification: 12 canonical test vectors