校正封板成功率为封板家数除以触板家数

This commit is contained in:
boris
2026-09-10 14:46:32 +08:00
parent c4632bacf1
commit 3fa1004ec5
+3 -1
View File
@@ -164,7 +164,7 @@ pub fn aggregate(request: Request) -> Result<Output, String> {
("market_return".into(), Some(average(returns.values().copied(), active))),
("market_limit_up_count".into(), Some(ups.len() as f64)),
("market_limit_down_count".into(), Some(downs as f64)),
("market_limit_up_rate".into(), (active > unlimited).then(|| ups.len() as f64 / (active - unlimited) as f64)),
("market_limit_up_rate".into(), (touched > 0).then(|| ups.len() as f64 / touched as f64)),
("market_broken_limit_rate".into(), (touched > 0).then(|| broken as f64 / touched as f64)),
("market_high_board".into(), board),
("market_profit_effect".into(), profit),
@@ -221,6 +221,8 @@ mod tests {
let d=&r.days[1];
assert_eq!(d.common["market_breadth"],Some(0.5));
assert_eq!(d.common["market_limit_down_count"],Some(1.0));
assert_eq!(d.common["market_limit_up_rate"],Some(1.0));
assert_eq!(r.days[0].common["market_limit_up_rate"],Some(0.0));
assert_eq!(r.days[0].common["market_broken_limit_rate"],Some(1.0));
assert_eq!(r.days[2].common["market_high_board"],Some(2.0));
assert!((r.days[2].common["market_profit_effect"].unwrap()-0.1).abs()<1e-12);