From 869c14e2b002ad0603be91b86e859425785db677 Mon Sep 17 00:00:00 2001 From: boris Date: Mon, 24 Aug 2026 02:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=94=A8=E7=9C=9F=E5=AE=9E=E8=A1=8C?= =?UTF-8?q?=E6=83=85=E9=AA=8C=E8=AF=81=E6=BB=9A=E5=8A=A8=E9=A3=8E=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fidc-core/src/platform_expr_strategy.rs | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/crates/fidc-core/src/platform_expr_strategy.rs b/crates/fidc-core/src/platform_expr_strategy.rs index 9d10248..e69db7d 100644 --- a/crates/fidc-core/src/platform_expr_strategy.rs +++ b/crates/fidc-core/src/platform_expr_strategy.rs @@ -16937,6 +16937,7 @@ mod tests { .map(|idx| { let date = start + chrono::Duration::days(idx); let volume = if idx >= 95 { 200_000 } else { 190_000 }; + let close = 10.0 + idx as f64 * 0.01; DailyMarketSnapshot { date, symbol: symbol.to_string(), @@ -16945,11 +16946,11 @@ mod tests { open: 10.0, high: 10.5, low: 9.8, - close: 10.0, - last_price: 10.0, - bid1: 9.99, - ask1: 10.01, - prev_close: 9.9, + close, + last_price: close, + bid1: close - 0.01, + ask1: close + 0.01, + prev_close: close - 0.01, volume, minute_volume: 1_000, bid1_volume: 2_000, @@ -16962,6 +16963,19 @@ mod tests { } }) .collect(); + let factor_rows = market_rows + .iter() + .map(|row| DailyFactorSnapshot { + date: row.date, + symbol: symbol.to_string(), + market_cap_bn: 33.64, + free_float_cap_bn: 33.64, + pe_ttm: 8.0, + turnover_ratio: Some(1.0), + effective_turnover_ratio: Some(1.0), + extra_factors: BTreeMap::from([("adjustment_factor_backward1".to_string(), 1.0)]), + }) + .collect(); let benchmark_rows: Vec = market_rows .iter() .map(|row| BenchmarkSnapshot { @@ -16984,21 +16998,7 @@ mod tests { status: "active".to_string(), }], market_rows, - vec![DailyFactorSnapshot { - date: current, - symbol: symbol.to_string(), - market_cap_bn: 33.64, - free_float_cap_bn: 33.64, - pe_ttm: 8.0, - turnover_ratio: Some(1.0), - effective_turnover_ratio: Some(1.0), - extra_factors: BTreeMap::from([ - ("ma5".to_string(), 11.0), - ("ma10".to_string(), 10.0), - ("ma30".to_string(), 9.0), - ("avg_volume5".to_string(), 200_000.0), - ]), - }], + factor_rows, vec![CandidateEligibility { date: current, symbol: symbol.to_string(), @@ -17043,9 +17043,9 @@ mod tests { .stock_state_with_factor_date(&ctx, current, current, symbol) .expect("stock state"); - assert!((stock.stock_ma5 - 9.9).abs() < 1e-9); - assert!((stock.stock_ma10 - 9.9).abs() < 1e-9); - assert!((stock.stock_ma30 - 9.9).abs() < 1e-9); + assert!(stock.stock_ma5 > stock.stock_ma10); + assert!(stock.stock_ma10 > stock.stock_ma30); + assert!(stock.stock_volume_ma5 > stock.stock_volume_ma100); assert!( !strategy