Esempio n. 1
0
def config():
    with open("test/test_data/config.json", "r") as f:
        config = json.load(f)
        # Inject ig_interface as active interface in the config file
        config["stocks_interface"]["active"] = InterfaceNames.IG_INDEX.value
        config["account_interface"]["active"] = InterfaceNames.IG_INDEX.value
        return Configuration(config)
Esempio n. 2
0
def config(request):
    with open("test/test_data/config.json", "r") as f:
        config = json.load(f)
        # Inject the fixture parameter in the configuration
        config["stocks_interface"]["active"] = request.param
        # To speed up the tests, reduce the timout of all interfaces
        config["stocks_interface"][
            InterfaceNames.YAHOO_FINANCE.value]["api_timeout"] = 0
        config["stocks_interface"][
            InterfaceNames.ALPHA_VANTAGE.value]["api_timeout"] = 0
        return Configuration(config)
Esempio n. 3
0
    def __init__(self, time_provider=None, config_filepath=None):
        # Time manager
        self.time_provider = time_provider if time_provider else TimeProvider()
        # Set timezone
        set(pytz.all_timezones_set)

        # Load configuration
        self.config = Configuration.from_filepath(config_filepath)

        # Setup the global logger
        self.setup_logging()

        # Init trade services and create the broker interface
        # The Factory is used to create the services from the configuration file
        self.broker = Broker(BrokerFactory(self.config))

        # Create strategy from the factory class
        self.strategy = StrategyFactory(self.config,
                                        self.broker).make_from_configuration()

        # Create the market provider
        self.market_provider = MarketProvider(self.config, self.broker)
Esempio n. 4
0
def config():
    config = Configuration.from_filepath("test/test_data/config.json")
    config.config["strategies"]["active"] = "simple_macd"
    config.config["stocks_interface"]["active"] = "alpha_vantage"
    config.config["stocks_interface"]["alpha_vantage"]["api_timeout"] = 0
    return config
def config():
    """
    Returns a dict with config parameter for strategy and simpleMACD
    """
    return Configuration.from_filepath("test/test_data/config.json")
Esempio n. 6
0
def config():
    config = Configuration.from_filepath("test/test_data/config.json")
    config.config["strategies"]["active"] = "weighted_avg_peak"
    return config
Esempio n. 7
0
def config():
    return Configuration.from_filepath("test/test_data/config.json")