Deterministic futures risk & funding
for AI agents
TradingCalc is the computation layer your agent calls for exact futures math — not AI, not estimates. Same inputs always produce the same outputs. Every formula is traceable to exchange documentation and regression-tested.
https://tradingcalc.io/api/mcp
Why deterministic matters
We are not AI. We are the computation layer that AI calls.
19 MCP tools across 4 suites
workflow.run_pnl_planningNet PnL, ROE, fees and gross P&L for a futures tradeworkflow.run_breakeven_planningBreak-even price accounting for entry and exit feesworkflow.run_exit_targetExit price required to hit a target PnL or ROEworkflow.run_position_sizingPosition size from account balance and max risk %primitive.average_entryAverage entry price after DCA into a positionworkflow.run_scenario_planningMulti-scenario P&L table across price targetsworkflow.run_dca_entryWeighted average entry, breakeven, and per-level contribution from multiple fillsworkflow.run_scale_outP&L, ROI, and cumulative P&L for each partial exit levelworkflow.run_liquidation_safetyLiquidation price for long/short with cross or isolated marginworkflow.run_max_leverageMaximum safe leverage given account size and volatilityprimitive.hedge_ratioShort perp size to fully hedge a spot position, including funding costworkflow.run_risk_rewardFull R:R analysis: position size, liquidation, breakeven, P&L at stop and target. Returns verdict.workflow.run_funding_costCumulative funding cost over a holding periodworkflow.run_funding_arbitrageAnnualized funding arbitrage yield between two exchangesworkflow.run_compound_fundingCompound funding cost with position size decayworkflow.run_carry_tradeDelta-neutral carry: net yield, gross/net profit, breakeven days. Returns verdict.workflow.run_funding_breakevenPrice move needed to cover funding cost + fees over a holding periodworkflow.run_pre_trade_checkFull pre-trade risk analysis: position size, liquidation price, breakeven, funding cost, and safety classification in one callBuilt for
Example agent workflows
- 1.Call `workflow.run_risk_reward` → R:R ratio, position size, liquidation, P&L at stop and target, verdict
- 2.Call `workflow.run_funding_cost` → cumulative funding cost over hold period
- 3.Call `workflow.run_pre_trade_check` → full decision: sizing + liquidation + breakeven + funding in one call
- 1.Call `workflow.run_dca_entry` with fill levels → avg entry, breakeven, per-level contribution
- 2.Call `workflow.run_liquidation_safety` → liquidation distance from averaged entry
- 3.Call `workflow.run_scale_out` with exit levels → P&L per exit, weighted avg exit, overall ROI
- 1.Call `workflow.run_carry_trade` → net yield, gross/net profit, breakeven days, verdict
- 2.Call `workflow.run_funding_breakeven` → price move needed to cover funding + fees
- 3.Call `workflow.run_funding_arbitrage` → annualized arb yield between two exchanges
- 1.Call `workflow.run_scenario_planning` with price targets → full P&L table
- 2.Call `workflow.run_exit_target` → exact price to hit target ROE
- 3.Call `primitive.hedge_ratio` → perp short size to hedge the position
Examples — request & response
workflow.run_pnl_planningcurl -X POST https://tradingcalc.io/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1,
"method": "tools/call",
"params": {
"name": "workflow.run_pnl_planning",
"arguments": {
"side": "long",
"entryPrice": 83000,
"exitPrice": 85000,
"size": 0.1,
"feeOpenPct": 0.0002,
"feeClosePct": 0.0005
}
}
}'{
"pnl": 194.09,
"pnlPct": 0.02339,
"fees": 5.91,
"gross": 200.00
}workflow.run_position_sizingcurl -X POST https://tradingcalc.io/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1,
"method": "tools/call",
"params": {
"name": "workflow.run_position_sizing",
"arguments": {
"side": "long",
"entryPrice": 83000,
"stopLoss": 81000,
"riskUsdt": 100,
"leverage": 5
}
}
}'{
"sizeBase": 0.04861,
"sizeQuote": 4034.56,
"margin": 806.91,
"stopDistPct": 2.41
}workflow.run_pre_trade_checkcurl -X POST https://tradingcalc.io/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0", "id": 1,
"method": "tools/call",
"params": {
"name": "workflow.run_pre_trade_check",
"arguments": {
"side": "long",
"entry_price": 83000,
"stop_loss": 81000,
"account_balance": 5000,
"risk_pct": 2,
"leverage": 5,
"funding_rate": 0.0001,
"hold_hours": 24
}
}
}'{
"safety": "ok",
"recommended_size": 0.04861,
"notional": 4034.56,
"margin_required": 806.91,
"liquidation_price": 66895.00,
"liquidation_distance_pct": 19.40,
"breakeven_price": 83023.51,
"funding_cost_24h": 1.21,
"summary_a": "Notional 4034.56 USDT · margin 806.91 USDT",
"summary_b": "Liquidation 19.4% away, stop 2.4%",
"summary_c": "Over 24h breakeven rises: 83023.51 → 83123.51 USDT"
}Self-verification
Agents can call system.verify before using results. Returns pass/fail for all 22 canonical test vectors. Every formula is traceable to exchange documentation — this is not a claim, it is a verifiable proof.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": { "name": "system.verify", "arguments": {} }
}
// Response
{
"status": "pass",
"passed": 22,
"failed": 0,
"total": 22,
"timestamp": "2026-03-30T..."
}Access methods
// Claude Desktop — ~/.claude/claude_desktop_config.json
{
"mcpServers": {
"tradingcalc": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://tradingcalc.io/api/mcp"]
}
}
}
// Cursor / VS Code
{
"tradingcalc": {
"url": "https://tradingcalc.io/api/mcp"
}
}curl -X POST https://tradingcalc.io/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "liquidation",
"arguments": {
"side": "long",
"entryPrice": 95000,
"leverage": 10,
"marginType": "isolated"
}
}
}'curl -X POST https://tradingcalc.io/api/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", ... }'
// MCP config with key
{
"mcpServers": {
"tradingcalc": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://tradingcalc.io/api/mcp",
"--header", "Authorization: Bearer YOUR_API_KEY"]
}
}
}Get a key at /request-access — free tier available, no signup required for anonymous use.
TypeScript SDK
Thin typed wrapper — same endpoint, zero dependencies.
npm install tradingcalc-sdkimport { TradingCalcClient } from 'tradingcalc-sdk';
const tc = new TradingCalcClient({ apiKey: 'tc_your_key' });
const check = await tc.workflows.preTradeCheck({
side: 'long', entry_price: 83000, stop_loss: 81000,
account_balance: 5000, risk_pct: 2, leverage: 5,
funding_rate: 0.0001, hold_hours: 24,
});
// { safety: 'ok', liquidation_price: 66895, summary_b: 'Liquidation 19.4% away', ... }
// Primitives — single formula, no opinion
const avg = await tc.primitives.averageEntry({ symbol: 'BTCUSDT', input: { fills: [{ price: 83000, quantity: 0.1 }, { price: 80000, quantity: 0.2 }] } });
// { avgEntry: 81000, totalQty: 0.3, totalCost: 24300, ... }Pricing
Credits-based. Priced by workflow class.Primitive call = 1 credit · Standard workflow = 5 cr · Integrated decision = 10 cr
Builder plan — free for 1 month
Building a trading bot, agent workflow, dashboard, or risk tool with TradingCalc? Get full Builder access (5,000 credits/mo) free for 30 days. No credit card. No commitment. Tell us what you're building.
Frequently asked questions
No signup required. Add to Claude Desktop or Cursor using the config above, or call the endpoint directly.