What is a deterministic computation layer?
A deterministic computation layer is a set of pure functions that maps inputs to outputs with zero variance. Same inputs today, tomorrow, and in six months always produce the same number — enforced by tests, not by convention.
In the context of crypto trading infrastructure, it means: liquidation prices, position sizes, funding costs, and breakeven prices that are exact, auditable, and callable by both humans and machines.
Four properties that define it
Call the same function with the same inputs 1,000 times — you get the same number back each time. No state, no side effects, no timestamp influence.
Every output can be reconstructed by hand from the formula. If the math is wrong, it is wrong predictably — not randomly.
An independent party can run the same inputs against the same formula and confirm the result. No black box.
Deterministic functions can be chained: the output of liquidation_price becomes the input of margin_required, which feeds position_size. Each step is auditable.
How it compares to alternatives
"Your liquidation is somewhere around $82,000"Varies between calls. Cannot be audited. Not suitable for risk decisions.
=B2*(1-1/C2+D2)Deterministic but not callable by machines. No schema, no versioning, no API.
liquidation_price({ entry: 85000, leverage: 10, side: "long", mmr: 0.005 }) → 76,925.00Why trading infrastructure specifically needs this
Trading decisions are binary: open or don't open, exit or hold. A number that is “approximately right” is not useful when the margin call threshold is exact. Determinism is not a preference in risk infrastructure — it is a requirement.
An LLM calling a deterministic layer gets an exact number it can reason about — not a probabilistic guess. system.verify lets the agent confirm correctness before a trading session.
Liquidation alerts and margin calls require exact thresholds. A ±0.5% error on liquidation price could mean the alert fires a candle too late.
Replaying historical trades requires the same formula every time, not one that changes with model versions or temperature settings.
Smart contracts cannot call an LLM. They can call a deterministic function whose output is signed and verifiable on-chain.
How TradingCalc implements it
Every calculator is a pure TypeScript function in src/lib/calculators/. No database reads, no network calls, no random seeds. Each function is covered by canonical test vectors with hand-verified arithmetic.
The same function runs in CI tests, in the REST API, in the MCP layer, and on the public verification page. Three independent surfaces — one formula.
Deterministic workflows: composition over configuration
A workflow is a deterministic pipeline: it chains several computation primitives, adds a decision layer on top, and returns a verdict. The “Should I open this trade?” workflow, for example, calls position sizing → liquidation price → funding cost, then classifies the result as CLEAR / WARN / HIGH RISK.
Use the computation layer directly
19 MCP tools. REST API. Free tier, no signup required. Every call returns an exact, auditable number — same formula as the live calculators.