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
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.