test: distinguish next-open one-yuan execution from later close classification

This commit is contained in:
boris
2026-09-11 09:11:28 +08:00
parent 20d723e2a1
commit c32807db1d
+19 -3
View File
@@ -6699,17 +6699,33 @@ mod tests {
}
#[test]
fn next_bar_open_execution_risk_rejects_execution_day_one_yuan_state() {
fn next_bar_open_execution_risk_rejects_one_yuan_open_despite_higher_close() {
let first = d(2025, 1, 2);
let second = d(2025, 1, 3);
let result = run_scheduled_next_open_with_dataset(dataset_with(
market(first, 10.0, 11.5),
market(second, 12.0, 99.0),
market(second, 0.9, 1.2),
candidate(first),
candidate(second),
));
assert_next_open_canceled_with_reason(&result, "one_yuan");
}
#[test]
fn next_bar_open_execution_risk_ignores_later_one_yuan_close() {
let first = d(2025, 1, 2);
let second = d(2025, 1, 3);
let result = run_scheduled_next_open_with_dataset(dataset_with(
market(first, 10.0, 11.5),
market(second, 1.2, 0.9),
candidate(first),
one_yuan_candidate(second),
));
assert_next_open_canceled_with_reason(&result, "one_yuan");
assert_eq!(result.fills.len(), 1);
assert_eq!(result.fills[0].date, second);
assert_eq!(result.fills[0].price, 1.2);
}
#[test]