chart/app/market/base.py

22 lines
473 B
Python

from collections.abc import AsyncIterator
from typing import Protocol
from app.bars.models import Bar, Timeframe
class MarketDataSource(Protocol):
name: str
def supports_history(self) -> bool: ...
async def history(
self,
symbol: str,
tf: Timeframe,
start: int | None,
end: int | None,
) -> list[Bar]: ...
def supports_stream(self) -> bool: ...
def stream(self, symbol: str) -> AsyncIterator[Bar]: ...