Skip to content
All strategies

Strategies

KO/PEP Log-Price Cointegration Spread Reversion: Rolling-OLS Hedge Ratio, Enter at |resid| > 2 sigma, Exit Inside 1 sigma, Dollar-Neutral Long/Short on USEQ DAILY Bars

Outcome: Abandoned

KoPepLogCointegrationSpreadReversion

Outcome Summary

The strategy tested KO/PEP log-price spread reversion using rolling OLS and dollar-neutral USEQ positions. It underwent three iterations, but Layer-3 verification timed out before performance metrics were generated. The run was abandoned before backtest review, optimization, analyst review, or risk review.

Hypothesis

This is the one concrete rule in TradeMan's FMZ 'Neutral-Hedge Statistical Arbitrage (Pure-Alpha)' description (section 3.7), taken out of its all-market basket scanner and applied to one economically linked pair on the commission-free USEQ venue. The rule: fit ln(Y) = a + b*ln(X) + c; with sigma = std(c), sell Y and buy X when c > lambda*sigma, do the reverse when c < -lambda*sigma, and close when c comes back inside [-0.5*lambda*sigma, +0.5*lambda*sigma]. Y = PEP.USEQ and X = KO.USEQ. The pair is chosen a……Show moreShow less

This is the one concrete rule in TradeMan's FMZ 'Neutral-Hedge Statistical Arbitrage (Pure-Alpha)' description (section 3.7), taken out of its all-market basket scanner and applied to one economically linked pair on the commission-free USEQ venue. The rule: fit ln(Y) = a + b*ln(X) + c; with sigma = std(c), sell Y and buy X when c > lambda*sigma, do the reverse when c < -lambda*sigma, and close when c comes back inside [-0.5*lambda*sigma, +0.5*lambda*sigma]. Y = PEP.USEQ and X = KO.USEQ. The pair is chosen a priori on economic grounds rather than from the backtest: two global beverage and snack franchises with the same consumer-staples factor exposure, the same input costs, the same FX translation and the same rate sensitivity. It has been the textbook cointegration pair since well before this dataset's out-of-sample window. Everything is fitted point-in-time: at each daily close, a and b are re-estimated by OLS on the trailing N=250 sessions of log closes, and sigma is the std of those in-window residuals. Only information at or before the current bar is used. Legs are dollar-neutral: each leg gets 50% of equity notional (gross 1.0x, well inside Reg-T 2x). The beta-weighting is in the signal, not the sizing, to keep it to 2 parameters. The source's all-market scanning, Hurst ranking, maker/taker execution and 'index arbitrage' parts are NOT ported: the description gives no rule for them and no code, and scanning many names is the family that times out here (L173). The source's Engle-Granger ADF and Hurst filter is pre-registered as a SEPARATE variant B (trade only when the trailing-250 residual ADF p < 0.10), scored on its own. It is not part of the primary claim (L130). Expected flat share: about 60-70% of sessions. Why this does not break the lessons: L137 bans multi-leg neutral BOOKS (baskets and cross-venue carry). This is one pair on a zero-commission venue, where the extra leg costs about 0.02-0.05% instead of 0.10-0.20%. The prompt's equity section lists 'pairs within a sector (KO/PEP style)' as a proven archetype. USEQ holds 2.5% of the corpus and long_short 14.7%, so this adds to both under-represented buckets. The daily history (decades) supports about 150-250 lifetime round trips, where crypto pair histories give tens.

Iteration 3 changes performance only. The rolling OLS was already incremental in iteration 2: O(1) per bar, with an amortised resync every 250 bars, over ~1650 daily bars, so strategy compute is milliseconds. The repeat 300s timeout is most likely environmental: host load average was ~83 at check time. The base template has no recursion path (checked _submit_exit, _submit_exit_position and _submit_entry_instrument). The only remaining per-bar work, the two cache.positions_open queries for orphan-leg cleanup, now runs only while a pair is held (_held != 0). Signal, entry/exit bands, sizing and config are unchanged, so Layers 1-2 stay green. If Layer 3 times out again, the cause is catalog/load-side (USEQ data loading), not strategy code.

verification_loop: sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (2400 days of PEP.USEQ-1-DAY-LAST-EXTERNAL). This almost always means per-bar work that scales with history — e.g. rescanning the full funding/supplementary series, or rebuilding a list and calling min()/sorted() inside calculate_signal()/on_bar() on every bar. Precompute sorted timestamp arrays ONCE in __init__ and use bisect, or cache lookups keyed by timestamp, so per-bar cost is O(log n) not O(n).

Implementation

PEP/KO log-price cointegration spread reversion on USEQ daily bars. Each session the OLS ln(PEP)=a+b*ln(KO)+c is refit point-in-time on the trailing 250 aligned sessions, using O(1) running sums. z=c/std(c). Enter when |z|>2: short PEP/long KO if z>2, long PEP/short KO if z<-2. Exit when the residual is back inside +/-1 sigma. Dollar-neutral: 50% of equity per leg, whole shares, 1.0x gross.

Verification Results

sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (2400 days of PEP.USEQ-1-DAY-LAST-EXTERNAL). This almost always means per-bar work that scales with history — e.g. rescanning the full funding/supplementary series, or rebuilding a list and calling min()/sorted() inside calculate_signal()/on_bar() on every bar. Precompute sorted timestamp arrays ONCE in __init__ and use bisect, or cache lookups keyed by timestamp, so per-bar cost is O(log n) not O(n).

Outcome Summary

Future iterations should keep all per-bar work independent of history and within the sandbox time limit.

The run was abandoned after the sandbox smoke test exceeded the 300-second limit on roughly 20,000 bars. Later stages were not reached.

It tried to trade rolling-OLS log-price residual mean reversion between PEP.USEQ and KO.USEQ with dollar-neutral legs.

No return, Sharpe, or trade count is available because no backtest report was produced. Verification reached three iterations but did not complete the Layer-3 sandbox backtest.

Analysis

【中性对冲统计套利New】(Pure-Alpha 梦幻版)|【Neutral-Hedge Statistical Arbitrage New】(Pure-Alpha dream version)

Backtest and paper results are hypothetical. Trading involves risk of loss.