fix(4branch): backtest single-step kernel uses 4-branch decode — was using old 3-branch

The single-step backtest_env_step kernel still called decode_exposure_index()
and compute_target_position() (old linear 3-branch mapping). Updated to use
decode_direction_4b/decode_magnitude_4b/compute_target_position_4branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-08 19:49:58 +02:00
parent af0ce41249
commit bb0e1308d5

View File

@@ -137,11 +137,12 @@ extern "C" __global__ void backtest_env_step(
return;
}
// ── Decode action (shared: trade_physics.cuh) ───────────────────────
// ── Decode action (4-branch: trade_physics.cuh) ───────────────────────
int action_val = actions[w];
int exposure_idx = decode_exposure_index(action_val, b0_size, b1_size, b2_size);
float target_exposure = compute_target_position(exposure_idx, b0_size, max_position);
int order_type_idx = decode_order_type(action_val, b1_size, b2_size);
int dir_idx = decode_direction_4b(action_val, b1_size, b2_size, b3_size);
int mag_idx = decode_magnitude_4b(action_val, b1_size, b2_size, b3_size);
float target_exposure = compute_target_position_4branch(dir_idx, mag_idx, max_position);
int order_type_idx = decode_order_4b(action_val, b2_size, b3_size);
// ── Margin-aware position cap (shared: trade_physics.cuh) ────────────
// margin = price * multiplier * margin_pct (e.g. 5000 * 50 * 0.06 = $15K for ES)