Strategies
Commodity-ETF 12-Month Momentum, Rank-Extreme Legs Conditioned on Own Trend Sign: Long the Strongest / Short the Weakest of the USEQ Commodity ETFs (GLD, SLV, USO, UNG), 21-Session Rebalance, Inverse-Vol Sized, Explicit Flat State (USEQ 1-DAY)
Outcome: Abandoned
CommodityEtfRankExtremeTsmomLS
Outcome Summary
CommodityEtfRankExtremeTsmomLS adapted a Quantpedia/QuantConnect commodity momentum strategy to four USEQ commodity ETFs, with each leg held only when the name's own 12-month trend sign agreed. The design asked for O(1) per-bar work because of earlier sandbox timeouts, and the code used fixed-length deques and running sums. Even so, after 3 iterations the strategy still exceeded the 300s Layer 3 sandbox limit on a 2400-day GLD window and was abandoned in the verification loop. It never reached backtesting, optimization, analyst review or risk review, so no performance metrics exist.
Hypothesis
Removed the per-bar execution retry path and repeated order/position cache scans. Reconciliation now occurs only on calendar-anchored rebalance bars while retaining the fixed-size rolling state and existing signal logic.
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 GLD.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
Ranks commodity ETFs by trailing 12-month return every 30 calendar days, holding the strongest only when positive and the weakest only when negative, with capped inverse-volatility sizing.
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 GLD.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
Multi-instrument strategies must be profiled to confirm the per-bar cost is truly O(1) in the sandbox before resubmitting. The hypothesis already required O(1) deques and running sums, but that was not enough to pass the timeout, so the remaining per-bar work (e.g. per-instrument cache/order queries and sorting on every bar instead of only on rebalance bars) should be checked.
The run was abandoned in a verification loop after 3 iterations. The Layer 3 sandbox backtest went over the 300s wall-clock limit on a ~20,000-bar window (2400 days of GLD.USEQ-1-DAY), which usually means per-bar work grows with the length of the history.
A 12-month cross-sectional commodity momentum strategy on the USEQ commodity ETFs (GLD, SLV, USO, UNG): long the strongest name only if its 12-month return was positive, short the weakest only if its 12-month return was negative, rebalanced every 21 sessions with inverse-vol sizing, on the thesis that roll yield and persistent inventory states drive commodity momentum.
No performance was measured: there is no backtest report and no optimization report, so there are no return, Sharpe or trade-count figures.
Analysis
Momentum Effect in Commodities Futures
Backtest and paper results are hypothetical. Trading involves risk of loss.