19 lines
509 B
Python
19 lines
509 B
Python
|
|
"""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
|
||
|
|
|
||
|
|
|
||
|
|
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: ...
|