Coverage for source/indicators/indicator_handler_base.py: 75%

8 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-08-01 20:51 +0000

1# indicators/indicator_handler_base.py 

2 

3# global imports 

4import pandas as pd 

5from abc import ABC, abstractmethod 

6 

7# local imports 

8 

9class IndicatorHandlerBase(ABC): 

10 """ 

11 Base class for indicators. Enforces certain functions to be implemented 

12 in derivative classes. 

13 """ 

14 

15 @abstractmethod 

16 def calculate(self, data: pd.DataFrame) -> pd.DataFrame: 

17 """ 

18 Calculates indicator values for given data. 

19 

20 Parameters: 

21 data (pd.DataFrame): Data frame with input data. 

22 

23 Returns: 

24 (pd.DataFrame): Output data with calculated values for certain indicator. 

25 """ 

26 

27 pass 

28 

29 def can_be_normalized(self) -> bool: 

30 """ 

31 Checks if the indicator can be normalized. 

32 

33 Returns: 

34 (bool): True if the indicator can be normalized, False otherwise. 

35 """ 

36 

37 return False