diff --git a/crates/ml/src/cuda_pipeline/experience_kernels.cu b/crates/ml/src/cuda_pipeline/experience_kernels.cu index 52eb55c00..baa78facb 100644 --- a/crates/ml/src/cuda_pipeline/experience_kernels.cu +++ b/crates/ml/src/cuda_pipeline/experience_kernels.cu @@ -473,7 +473,13 @@ extern "C" __global__ void experience_env_step( float tx_cost = 0.0f; if (delta != 0.0f) { - tx_cost = fabsf(delta) * raw_close * tx_cost_multiplier * spread_scale; + /* Market impact: larger trades cost more (quadratic in size). + * A 1-lot order fills at bid/ask. A 4-lot order moves the market. + * impact_scale = 1 + |delta/max_position|^2 — ranges from 1.0 to 2.0. + * This teaches the model that scaling to max position is expensive. */ + float size_ratio = fabsf(delta) / (max_position > 0.0f ? max_position : 1.0f); + float impact_scale = 1.0f + size_ratio * size_ratio; + tx_cost = fabsf(delta) * raw_close * tx_cost_multiplier * spread_scale * impact_scale; cash -= delta * raw_close; cash -= tx_cost; position = target_position;