perf(selection): 优化选股执行性能
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
from datetime import date
|
||||
|
||||
from ..domain.models import SelectionEvaluation, StockHistory
|
||||
@@ -44,3 +45,12 @@ class EvaluateZhixingB1:
|
||||
"""Evaluate an already loaded history for deterministic unit tests."""
|
||||
|
||||
return self.strategy.evaluate(history, target_trade_date)
|
||||
|
||||
def execute_histories(
|
||||
self,
|
||||
histories: Sequence[StockHistory],
|
||||
target_trade_date: date,
|
||||
) -> tuple[SelectionEvaluation, ...]:
|
||||
"""Evaluate loaded histories without issuing one read per stock."""
|
||||
|
||||
return tuple(self.execute_history(history, target_trade_date) for history in histories)
|
||||
|
||||
Reference in New Issue
Block a user