ta-oliver / infertrade

Open source trading and investment strategy library designed for accessibility and compatibility
Apache License 2.0
34 stars 20 forks source link

Try and simplify dictionaries that accompany the allocation rules #227

Closed ta-oliver closed 2 years ago

ta-oliver commented 3 years ago

Current format of the dictionaries is complicated, with four fields:

current-dict

This could be simplified by the follow steps:

We do need to retain the "series" field, as there is otherwise no way of knowing which series the function needs.

CURRENT:

    },
    "ADX_strategy": {
        "function": ADX_strategy,
        "parameters": {"window": 14, "max_investment": 0.1},
        "series": ["close", "high", "low"],
        "available_representation_types": {
            "github_permalink": github_permalink + "#L" + str(ADX_strategy.__code__.co_firstlineno)
        },
    },
    "vortex_strategy": {
        "function": vortex_strategy,
        "parameters": {"window": 14, "max_investment": 0.1},
        "series": ["close", "high", "low"],
        "available_representation_types": {
            "github_permalink": github_permalink + "#L" + str(vortex_strategy.__code__.co_firstlineno)
        },
    },
    "DPO_strategy": {
        "function": DPO_strategy,
        "parameters": {"window": 20, "max_investment": 0.1},
        "series": ["close"],
        "available_representation_types": {
            "github_permalink": github_permalink + "#L" + str(DPO_strategy.__code__.co_firstlineno)
        },
    },

PROPOSED:

        },
    "ADX_strategy": {
        "series": ["close", "high", "low"],
    },
    "vortex_strategy": {
        "series": ["close", "high", "low"],
    },
    "DPO_strategy": {
        "series": ["close"],
    },
ta-oliver commented 3 years ago

@bi-kash - worth future discussion?