Coverage for interfaces / live_strategy.py: 100%
14 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-04 15:08 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-04 15:08 +0000
1# interfaces/live_strategy.py
2from abc import ABC, abstractmethod
3from typing import List
4from common.types import TradeSignal
7class LiveStrategy(ABC):
8 """라이브 모드 전략의 추상 인터페이스.
10 모든 라이브 전략은 scan()과 check_exits()를 구현해야 한다.
11 StrategyScheduler가 장중 주기적으로 이 메서드들을 호출한다.
12 """
14 @property
15 @abstractmethod
16 def name(self) -> str:
17 """전략 고유 이름 (VirtualTradeRepository strategy 컬럼 값)."""
18 ...
20 @abstractmethod
21 async def scan(self) -> List[TradeSignal]:
22 """시장을 스캔하여 매수 후보를 찾고 BUY TradeSignal 리스트를 반환한다."""
23 ...
25 @abstractmethod
26 async def check_exits(self, holdings: List[dict]) -> List[TradeSignal]:
27 """보유 종목의 청산 조건을 확인하고 SELL TradeSignal 리스트를 반환한다.
29 Args:
30 holdings: VirtualTradeRepository.get_holds_by_strategy()의 반환값.
31 각 dict는 strategy, code, buy_date, buy_price, status 키를 포함.
32 """
33 ...