修正平台目标调仓执行口径
This commit is contained in:
@@ -2849,10 +2849,8 @@ where
|
||||
}
|
||||
|
||||
let current_value = if self.aiquant_rqalpha_execution_rules {
|
||||
portfolio
|
||||
.position(symbol)
|
||||
.map(|position| position.market_value())
|
||||
.unwrap_or(0.0)
|
||||
let valuation_price = self.target_value_valuation_price(date, data, symbol, snapshot);
|
||||
valuation_price * current_qty as f64
|
||||
} else {
|
||||
let valuation_price = self.target_value_valuation_price(date, data, symbol, snapshot);
|
||||
valuation_price * current_qty as f64
|
||||
@@ -5285,7 +5283,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn aiquant_target_value_delta_uses_position_market_value() {
|
||||
fn aiquant_target_value_delta_uses_scheduled_mark_price() {
|
||||
let date = chrono::NaiveDate::from_ymd_opt(2023, 5, 8).expect("valid date");
|
||||
let symbol = "603101.SH";
|
||||
let broker = BrokerSimulator::new_with_execution_price(
|
||||
@@ -5397,11 +5395,11 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
portfolio.position(symbol).map(|pos| pos.quantity),
|
||||
Some(21_200)
|
||||
Some(21_400)
|
||||
);
|
||||
if let Some(order) = report.order_events.last() {
|
||||
assert_eq!(order.requested_quantity, 0);
|
||||
assert_eq!(order.filled_quantity, 0);
|
||||
assert_eq!(order.requested_quantity, 200);
|
||||
assert_eq!(order.filled_quantity, 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user