Skip to content
All strategies

Strategies

ianzeng123 RWA Risk Parity v2.5 — Faithful Four-Asset Bybit Port

Outcome: Abandoned

IanzengRwaRiskParityV25

Outcome Summary

IanzengRwaRiskParityV25 tried to port ianzeng123's four-asset Bybit risk-parity allocator (BTC, gold, SPY, crude oil) to the platform, keeping the source's paper-branch allocation logic. Over 3 iterations the code never passed Layer 3 verification, because the sandbox smoke test went over its 300s limit on a window of about 20,000 hourly bars. The likely cause is that every bar rebuilt timestamp maps and intersected them across all four legs' full histories. The run was abandoned before any backtest, optimization or analyst review, so no performance numbers exist.

Hypothesis

Translate ianzeng123's executable multi-asset allocation strategy, preserving the supplied code rather than correcting it to match the prose. Trade BTC, gold, SPY and crude-oil USDT perpetuals on Bybit. The code uses PERIOD_H1, not the description's 15-minute covariance bars. Preserve signed risk-parity weights, volatility-dependent exposure, initial/timed/weight-change/direction-change rebalancing and emergency partial reductions. Source defaults are TRADE_MODE=paper, INIT_CAPITAL=10000 USDT, LOOKBACK=60, EWMA_LAMBDA=0.94, TARGET_VOL=0.15, MAX_LEVERAGE=3, REBALANCE_HOURS=24, DRIFT_THRESHOLD=0.15, POSITION_RATIO=0.95 and MIN_REBAL_USDT=5. The platform adaptation uses its actual $100000 account equity and engine accounting, with real commissions and execution costs; do not reproduce the source's fee-free simulated PnL as backtest results. Preserve the source paper branch's allocation decisions separately from engine accounting. No parameter optimization is authorized.

The user's explicit faithful-port request takes precedence over choosing a different mechanism for diversity. Bybit is underrepresented at 2.3%, and this four-asset portfolio addresses the single-symbol concentration. BTC is required by the original asset pool. corpus_concentration is empty, so no instrument-specific recent share can be verified. Exact 1-HOUR catalog directories contain parquet files for all four Bybit legs. Filename ranges suggest potential common coverage from 2026-05-14 10:00 UTC through 2026-10-02 00:00 UTC; this is not verification of row-level continuity, timestamp intersection or economic contract identity. Validate those before coding/backtesting, including that CL is crude oil and SPY represents the intended equity exposure. Do not substitute similarly named tokens or other assets.

