Skip to content

View original

StockConnectClosureFlowReboundHkeq

Hypotheses

Stock-Connect Reopening Flow Rebound, Hong Kong Large-Cap Basket (HKEQ daily bars — buy the 10 highest-southbound-ownership H-shares on the last HK session while mainland Stock Connect is SUSPENDED for a Chinese public holiday, hold through the reopening of southbound flow, exit on the 3rd session after Connect resumes; mainland-session heartbeat read from a CNEQ bar stream, 2 parameters)

Hypotheses

A calendar/flow-event strategy on a data estate the factory has NEVER touched: Hong Kong equities (HKEQ, 174 liquid names, clean split-adjusted daily bars 2018-01-02 -> 2026-08, venue already wired in venue_configs.py as a CASH account at 0.11% per side). Mechanism: a large and mechanically-mandated share of daily turnover in HK large caps is mainland money arriving through Shanghai/Shenzhen-Hong Kong Stock Connect (southbound). When mainland exchanges close for a multi-day public holiday (Lunar New Year, Qingming, Labour Day, Dragon Boat, Mid-Autumn, National Day/Golden Week, New Year) Connect southbound trading is SUSPENDED while HKEX keeps trading. For those sessions a persistent, price-insensitive buy-side flow is removed from the HK book by regulation, not by sentiment; high-southbound-ownership H-shares trade thinner and drift soft. When the mainland reopens, the suspended flow returns in a burst. The strategy is long the flow-return: buy an equal-weighted basket of 10 high-southbound HK large caps at the close of the LAST HK session inside the closure window and hold through the reopening. This is not a momentum, mean-reversion, pairs, ETF-rotation, funding or liquidation idea — no family in the 1330-hypothesis corpus resembles it, and no experiment has ever run on HKEQ (0 of 3068). The closure calendar is known history, so the whole 8.7 years is backtestable today with zero data-availability risk. The mainland-holiday state is derived ONLINE, not hardcoded: 000001.CNEQ is subscribed as a SIGNAL-ONLY heartbeat (never traded) — if no CNEQ daily bar has printed for >= mainland_closed_days calendar days while HK bars keep arriving, the mainland is closed. Permitted fallback if the extra CNEQ venue proves awkward in the engine: a static table of mainland holiday windows 2018-2027 (ex-ante known, no lookahead).

Hypotheses

Implements the hypothesis exactly: long the flow-return, on the declared 10-name HK large-cap basket, entered on the last HK session of a mainland Connect suspension and exited on the 3rd session after southbound flow resumes. The hypothesis's two parameters map to min_closure_weekdays (how long a suspension must be to be tradeable) and hold_sessions_after_resume (the post-reopen exit horizon); both are declared in _param_bounds together with gross_exposure, the only other clamped value. I took the hypothesis's explicitly permitted fallback and derived the mainland-holiday state from a static closure table instead of subscribing 000001.CNEQ as a heartbeat leg, because the CNEQ leg is not merely awkward but fatal in this engine, twice: (1) the base template's same-timeframe cross-leg barrier defers the primary signal until every same-timeframe extra leg has a bar at the PRIMARY bar's exact timestamp, and CNEQ daily bars are stamped at the mainland close (07:00 UTC) while HKEQ daily bars are stamped at the HK close (08:00 UTC) — they never coincide, so the strategy would evaluate zero bars and place zero trades; (2) BacktestRunner funds every extra venue with its own 100k account and uses the SUM of starting balances as the return/drawdown denominator, so an idle 100k CNY heartbeat account would halve every reported performance number. The table carries the same information with no lookahead: 2018-01..2026-06 is the realised A-share trading calendar (I verified it reproduces exactly the mainland holiday windows — 57 windows, no data-gap noise) and the tail is the officially announced schedule, which mainland regulators publish ~a year in advance. Using the published calendar also lets the entry be the hypothesis's literal rule — the LAST session inside the window — which a purely online heartbeat could never identify without lookahead, since 'the mainland reopens tomorrow' is only knowable from the (public) calendar. Venue: HKEQ as declared (venue_type 'spot' — CASH, long-only, leverage 1.0, which the code never references). Cost awareness: 0.11%/side + ~4bp half-spread ≈ 0.30% round trip per leg, so the ~0.5% mean / ~1.2% median basket move over the hold is a thin but positive margin — the mechanism is a regulatory flow artefact, not a price pattern, so there is no per-trade edge to widen without abandoning the event. Performance contract: all per-bar work is O(1) (one dict lookup, no history scans, no growing lists).

