Exemplo n.º 1
0
        private static SimpleBacktesterConfig InitConfig(string environment)
        {
            var configRoot = ConfigUtils.InitConfig(environment);
            var config     = new SimpleBacktesterConfig();

            ConfigUtils.FillConfig(configRoot, "config", config);
            return(config);
        }
Exemplo n.º 2
0
        private static void MergeBacktestsWithBase(SimpleBacktesterConfig config)
        {
            if (config.Backtests == null || !config.Backtests.Any())
            {
                throw new Exception("Please configure at least one backtest in appsettings.json");
            }

            if (config.Base == null)
            {
                return;
            }

            foreach (var backtest in config.Backtests)
            {
                backtest.BaseSymbol ??= config.Base.BaseSymbol;
                backtest.QuoteSymbol ??= config.Base.QuoteSymbol;
                backtest.Amount ??= config.Base.Amount;
                backtest.DirectoryPath ??= config.Base.DirectoryPath;
                backtest.FilePattern ??= config.Base.FilePattern;

                backtest.TimestampType ??= config.Base.TimestampType;
                backtest.TimestampDecimals ??= config.Base.TimestampDecimals;

                backtest.FeePercentage ??= config.Base.FeePercentage;
                backtest.DisplayFee ??= config.Base.DisplayFee;

                backtest.MaxInventory ??= config.Base.MaxInventory;

                backtest.Visualize ??= config.Base.Visualize;
                backtest.VisualizeLimitBars ??= config.Base.VisualizeLimitBars;
                backtest.VisualizeSkipBars ??= config.Base.VisualizeSkipBars;

                backtest.SkipFiles ??= config.Base.SkipFiles;
                backtest.LimitFiles ??= config.Base.LimitFiles;

                backtest.RunWebVisualization ??= config.RunWebVisualization;
            }
        }