并行构建证券序列索引
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user