减少文本因子读取临时分配
This commit is contained in:
@@ -2449,6 +2449,13 @@ impl DataSet {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn factor_text_rows_on(&self, date: NaiveDate) -> &[FactorTextValue] {
|
||||||
|
self.factor_text_by_date
|
||||||
|
.get(&date)
|
||||||
|
.map(Vec::as_slice)
|
||||||
|
.unwrap_or(&[])
|
||||||
|
}
|
||||||
|
|
||||||
pub fn market_snapshots_on(&self, date: NaiveDate) -> Vec<&DailyMarketSnapshot> {
|
pub fn market_snapshots_on(&self, date: NaiveDate) -> Vec<&DailyMarketSnapshot> {
|
||||||
self.market_by_date
|
self.market_by_date
|
||||||
.get(&date)
|
.get(&date)
|
||||||
|
|||||||
@@ -3687,8 +3687,8 @@ impl PlatformExprStrategy {
|
|||||||
},
|
},
|
||||||
available_text_factor_names: if self.stock_text_factors_required {
|
available_text_factor_names: if self.stock_text_factors_required {
|
||||||
ctx.data
|
ctx.data
|
||||||
.factor_text_snapshots_on(date)
|
.factor_text_rows_on(date)
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|row| row.field.clone())
|
.map(|row| row.field.clone())
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
@@ -4081,8 +4081,8 @@ impl PlatformExprStrategy {
|
|||||||
extra_factors,
|
extra_factors,
|
||||||
extra_text_factors: if self.stock_text_factors_required {
|
extra_text_factors: if self.stock_text_factors_required {
|
||||||
ctx.data
|
ctx.data
|
||||||
.factor_text_snapshots_on(date)
|
.factor_text_rows_on(date)
|
||||||
.into_iter()
|
.iter()
|
||||||
.filter(|row| row.symbol == symbol)
|
.filter(|row| row.symbol == symbol)
|
||||||
.map(|row| (row.field.clone(), row.value.clone()))
|
.map(|row| (row.field.clone(), row.value.clone()))
|
||||||
.collect()
|
.collect()
|
||||||
|
|||||||
Reference in New Issue
Block a user