Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wiseplat
GitHub Repository: wiseplat/python-code
Path: blob/master/ invest-robot-contest_invest-bot-main/trade_system/strategies/strategy_factory.py
5933 views
1
from typing import Optional
2
3
from trade_system.strategies.change_and_volume_strategy import ChangeAndVolumeStrategy
4
from trade_system.strategies.base_strategy import IStrategy
5
6
__all__ = ("StrategyFactory")
7
8
9
class StrategyFactory:
10
"""
11
Fabric for strategies. Put here new strategy.
12
"""
13
@staticmethod
14
def new_factory(strategy_name: str, *args, **kwargs) -> Optional[IStrategy]:
15
match strategy_name:
16
case "ChangeAndVolumeStrategy":
17
return ChangeAndVolumeStrategy(*args, **kwargs)
18
case _:
19
return None
20
21