from itertools import product
from src.strategies.trend_filtered import TrendFilteredMACrossover

class TrendFilteredMAOptimization:

    name = "TrendFiltered_MA"

    @staticmethod
    def parameter_grid():
        fast = [10, 15, 20, 25, 30]
        slow = [40, 50, 60, 80, 100]
        adx = [15, 20, 25, 30]
        min_gap = 15

        for f, s, a in product(fast, slow, adx):
            if s - f >= min_gap:
                yield {
                    "fast_period": f,
                    "slow_period": s,
                    "ma_type": "ema",
                    "adx_threshold": a,
                }

    @staticmethod
    def build_strategy(params):
        return TrendFilteredMACrossover(**params)
