from abc import ABC, abstractmethod
from typing import List

import numpy as np

from src.core_data import Bar


class Indicator(ABC):

    def __init__(self):
        pass

    @abstractmethod
    def get_values(self, close: np.array, open: np.array, high: np.array, low: np.array, volume: np.array):
        pass


    def get_latest_value(self, close: np.array, open: np.array, high: np.array, low: np.array, volume: np.array):
        return self.get_values(close, open, high, low, volume)[-1].item()
    
    @abstractmethod
    def get_name(self):
        pass
    

