Open the app
Quantitative core

Deterministic scripts

The processing chain from raw data to journal, the ten script categories, the risk-validation pipeline with machine-readable rejection codes, and the AI boundaries.

The quantitative core is a chain of deterministic scripts, not one model. Each is pure where possible, versioned, replayable and unit-tested — and the AI sits above them, never inside the path that computes a number or approves a trade.

The processing chain

Every layer has one responsibility. A strategy never calls an exchange; an indicator never decides to trade; the executor never edits strategy logic; the AI never bypasses the risk engine.

  1. Raw market dataCollected from venues via CCXT and on-chain
  2. Validation → normalized dataGaps, duplicates, impossible prices rejected
  3. IndicatorsPure functions from the mathematical library
  4. Strategy conditions → signal candidateVersioned strategy logic only
  5. Liquidity & risk validationSlippage, sizing, exposure, circuit breakers
  6. Execution intent → orderExchange precision, idempotency, reconciliation
  7. Position monitoring → exitStops, targets, invalidation
  8. Trade journal → performanceEvery signal and trade, with versions

The ten script categories

CategoryResponsibility
Data collectionConnect to venues, collect OHLCV / trades / books / fees / limits, normalize timestamps
Data validationDuplicates, impossible prices, gaps, stale books, data-quality scores
IndicatorsPure, typed functions with declared minimum history and unit tests
SignalCombine indicators into a candidate with reasons — never places an order
RiskPlanned loss, position size, limits, stop & liquidity validation, breakers
ExecutionTranslate intents to venue orders, retries, idempotency, reconciliation
Position monitoringExposure, stops/targets, trailing, emergency exit
BacktestingReplay without look-ahead, simulate fills/fees/slippage/latency, metrics
ResearchParameter grids, walk-forward, sensitivity, overfitting detection, reports
JournalRecord every signal/trade/rejection with strategy and formula versions

Data validation invariants

Normalized candles must satisfy, in code:

  • Low ≤ Open ≤ High and Low ≤ Close ≤ High;
  • High ≥ Low and Volume ≥ 0;
  • no duplicate, out-of-order or impossible-price candles;
  • order books that are not stale relative to the venue clock.

The risk-validation pipeline

A signal candidate becomes an approved execution intent only after every gate passes:

  1. Validate strategy & data freshnessState, market-data age, venue status
  2. Validate market rules & liquidityTradable, depth, expected slippage
  3. Stop distance → position sizeRisk-first, bounded by every limit
  4. Validate balance & exposureAvailable quote, portfolio heat
  5. Validate daily/weekly risk & breakersLimits and circuit-breaker state
  6. Approved intent or rejectionWith machine-readable codes

Rejections are machine-readable, so the rejected-signal journal can be analyzed later:

CodeCode
STALE_MARKET_DATASPREAD_TOO_WIDE
SLIPPAGE_TOO_HIGHINSUFFICIENT_BALANCE
MAX_DAILY_LOSS_REACHEDMAX_PORTFOLIO_HEAT_REACHED
POSITION_TOO_SMALLPOSITION_TOO_LARGE
VENUE_RESTRICTEDMARKET_NOT_TRADABLE
STOP_INVALIDDATA_QUALITY_TOO_LOW
CIRCUIT_BREAKER_ACTIVE

Versioning & determinism

Every important formula set carries a version (position_sizing_v1, atr_stop_v2, slippage_model_v2, …). Historical definitions are never overwritten in place, so a trade stays reproducible after formulas change. The engine is deterministic, versioned, observable and conservative when data is incomplete.

What the AI may never do
The AI can summarize results, compare variants, explain rejections and propose experiments. It cannot compute the authoritative balance, choose an unbounded size, disable risk checks, alter completed trade history, mark an unknown order canceled without reconciliation, override a circuit breaker, or promote a strategy to live without the approval workflow.