verification_loop: sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (833 days of BTCUSDT.BYBIT-1-HOUR-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

Faithful Bybit port of ianzeng123's RWA risk parity v2.5. It uses hourly closes for the BTC, XAU, SPY and CL USDT perps, kept only at timestamps where all four legs have a bar. Covariance is EWMA (lambda 0.94, 60 returns, 0.001 regularisation). The signed risk-parity solver sets each asset's direction from its covariance with the equal-vol portfolio, clamps weights to +/-0.5, and targets leverage of min(0.15/annual_vol, 3). The source paper-mode allocation ledger runs the initial, 24h, direction-flip and 15% drift rebalances. It also runs the emergency rule (a 5% adverse move halves the leg) and the margin-budget scaling. The ledger sends real market orders one leg at a time on the engine, charged real Bybit fees.

Iteration 3 fixes only the Layer 2 failure. The synthetic harness builds its config with the default leverage of 1.0 while parameters.leverage stays at 3.0, so the hard 'must mirror' ValueError broke every scenario at setup. That check is removed. The real config still sets leverage=3.0 and parameters.leverage=3.0, matching the plan's fixed value. Sizing still reads self.config.leverage: current_leverage = min(TARGET_VOL/annual_vol, MAX_LEVERAGE, config.leverage). The signal, solver, ledger, rebalance and emergency logic, the parameters and the config are unchanged from iteration 2.

Verification Results

sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (833 days of BTCUSDT.BYBIT-1-HOUR-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).

Iteration History

Verification failed (Layer 1.5 — hypothesis/config consistency) [class=hypothesis_mismatch]: - optimization_plan fixes leverage at 3.0

Verification failed (Layer 2 — synthetic scenarios): Parameters used: ['LOOKBACK', 'leverage', 'TARGET_VOL', 'TRADE_MODE', 'EWMA_LAMBDA', 'ANNUAL_HOURS', 'INIT_CAPITAL', 'MAX_LEVERAGE', 'MID_INTERVAL', 'PNL_INTERVAL', 'SOURCE_ORDER', 'FAST_INTERVAL', 'NUMERIC_FLOOR', 'POSITION_DUST', 'SLOW_INTERVAL', 'EMERGENCY_DROP', 'MIN_REBAL_USDT', 'POSITION_RATIO', 'DRIFT_THRESHOLD', 'REBALANCE_HOURS', 'CASH_BUFFER_USDT', 'COV_SCALE_TARGET', 'EMERGENCY_REDUCE', 'MAX_SHORT_WEIGHT', 'SOLVER_TOLERANCE', 'MIN_SOLVER_WEIGHT',……Show moreShow less

Verification failed (Layer 2 — synthetic scenarios): Parameters used: ['LOOKBACK', 'leverage', 'TARGET_VOL', 'TRADE_MODE', 'EWMA_LAMBDA', 'ANNUAL_HOURS', 'INIT_CAPITAL', 'MAX_LEVERAGE', 'MID_INTERVAL', 'PNL_INTERVAL', 'SOURCE_ORDER', 'FAST_INTERVAL', 'NUMERIC_FLOOR', 'POSITION_DUST', 'SLOW_INTERVAL', 'EMERGENCY_DROP', 'MIN_REBAL_USDT', 'POSITION_RATIO', 'DRIFT_THRESHOLD', 'REBALANCE_HOURS', 'CASH_BUFFER_USDT', 'COV_SCALE_TARGET', 'EMERGENCY_REDUCE', 'MAX_SHORT_WEIGHT', 'SOLVER_TOLERANCE', 'MIN_SOLVER_WEIGHT', 'SOLVER_ITERATIONS', 'COV_REGULARIZATION', '_optimization_plan', 'MIN_ADD_MARGIN_USDT', 'ALIGNMENT_EXTRA_BARS', 'INVALID_VARIANCE_VOL'] Check that __init__ sets all attributes from self.parameters.get(). - steady_uptrend: Setup error: ValueError: parameters.leverage must mirror config.leverage - steady_downtrend: Setup error: ValueError: parameters.leverage must mirror config.leverage - flat_ranging: Setup error: ValueError: parameters.leverage must mirror config.leverage - volatility_spike: Setup error: ValueError: parameters.leverage must mirror config.leverage - zero_volume: Setup error: ValueError: parameters.leverage must mirror config.leverage - price_gap: Setup error: ValueError: parameters.leverage must mirror config.leverage

Outcome Summary

In multi-leg strategies, keep per-bar work bounded: maintain rolling, timestamp-aligned price windows incrementally instead of rebuilding dicts and set intersections over the full buffered history of every leg on every bar.

It was abandoned in the verification loop after 3 iterations: the Layer 3 sandbox backtest went over the 300s wall-clock limit on a window of about 20,000 bars (833 days of BTCUSDT.BYBIT 1-hour bars). The likely cause is per-bar work that grows with the length of history.

A faithful port of ianzeng123's RWA risk-parity v2.5 strategy, allocating signed risk-parity weights across BTC, gold, SPY and crude-oil USDT perpetuals on Bybit using hourly EWMA covariance, volatility targeting (TARGET_VOL=0.15, MAX_LEVERAGE=3) and timed, drift and direction-change rebalancing, with no parameter optimization authorized.

No performance figures exist: the strategy never produced a backtest report, so return, Sharpe and trade counts are unavailable, and the optimization, analyst and risk-review stages were never reached.

Analysis

RWA大类资产风险平价策略

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