Source code for curvesim.templates.price_samplers
from abc import ABC, abstractmethod
from datetime import datetime
from curvesim.logging import get_logger
from curvesim.utils import dataclass
logger = get_logger(__name__)
[docs]@dataclass(slots=True)
class PriceSample:
"""
Attributes
-----------
timestamp : datetime.datetime
Timestamp for the current price/volume.
prices : dict
Price for each pairwise coin combination.
"""
timestamp: datetime
prices: dict
[docs]class PriceSampler(ABC):
"""
An iterator that yields market data ticks, i.e. price or other data
for each timestamp.
"""
[docs] @abstractmethod
def __iter__(self) -> PriceSample:
"""
Yields
-------
class:`PriceSample`
"""
raise NotImplementedError