diff --git a/crates/fidc-core/src/data.rs b/crates/fidc-core/src/data.rs index f7bf966..52a0c0d 100644 --- a/crates/fidc-core/src/data.rs +++ b/crates/fidc-core/src/data.rs @@ -5415,7 +5415,7 @@ mod tests { use std::hint::black_box; use std::time::Instant; - let data = volume_contract_data(Some([1.0, 1.0, 1.0])); + let data = adjusted_close_benchmark_data(); let symbol_id = data.symbol_id("000001.SZ").expect("symbol id"); let series = data .adjusted_close_series_by_symbol_id(symbol_id) @@ -5467,6 +5467,7 @@ mod tests { } assert_eq!(repeated_checksum, reused_checksum); + assert!(repeated_checksum > 0.0); let repeated_seconds = repeated_nanos as f64 / 1_000_000_000.0; let reused_seconds = reused_nanos as f64 / 1_000_000_000.0; eprintln!( @@ -5875,6 +5876,58 @@ mod tests { ); } + fn adjusted_close_benchmark_data() -> DataSet { + let dates = [ + NaiveDate::from_ymd_opt(2025, 1, 2).unwrap(), + NaiveDate::from_ymd_opt(2025, 1, 3).unwrap(), + NaiveDate::from_ymd_opt(2025, 1, 6).unwrap(), + ]; + DataSet::from_components( + vec![Instrument { + symbol: "000001.SZ".to_string(), + name: "000001.SZ".to_string(), + board: "SZ".to_string(), + round_lot: 100, + listed_at: None, + delisted_at: None, + status: "active".to_string(), + }], + dates + .iter() + .enumerate() + .map(|(index, date)| { + market_row( + &date.format("%Y-%m-%d").to_string(), + 10.0 + index as f64, + 100_000, + ) + }) + .collect(), + dates + .iter() + .map(|date| DailyFactorSnapshot { + date: *date, + symbol: "000001.SZ".to_string(), + market_cap_bn: 10.0, + free_float_cap_bn: 8.0, + pe_ttm: 10.0, + turnover_ratio: None, + effective_turnover_ratio: None, + extra_factors: NumericFactorMap::from([( + Cow::Borrowed(BACKWARD_ADJUSTMENT_FACTOR_FIELD), + 1.0, + )]), + }) + .collect(), + Vec::new(), + dates + .iter() + .map(|date| benchmark_row(&date.format("%Y-%m-%d").to_string(), 1_000.0)) + .collect(), + ) + .expect("adjusted close benchmark dataset") + } + fn volume_contract_data(availability: Option<[f64; 3]>) -> DataSet { let dates = [ NaiveDate::parse_from_str("2025-01-02", "%Y-%m-%d").unwrap(),