Ports two scope-complete fixes from the ml-alpha-phase-f-g-flawed
reference branch:
A7 fee model:
- order_match.cu::submit_market_immediate gains 2 new kernel args
(cost_per_lot_per_side, total_fees_per_b) mirroring the per-fill
fee deduction in resting_orders.cu::apply_fill_to_pos:213-219.
Fee deducts from pos.realized_pnl on EVERY fill (open, scale-in,
counter); total_fees_per_b accumulates for telemetry.
Single-writer-per-block plain += is safe — line 79 has
`threadIdx.x != 0 → return` (feedback_no_atomicadd).
- LobSimCuda::submit_market launch updated to pass the 2 new args.
- LobSimCuda::upload_cost_per_lot_per_side host API lets callers
configure ES-realistic fees (≈$1.25/contract/side). Default
alloc_zeros = $0; production decision-policy path is unchanged
(uploads its own cost via step_decision_with_latency).
A8 loader pair API:
- MultiHorizonLoader::next_sequence_pair returns
(LabeledSequence, LabeledSequence) at adjacent anchors in the
same source file. anchor_t sampled from [min_anchor, max_anchor−1)
so anchor+1 also fits the upper-bound. Counts as ONE yielded
sequence against n_max_sequences.
- next_sequence_random and next_sequence_pair share a new private
helper build_sequence_at(lf, anchor) -> LabeledSequence that
contains the multi-resolution windowing logic. Single source of
truth for the build (feedback_single_source_of_truth_no_duplicates).
- next_sequence's caller-facing contract (random anchor, one
sequence per call) is unchanged — alpha_train.rs supervised
pipeline keeps working as-is.
No new local tests this phase per the rebuild plan (R2): the fee
deduction with default cost=0 is a no-op for existing callers, and
G7 in R6 covers the with-fees path via a rebuilt reward_calibration
test driving LobSimCuda directly (no LobEnv adapter).
cargo check -p ml-alpha -p ml-backtesting + cargo build --tests on
ml-backtesting both green; baseline test suite unaffected.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>