Hypotheses

No measurable edge (35 independent events, t = 0.90), three unwaivable hard validity failures, per-trade edge below the HKEQ floor once the uncharged statutory cost is netted, and no tunable path — the single mechanism parameter is a cliff and Connect suspensions are ~7/year by regulation, so no reframe adds independent observations. Not revise_hypothesis: the binding constraint is the mainland holiday calendar's event-count ceiling, which any HK-basket reframe inherits.

Implementation

Calendar/flow-event strategy on Hong Kong large caps (HKEQ daily bars, long-only CASH venue, 0.11%/side statutory cost). Mainland public holidays SUSPEND Shanghai/Shenzhen-Hong Kong Stock Connect southbound trading by regulation while HKEX keeps trading, removing a persistent price-insensitive mainland bid from the HK book; when the mainland reopens that flow returns in a burst. The strategy buys an equal-weighted basket of the 10 highest-southbound-ownership H-shares/HK large caps (0700, 0939, 1398, 0941, 0883, 0388, 2318, 1288, 0386, 0857) at the close of the LAST HK session inside the closure window and exits at the close of the 3rd HK session on which the mainland is open again (hold_sessions_after_resume). Mainland-closed state comes from a static table of mainland market-closure windows: the realised A-share trading calendar 2018-01..2026-06 plus the published forward schedule through 2027 — ex-ante public information, read point-in-time off each bar's own date, with a single dict lookup per bar. calculate_signal returns a continuous phase score in weekday units: -rem_after while a suspension is still running, +window_len on the flow-return eve (conviction = weekdays of flow removed), and -(10 + sessions_since_resume) once flow is back — so the entry threshold (min_closure_weekdays) and the exit threshold (hold_sessions_after_resume) are both comparisons in the signal's own units. 35 events over 8.7 years (~4/yr, 350 leg round trips at 10 legs), average hold ~4 sessions, per-leg budget snapshotted once per entry so the basket stays equal-weighted, whole-share sizing, 90% gross exposure, no leverage, no shorts.

Verification Results

Fall back to the latest HK session at-or-before the window end when no bar prints on the final closed weekday — still ex-ante, recovers ~6 events.

Verification Results

Entry fires only on the last mainland-closed WEEKDAY, not on the last HK SESSION inside the window. Replay shows 6 windows with 1-3 HK sessions inside the suspension are skipped because that final closed weekday is itself an HK holiday (2018-04-30..05-01, 2018-12-31..2019-01-01, 2019-10-01..07, 2022-04-04..05, 2025-05-01..05) — ~15% of tradeable events dropped, including a Golden Week. Conservative (no look-ahead), but it thins an already small sample.

Verification Results

Count closure-free weekdays since the most recent window end via bisect on the bar's own date, so the signal is a pure function of the timestamp.

Verification Results

`_resume_age` is uptime-anchored (seeded at resume_cap=60 in __init__) rather than derived from the bar's date. Backtest-safe, but a paper/live restart mid-hold yields signal -70 on the first bar and flattens the whole basket instead of holding to session 3; replay parity is impossible.

Verification Results

Note a minimum viable capital (~1M HKD) or round each leg down to its board lot.

Verification Results

HK equities trade in board lots (0700=100 sh ≈ HKD 60k/lot, 0939/1398=1000, 0386/0857=2000) but sizing is in single shares and the venue models no lot size. A 9% slot of the 100k HKD starting balance is below one board lot for most legs — the fills aren't executable at that capital.

