修正当前复权均线预计算命中
This commit is contained in:
@@ -770,7 +770,10 @@ fn precomputed_stock_current_rolling_mean(
|
||||
};
|
||||
match field.trim().to_ascii_lowercase().as_str() {
|
||||
"close" | "prev_close" | "stock_close" | "price" => {
|
||||
value_for(&format!("ma{lookback}_current_close"))
|
||||
// `rolling_mean_current("close", ...)` uses the framework's
|
||||
// back-adjusted close series. Source Lake `maN_current_close` is
|
||||
// calculated from raw close and is therefore not interchangeable.
|
||||
value_for(&format!("ma{lookback}_current_back_adjusted_close"))
|
||||
}
|
||||
"volume" | "stock_volume" => value_for(&format!("avg_volume{lookback}_current")),
|
||||
_ => None,
|
||||
@@ -787,6 +790,7 @@ fn is_precomputed_stock_current_rolling_key(key: &str) -> bool {
|
||||
}
|
||||
|
||||
has_numeric_window(key, "ma", "_current_close")
|
||||
|| has_numeric_window(key, "ma", "_current_back_adjusted_close")
|
||||
|| has_numeric_window(key, "avg_volume", "_current")
|
||||
}
|
||||
|
||||
@@ -28590,6 +28594,7 @@ mod tests {
|
||||
extra_factors.insert("ma30_prev_close".to_string(), 97.0);
|
||||
extra_factors.insert("avg_volume5".to_string(), 88.0);
|
||||
extra_factors.insert("avg_volume100".to_string(), 99.0);
|
||||
extra_factors.insert("ma5_current_close".to_string(), 999.0);
|
||||
extra_factors.insert("adjustment_factor_backward1".to_string(), 1.0);
|
||||
let data = DataSet::from_components(
|
||||
vec![Instrument {
|
||||
@@ -28795,7 +28800,10 @@ mod tests {
|
||||
effective_turnover_ratio: None,
|
||||
extra_factors: BTreeMap::from([
|
||||
("adjustment_factor_backward1".to_string(), 1.0),
|
||||
("ma5_current_close".to_string(), current_close),
|
||||
(
|
||||
"ma5_current_back_adjusted_close".to_string(),
|
||||
current_close,
|
||||
),
|
||||
("avg_volume5_current".to_string(), current_volume),
|
||||
]),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user