2026-08-08 22:41:45 +08:00
|
|
|
"""Ports that keep selection formulas independent from storage technology."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from datetime import date
|
|
|
|
|
from typing import Protocol
|
|
|
|
|
|
|
|
|
|
from .models import StockHistory
|
2026-08-09 09:34:46 +08:00
|
|
|
from .runs import SelectionExecutionSource, SelectionUniverseReader
|
2026-08-08 22:41:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class MarketDataReaderError(RuntimeError):
|
|
|
|
|
"""A market-data adapter could not complete a read."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MarketDataReader(Protocol):
|
|
|
|
|
"""Read qfq history sufficient for one historical strategy evaluation."""
|
|
|
|
|
|
|
|
|
|
def load_history(self, ts_code: str, target_trade_date: date) -> StockHistory: ...
|
2026-08-09 09:34:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
|
"MarketDataReader",
|
|
|
|
|
"MarketDataReaderError",
|
|
|
|
|
"SelectionExecutionSource",
|
|
|
|
|
"SelectionUniverseReader",
|
|
|
|
|
]
|