Sequence/docs

Monitoring & TCA

The pre- and post-trade analysis surface. Pre-trade: depth, slippage curves, routing recommendations, execution forecasts. Post-trade: TCA (transaction cost analysis), execution review, nanosecond-precision lifecycle traces. Most endpoints return free-form JSON today — typed shapes land in v0.2; keep your parsing defensive (.get(..., default)).


Pre-trade: depth, slippage, routing, forecast

All four endpoints share the same cold-fallback chain as quote() and preview() — calling them on a cold ticker triggers a warming cycle so the response carries real data instead of empty arrays. No explicit quote() warm step needed.

rust
use sequence_sdk::Side;
 
let depth     = seq.depth("BTC-USD").await?;
let slippage  = seq.slippage("BTC-USD", Side::Buy).await?;
let routing   = seq.routing("BTC-USD", Side::Buy, 1.0).await?;
let forecast  = seq.forecast("BTC-USD", Side::Buy, 1.0).await?;
let intel     = seq.intel("BTC-USD").await?;
EndpointUse
depthL2 depth aggregated across every venue, book-side sorted
slippageSlippage curve at $1k / $10k / $100k / $1M notional. Same curve SOR uses internally
routingSOR's recommended leg-split for this exact order — same endpoint the kernel uses
forecastExpected slippage, expected horizon, expected venue mix. Cheaper than submitting a sandbox order
intelMarket structure snapshot: per-venue market-share, spread regime, toxicity score, quote-to-trade ratio

Post-trade: TCA

Notional-weighted Transaction Cost Analysis aggregates from durable order history.

rust
let all  = seq.tca().await?;                          // cross-desk aggregate
let one  = seq.tca_symbol("BTC-USD").await?;          // per-symbol

Returns implementation_shortfall_bps, spread_cost_bps, market_impact_bps, savings_vs_benchmark_bps, savings_usd, weighted percentiles (p50/p75/p95/p99), and a TCA-quality provenance breakdown.

Prediction-market TCA fields

Every per-order TCA entry on prediction-market fills carries four extra fields. Branch on is_prediction before interpreting slippage — spot metrics are in price-bps, prediction metrics are in probability-bps. The two are not comparable.

FieldMeaning
is_predictiontrue for binary-outcome fills (Kalshi/Polymarket)
arrival_implied_prob_bpsArrival mid as implied probability bps (0.30 → 3000)
achieved_implied_prob_bpsAchieved VWAP as implied probability bps
probability_slippage_bpsSide-adjusted shift from arrival to achieved. Positive = moved against you

Execution review

In-flight monitoring + post-trade review for a single order. Cheap to call repeatedly — the response is server-cached.

rust
let live    = seq.execution_live  ("graph:graph_…:n:1").await?;  // updates as fills land
let review  = seq.execution_review("graph:graph_…:n:1").await?;  // arrival, VWAP, venue split
let summary = seq.execution_summary().await?;                    // desk-wide KPIs

execution_review returns arrival price, VWAP, venue breakdown, realized slippage. execution_summary returns desk-wide KPIs: 24h notional, hit rate, avg slippage, top symbols.


Trace — nanosecond lifecycle

The reference tool for latency regressions. Returns every event from SOR admission → edge dispatch → venue ACK → first fill → terminal state, with nanosecond timestamps.

rust
let events = seq.trace("graph:graph_…:n:1").await?;
for e in events {
    println!("{:>20}ns {:18} {:?}", e.timestamp_ns, e.event_type, e.venue);
}

Returns Vec<TraceEvent { event_type: String, timestamp_ns: u64, venue: Option<String>, detail: Option<String> }>.

Common event_type values: admitted, routed, edge_submitted, venue_acked, first_fill, completed, plus terminal states.


A/B promotion report

Promotion-readiness report for routing-version experiments — the single rollout signal for V2/V3 promotion.

bash
curl -H "Authorization: Bearer $SEQ_API_KEY" \
  "https://api.sequencemkts.com/v1/analytics/ab_report?days=7"

Returns bucketed stats by (routing_version, symbol, side, notional_bucket), sample-sufficiency flags (n >= 30), bootstrap confidence intervals, and a promotion_ready decision flag. Treat promotion_ready as authoritative — it already incorporates sample floors and bootstrap significance checks.


Streaming the same data

Most of these surfaces are also available as live-pushed channels — see Streaming for subscribe protocol:

RESTWS channel
tca aggregatetca (one event per completed order, full cost decomp)
routing recommendrouting (every SOR decision)
trace per-ordertraces:{deployment_id} (algo callback traces only)

Next steps