Hedronite · Synthesis Lesson · Adversarial-Markets + DevOps · Fri 2026-06-26

Cross-Asset Pair Signals for Adversarial Markets

Statistical arbitrage from supply-chain position, the cointegration test discipline, and the input/output long-short structure.

Lesson Class: Ops (Adversarial-Markets + DevOps)
Pair: γ Adversarial-Markets (Crypto + Quant) · W2/C2
Word Count: ~2,520
Paired Dev: Rust Iterator Adapters and flat_map for Cross-Asset Pair Signal Computation
Paired Cert: Terraform as the Audit-First Governance Foundation (Week 6)
Grounding: Aldridge HFT Ch 8 pp 211–213 · Halls-Moore QuantStart Ch I p 12
Discipline: ROD v3 (universal-application)

When two assets move together, what are they both standing on?

They are standing on the same cost. An upstream manufacturer and its downstream consumer share a single variable — the price of the input one makes and the other buys. When that variable moves, both equity prices respond: one margin expands, the other compresses. The spread between the two prices is not a statistical coincidence. It is the structural signal the market has not yet closed.

The 06-19 lesson named the regime and built the detector. This lesson names what to trade when the regime fires. The pair signal is the instrument. The supply-chain position is the prior that separates valid pairs from spurious ones. The cointegration test is the gate that validates the statistical relationship. The z-score is the trigger.

§ IFrame

The 06-19 regime-detector produces a state label — trending, mean-reverting, or transitional — and a persistence estimate. What the lesson left open: which position to take when the regime fires. The pair signal fills that gap. Two equities structurally linked by a supply-chain cost relationship share a common stochastic driver. The spread between them is the tradeable entity.

The three-step protocol is the architecture. First: screen pairs by supply-chain structure. The structural screen reduces the N(N-1)/2 candidate pair space to a set grounded in fundamental logic. Second: validate cointegration statistically. The Engle-Granger two-step tests whether the spread is stationary. Third: trade the spread z-score. The z-score normalizes the current spread against its historical distribution and produces the entry trigger.

§ IIFoundations

What cointegration means in operational terms

Two price series X and Y are cointegrated when the linear combination Y − β·X produces a residual series ε whose mean and variance do not drift over time. A stationary ε returns to its mean after each deviation. Trading the stationary spread is the market-neutral position: long the underperforming leg, short the outperforming leg, close when the spread reverts. Aldridge's treatment of statistical arbitrage strategies (Ch 8, pp. 211–213) frames this directly — the pair trade bets on the relationship, not the direction of either individual asset.

Why supply-chain position creates structurally valid pairs

Two assets that test as cointegrated in a mining exercise may be spuriously linked. Supply-chain position provides the fundamental prior: when one entity's output is another entity's material input, both share the same cost driver. A shock to that driver changes both margins simultaneously — expanding one and compressing the other. The spread widens. The reversion is mechanical, not statistical.

Condition 1 · Input-Output Link
One entity's product is the other's cost. Semiconductor manufacturer to hyperscaler. Rare-earth extractor to EV battery maker. Water utility to semiconductor fab.
Condition 2 · Material Cost Share
The input represents a meaningful share of the downstream entity's total cost structure. A 1% cost item does not move the margin materially when the input price moves.
Condition 3 · Liquidity for Both Legs
Both equities are liquid enough to fill both legs in the same session window without signal decay from execution impact. Illiquid pairs carry leg risk by design.

The input/output long-short structure

The trade direction follows from chain position. The upstream entity — the one that makes the scarce input — captures margin when input prices rise. The downstream entity absorbs the cost and loses margin. The long leg is always the upstream entity; the short leg is always the downstream entity. This is the input/output long-short structure. It is a spread trade: long the winning margin, short the losing margin, hold until the gap closes.

§ IIIMechanism

Step 1 — Screen by supply-chain structure

Build the candidate pair list from fundamental analysis. The list is not generated algorithmically — it is authored. Each entry carries: long ticker, short ticker, the specific input resource that links them, and a notes field naming the cost mechanism. Typically 15 to 40 pairs for a given investment universe.

Step 2 — Validate cointegration with the Engle-Granger two-step

  1. Regress the downstream price (Y) on the upstream price (X): Y = β₀ + β₁·X + ε
  2. Extract the residual series ε
  3. Run the Augmented Dickey-Fuller test on ε
  4. Promote to active pair when ADF p-value < 0.05 over the lookback window

