public ParagraphConverter( IStrategyExecutor <IInlineElement, IInline> parser, ILogger <ParagraphConverter> logger) { Parser = parser; Logger = logger; }
public HeaderHtmlConverterStrategy(IStrategyExecutor <string, IInlineElement> inlineConverter, ITemplateTagCollection templateCollection, ITemplateFiller templateFiller) { InlineConverter = inlineConverter; TemplateTagCollection = templateCollection; TemplateFiller = templateFiller; }
public MarkdownFileParser( FileReader fileParser, IStrategyExecutor <IBlockElement, IBlock> markdownParser, ILogger <MarkdownFileParser> logger ) { this.fileParser = fileParser; this.markdownParser = markdownParser; this.logger = logger; }
private static TimeSpan MeassuredRun(IStrategyExecutor executor) { Stopwatch sw = new Stopwatch(); sw.Start(); executor.Run(); sw.Stop(); return(sw.Elapsed); }
public static void Run() { // Initialize aggregator string[] ignoredCheckpoints = { Checkpoint.Names.Setup, Checkpoint.Names.TearDown }; HistogramAggregator histogramAggregator = new HistogramAggregator() .Add(new TimeDimension(TimeSpan.FromSeconds(10))) .Add(new FuncMetric <TimeSpan>("TMin", TimeSpan.MaxValue, (span, result) => span > result.IterationStarted ? result.IterationStarted : span)) .Add(new FuncMetric <TimeSpan>("TMax", TimeSpan.MinValue, (span, result) => span < result.IterationFinished ? result.IterationFinished : span)) .Add(new FuncMetric <int>("Working Threads", 0, (i, result) => result.CreatedThreads - result.IdleThreads)) //.Add(new MinDurationMetric(ignoredCheckpoints)) .Add(new AvgDurationMetric(ignoredCheckpoints)) .Add(new MaxDurationMetric(ignoredCheckpoints)) //.Add(new PercentileMetric(new[] {0.99999}, ignoredCheckpoints)) .Add(new CountMetric(ignoredCheckpoints)) .Add(new TransactionsPerSecMetric()) .Add(new ErrorCountMetric()) .Alias($"Min: {Checkpoint.Names.Iteration}", "Min (ms)") .Alias($"Avg: {Checkpoint.Names.Iteration}", "Avg (ms)") .Alias($"Max: {Checkpoint.Names.Iteration}", "Max (ms)") .Alias($"50%: {Checkpoint.Names.Iteration}", "50% (ms)") .Alias($"80%: {Checkpoint.Names.Iteration}", "80% (ms)") .Alias($"90%: {Checkpoint.Names.Iteration}", "90% (ms)") .Alias($"95%: {Checkpoint.Names.Iteration}", "95% (ms)") .Alias($"99.99%: {Checkpoint.Names.Iteration}", "99.99% (ms)") .Alias($"Count: {Checkpoint.Names.Iteration}", "Success: Count"); StrategyBuilder strategy = new StrategyBuilder() .SetScenario <TestScenario>() .SetLimit(new TimeLimit(TimeSpan.FromSeconds(10))) .SetThreading(new FixedThreadCount(40)) .SetSpeed(new FixedSpeed(2000)) // Tps is lower in results due to failed iterations not being counted .SetFinishTimeout(TimeSpan.FromSeconds(60)) .SetAggregator(histogramAggregator); IStrategyExecutor engine = strategy.Build(); engine.Run(); object defaultResults = histogramAggregator.BuildResultsObjects(); Console.WriteLine(JsonConvert.SerializeObject(defaultResults, Formatting.Indented)); }
public Generator( IDirectoryEnumerator directoryLister, CliOptions options, IStrategyExecutor <object, IFileSystemObject> converter, OnSiteStart beforeStart, OnSiteDone afterEnd ) { this.directoryLister = directoryLister; this.Options = options; this.converter = converter; this.BeforeStart = beforeStart; this.AfterEnd = afterEnd; }
private void btStrategyResult_Click(object sender, EventArgs e) { IStrategyExecutor executor = this.binder.StrategyExecutor; if (executor == null) { MessageBox.Show(""); return; } IStrategyReport report = executor.StrategyReport; if (report == null) { MessageBox.Show(""); return; } FormStrategyResult form = new FormStrategyResult(binder.CompChart, report.StrategyResult); form.ShowDialog(); }
/// <summary> /// Creates a new StrategyExecutionSandbox /// </summary> public StrategyExecutionSandbox(IStrategyExecutor strategyExecutor, StrategyBase strategy) { if (strategyExecutor == null) { throw new ArgumentNullException("strategyExecutor"); } else if (strategy == null) { throw new ArgumentNullException("strategy"); } StrategyExecutor = strategyExecutor; Strategy = strategy; Initialize(); // outer event wiring strategy.SellEvent += OnSellEvent; strategy.BuyEvent += OnBuyEvent; strategy.MarketTickEvent += OnMarketTickEvent; }
/// <summary> /// 运行策略,并且将策略运行结果绑定到该 /// </summary> public void Run() { Strategy_MultiMa strategy = new Strategy_MultiMa(); strategy.MainKLinePeriod = this.compChart.Controller.CompData.KlinePeriod; this.strategy = strategy; if (this.strategy == null) { return; } StrategyReferedPeriods referedPeriods = this.strategy.GetReferedPeriods(); if (referedPeriods == null) { referedPeriods = new StrategyReferedPeriods(); KLinePeriod currentPeriod = this.compChart.Controller.CompData.KlinePeriod; referedPeriods.UsedKLinePeriods.Add(currentPeriod); } KLinePeriod mainPeriod = referedPeriods.MainPeriod; StrategyForwardPeriod forwardPeriod = new StrategyForwardPeriod(referedPeriods.UseTickData, mainPeriod); IStrategyExecutorFactory_History executorFactory = StrategyCenter.Default.GetStrategyExecutorFactory_History(); IDataPackage_Code dataPackage = this.compChart.Controller.CurrentNavigater.DataPackage; Dictionary <KLinePeriod, int> dic_KLinePeriod_StartPos = new Dictionary <KLinePeriod, int>(); for (int i = 0; i < referedPeriods.UsedKLinePeriods.Count; i++) { KLinePeriod period = referedPeriods.UsedKLinePeriods[i]; dic_KLinePeriod_StartPos.Add(period, dataPackage.GetKLineData(period).BarPos); } drawOperator = new StrategyDrawOperator(this.compChart.Drawer, dic_KLinePeriod_StartPos, 0, 0); IStrategyOperator strategyOperator = new StrategyOperator(drawOperator); IStrategyExecutor executor = executorFactory.CreateExecutorByDataPackage(dataPackage, referedPeriods, forwardPeriod, strategyOperator); executor.SetStrategy(strategy); executor.Run(); }
private void RunStrategy(IStrategy strategy) { IDataPackage_Code dataPackage = this.compChart1.CompChartData.DataPackage; StrategyReferedPeriods referedPeriods = new StrategyReferedPeriods(); //compChart1.KlinePeriod KLinePeriod period = compChart1.GetKLinePeriod(); referedPeriods.UsedKLinePeriods.Add(period); //referedPeriods.UsedKLinePeriods.Add(this.n) StrategyForwardPeriod forwardPeriod = new StrategyForwardPeriod(false, period); IStrategyExecutor strategyRunner = StrategyCenter.Default.GetStrategyExecutorFactory_History().CreateExecutorByDataPackage(dataPackage, referedPeriods, forwardPeriod, compChart1.StrategyHelper); //compChart1.StrategyHelper.DrawHelper.ClearShapes(); //compChart1.CurrentPriceRectDrawer.cl //compChart1.CurrentPriceRectDrawer.ClearPriceShapes(); if (strategy is StrategyAbstract) { ((StrategyAbstract)strategy).MainKLinePeriod = period; } strategyRunner.SetStrategy(strategy); strategyRunner.Run(); compChart1.Refresh(); }
/// <summary> /// Argument Constructor /// </summary> /// <param name="strategyExecutor"> </param> public StockTraderFitnessFunction(IStrategyExecutor strategyExecutor) { _strategyExecutor = strategyExecutor; }
public MarkdownConverter(IStrategyExecutor <string, IBlockElement> blockConverter, CliOptions options) { BlockConverter = blockConverter; Options = options; }
private void EngineOnStopped(IStrategyExecutor sender, Exception exception) { Stopped?.Invoke(sender, exception); }
private void EngineOnStarted(IStrategyExecutor sender, ITestState state) { Started?.Invoke(sender, _engine.State); }
public StrategyExecutorInfo_CodePeriod(IStrategyExecutor executor, ICodePeriod codePeriod) { this.executor = executor; this.codePeriod = codePeriod; }
public HeaderConverter(IStrategyExecutor <IInlineElement, IInline> inlineParser) { InlineParser = inlineParser; }