Ejemplo n.º 1
0
        private void UpdateConfigWithArgs(ParseResult parseResult, ICoreConfig config)
        {
            if (parseResult["backtesting"] != null)
            {
                config.Backtesting.Enabled             = true;
                config.Backtesting.PostAnalysisEnabled = (bool)parseResult["backtesting_analysis"];

                config.Notification.Enabled = false;

                config.Trader.Enabled          = false;
                config.TraderSimulator.Enabled = true;
            }

            if (parseResult["simulate"] != null)
            {
                config.Trader.Enabled          = false;
                config.TraderSimulator.Enabled = true;
            }

            if (parseResult["risk"] != null)
            {
                decimal risk = (decimal)parseResult["risk"];

                if (0 < risk && risk <= 1)
                {
                    config.Trading.Risk = risk;
                }
            }
        }
Ejemplo n.º 2
0
 public CastleService(ICoreConfig config, ILogger logger, ISqlService sqlService, IConfiguration settings)
 {
     this.config     = config;
     this.logger     = logger;
     this.sqlService = sqlService;
     this.settings   = settings;
 }
Ejemplo n.º 3
0
 public static void TryAddCoreServices(this IServiceCollection services, ICoreConfig config)
 {
     services.TryAddSingleton <ICoreConfig>(config);
     services.TryAddScoped <IScriptService, ScriptService>();
     services.TryAddScoped <IThemeService>(sp => new ThemeService(config.Theme));
     services.TryAddScoped <IRenderContext>(sp => new RenderContext(config.IsServer, config.IsPreRendering));
 }
Ejemplo n.º 4
0
        public OctoBot(ICoreConfig config, bool ignoreConfig = false, bool resetTradingHistory = false)
        {
            StartTime           = DateTimeOffset.Now;
            Config              = config;
            ResetTradingHistory = resetTradingHistory;
            StartupConfig       = config.DeepClone();
            EditedConfig        = config.DeepClone();

            // tools: используется для альтернативных операций в ботом на лету (например, «backtesting» запускается из веб-интерфейса)
            Tools = new Dictionary <string, object>()
            {
                { ConfigVars.BOT_TOOLS_BACKTESTING, null },
                { ConfigVars.BOT_TOOLS_STRATEGY_OPTIMIZER, null },
                { ConfigVars.BOT_TOOLS_RECORDER, null }
            };

            // уникальное значение сеанса aiohttp: инициализируется из геттера в задаче
            AioHttpSession = null;

            // metrics если включены
            MetricsHandler = null;

            // Logger
            loggingService = Application.Resolve <ILoggingService>();

            Initializer      = new Initializer(this);
            TaskManager      = new TaskManager(this);
            ExchangeFactory  = new ExchangeFactory(this, ignoreConfig);
            EvaluatorFactory = new EvaluatorFactory(this);
        }
Ejemplo n.º 5
0
 public static void InitAdvancedClassesIfNecessary(ICoreConfig config)
 {
     if (config.AdvancedClasses.Count > 0)
     {
         Debug.WriteLine(1);
     }
 }
Ejemplo n.º 6
0
 public static void TryAddPrismServices(this IServiceCollection services, ICoreConfig config)
 {
     services.TryAddCoreServices(config);
     services.TryAddScoped <IPrismHighlighter, PrismHighlighter>();
     services.TryAddScriptTypeProvider <PrismScriptProvider>();
     services.TryAddStyleTypeProvider <PrismStyleProvider>();
 }
 public void InjectDependencies(
     ICoreConfig coreConfig, IYieldFormatter yieldFormatter, DiContainer container
     )
 {
     CoreConfig     = coreConfig;
     YieldFormatter = yieldFormatter;
     Container      = container;
 }
Ejemplo n.º 8
0
        public static void ReloadTentacleConfig(ICoreConfig config)
        {
            var a = ConfigBase.LoadConfig(ConfigVars.CONFIG_EVALUATOR_FILE_PATH, false);

            //config.Evaluator = ConfigBase.LoadConfig(ConfigVars.CONFIG_EVALUATOR_FILE_PATH, false);
            //if (config.Evaluator == null) throw new ConfigEvaluatorError();

            Debug.WriteLine(1);
        }
Ejemplo n.º 9
0
        public bool IsEnabled(Type cls, ICoreConfig config, bool defaultObject)
        {
            if (config.Evaluator.Count > 0)
            {
            }

            Debug.WriteLine(1);

            return(false);
        }