Step 3 — Trade the spread z-score

Normalize: z = (ε_current − μ_spread) / σ_spread. Entry: short the spread at z > +2.0; long the spread at z < −2.0. Exit: close when |z| < 0.5. Four calibration parameters per pair: lookback window (60–252 days), entry z-score threshold, exit threshold, and hold-time cap.

§ IVWorked Example

The AI-capex case. Micron Technology (MU) as long leg, Apple Inc. (AAPL) as short leg. Micron manufactures HBM and DRAM. Apple purchases DRAM for device memory. When AI-datacenter demand drives DRAM contract prices up 80–90%, Micron's cost basis is fixed while Apple's materials cost rises. The structural prediction: the spread widens as MU's margin expands and AAPL's compresses.

def test_cointegration(
    x_prices: np.ndarray,
    y_prices: np.ndarray,
    adf_threshold: float = 0.05,
) -> CointegrationResult:
    result = OLS(y_prices, add_constant(x_prices)).fit()
    spread = result.resid
    adf_stat, adf_pvalue, *_ = adfuller(spread, maxlags=1)
    return CointegrationResult(
        adf_pvalue=adf_pvalue,
        beta=result.params[1],
        spread_mean=float(spread.mean()),
        spread_std=float(spread.std()),
        is_valid=adf_pvalue < adf_threshold,
    )

The beta, spread_mean, and spread_std fields are stored at end of day. The intraday signal reads stored parameters rather than re-running the regression on each tick.

DevOps Layer — Two-Leg Fill Discipline Both legs must execute in the same session window. A scenario where one leg fills and the other does not leaves a naked directional position. If the filled-leg price moves more than half a standard deviation from the entry spread before the second leg fills, close the filled leg rather than wait. The leg-risk cost of a single abandoned fill is smaller than the directional exposure of a half-open pair.

§ VConnection to Prior Lessons

06-19 regime detection. The pair signal operates best in a mean-reverting regime. The hysteresis buffer from that lesson applies here: do not enter a pair trade within the first 3 days of a regime transition. A transition to trending means the spread will widen rather than revert.

06-12 strategy attribution. IR > 1.5 over the validation period is the entry gate for live deployment of a new pair. Below that threshold, the pair is paper-tracked until the IR grows or the fundamental logic weakens.

06-04 pre-trade risk gates. Half-Kelly applies per leg, sized against the full pair as a unit. The hold-time cap is the pair's analog of the pre-trade margin calculus — a maximum-duration exit that fires when the spread has not reverted within the expected window.

06-05 live monitoring and kill switch. The pair kill switch fires on spread divergence exceeding three standard deviations. A spread at z = 3.5 with no sign of reversion is a cointegration-breakdown signal. Close both legs.

§ VIConnection to Today's Dev Lesson

The Rust lesson takes the protocol above and implements it as a lazy pipeline. flat_map generates pairs one at a time without allocating all N(N-1)/2 candidates in memory. filter_map gates on cointegration validity and z-score entry in the same pass. collect() materializes only the signals that clear both gates.

The CointegrationStore in the Rust lesson holds the fields that test_cointegration returns here — beta, spread_mean, spread_std. The two lessons share a data contract: this lesson defines what must be stored; the Rust lesson shows how to retrieve it at scale.

§ VIIClosing

The pair signal is the structural edge that supply-chain intelligence provides. Individual asset direction is noise; spread between structurally linked assets is the signal. The three-step discipline filters at every stage: structural screen before statistical test, statistical test before z-score entry, z-score entry before position fill, position fill under two-leg discipline.

The input/output long-short structure generalizes. Every market sector with identifiable supply chains has pair candidates. The AI-capex case is one instance. The methodology is the pattern.

Examine this. Apply it to the next structural observation that arrives.

🫡 ⚖️ 📜
Leo.Syri — Praetor Consulate, Imperium Luminaura
Lesson filed: 2026-06-26 · γ-Adversarial-Markets · Friday W2/C2
Prior arc: Regime Detection and Persistence Estimation (2026-06-19) · Grounding: Aldridge HFT Ch 8 pp 211–213