test: assert broker fill events for scoped buy denials
This commit is contained in:
@@ -8251,13 +8251,13 @@ mod tests {
|
||||
symbol: "000001.SZ".to_string(), target_value: 3_000.0, reason: "topup".to_string(),
|
||||
});
|
||||
let report = broker.execute(second, &mut portfolio, &data, &blocked).unwrap();
|
||||
assert!(report.fills.is_empty());
|
||||
assert!(report.fill_events.is_empty());
|
||||
assert_eq!(portfolio.position("000001.SZ").unwrap().quantity, 100);
|
||||
assert!(broker.runtime_buy_denials.borrow().is_empty());
|
||||
blocked.order_intents = next_open_sell_decision().order_intents;
|
||||
let report = broker.execute(second, &mut portfolio, &data, &blocked).unwrap();
|
||||
assert_eq!(report.fills.len(), 1);
|
||||
assert_eq!(report.fills[0].side, OrderSide::Sell);
|
||||
assert_eq!(report.fill_events.len(), 1);
|
||||
assert_eq!(report.fill_events[0].side, OrderSide::Sell);
|
||||
assert!(broker.runtime_buy_denials.borrow().is_empty());
|
||||
}
|
||||
|
||||
@@ -8273,7 +8273,7 @@ mod tests {
|
||||
decision.buy_denials.insert("000001.SZ".to_string(), "strategy_buy_condition_false".to_string());
|
||||
let mut portfolio = PortfolioState::new(100_000.0);
|
||||
let report = broker.execute(date, &mut portfolio, &data, &decision).unwrap();
|
||||
assert!(!report.fills.is_empty());
|
||||
assert!(!report.fill_events.is_empty());
|
||||
assert!(broker.runtime_buy_denials.borrow().is_empty());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user