严格使用真实上市天数过滤候选
This commit is contained in:
@@ -3650,7 +3650,13 @@ impl PlatformExprStrategy {
|
|||||||
allow_sell: candidate.allow_sell,
|
allow_sell: candidate.allow_sell,
|
||||||
touched_upper_limit,
|
touched_upper_limit,
|
||||||
touched_lower_limit,
|
touched_lower_limit,
|
||||||
listed_days: if candidate.is_new_listing { 0 } else { 365 },
|
listed_days: factor
|
||||||
|
.extra_factors
|
||||||
|
.get("listed_days")
|
||||||
|
.copied()
|
||||||
|
.filter(|value| value.is_finite() && *value >= 0.0)
|
||||||
|
.map(|value| value.floor() as i64)
|
||||||
|
.unwrap_or(-1),
|
||||||
stock_ma_short,
|
stock_ma_short,
|
||||||
stock_ma_mid,
|
stock_ma_mid,
|
||||||
stock_ma_long,
|
stock_ma_long,
|
||||||
@@ -15902,7 +15908,7 @@ mod tests {
|
|||||||
pe_ttm: 8.0,
|
pe_ttm: 8.0,
|
||||||
turnover_ratio: Some(1.0),
|
turnover_ratio: Some(1.0),
|
||||||
effective_turnover_ratio: Some(1.0),
|
effective_turnover_ratio: Some(1.0),
|
||||||
extra_factors: BTreeMap::new(),
|
extra_factors: BTreeMap::from([("listed_days".to_string(), 263.0)]),
|
||||||
}],
|
}],
|
||||||
vec![CandidateEligibility {
|
vec![CandidateEligibility {
|
||||||
date,
|
date,
|
||||||
@@ -15965,6 +15971,7 @@ mod tests {
|
|||||||
assert!((stock.market_cap_bn - 18.0).abs() < 1e-9);
|
assert!((stock.market_cap_bn - 18.0).abs() < 1e-9);
|
||||||
assert!((stock.free_float_cap - 9.0).abs() < 1e-9);
|
assert!((stock.free_float_cap - 9.0).abs() < 1e-9);
|
||||||
assert!((stock.free_float_cap_bn - 9.0).abs() < 1e-9);
|
assert!((stock.free_float_cap_bn - 9.0).abs() < 1e-9);
|
||||||
|
assert_eq!(stock.listed_days, 263);
|
||||||
assert_eq!(stock.close, 10.0);
|
assert_eq!(stock.close, 10.0);
|
||||||
assert!(stock.high.is_nan());
|
assert!(stock.high.is_nan());
|
||||||
assert!(stock.low.is_nan());
|
assert!(stock.low.is_nan());
|
||||||
|
|||||||
Reference in New Issue
Block a user