Refine open auction execution semantics
This commit is contained in:
@@ -179,7 +179,8 @@ fn broker_uses_day_open_price_for_open_auction_matching() {
|
||||
ChinaAShareCostModel::default(),
|
||||
ChinaEquityRuleHooks::default(),
|
||||
PriceField::DayOpen,
|
||||
);
|
||||
)
|
||||
.with_slippage_model(SlippageModel::PriceRatio(0.05));
|
||||
|
||||
let report = broker
|
||||
.execute(
|
||||
@@ -203,6 +204,10 @@ fn broker_uses_day_open_price_for_open_auction_matching() {
|
||||
|
||||
assert_eq!(report.fill_events.len(), 1);
|
||||
assert!((report.fill_events[0].price - 9.8).abs() < 1e-9);
|
||||
let position = portfolio.position("000002.SZ").expect("position");
|
||||
let expected_total_equity = portfolio.cash() + position.quantity as f64 * 9.8;
|
||||
assert_eq!(report.account_events.len(), 1);
|
||||
assert!((report.account_events[0].total_equity - expected_total_equity).abs() < 1e-6);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user