Same-Industry Duopoly Pairs on USEQ Daily: Engle-Granger Spread with Formation-Frozen vs Rolling Hedge Ratio (KO/PEP, XOM/CVX, HD/LOW, V/MA, Dollar-Neutral L/S)
Classification: (a). The source gives a concrete mechanism (an Engle-Granger cointegration pairs trade with a 2-sd z-score entry) but names no instrument. The author's question (re-estimate beta every bar, or freeze……Show moreShow less
Classification: (a). The source gives a concrete mechanism (an Engle-Granger cointegration pairs trade with a 2-sd z-score entry) but names no instrument. The author's question (re-estimate beta every bar, or freeze the in-sample beta) becomes a pre-registered categorical parameter that the backtest answers. Crypto venues are rejected for this mechanism: z-score spread fades on crypto perps keep dying on fees (mean_reversion 0/203, multi_instrument 0/148, captures below the cost of 4 legs). US equities suit it: zero commission (about 0.02-0.05% round trip for spread and impact per leg), shorting on Reg-T margin, and decades of daily split-adjusted bars, so the trade count comes from long history rather than fast trading. The universe is capped at 4 hand-picked same-industry duopoly pairs (8 names, under the ~10-name cap of lesson L173). Each pair has an economic reason to be cointegrated: KO/PEP (beverages), XOM/CVX (integrated oil, same crude and refining margins), HD/LOW (home improvement, same housing cycle), V/MA (card networks, same payments volume). Dividends are not in PnL, but yields are similar within each pair, so the omission roughly cancels across the dollar-neutral legs. The mechanism splits time into formation and trading periods (Gatev/Vidyamurthy style). Every rebalance_days sessions each pair is re-formed on the trailing formation_days of log prices: an OLS of log(y) on log(x) gives beta and the residual mean and sd. If an ADF test on the residuals gives a t-stat below adf_crit, the pair is TRADEABLE for the next trading window; otherwise it is not traded until the next formation, and any open position in it is closed. The author's question is the categorical parameter beta_mode. 'frozen' keeps the formation-window beta, mu and sigma for the whole trading window. This is the textbook out-of-sample answer: the cointegrating vector is treated as a fixed population parameter, and re-fitting it every bar lets the hedge ratio chase the dislocation and shrink the z-score exactly when it should trade. 'rolling' re-estimates beta, mu and sigma every bar on the trailing formation_days. Both run through the same code path. To avoid the Layer-3 sandbox timeout that killed the PEAD basket, keep rolling sums per pair (sum x, sum y, sum x^2, sum xy, sum y^2) so each bar costs O(1), and run the ADF only at formation dates, never per bar. Risk: each leg is capped at 25% of equity per pair, 4 pairs max, so at most 100% long plus 100% short (within 2x Reg-T). Legs are sized dollar-neutral by beta (y notional = N, x notional = beta*N). Stops: spread z beyond stop_z, or a time stop at max_hold_days.