并行构建证券序列索引

This commit is contained in:
boris
2026-08-01 21:39:17 +08:00
parent 2a4a9d1290
commit 6f2c39aaf2
4 changed files with 57 additions and 2 deletions
+1
View File
@@ -8,6 +8,7 @@ authors.workspace = true
[dependencies]
chrono.workspace = true
indexmap.workspace = true
rayon.workspace = true
rhai.workspace = true
serde.workspace = true
serde_json.workspace = true
+3 -2
View File
@@ -2,6 +2,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};
use std::sync::{Arc, OnceLock};
use chrono::{NaiveDate, NaiveDateTime};
use rayon::prelude::*;
use serde::{Deserialize, Serialize};
use thiserror::Error;
@@ -1250,14 +1251,14 @@ impl DataSet {
.push(row.as_ref());
}
let market_series_by_symbol = market_rows_by_symbol
.into_iter()
.into_par_iter()
.map(|(symbol, rows)| {
let series = Arc::new(SymbolPriceSeries::new(symbol.clone(), rows));
(symbol, series)
})
.collect::<HashMap<_, _>>();
let adjusted_close_series_by_symbol = market_series_by_symbol
.iter()
.par_iter()
.filter_map(|(symbol, market)| {
AdjustedCloseSeries::new(market, &factor_by_date)
.map(|series| (symbol.clone(), Arc::new(series)))