# Path: speculator/features/TechnicalAnalysis.py
# class TechnicalAnalysis(abc.ABC):
#     """ Abstract class for calculating technical analysis indicators """
#     
#     @staticmethod
#     @abc.abstractmethod
#     def eval_algorithm(*args, **kwargs):
#         """ Evaluates TA algorithm """
# 
#     @staticmethod
#     @abc.abstractmethod
#     def eval_from_json(json):
#         """ Evaluates TA algorithm from JSON
# 
#         Args:
#             json: List of dates where each entry is a dict of raw market data.
#         """
# 
# Path: speculator/utils/poloniex.py
# def json_to_url(json, symbol):
# def chart_json(start, end, period, symbol):
# def parse_changes(json):
# def get_gains_losses(changes):
# def get_attribute(json, attr):
# def get_json_shift(year, month, day, unit, count, period, symbol):


from speculator.features.TechnicalAnalysis import TechnicalAnalysis
from speculator.utils import poloniex
    """

    def eval_algorithm(curr, prev):
        """ Evaluates OBV

        Args:
            curr: Dict of current volume and close
            prev: Dict of previous OBV and close

        Returns:
            Float of OBV
        """
        if curr['close'] > prev['close']:
            v = curr['volume']
        elif curr['close'] < prev['close']:
            v = curr['volume'] * -1
        else:
            v = 0
        return prev['obv'] + v

    def eval_from_json(json):
        """ Evaluates OBV from JSON (typically Poloniex API response)

        Args:
            json: List of dates where each entry is a dict of raw market data.

        Returns:
            Float of OBV
        """
        closes = poloniex.get_attribute(json, 'close')

# Path: speculator/features/TechnicalAnalysis.py
# class TechnicalAnalysis(abc.ABC):
#     """ Abstract class for calculating technical analysis indicators """
#     
#     @staticmethod
#     @abc.abstractmethod
#     def eval_algorithm(*args, **kwargs):
#         """ Evaluates TA algorithm """
# 
#     @staticmethod
#     @abc.abstractmethod
#     def eval_from_json(json):
#         """ Evaluates TA algorithm from JSON
# 
#         Args:
#             json: List of dates where each entry is a dict of raw market data.
#         """
# 
# Path: speculator/utils/poloniex.py
# def json_to_url(json, symbol):
# def chart_json(start, end, period, symbol):
# def parse_changes(json):
# def get_gains_losses(changes):
# def get_attribute(json, attr):
# def get_json_shift(year, month, day, unit, count, period, symbol):


# Path: speculator/features/OBV.py
from speculator.features.TechnicalAnalysis import TechnicalAnalysis
from speculator.utils import poloniex

    """

    def eval_algorithm(curr, prev):
        """ Evaluates OBV

        Args:
            curr: Dict of current volume and close
            prev: Dict of previous OBV and close

        Returns:
            Float of OBV
        """
        if curr['close'] > prev['close']:
            v = curr['volume']
        elif curr['close'] < prev['close']:
            v = curr['volume'] * -1
        else:
            v = 0
        return prev['obv'] + v

    def eval_from_json(json):
        """ Evaluates OBV from JSON (typically Poloniex API response)

        Args:
            json: List of dates where each entry is a dict of raw market data.

        Returns:
            Float of OBV
        """
        closes = poloniex.get_attribute(json, 'close')

        volumes = poloniex.get_attribute(json, 'volume')