paulhemb's picture
Create interfaces.py
658136d verified
Raw History Blame Contribute Delete
768 Bytes
"""Protocols / abstract base classes for dependency injection."""
from typing import Protocol, Any, List, Dict, Optional
from datetime import date
class CacheProtocol(Protocol):
def get(self, key: str) -> Any: ...
def set(self, key: str, value: Any, ttl: int) -> None: ...
class ScraperProtocol(Protocol):
"""Interface that NepseScraper implements."""
def fetch_live_nepse(self) -> Optional[Any]: ...
def fetch_market_indices(self, analysis_date: Optional[str] = None) -> Optional[Dict]: ...
def fetch_datewise_indices(self, index_id: int = 1) -> Optional[Dict]: ...
def fetch_52w_high_low(self) -> Optional[List[Dict]]: ...
def fetch_holidays(self) -> Optional[List[Dict]]: ...
def fetch_company_master(self) -> List[Dict]: ...