diff --git a/crates/fidc-core/src/market_event_context.rs b/crates/fidc-core/src/market_event_context.rs index 32b7b51..29cbff5 100644 --- a/crates/fidc-core/src/market_event_context.rs +++ b/crates/fidc-core/src/market_event_context.rs @@ -164,7 +164,7 @@ pub fn aggregate(request: Request) -> Result { ("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);