# Path: speculator/features/SMA.py
# 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)
# 
#     def eval_from_json(json):
#         """ Evaluates SMA from JSON (typically Poloniex API response)
# 
#         Args:
#             json: List of dates where each entry is a dict of raw market data.
# 
#         Returns:
#             Float average of closes.
#         """
#         closes = [date['close'] for date in json]
#         return SMA.eval_algorithm(closes)


from speculator.features.SMA import SMA
import unittest

class SMATest(unittest.TestCase):
    def test_eval_algorithm(self):
        closes = [11, 12, 13, 14, 15, 16, 17]

# Path: speculator/features/SMA.py
# 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)
# 
#     def eval_from_json(json):
#         """ Evaluates SMA from JSON (typically Poloniex API response)
# 
#         Args:
#             json: List of dates where each entry is a dict of raw market data.
# 
#         Returns:
#             Float average of closes.
#         """
#         closes = [date['close'] for date in json]
#         return SMA.eval_algorithm(closes)


# Path: speculator/tests/unit/test_sma.py
from speculator.features.SMA import SMA
import unittest


class SMATest(unittest.TestCase):
    def test_eval_algorithm(self):
        closes = [11, 12, 13, 14, 15, 16, 17]

        self.assertEqual(SMA.eval_algorithm(closes), 14)