修正次日开盘目标市值换股语义
This commit is contained in:
@@ -427,11 +427,10 @@ where
|
|||||||
symbol: &str,
|
symbol: &str,
|
||||||
snapshot: &crate::data::DailyMarketSnapshot,
|
snapshot: &crate::data::DailyMarketSnapshot,
|
||||||
) -> f64 {
|
) -> f64 {
|
||||||
if self.matching_type == MatchingType::NextBarOpen
|
if self.matching_type == MatchingType::NextBarOpen {
|
||||||
&& snapshot.prev_close.is_finite()
|
// The target budget is frozen on the signal day, but the broker can only
|
||||||
&& snapshot.prev_close > 0.0
|
// convert that budget to shares once the next session's open is visible.
|
||||||
{
|
return self.sizing_price(snapshot);
|
||||||
return snapshot.prev_close;
|
|
||||||
}
|
}
|
||||||
if self.aiquant_execution_rules && self.execution_price_field == PriceField::Last {
|
if self.aiquant_execution_rules && self.execution_price_field == PriceField::Last {
|
||||||
let start_cursor = self
|
let start_cursor = self
|
||||||
@@ -7154,7 +7153,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn next_open_target_value_valuation_uses_previous_close() {
|
fn next_open_target_value_valuation_uses_execution_open() {
|
||||||
let date = chrono::NaiveDate::from_ymd_opt(2025, 1, 2).expect("valid date");
|
let date = chrono::NaiveDate::from_ymd_opt(2025, 1, 2).expect("valid date");
|
||||||
let broker = BrokerSimulator::new_with_execution_price(
|
let broker = BrokerSimulator::new_with_execution_price(
|
||||||
ChinaAShareCostModel::default(),
|
ChinaAShareCostModel::default(),
|
||||||
@@ -7181,7 +7180,7 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
broker.target_value_valuation_price(date, &data, "000001.SZ", snapshot),
|
broker.target_value_valuation_price(date, &data, "000001.SZ", snapshot),
|
||||||
10.0
|
11.0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user