Language guide, engine API, 675 builtins and the preset library · v3.0.0-phase1
Enterprise microstructure indicators
The thirty analyses in presets/analysis/hft/enterprise/ separate displayed liquidity, observed order flow, calibrated transition estimates and execution diagnostics. They run in the native C++ engine and publish numeric series, bounded status tables and chart visuals. Missing observations produce na and an availability message; they are never reconstructed from candle direction or volume. The library is analytical infrastructure; calibration and execution quality must be evaluated on the deployment's own feeds and latency.
Event sessions
The normal terminal book path supplies one snapshot per chart bar. Its snapshots support depth geometry, displayed sweep costs and concentration. Temporal indicators require a separate immutable event session: one observation per sequenced source event, containing the reconstructed book after that event. Equal exchange timestamps remain separate rows.
Send subsequent complete batches with op = "append_events", the same session, and a bars object in the same column format. JSON arrays and base64 Float64 columns are supported. The authenticated /api/quascript/session route exposes both operations and scopes sessions to the caller. quas serve provides the same protocol directly. Asset tick_size must match the instrument; quantities, fee units and any cross-venue conversion must also match.
Transport rules:
event.sequence is a nonnegative safe integer, increasing strictly between resets. Use a session-local lossless sequence mapping if exchange IDs exceed Float64's integer range.
time and event.time are identical, nondecreasing epoch seconds, with fractional seconds preserved. event.receive_time is finite epoch seconds on a synchronized clock.
The first row requires event.reset = 1 and a two-sided reconstructed book. A reset may restart the sequence number; it cannot move the observation clock backward.
The engine derives event.valid. A sequence discontinuity or explicit event.gap = 1 latches the feed invalid until a new full snapshot with event.reset = 1. Temporal state resets across that boundary. A dropped event must never be concealed by renumbering it.
Event history is immutable: append and update_last are rejected for event sessions. Bar-based feeds and backtest strategies are rejected in event mode.
A batch is validated before changing the session. Default capacity is 250,000 observations; maxObservations accepts 1..2,000,000. At capacity the engine rejects additional rows. Hosts must manage bounded replay windows explicitly; reopening a window restarts calibration.
The event host schema is fixed at open, with at most 128 columns. Declare optional channels as null-filled columns initially; introducing columns later is rejected to avoid historical padding on a live update. Every event batch must contain at least one observation.
maxInputBytes caps retained input payload storage (default 128 MiB, range 64 KiB..512 MiB). Admission includes books and the fixed host schema. Allocator overhead and retained output series are additional; the observation cap bounds output history independently.
Host observation contract
All columns live in bars.host, aligned one-for-one with the observation rows. Missing columns remain absent, not zero. Columns representing event increments must explicitly contain zero on events where that activity did not occur.
Executable remote touch quotes and quantities, already converted into the local instrument's units
venue.age_ms, venue.fee_bps
Remote quote age in milliseconds and one-way fee in basis points
model.drift_ticks
Host-calibrated expected signed mid displacement at the host model's documented horizon, in instrument ticks
Own-order fill and queue statistics require identity continuity. MBO snapshots by themselves do not establish own queue priority: the adapter must apply venue matching rules, priority changes and own acknowledgements. An order change censors incomplete order episodes rather than assigning another order's fills to the previous observation. Snapshot depth changes do not identify additions, cancellations or executions.
Completed range boundaries and covering visible depth
Participation Surprise
hft.participation
Explicit trades, typed events and clock
Order Lifecycle Flux
hft.lifecycle
Explicit typed lifecycle events
Cross-Venue Executable Dislocation
hft.cross_venue
Comparable fresh remote quotes, size and fees
Feed Integrity and Signal Validity
hft.validity
Book and transport metadata
hft.microprice is a causal next-event conditional mid forecast, not the full infinite-horizon Markov-limit estimator. Its error band describes calibration dispersion/standard error, not a guaranteed price interval. Exhaustion probabilities describe next-event bid-down / ask-up transitions, a quote-depletion proxy. Calibration outputs stay na until sufficient labels have matured. len controls a bounded effective EW learning window, not a fixed rolling sample.
Markout horizons and latency delays are measured in immutable event observations, not milliseconds. An event-delay curve must not be presented as a measured deployment latency curve; compare it with separately measured wall-clock transport and execution times. Favorable markouts are signed positively; adverse-selection cost has the opposite sign. Descriptive stress, fragility and absorption scores are not calibrated probabilities.
Sweep costs include distance from the mid. The sweep returns na cost when the visible book cannot fill the entire requested quantity, together with the available fill fraction. Execution edge deducts that crossing cost and one-way fees from the supplied forecast, so spread is not deducted twice. Snapshot costs describe displayed liquidity at that observation.
Performance and verification
See the measured performance report for the reference environment, individual latency percentiles, observed tails and measurement limits.
Event sessions append only changed observations and return only the resulting output tail. Their normal path does not copy forming-bar checkpoints. Calibration uses bounded state, bounded event-horizon rings and visible-depth scans, with no historical-series scan per update. Retained input/output history is bounded by the session capacity. Rendering runs separately from calculation; plot backend selection is a chart concern, not a signal-processing delay.
The tests use explicitly synthetic host observations to check independent book arithmetic, causal prefixes, missing-data behavior, sequence-gap/reset handling and JSON/base64 incremental equivalence for every preset. The benchmark reports worker execution and transport separately, including percentile latency. These checks do not establish predictive profitability or a zero-latency guarantee. Record the compiler, hardware, dataset, book depth and event batch size when comparing results.