# 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/utils/stats.py
# def avg(vals, count=None):


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

class SMA(TechnicalAnalysis):
    """
    Simple Moving Average:
    Average closing price over a period
    SMA = avg(closes) = sum(closes) / len(closes)
    """

    def eval_algorithm(closes):
        """ Evaluates the SMA algorithm

        Args:
            closes: List of price closes.

        Returns:
            Float average of closes.
        """

# 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/utils/stats.py
# def avg(vals, count=None):


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


class SMA(TechnicalAnalysis):
    """
    Simple Moving Average:
    Average closing price over a period
    SMA = avg(closes) = sum(closes) / len(closes)
    """

    def eval_algorithm(closes):
        """ Evaluates the SMA algorithm

        Args:
            closes: List of price closes.

        Returns:
            Float average of closes.
        """

        return stats.avg(closes)