Ejemplo n.º 10
0
        public TentaclePackageManager(ICoreConfig config, TentacleManager tentacleManager)
        {
            Config               = config;
            TentacleManager      = tentacleManager;
            JustProcessedModules = new List <string>();
            InstalledModules     = new Dictionary <string, object>();
            MaxSteps             = null;
            CurrentStep          = 1;

            loggingService = Application.Resolve <ILoggingService>();
        }
Ejemplo n.º 11
0
        public TentacleManager(ICoreConfig config)
        {
            Config = config;
            TentaclePackageManager = new TentaclePackageManager(config, this);
            DefaultPackage         = null;
            AdvancedPackageList    = new List <object>();
            ForceActions           = false;
            GitBranch = TentaclesManagerVars.TENTACLES_DEFAULT_BRANCH;

            loggingService = Application.Resolve <ILoggingService>();
        }
        public static void TryAddDevToolsServices(this IServiceCollection services, ICoreConfig config)
        {
            services.TryAddCoreServices(config);

            services.TryAddJsonServices();

            services.TryAddScoped(typeof(IReduxTool <,>), typeof(ReduxTool <,>));

            services.TryAddScoped(typeof(IStateTreeTool <>), typeof(StateTreeTool <>));

            services.TryAddScriptTypeProvider <DevToolsScriptProvider>();
        }
        public B With(ICoreConfig config)
        {
            WithIsServer(config.IsServer);

            WithIsPreRendering(config.IsPreRendering);

            WithDisableBinding(config.DisableBinding);

            WithDisableConfigurer(config.DisableConfigurer);

            WithTheme(config.Theme);

            return(Builder());
        }
Ejemplo n.º 14
0
 private void LogTermsIfUnaccepted(ICoreConfig config)
 {
     if (ConfigManager.AcceptedTerms(Config) == false)
     {
         loggingService.Info("*** Disclaimer ***");
         foreach (var line in DISCLAIMER)
         {
             loggingService.Info(line);
         }
         loggingService.Info("... Disclaimer ...");
     }
     else
     {
         loggingService.Info("Отказ от ответственности принят пользователем.");
     }
 }
