15 lines
322 B
Python
15 lines
322 B
Python
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class TradingSessionKey:
|
|
date: str
|
|
ticker: str | None = None
|
|
|
|
def __post_init__(self):
|
|
if not self.date:
|
|
raise ValueError("Session must have a date")
|
|
|
|
def key(self) -> str:
|
|
return f"{self.date}:{self.ticker or 'all'}"
|