test: distinguish next-open one-yuan execution from later close classification
This commit is contained in:
@@ -6699,17 +6699,33 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[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 first = d(2025, 1, 2);
|
||||||
let second = d(2025, 1, 3);
|
let second = d(2025, 1, 3);
|
||||||
let result = run_scheduled_next_open_with_dataset(dataset_with(
|
let result = run_scheduled_next_open_with_dataset(dataset_with(
|
||||||
market(first, 10.0, 11.5),
|
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),
|
candidate(first),
|
||||||
one_yuan_candidate(second),
|
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]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user