Product concept · 6 workflows · Exact math

Deterministic workflows

A deterministic workflow answers a specific trader question by orchestrating several calculation primitives and applying a classification layer on top. The answer is always the same for the same inputs — no model variation, no hallucination, no rounding drift.

Calculator vs workflow

Calculators are primitives — they compute one number. Workflows are decision tools — they chain primitives and tell you what to do with the result.

Calculator

Returns a number. You interpret it. "Liquidation price: $76,925." What does that mean for this setup? Up to you.

Workflow

Returns a verdict + explanation. "WARN: liquidation is 9.5% away — closer than your stop. Consider reducing leverage." The decision layer is built in.

Taxonomy: three layers of abstraction

TradingCalc organises its tools into three levels. Each level builds on the one below.

PrimitiveSingle formula, one output

PnL, Liquidation price, Breakeven, Position size, Funding cost

AnalyzerPrimitive with safety classification

Max safe leverage, Scenario PnL table, Compound funding decay

WorkflowOrchestrates multiple primitives → verdict

Pre-trade check, Risk/reward, Carry trade, DCA entry, Scale-out, Funding breakeven

How a workflow is built

Each workflow is a pure TypeScript function in src/lib/workflows/ that calls one or more calculator modules, aggregates the outputs, and applies a classification rule. The UI layer renders the verdict — it never touches the math.

// src/lib/workflows/pre_trade_check.ts export function compute(input: PreTradeInput): PreTradeOutput { const size = position_size(input); // Primitive 1 const liq = liquidation_price(input); // Primitive 2 const funding = funding_cost(input); // Primitive 3 const be = breakeven_price(input); // Primitive 4 const verdict = classify(liq, size, funding); // Decision layer return { size, liq, funding, be, verdict, verdict_summary: explain(verdict, input) }; } // Same inputs → same verdict, every time

All 6 workflows

Runs four primitives in one pass. Surfaces the liquidation distance, carry cost, and required margin before you commit capital.

Primitives:Position sizeLiquidation priceFunding costBreakeven
Verdict: CLEAR / WARN / HIGH RISK / ERROR

Computes expected reward vs defined risk. Verdict is based on the R:R ratio and a configurable minimum threshold.

Primitives:PnL at targetPnL at stopR:R ratio
Verdict: Take it / Worth the risk / Think twice / Skip this one

Sizes the delta-neutral hedge and computes the net funding yield after hedging costs — shows if the carry is actually profitable.

Primitives:Funding costHedge ratioNet yield
Verdict: Positive carry / Negative carry / Break-even point

Distributes position size across price levels. Shows the blended average entry and checks liquidation safety at full deployment.

Primitives:Average entryPosition size per levelLiquidation at full size
Verdict: Entry plan with per-level sizing and blended average

Plans partial exits at multiple targets. Shows the PnL at each level, the reduced risk after each close, and the running breakeven.

Primitives:PnL per exit levelRemaining sizeBreakeven after partial close
Verdict: Exit plan with per-level PnL and remaining risk

Given an unrealized profit and a funding rate, computes how long you can hold before carry cost neutralises the gain.

Primitives:Funding cost accumulationPnL at targetHold time to breakeven
Verdict: Hours / days until carry cost equals unrealized PnL

Why determinism matters specifically for workflows

A probabilistic workflow (e.g. an LLM asked “should I open this trade?”) will give a different answer each time, even for identical inputs. For a one-off analysis that may be fine. For a risk monitor that fires alerts, a backtester replaying 10,000 trades, or an AI agent making sequential decisions — it is not.

Deterministic workflows are also composable: the output of “Is this trade worth taking?” can feed directly into “How should I size the position?” — and the combined result is still auditable end-to-end.

Use workflows via API

Every workflow is callable through the REST API and the MCP layer. The same function that powers the UI is the one your agent or bot calls.

POST /api/v1/workflows/pre-trade-check { "side": "long", "entry_price": 85000, "leverage": 10, "account_balance": 10000, "risk_pct": 1, "stop_loss": 83000, "funding_rate": 0.0001, "hold_hours": 24 } → { "verdict": "safe", "verdict_summary": "...", "recommended_size": 0.059, ... }

Start with a workflow

Open the pre-trade check, enter your setup, and get a verdict in under 10 seconds. No account needed.