Verification Results

Two things the analyst must weigh at backtest review. (1) COSTS ARE NOT CHARGED: HKEQ instruments are NautilusTrader `Equity` objects and `BacktestRunner._apply_fees` returns Equity unchanged (src/backtesting/runner.py:2178-2183), so the 0.1100%/side statutory cost declared for HKEQ in venue_configs.py is NEVER applied — the sandbox reports total_commission 0.0. The sandbox's avg_trade_return_pct 0.482% is therefore GROSS of ~0.22% round-trip stamp duty + levies and of the 8bp round-trip half-spread (impact_folded=false); true net per-trade is roughly 0.18%, only just above the 0.15% HKEQ floor, and ROUND_TRIP_COST_PCT['HKEQ']=0.10 understates the venue ~3x. (2) EFFECTIVE SAMPLE IS 35, NOT 350: I replayed the closure table against the real 0700.HKEQ series — exactly 35 entry events fire over 2018-01..2026-09; the 10 legs of each event are one correlated observation, so the holdout will hold ~7 events. Expect wide CIs and heavy deflation; raising min_closure_weekdays to its bound (4) cuts events to ~15.

Backtest Review

Mechanism implemented faithfully and verified in the trade records: all 350 legs LONG, each event entering at the close of the last closed mainland weekday (e.g. 2018-02-21, final LNY closure weekday) and exiting on the 3rd HK session after Connect resumes (2018-02-26). Direction, timing and sizing all match the hypothesis; closure table is point-in-time, no lookahead.

Backtest Review

Genuinely novel data estate (first HKEQ experiment in the corpus); not a member of any dead family.

Backtest Review

Gross result is clean and not a leverage/compounding artifact: PF 1.28, win rate 0.586, DD 9.3%, avg_position_pct 9.1% (true equal-weight 10-leg basket).

Backtest Review

Costs are structurally uncharged and the gap exceeds the edge: `_apply_fees` returns NautilusTrader `Equity` objects unchanged, so HKEQ's 0.11%/side never applies (total_commission 0.0, commission 0.0 on all 350 trades). Real HK round trip ≈0.22% statutory + ~0.08% spread ≈0.30%; net per-trade ≈0.19%, below the 0.30% HKEQ floor. ROUND_TRIP_COST_PCT['HKEQ']=0.10 understates the venue ~3x so the code floor is blind here.

Backtest Review

Net economics round to zero: $12,608 gross − $2,986 unfolded impact (19.15% of gross) − ~$7,000 statutory ≈ $2,600 over 8.7 years ≈ 0.3%/yr vs the 1.46% gross CAGR.

Backtest Review

No tuning path: gross_exposure only levers a sub-cost edge on a 1x CASH venue; hold_sessions_after_resume adds no per-trade margin; min_closure_weekdays at its bound (4) cuts 35 events to ~15.

Backtest Review

Supporting: 35 independent events (not 350), sharpe_ci [-0.50, 1.03] straddles zero, PSR 0.536, Sortino 0.040, Calmar 0.157, DD duration 742 days, 5 of 9 years positive.

Analysis

Mechanism implemented faithfully and point-in-time clean: all 350 legs LONG, entries on the last mainland-closed weekday of each suspension, exits on the 3rd HK session after flow resumes.

Analysis

Holdout technically positive (Sharpe 0.075, 70 trades) and consistent with WF-OOS (z = -0.50) — the failure is not holdout degradation.

Analysis

Sensitivity flat in every structural parameter; drawdown small (2.7% optimized) and inside the pre-registered 15%; 4 of 6 pre-registered criteria met.

Analysis

Genuinely novel estate (first HKEQ event-calendar run) — informative negative result.

Analysis

Three unwaivable HARD failures: overfit (IS 0.910 -> OOS 0.493), OOS 0.493 < 0.5, PBO 0.656 > 0.5.

Analysis

350 trades are really 35 events × 10 correlated legs. Per-event mean +0.41%, sd 2.67%, t = 0.90 — indistinguishable from zero; matches DSR 0.0157, sharpe_ci_low -0.48, failed programme FDR.