Ejemplo n.º 15
0
        public static bool InstallOnDevelopment(ICoreConfig config, bool?moduleDev)
        {
            // is not on development
            if (moduleDev == null || moduleDev == false)
            {
                return(true);
            }

            // is on development
            if (moduleDev == true && config.DevMode != null && config.DevMode == true)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 16
0
        private static List <Type> GetClasses(ICoreConfig config, Type classType, bool getAllClasses = false)
        {
            List <Type> classes = new List <Type>();

            if (AdvancedManager.GetAdvancedClassesList(config).ContainsKey(classType.Name) == true)
            {
                //classes = copy(AdvancedManager._get_advanced_classes_list(config)[class_type.get_name()])
                Debug.WriteLine(1);
            }

            if (classes.Count == 0 || (getAllClasses == true && classes.Contains(classType) == false))
            {
                classes.Add(classType);
            }

            return(classes);
        }
Ejemplo n.º 17
0
        private void AutoOpenWeb(ICoreConfig config, OctoBot bot)
        {
            try
            {
                // Ожидаем готовность бота к работе
                while (bot.IsReady() == false)
                {
                    Thread.Sleep(100);
                }

                //webbrowser.open(String.Format("http://{0}:{1}", socket.gethostbyname(socket.gethostname()), config.Services[] [CONFIG_WEB][CONFIG_WEB_PORT]);
            }
            catch (Exception exc)
            {
                loggingService.Error(String.Format("{0}, невозможно автоматически открыть веб-интерфейс", exc.Message));
            }
        }
Ejemplo n.º 18
0
        public static void InitTimeFramesFromStrategies(ICoreConfig config)
        {
            object timeFrameList = null;

            var lst = AdvancedManager.CreateAdvancedEvaluatorTypesList(typeof(StrategiesEvaluator), config);

            foreach (Type strategiesEvalClass in lst)
            {
                var instance = (IAbstractEvaluator)Activator.CreateInstance(strategiesEvalClass);

                if (instance.IsEnabled(strategiesEvalClass, config, false) == true)
                {
                }

                Debug.WriteLine(1);
            }

            Debug.WriteLine(1);
        }
Ejemplo n.º 19
0
 public static bool IsInDevMode(ICoreConfig config)
 {
     // return True если "DEV-MODE": true в config.json
     return((bool)config.DevMode);
 }
 public static void TryAddMaterialCoreServices(this IServiceCollection services, ICoreConfig config)
 {
     services.TryAddDomHelpersServices(config);
 }
Ejemplo n.º 21
0
 public void SetUp()
 {
     _coreConfig = ConfigurationFactory.Create();
 }
Ejemplo n.º 22
0
        public static List <Type> CreateAdvancedEvaluatorTypesList(Type evaluatorClass, ICoreConfig config)
        {
            List <Type> evaluatorAdvancedEvalClassList = new List <Type>();

            IEnumerable <Type> lstEvaluatorClass = FindDerivedTypes(evaluatorClass);

            foreach (Type evaluatorSubclass in lstEvaluatorClass)
            {
                IEnumerable <Type> lstEvaluatorSubclass = FindDerivedTypes(evaluatorSubclass);
                foreach (Type evalClass in lstEvaluatorSubclass)
                {
                    foreach (Type evalClassType in AdvancedManager.GetClasses(config, evalClass))
                    {
                        evaluatorAdvancedEvalClassList.Add(evalClassType);
                    }
                }
            }

            if (AdvancedManager.CheckDuplicate(evaluatorAdvancedEvalClassList) == false)
            {
                var logger = Application.Resolve <ILoggingService>();
                logger.Warning("Дубликат имени evaluator");
            }

            return(evaluatorAdvancedEvalClassList);
        }
Ejemplo n.º 23
0
 private static Dictionary <string, object> GetAdvancedClassesList(ICoreConfig config)
 {
     return(config.AdvancedClasses);
 }
Ejemplo n.º 24
0
 public YieldFormatter(ICoreConfig coreConfig)
 {
     CoreConfig = coreConfig;
 }
Ejemplo n.º 25
0
        public static void TryAddFlightFinderViewServices(this IServiceCollection services, ICoreConfig config)
        {
            services.TryAddMobxServices(config);

            services.TryAddFlightFinderStateServices();

            services.TryAddDevToolsServices(config);
        }
Ejemplo n.º 26
0
 public static bool AcceptedTerms(ICoreConfig config)
 {
     return(config.AcceptedTerms);
 }
Ejemplo n.º 27
0
 public ValuesController(IHttpContextAccessor httpContextAccessor,
                         ICoreConfig config)
 {
     _httpContextAccessor = httpContextAccessor;
     _config = config;
 }
Ejemplo n.º 28
0
 public void InjectDependencies(IYieldFormatter yieldFormatter, ICoreConfig coreConfig)
 {
     YieldFormatter = yieldFormatter;
     CoreConfig     = coreConfig;
 }
Ejemplo n.º 29
0
 public ITentacleManager CreateTentacleManager(ICoreConfig coreConfig)
 {
     return(new TentacleManager(coreConfig));
 }
        public static void TryAddDomHelpersServices(this IServiceCollection services, ICoreConfig config)
        {
            services.TryAddCoreServices(config);
            services.TryAddScoped <DomHelpers>();

            services.TryAddTransient <EventDelegator>();
            services.TryAddTransient <MediaQueryMatcher>();
            services.TryAddTransient <DetectThemeHelper>();
            services.TryAddTransient <HistoryBackHelper>();

            services.TryAddScriptTypeProvider <DomHelpersScriptProvider>();
        }
Ejemplo n.º 31
0
        public static void PackageManager(ITentacleManagerService tentacleManagerService, ICoreConfig config, IList <string> commands, bool useCatch = false, bool force = false, string defaultGitBranch = "")
        {
            if (defaultGitBranch == "")
            {
                defaultGitBranch = TentaclesManagerVars.TENTACLES_DEFAULT_BRANCH;
            }

            try
            {
                if (commands.Contains(ConfigVars.TENTACLES_FORCE_CONFIRM_PARAM) == true)
                {
                    force = true;
                    commands.Remove(ConfigVars.TENTACLES_FORCE_CONFIRM_PARAM);
                }

                var tentacleManager = tentacleManagerService.CreateTentacleManager(config);
                tentacleManager.ParseCommands(commands, force, defaultGitBranch);
            }
            catch (Exception exc)
            {
                if (useCatch == false)
                {
                    throw new Exception(exc.Message);
                }
            }
        }
Ejemplo n.º 32
0
 public JiraConfig(ICoreConfig coreConfig)
 {
     _coreConfig = coreConfig;
 }