Exemple #1
0
 def load(self, scope):
     if not self._manager_id:
         raise RuntimeError("You should set manage id first")
     scope = self._origin.load(scope)
     if isinstance(self._origin, UserFuncStrategyLoader):
         scope["get_file"] = get_file
     paths, codes = get_codes()
     for key in ["init", "handle_bar", "before_trading"]:
         if key not in scope:
             key = "empty_" + key
             scope = compile_strategy(codes[key], paths[key], scope)
     scope = compile_strategy(codes["wrapper"], paths["wrapper"], scope)
     return scope
 def load(self, scope):
     return compile_strategy(self._code, "strategy.py", scope)
    def load(self, scope):
        with codecs.open(self._strategy_file_path, encoding="utf-8") as f:
            source_code = f.read()

        return compile_strategy(source_code, self._strategy_file_path, scope)
Exemple #4
0
 def load(self, scope):
     return compile_strategy(self._code, "strategy.py", scope)
Exemple #5
0
    def load(self, scope):
        with codecs.open(self._strategy_file_path, encoding="utf-8") as f:
            source_code = f.read()

        return compile_strategy(source_code, self._strategy_file_path, scope)