Analysis

VERIFIED cost gap: every trade record shows commission 0.0 and total_commission 0.0 despite venue_configs.py setting HKEQ maker/taker = 0.0011 — _apply_fees() returns early for all NT Equity instruments. Netting the ~0.22% round trip (~$2,080 of $3,664 PnL at $2,702 avg notional) plus unfolded impact takes per-trade return 0.490% -> ~0.19%, below the 0.30% HKEQ floor.

Analysis

Only mechanism lever is a cliff: hold_sessions_after_resume 2 -> 0.092, 3 -> 0.470, 4 -> 0.137; all other parameters inert.

Analysis

OOS carried by one window (1.895 / 0.066 / -0.480); CAGR 1.46%, Calmar 0.174, 5 of 9 years positive, 742-day drawdown duration.

Analysis

Benjamini-Hochberg at q=0.10 over 285 programme candidates keeps 4. A candidate that does not survive here is not distinguishable from the programme's own noise, however good its individual statistics look.

Outcome Summary

StockConnectClosureFlowReboundHkeq-0f0a5e78c8

Outcome Summary

StockConnectClosureFlowReboundHkeq was the factory's first experiment on Hong Kong equities: it bought a 10-name high-southbound basket on the last HK session of each mainland holiday closure and held through the return of suspended Stock Connect flow, using a point-in-time closure calendar. The mechanism was implemented faithfully — all 350 legs long, entries on the final closed mainland weekday, exits on the 3rd session after resumption — and the initial backtest looked clean on gross numbers (12.61% total return, PF 1.28, 58.6% win rate), which earned an 'optimize' verdict at backtest review. Optimization then exposed the statistics: IS 0.910 vs OOS 0.493, PBO 0.656, deflated Sharpe 0.0157, failed programme FDR, and an OOS record carried by a single window, while the 350 trades reduced to 35 independent events with t = 0.90. The analyst abandoned it after one iteration, noting that HKEQ fees were never actually charged in the backtest and that netting the real ~0.22% round trip puts per-trade return below the venue floor, with no tunable path since the only live parameter is a cliff and Connect suspensions occur roughly 7 times a year by regulation.

Outcome Summary

Calendar-event strategies are capped by the event count itself — 35 holiday windows across 8.7 years with 10 correlated legs cannot produce a statistically distinguishable edge, and gross per-trade returns must be checked against real venue costs when the engine charges none.

Outcome Summary

The analyst returned abandon at ANALYZING after an earlier 'optimize' verdict at backtest review: three unwaivable hard validity failures (overfit, OOS Sharpe 0.493 below the 0.5 floor, PBO 0.656 above 0.5) plus the finding that the 350 legs are really 35 correlated events with per-event mean +0.41% and t = 0.90. Commissions were verified as never charged (total_commission 0.0 despite HKEQ maker/taker 0.11%), and netting the ~0.22% statutory round trip plus unfolded impact takes per-trade return from 0.490% to ~0.19%, below the 0.30% HKEQ floor.

Outcome Summary

Buy an equal-weighted basket of 10 high-southbound-ownership Hong Kong large caps (HKEQ daily bars) on the last HK session while mainland Stock Connect is suspended for a Chinese public holiday, holding through the reopening and exiting on the 3rd session after southbound flow resumes.

Outcome Summary

Over 2018-01 to 2026-09 the initial backtest produced 12.61% total return (CAGR 1.46%), Sharpe 0.245 (CI -0.50 to 1.03), 350 trade legs from 35 closure events, 58.6% win rate, profit factor 1.28 and 9.3% max drawdown, with gross avg trade return 0.490% of notional. After optimization: CAGR 0.469%, Sharpe 0.269, max drawdown 2.69%, walk-forward OOS Sharpe 0.493 vs IS 0.910, PBO 0.656, deflated Sharpe 0.0157, and a holdout that passed with Sharpe 0.075 on 70 trades.
Strategy report

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