# Path: OnePy/custom_module/cleaner_sma.py
# class SMA(CleanerBase):
#     def calculate(self, ticker):
#         key = f'{ticker}_{self.frequency}'
#         close = self.data[key]['close']
# 
#         return sum(close)/len(close)  # TODO:尝试用numpy看能否提高性能


import OnePy as op
from OnePy.custom_module.cleaner_sma import SMA

class SmaStrategy(op.StrategyBase):

    def __init__(self):

        super().__init__()
        self.sma1 = SMA(3, 40).calculate

# Path: OnePy/custom_module/cleaner_sma.py
# class SMA(CleanerBase):
#     def calculate(self, ticker):
#         key = f'{ticker}_{self.frequency}'
#         close = self.data[key]['close']
# 
#         return sum(close)/len(close)  # TODO:尝试用numpy看能否提高性能


# Path: examples/Trade_Analysis_Example.py
import OnePy as op
from OnePy.custom_module.cleaner_sma import SMA


class SmaStrategy(op.StrategyBase):

    def __init__(self):

        super().__init__()
        self.sma1 = SMA(3, 40).calculate

        self.sma2 = SMA(5, 40).calculate